Skip to content

feat(@nx/eslint): bulk suppression options (suppressAll, suppressRule) do not work with the lint executor #35284

@aqeelat

Description

@aqeelat

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

  1. 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.

  2. 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:

  1. ESLint v10+: Sets applySuppressions: true on the ESLint constructor (enables programmatic suppression support)
  2. ESLint v9.x: Manually integrates SuppressionsService post-lint, mirroring what the ESLint CLI does
  3. All versions: Handles suppressAll/suppressRule (writing) and pruneSuppressions (pruning) post-lint
  4. Adds pruneSuppressions and passOnUnprunedSuppressions executor options (matching ESLint CLI flags)

Related

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions