tools/eslint-fuzzer.js
function isolateBadConfig(text, config, problemType) {
        for (const ruleId of Object.keys(config.rules)) {
            const reducedConfig = Object.assign({}, config, { rules: { [ruleId]: config.rules[ruleId] } });
            let fixResult;

            try {
                fixResult = linter.verifyAndFix(text, reducedConfig, {});
            } catch (err) {
                return reducedConfig;
            }

            if (fixResult.messages.length === 1 && fixResult.messages[0].fatal && problemType === "autofix") {
                return reducedConfig;
            }
        }
        return config;
    }
function isolateBadConfig(text, config, problemType) {
        for (const ruleId of Object.keys(config.rules)) {
            const reducedConfig = Object.assign({}, config, { rules: { [ruleId]: config.rules[ruleId] } });
            let fixResult;

            try {
                fixResult = linter.verifyAndFix(text, reducedConfig, {});
            } catch (err) {
                return reducedConfig;
            }

            if (fixResult.messages.length === 1 && fixResult.messages[0].fatal && problemType === "autofix") {
                return reducedConfig;
            }
        }
        return config;
    }
function isolateBadConfig ( text , config , problemType ) { for ( const ruleId of Object . keys ( config . rules ) ) { const reducedConfig = Object . assign ( { } , config , { rules : { [ ruleId ] : config . rules [ ruleId ] } } ) ; let fixResult ; try { fixResult = linter . verifyAndFix ( text , reducedConfig , { } ) ; } catch ( err ) { return reducedConfig ; } if ( fixResult . messages . length === 1 && fixResult . messages [ 0 ] . fatal && problemType === "autofix" ) { return reducedConfig ; } } return config ; }
Tries to isolate the smallest config that reproduces a problem
@param {string} text The source text to lint
@param {Object} config A config object that causes a crash or autofix error
@param {("crash"|"autofix")} problemType The type of problem that occurred
@returns {Object} A config object with only one rule enabled that produces the same crash or autofix error, if possible.
Otherwise, the same as `config`
Tries to isolate the smallest config that reproduces a problem