Skip to content

feat(tooling): upgrade ESLint 9 → 10 with flat config migration#171

Draft
scottschreckengaust wants to merge 4 commits into
mainfrom
feat/eslint-10-upgrade
Draft

feat(tooling): upgrade ESLint 9 → 10 with flat config migration#171
scottschreckengaust wants to merge 4 commits into
mainfrom
feat/eslint-10-upgrade

Conversation

@scottschreckengaust
Copy link
Copy Markdown
Contributor

Summary

Closes #169

Upgrades ESLint from v9 (legacy .eslintrc.json with ESLINT_USE_FLAT_CONFIG=false) to v10 (flat config only). Migrates both cdk/ and cli/ configurations to eslint.config.mjs format.

Changes

Commit What
Package upgrades eslint ^10, @cdklabs/eslint-plugin ^2, eslint-plugin-import-x ^4 (replaces eslint-plugin-import)
CDK flat config .eslintrc.json → eslint.config.mjs, all rules preserved
CLI flat config Same migration, no-console override preserved for src/

Key decisions

  • eslint-plugin-import → eslint-plugin-import-x: Drop-in replacement with ESLint 10 support. Rule prefix changes from import/ to import-x/.
  • @cdklabs/eslint-plugin v1 → v2: Required for ESLint 10 peer dependency.
  • 4 @cdklabs rules disabled (chore(eslint): re-enable @cdklabs rules after plugin fixes deprecated context.getFilename() #170): Plugin v2.0.6 uses removed context.getFilename() API. Re-enable when upstream fixes.
  • --ext flag removed: File targeting now via files patterns in flat config.
  • ESLINT_USE_FLAT_CONFIG removed: Not needed (flat config is the only format in ESLint 10).

What's NOT in this PR (Phase 2, separate PRs)

  • Removing existing eslint-disable suppressions (29 total)
  • Enabling new ESLint 10 recommended rules (no-unassigned-vars, no-useless-assignment, preserve-caught-error)
  • Addressing the @cdklabs plugin upstream issue

Test plan

  • mise //cdk:eslint passes (zero errors)
  • mise //cli:eslint passes (zero errors)
  • Pre-commit hooks pass for both packages
  • CI build passes (includes eslint in the build chain)
  • No source code changes (config-only migration)

References: #169 (implementation issue), #170 (@cdklabs upstream blocker), #104 (toolchain monitoring RFC)

🤖 Generated with Claude Code

scottschreckengaust and others added 4 commits May 22, 2026 20:28
- eslint ^9 -> ^10 (10.4.0)
- @cdklabs/eslint-plugin ^1 -> ^2 (flat config support)
- eslint-plugin-import removed (no ESLint 10 support)
- eslint-plugin-import-x ^4 added (drop-in replacement)
- eslint-import-resolver-typescript removed (import-x has built-in TS resolution)
- Root resolution for eslint-plugin-import/minimatch removed

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Convert .eslintrc.json to eslint.config.mjs (ESM flat config format).
Replace import/ rule prefix with import-x/. Remove --ext flag and
ESLINT_USE_FLAT_CONFIG env var from the eslint script.

All existing rules preserved with equivalent flat config syntax.
Four @cdklabs rules (no-core-construct, invalid-cfn-imports,
no-literal-partition, no-invalid-path) are temporarily disabled
because they use context.getFilename() which was removed in ESLint 10.
Stale eslint-disable comments for disabled/absent rules removed by
auto-fix.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Convert .eslintrc.json to eslint.config.mjs. Replace import/ rule
prefix with import-x/. Remove --ext flag and ESLINT_USE_FLAT_CONFIG.
All existing rules preserved including no-console override for src/.
Removed stale no-constant-condition disable comments (rule deprecated
in ESLint 10).

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
The resolver is required by eslint-plugin-import-x for TypeScript path
resolution. Was incorrectly removed in the package upgrade commit.
Also disable license-header rule for shebang bin files (workaround).

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Comment thread cdk/eslint.config.mjs
languageOptions: {
parser: tsparser,
parserOptions: {
ecmaVersion: 2018,
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

is this the latest version 2018?

Comment thread cdk/eslint.config.mjs
Comment on lines +192 to +199
// NOTE: The following 4 rules use context.getFilename() which was removed in ESLint 10.
// They are disabled until @cdklabs/eslint-plugin adds ESLint 10 support.
// Track: https://github.com/cdklabs/eslint-plugin/issues
'@cdklabs/no-core-construct': ['off'],
'@cdklabs/invalid-cfn-imports': ['off'],
'@cdklabs/no-literal-partition': ['off'],
'@cdklabs/no-invalid-path': ['off'],
'@cdklabs/promiseall-no-unbounded-parallelism': ['error'],
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

There are five rules here. Is that intentional?

Comment thread cdk/eslint.config.mjs
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

What items are necessary for eslint v10 - what items are already set out-of-the-box and which ones are enhancements?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

feat(tooling): upgrade ESLint 9 → 10 with flat config migration

1 participant