fix(linter): remove reportUnusedDisableDirectives for flat config (#21405)

This commit is contained in:
Miroslav Jonaš 2024-02-02 14:22:32 +01:00 committed by GitHub
parent 3505fc628e
commit 35b5ca756e
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -49,8 +49,6 @@ export async function resolveAndInstantiateESLint(
* not be any html files in the project, so keeping it true would break linting every time
*/
errorOnUnmatchedPattern: false,
reportUnusedDisableDirectives:
options.reportUnusedDisableDirectives || undefined,
};
if (useFlatConfig) {
@ -69,6 +67,11 @@ export async function resolveAndInstantiateESLint(
'For Flat Config, ESLint removed `ignorePath` and so it is not supported as an option. See https://eslint.org/docs/latest/use/configure/configuration-files-new'
);
}
if (options.reportUnusedDisableDirectives) {
throw new Error(
'For Flat Config, ESLint removed `reportedUnusedDisableDirectives` and so it is not supported as an option. See https://eslint.org/docs/latest/use/configure/configuration-files-new'
);
}
} else {
eslintOptions.rulePaths = options.rulesdir || [];
eslintOptions.resolvePluginsRelativeTo =
@ -79,6 +82,8 @@ export async function resolveAndInstantiateESLint(
* merge the provided config with others it finds automatically.
*/
eslintOptions.useEslintrc = !options.noEslintrc;
eslintOptions.reportUnusedDisableDirectives =
options.reportUnusedDisableDirectives || undefined;
}
const eslint = new ESLint(eslintOptions);