tests/lib/configs/_rules.js
/**
     * Validate the given config object.
     * @param {any} config The config object to check.
     * @param {string} source The filename of the configuration to show error messages.
     * @returns {void}
     */
Validate the given config object.
@param {any} config The config object to check.
@param {string} source The filename of the configuration to show error messages.
@returns {void}
Validate the given config object . @param { any } config The config object to check . @param { string } source The filename of the configuration to show error messages . @returns { void }
validateConfig(config, source) {
        Validator.validate(
            config,
            source,
            ruleId => allRules.get(ruleId),
            environments
        )
        const ruleMap = allRules.getAllLoadedRules()
        for (const ruleId of [].concat(
            Object.keys(config.rules || {}),
            ...(config.overrides || []).map(c => Object.keys(c.rules || {}))
        )) {
            const rule = ruleMap.get(ruleId)
            if (rule == null) {
                throw new Error(`The '${ruleId}' rule does not exist.`)
            }
            if (deprecatedRuleNames.has(ruleId)) {
                throw new Error(`The '${ruleId}' rule was deprecated.`)
            }
            if (removedRuleNames.has(ruleId)) {
                throw new Error(`The '${ruleId}' rule was removed.`)
            }
        }
    }
validateConfig ( config , source ) { Validator . validate ( config , source , ruleId => allRules . get ( ruleId ) , environments ) const ruleMap = allRules . getAllLoadedRules ( ) for ( const ruleId of [ ] . concat ( Object . keys ( config . rules || { } ) , ... ( config . overrides || [ ] ) . map ( c => Object . keys ( c . rules || { } ) ) ) ) { const rule = ruleMap . get ( ruleId ) if ( rule == null ) { throw new Error ( ` ${ ruleId } ` ) } if ( deprecatedRuleNames . has ( ruleId ) ) { throw new Error ( ` ${ ruleId } ` ) } if ( removedRuleNames . has ( ruleId ) ) { throw new Error ( ` ${ ruleId } ` ) } } }
Validate the given config object.
Validate the given config object .
/* istanbul ignore next */