Repository: eslint/eslint
File: lib/cli.js (JavaScript)

Code before:
            ignorePatterns: ignorePattern,
            parser,
            parserOptions,
            plugins: plugin,
            rules: rule
        };
    }

    const options = {
        allowInlineConfig: inlineConfig,
        cache,
        cacheLocation: cacheLocation || cacheFile,
        cacheStrategy,
        errorOnUnmatchedPattern,
        fix: (fix || fixDryRun) && (quiet ? quietFixPredicate : true),
        fixTypes: fixType,
        ignore,
        overrideConfig,
        overrideConfigFile,
        reportUnusedDisableDirectives: reportUnusedDisableDirectives ? "error" : void 0,

        /*
         * For performance reasons rules not marked as 'error' are filtered out in quiet mode. As maxWarnings
         * requires rules set to 'warn' to be run, we only filter out 'warn' rules if maxWarnings is 0.
         */
        ruleFilter: quiet && maxWarnings === 0 ? quietRuleFilter : () => true
    };

    if (configType === "flat") {
        options.ignorePatterns = ignorePattern;
        options.warnIgnored = warnIgnored;
    } else {
        options.resolvePluginsRelativeTo = resolvePluginsRelativeTo;
        options.rulePaths = rulesdir;
        options.useEslintrc = eslintrc;
        options.extensions = ext;
        options.ignorePath = ignorePath;
    }

    return options;
}

/**
 * Count error messages.
 * @param {LintResult[]} results The lint results.
 * @returns {{errorCount:number;fatalErrorCount:number,warningCount:number}} The number of error messages.
 */
function countErrors(results) {
    let errorCount = 0;
    let fatalErrorCount = 0;
    let warningCount = 0;

Review comment (bug):
```suggestion
        ruleFilter: quiet && maxWarnings === -1 ? quietRuleFilter : () => true
```

`0` is when `--max-warnings 0` is passed, meaning that linting should fail if there are any warnings found (so we need to run rules to count warnings).

`-1` is the default which means that the option was not used. Only in this case we should not run rules.

https://github.com/eslint/eslint/blob/e0cb960e45961a36845b075a2986a1fa6cd6b8aa/lib/options.js#L266-L271

It would be good to add a `cli` test that checks that the rules are not run with `--quiet`.



Code after:
                obj[name] = true;
                return obj;
            }, {}),
            globals: global && global.reduce((obj, name) => {
                if (name.endsWith(":true")) {
                    obj[name.slice(0, -5)] = "writable";
                } else {
                    obj[name] = "readonly";
                }
                return obj;
            }, {}),
            ignorePatterns: ignorePattern,
            parser,
            parserOptions,
            plugins: plugin,
            rules: rule
        };
    }

    const options = {
        allowInlineConfig: inlineConfig,
        cache,
        cacheLocation: cacheLocation || cacheFile,
        cacheStrategy,
        errorOnUnmatchedPattern,
        fix: (fix || fixDryRun) && (quiet ? quietFixPredicate : true),
        fixTypes: fixType,
        ignore,
        overrideConfig,
        overrideConfigFile,
        passOnNoPatterns
    };

    if (configType === "flat") {
        options.ignorePatterns = ignorePattern;
        options.warnIgnored = warnIgnored;

        /*
         * For performance reasons rules not marked as 'error' are filtered out in quiet mode. As maxWarnings
         * requires rules set to 'warn' to be run, we only filter out 'warn' rules if maxWarnings is not specified.
         */
        options.ruleFilter = quiet && maxWarnings === -1 ? quietRuleFilter : () => true;
    } else {
        options.resolvePluginsRelativeTo = resolvePluginsRelativeTo;
        options.rulePaths = rulesdir;
        options.useEslintrc = eslintrc;
        options.extensions = ext;
        options.ignorePath = ignorePath;
        if (reportUnusedDisableDirectives || reportUnusedDisableDirectivesSeverity !== void 0) {
            options.reportUnusedDisableDirectives = reportUnusedDisableDirectives
                ? "error"