lib/config/config-rule.js
function generateConfigsFromSchema(schema) {
    const configSet = new RuleConfigSet();

    if (Array.isArray(schema)) {
        for (const opt of schema) {
            if (opt.enum) {
                configSet.addEnums(opt.enum);
            } else if (opt.type && opt.type === "object") {
                if (!configSet.addObject(opt)) {
                    break;
                }

            // TODO (IanVS): support oneOf
            } else {

                // If we don't know how to fill in this option, don't fill in any of the following options.
                break;
            }
        }
    }
    configSet.addErrorSeverity();
    return configSet.ruleConfigs;
}
function generateConfigsFromSchema(schema) {
    const configSet = new RuleConfigSet();

    if (Array.isArray(schema)) {
        for (const opt of schema) {
            if (opt.enum) {
                configSet.addEnums(opt.enum);
            } else if (opt.type && opt.type === "object") {
                if (!configSet.addObject(opt)) {
                    break;
                }

            // TODO (IanVS): support oneOf
            } else {

                // If we don't know how to fill in this option, don't fill in any of the following options.
                break;
            }
        }
    }
    configSet.addErrorSeverity();
    return configSet.ruleConfigs;
}
function generateConfigsFromSchema ( schema ) { const configSet = new RuleConfigSet ( ) ; if ( Array . isArray ( schema ) ) { for ( const opt of schema ) { if ( opt . enum ) { configSet . addEnums ( opt . enum ) ; } else if ( opt . type && opt . type === "object" ) { if ( ! configSet . addObject ( opt ) ) { break ; } // TODO (IanVS): support oneOf } else { // If we don't know how to fill in this option, don't fill in any of the following options. break ; } } } configSet . addErrorSeverity ( ) ; return configSet . ruleConfigs ; }
Generate valid rule configurations based on a schema object
@param   {Object} schema  A rule's schema object
@returns {Array[]}        Valid rule configurations
Generate valid rule configurations based on a schema object