Skip to content

feat(linter): deprecate ESLint v8 support#35819

Merged
FrozenPandaz merged 7 commits into
masterfrom
nxc-3986
Jun 2, 2026
Merged

feat(linter): deprecate ESLint v8 support#35819
FrozenPandaz merged 7 commits into
masterfrom
nxc-3986

Conversation

@polygraph-snapshot-app

@polygraph-snapshot-app polygraph-snapshot-app Bot commented May 28, 2026

Copy link
Copy Markdown
Contributor

Current Behavior

The @nx/eslint package supports ESLint v8 as a first-class citizen. Fresh installs without flat config get ESLint v8 + typescript-eslint v8, and there is no signal to users that this support is going away.

In addition, workspaces that end up on ESLint v9 with eslintrc-style config get a broken workspace-rule rule-test template. ESLint v9 dropped the eslintrc-style RuleTester class, but the generator emits TSESLint.RuleTester (which extends eslint.RuleTester) regardless of the installed major. v9 + eslintrc users currently can't run the generated .spec.ts without manual edits.

Expected Behavior

  • ESLint v8 support is soft-deprecated. @nx/eslint generators (via assertSupportedEslintVersion) and the @nx/eslint:lint executor emit a deprecation warning on every invocation when the workspace's installed ESLint major is 8. v8 keeps working unchanged; hard removal is scheduled for Nx v24.
  • Fresh installs always pull the latest supported ESLint stack (v9 + typescript-eslint v8) regardless of the user's flat-config preference. The eslintrc config-file shape is still honored at the file level (ESLint v9 loads eslintrc files through LegacyESLint); only the installed package versions move forward.
  • The workspace-rule generator emits the flat-style @typescript-eslint/rule-tester template (and installs that dep) for any workspace ending up on ESLint v9+, not just flat-config ones. v8 + eslintrc workspaces continue to use the existing TSESLint.RuleTester template unchanged.

Implementation Details

  • New warnEslintV8Deprecation() in packages/eslint/src/utils/deprecation.ts, fired from assertSupportedEslintVersion (choke point for the init, lint-project, workspace-rule, workspace-rules-project, convert-to-flat-config, and convert-to-inferred generators) and the lint executor.
  • The workspace-rule generator now gates the rule-test template on useFlatRuleTester = flatConfig || effectiveEslintMajor >= 9, derived from versions(tree).eslintVersion so it covers both declared workspaces and fresh installs.
  • versions(tree) no longer consults useFlatConfig for the fresh-install branch; both lanes return latestVersions. minSupportedEslintVersion stays at '8.0.0' and versionMap[8] stays in place so existing v8 workspaces keep getting a coherent stack until v24 removes them.

View session information ↗

@netlify

netlify Bot commented May 28, 2026

Copy link
Copy Markdown

Deploy Preview for nx-dev ready!

Name Link
🔨 Latest commit 11a24c8
🔍 Latest deploy log https://app.netlify.com/projects/nx-dev/deploys/6a1d33e91f08490007eb2b4c
😎 Deploy Preview https://deploy-preview-35819--nx-dev.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@netlify

netlify Bot commented May 28, 2026

Copy link
Copy Markdown

Deploy Preview for nx-docs ready!

Name Link
🔨 Latest commit 11a24c8
🔍 Latest deploy log https://app.netlify.com/projects/nx-docs/deploys/6a1d33e9086f23000826508e
😎 Deploy Preview https://deploy-preview-35819--nx-docs.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@nx-cloud

nx-cloud Bot commented May 28, 2026

Copy link
Copy Markdown
Contributor

View your CI Pipeline Execution ↗ for commit 11a24c8

Command Status Duration Result
nx affected --targets=lint,test,build,e2e,e2e-c... ✅ Succeeded 3m 41s View ↗
nx run-many -t check-imports check-lock-files c... ✅ Succeeded 3s View ↗
nx-cloud record -- pnpm nx-cloud conformance:check ✅ Succeeded 15s View ↗
nx build workspace-plugin ✅ Succeeded <1s View ↗
nx-cloud record -- nx sync:check ✅ Succeeded 17s View ↗
nx-cloud record -- nx format:check ✅ Succeeded 3s View ↗

☁️ Nx Cloud last updated this comment at 2026-06-01 07:32:48 UTC

@leosvelperez leosvelperez self-assigned this May 28, 2026
@leosvelperez leosvelperez changed the title feat(linter): warn that ESLint v8 support is deprecated and will be removed in Nx v24 feat(linter): deprecate ESLint v8 support May 28, 2026
nx-cloud[bot]

This comment was marked as outdated.

@nx-cloud nx-cloud Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Important

At least one additional CI pipeline execution has run since the conclusion below was written and it may no longer be applicable.

Nx Cloud is proposing a fix for your failed CI:

We updated the snapshot for @nx/eslint:workspace-rules-project should generate the required files 4 to include "isolatedModules": true in the generated tsconfig.spec.json compiler options. This fix aligns the snapshot with the intentional generator change from the fix(linter): generate workspace-rules-project tsconfig.spec.json with isolatedModules commit. Without this update, the test fails on a snapshot mismatch even though the generated output is correct.

Note

We are verifying this fix by re-running a subset of the 2 failed tasks that were analyzed.

diff --git a/packages/eslint/src/generators/workspace-rules-project/__snapshots__/workspace-rules-project.spec.ts.snap b/packages/eslint/src/generators/workspace-rules-project/__snapshots__/workspace-rules-project.spec.ts.snap
index fb771952..4bc20e65 100644
--- a/packages/eslint/src/generators/workspace-rules-project/__snapshots__/workspace-rules-project.spec.ts.snap
+++ b/packages/eslint/src/generators/workspace-rules-project/__snapshots__/workspace-rules-project.spec.ts.snap
@@ -70,7 +70,8 @@ exports[`@nx/eslint:workspace-rules-project should generate the required files 4
   "extends": "./tsconfig.json",
   "compilerOptions": {
     "outDir": "../../dist/out-tsc",
-    "types": ["jest", "node"]
+    "types": ["jest", "node"],
+    "isolatedModules": true
   },
   "include": [
     "jest.config.ts",

Apply fix via Nx Cloud  Reject fix via Nx Cloud


Or Apply changes locally with:

npx nx-cloud apply-locally 28PZ-kTWD

Apply fix locally with your editor ↗   View interactive diff ↗



🎓 Learn more about Self-Healing CI on nx.dev

…emoved in Nx v24

Add a shared warning for ESLint v8 users emitted at both generator
entry (via `assertSupportedEslintVersion`, which is the choke point
for the init / lint-project / workspace-rule(s) / convert-to-flat-config
/ convert-to-inferred generators) and lint-executor entry. v8 stays
fully supported until v24 — this is a soft deprecation only.
…+ eslintrc workspaces

ESLint v9 dropped the eslintrc-style `RuleTester` class, so the
generated `.spec.ts` template's `TSESLint.RuleTester` (which extends
`eslint.RuleTester`) breaks on v9 even when running in eslintrc mode.
Switch the generator to emit the flat-style `@typescript-eslint/rule-tester`
template whenever the workspace ends up on ESLint v9+ regardless of
the config-file shape, and install `@typescript-eslint/rule-tester`
on that path. v8 + eslintrc workspaces continue to use the existing
`TSESLint.RuleTester` template unchanged.
…hapes

Fresh installs (no `eslint` declared) now always pull ESLint v9
regardless of the user's flat-config preference. The eslintrc-shape
config files generated when `useFlatConfig(tree)` is false are still
honored — v9 loads them through `LegacyESLint` — only the installed
package versions move forward. Existing v8 workspaces are untouched
because their declared major still routes through `versionMap[8]`.
…emplate change

The snapshots were captured against the eslintrc-style template and
became stale once the generator started emitting the flat-style
`@typescript-eslint/rule-tester` template for fresh installs (which
now default to ESLint v9).
…test template across ESLint majors

`TSESLint.RuleTester` (from `@typescript-eslint/utils`, already installed
by `lintWorkspaceRulesProjectGenerator`) just extends `eslint.RuleTester`,
so its accepted constructor shape follows the installed ESLint major.
The eslintrc rule-test template now branches on `eslintMajor` to emit
eslintrc-style args for v8 and flat-style args for v9, while
`@typescript-eslint/rule-tester` stays scoped to flat-config workspaces.
This avoids requiring v9 + eslintrc workspaces to install an extra
dependency.
… isolatedModules

`@typescript-eslint/rule-tester` only exposes its API through an
`exports` map (no `main`). Without `isolatedModules: true`, the
`module: node16` setting inherited from the project's base
`tsconfig.json` triggers ts-jest's TS151002 warning and the generated
`.spec.ts` fails to resolve `@typescript-eslint/rule-tester`. Setting
`isolatedModules: true` (matching the repo's own `tools/eslint-rules`
configuration) ensures the package resolves reliably.

Also restores the workspace-rule template's `@typescript-eslint/rule-tester`
import for any ESLint v9+ workspace (flat or eslintrc) — typescript-eslint's
recommended replacement for the eslintrc-style `RuleTester` API that v9
dropped — instead of relying on `TSESLint.RuleTester`, whose
`@typescript-eslint/utils@^8` type definitions are still locked to the
eslintrc constructor shape and reject flat-style args at type-check time.
…g.spec.json isolatedModules

Follow-up to 069cf30 which added `isolatedModules: true` to the
generated tsconfig.spec.json. Snapshot entry 4 was not refreshed.
@leosvelperez leosvelperez marked this pull request as ready for review June 1, 2026 07:49
@leosvelperez leosvelperez requested a review from a team as a code owner June 1, 2026 07:49
@leosvelperez leosvelperez self-requested a review June 1, 2026 07:49
@FrozenPandaz FrozenPandaz merged commit b2657e3 into master Jun 2, 2026
26 checks passed
@FrozenPandaz FrozenPandaz deleted the nxc-3986 branch June 2, 2026 18:07
vrxj81 pushed a commit to vrxj81/nx that referenced this pull request Jun 7, 2026
## Current Behavior

The `@nx/eslint` package supports ESLint v8 as a first-class citizen.
Fresh installs without flat config get ESLint v8 + typescript-eslint v8,
and there is no signal to users that this support is going away.

In addition, workspaces that end up on ESLint v9 with eslintrc-style
config get a broken `workspace-rule` rule-test template. ESLint v9
dropped the eslintrc-style `RuleTester` class, but the generator emits
`TSESLint.RuleTester` (which extends `eslint.RuleTester`) regardless of
the installed major. v9 + eslintrc users currently can't run the
generated `.spec.ts` without manual edits.

## Expected Behavior

- ESLint v8 support is soft-deprecated. `@nx/eslint` generators (via
`assertSupportedEslintVersion`) and the `@nx/eslint:lint` executor emit
a deprecation warning on every invocation when the workspace's installed
ESLint major is 8. v8 keeps working unchanged; hard removal is scheduled
for Nx v24.
- Fresh installs always pull the latest supported ESLint stack (v9 +
typescript-eslint v8) regardless of the user's flat-config preference.
The eslintrc config-file shape is still honored at the file level
(ESLint v9 loads eslintrc files through `LegacyESLint`); only the
installed package versions move forward.
- The `workspace-rule` generator emits the flat-style
`@typescript-eslint/rule-tester` template (and installs that dep) for
any workspace ending up on ESLint v9+, not just flat-config ones. v8 +
eslintrc workspaces continue to use the existing `TSESLint.RuleTester`
template unchanged.

## Implementation Details

- New `warnEslintV8Deprecation()` in
`packages/eslint/src/utils/deprecation.ts`, fired from
`assertSupportedEslintVersion` (choke point for the `init`,
`lint-project`, `workspace-rule`, `workspace-rules-project`,
`convert-to-flat-config`, and `convert-to-inferred` generators) and the
lint executor.
- The `workspace-rule` generator now gates the rule-test template on
`useFlatRuleTester = flatConfig || effectiveEslintMajor >= 9`, derived
from `versions(tree).eslintVersion` so it covers both declared
workspaces and fresh installs.
- `versions(tree)` no longer consults `useFlatConfig` for the
fresh-install branch; both lanes return `latestVersions`.
`minSupportedEslintVersion` stays at `'8.0.0'` and `versionMap[8]` stays
in place so existing v8 workspaces keep getting a coherent stack until
v24 removes them.

<!-- polygraph-session-start -->
---
[View session information
↗](https://snapshot.app.trypolygraph.com/orgs/69cdc268b6aa527e4129c2b4/sessions/nxc-3986-ac90716f)
<!-- polygraph-session-end -->

---------

Co-authored-by: Leosvel Pérez Espinosa <leosvel.perez.espinosa@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants