diff --git a/packages/eslint/src/executors/lint/utility/eslint-utils.ts b/packages/eslint/src/executors/lint/utility/eslint-utils.ts index 6011b266df..723e6799a1 100644 --- a/packages/eslint/src/executors/lint/utility/eslint-utils.ts +++ b/packages/eslint/src/executors/lint/utility/eslint-utils.ts @@ -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);