function getOrCreateValidator(rule, ruleId) {
	if (!validators.has(rule)) {
		try {
			const schema = getRuleOptionsSchema(rule);

			if (schema) {
				validators.set(rule, ajv.compile(schema));
			}
		} catch (err) {
			throw new InvalidRuleOptionsSchemaError(ruleId, err);
		}
	}

	return validators.get(rule);
}
Gets or creates a validator for a rule.
@param {Object} rule The rule to get a validator for.
@param {string} ruleId The ID of the rule (for error reporting).
@returns {Function|null} A validation function or null if no validation is needed.
@throws {InvalidRuleOptionsSchemaError} If a rule's `meta.schema` is invalid.