Issue
The @nx/eslint:lint executor accepts suppressAll, suppressRule, and suppressionsLocation options (added in schema.json), but these options have no effect at runtime. The executor passes them to the ESLint constructor, but ESLint's programmatic API silently ignores them — suppression handling only exists in the ESLint CLI.
This means:
- Running
nx run <project>:lint with suppressAll: true does NOT create an eslint-suppressions.json file
- Existing
eslint-suppressions.json files are NOT applied when linting through Nx
- Users must fall back to running
eslint directly to use bulk suppressions
Root Cause
-
ESLint v9.x: The SuppressionsService class in eslint/lib/cli.js handles writing/applying suppressions, but it is only used by the CLI. The ESLint constructor silently ignores suppressAll, suppressRule, and suppressionsLocation options.
-
ESLint v10.x: The programmatic API gained applySuppressions: true as a proper option that makes lintFiles() apply suppressions from the suppressions file. However, suppressAll/suppressRule (for writing suppressions) remain CLI-only.
Expected Behavior
suppressAll: true → writes all errors to eslint-suppressions.json
suppressRule: ['no-console'] → writes violations for specified rules to eslint-suppressions.json
pruneSuppressions: true → removes stale entries from eslint-suppressions.json
- When
eslint-suppressions.json exists → suppressed errors should be filtered from results
Current Behavior
All suppression options are silently ignored. Lint results are identical whether or not suppression options are set.
Fix
I have a PR ready that:
- ESLint v10+: Sets
applySuppressions: true on the ESLint constructor (enables programmatic suppression support)
- ESLint v9.x: Manually integrates
SuppressionsService post-lint, mirroring what the ESLint CLI does
- All versions: Handles
suppressAll/suppressRule (writing) and pruneSuppressions (pruning) post-lint
- Adds
pruneSuppressions and passOnUnprunedSuppressions executor options (matching ESLint CLI flags)
Related
Issue
The
@nx/eslint:lintexecutor acceptssuppressAll,suppressRule, andsuppressionsLocationoptions (added in schema.json), but these options have no effect at runtime. The executor passes them to the ESLint constructor, but ESLint's programmatic API silently ignores them — suppression handling only exists in the ESLint CLI.This means:
nx run <project>:lintwithsuppressAll: truedoes NOT create aneslint-suppressions.jsonfileeslint-suppressions.jsonfiles are NOT applied when linting through Nxeslintdirectly to use bulk suppressionsRoot Cause
ESLint v9.x: The
SuppressionsServiceclass ineslint/lib/cli.jshandles writing/applying suppressions, but it is only used by the CLI. TheESLintconstructor silently ignoressuppressAll,suppressRule, andsuppressionsLocationoptions.ESLint v10.x: The programmatic API gained
applySuppressions: trueas a proper option that makeslintFiles()apply suppressions from the suppressions file. However,suppressAll/suppressRule(for writing suppressions) remain CLI-only.Expected Behavior
suppressAll: true→ writes all errors toeslint-suppressions.jsonsuppressRule: ['no-console']→ writes violations for specified rules toeslint-suppressions.jsonpruneSuppressions: true→ removes stale entries fromeslint-suppressions.jsoneslint-suppressions.jsonexists → suppressed errors should be filtered from resultsCurrent Behavior
All suppression options are silently ignored. Lint results are identical whether or not suppression options are set.
Fix
I have a PR ready that:
applySuppressions: trueon the ESLint constructor (enables programmatic suppression support)SuppressionsServicepost-lint, mirroring what the ESLint CLI doessuppressAll/suppressRule(writing) andpruneSuppressions(pruning) post-lintpruneSuppressionsandpassOnUnprunedSuppressionsexecutor options (matching ESLint CLI flags)Related
applySuppressionsoption: https://eslint.org/docs/latest/integration/nodejs-api#-new-eslintoptions