lib/config/config-validator.js
function validateRuleSchema(rule, localOptions) {
    if (!ruleValidators.has(rule)) {
        const schema = getRuleOptionsSchema(rule);

        if (schema) {
            ruleValidators.set(rule, ajv.compile(schema));
        }
    }

    const validateRule = ruleValidators.get(rule);

    if (validateRule) {
        validateRule(localOptions);
        if (validateRule.errors) {
            throw new Error(validateRule.errors.map(
                error => `\tValue ${JSON.stringify(error.data)} ${error.message}.\n`
            ).join(""));
        }
    }
}
function validateRuleSchema(rule, localOptions) {
    if (!ruleValidators.has(rule)) {
        const schema = getRuleOptionsSchema(rule);

        if (schema) {
            ruleValidators.set(rule, ajv.compile(schema));
        }
    }

    const validateRule = ruleValidators.get(rule);

    if (validateRule) {
        validateRule(localOptions);
        if (validateRule.errors) {
            throw new Error(validateRule.errors.map(
                error => `\tValue ${JSON.stringify(error.data)} ${error.message}.\n`
            ).join(""));
        }
    }
}
function validateRuleSchema ( rule , localOptions ) { if ( ! ruleValidators . has ( rule ) ) { const schema = getRuleOptionsSchema ( rule ) ; if ( schema ) { ruleValidators . set ( rule , ajv . compile ( schema ) ) ; } } const validateRule = ruleValidators . get ( rule ) ; if ( validateRule ) { validateRule ( localOptions ) ; if ( validateRule . errors ) { throw new Error ( validateRule . errors . map ( error => ` \t ${ JSON . stringify ( error . data ) } ${ error . message } \n ` ) . join ( "" ) ) ; } } }
Validates the non-severity options passed to a rule, based on its schema.
@param {{create: Function}} rule The rule to validate
@param {Array} localOptions The options for the rule, excluding severity
@returns {void}
Validates the non - severity options passed to a rule based on its schema .