Skip to content

Update ESLint to v10 and eslint-plugin-n to v18 - #1013

Merged
cclauss merged 2 commits into
mapbox:masterfrom
acalcutt:mapbox-eslint-10
Oct 5, 2026
Merged

cclauss merged 2 commits into
mapbox:masterfrom
acalcutt:mapbox-eslint-10

Conversation

@acalcutt

@acalcutt acalcutt commented Oct 4, 2026

Copy link
Copy Markdown
Contributor

Updates ESLint to v10 and eslint-plugin-n to v18, as requested in #1011. Supersedes #1004 and #1007.

These need to go together: @mapbox/eslint-config-mapbox (latest 5.1.0) requires eslint ^8.57.0 and eslint-plugin-n ^17.9.0, and ESLint 9+ no longer supports .eslintrc.

Changes

  • Replace .eslintrc with flat config eslint.config.js.
  • Remove @mapbox/eslint-config-mapbox; its base.js/node.js rules (eslint:recommended plus ~25 rules and 4 n/ rules) are now defined directly in eslint.config.js, alongside the existing repo-specific rules.
  • Formatting rules deprecated in ESLint core (indent, semi, quotes, spacing rules…) now come from @stylistic/eslint-plugin with the same options, so they won't break when ESLint removes them.
  • Remove the typescript-eslint overrides added in Override typescript-eslint to v8 to drop vulnerable braces chain #1011. They were only needed because of eslint-config-mapbox's peer dependencies.
  • Fix the issues flagged by ESLint's newer recommended rules (separate commit, no behavior change): unused caught errors now use optional catch binding, one value that was never read is removed, and four stale eslint-disable comments are dropped.
  • .npmignore: exclude eslint.config.js instead of .eslintrc.

Verification

  • npm run lint passes (now also lints eslint.config.js).
  • A file with deliberate violations of every configured rule reports the same problems under the old setup (ESLint 8 + eslint-config-mapbox) and the new one, apart from the two checks ESLint added to its recommended set since v8: no-useless-assignment and caught errors in no-unused-vars.
  • ESLint 10 / eslint-plugin-n 18 require Node ^20.19 || ^22.13 || >=24 for linting only; all workflows lint on Node 22+.

acalcutt and others added 2 commits October 4, 2026 18:37
- Use optional catch binding where the caught error is unused
  (no-unused-vars now checks caught errors by default)
- Remove initial values and assignments that are never read
  (no-useless-assignment is now part of eslint:recommended)
- Remove eslint-disable comments that no longer suppress anything

No behavior changes.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Migrates from .eslintrc to flat config (eslint.config.js), required by
ESLint 9+. @mapbox/eslint-config-mapbox (latest 5.1.0) only supports
ESLint 8 and eslint-plugin-n 17, so its node/base rules are now defined
directly in eslint.config.js alongside the existing repo rules.

Formatting rules deprecated in ESLint core are taken from
@stylistic/eslint-plugin with the same options. A lint of a file with
deliberate violations reports the same problems as before, plus the
two checks added to ESLint's recommended rules since v8
(no-useless-assignment, caught errors in no-unused-vars).

Dropping eslint-config-mapbox also removes its typescript-eslint peer
dependencies, so the typescript-eslint overrides are no longer needed.

Supersedes mapbox#1004 and mapbox#1007.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@acalcutt
acalcutt requested a review from a team as a code owner October 4, 2026 22:46
@cclauss
cclauss merged commit 31d8230 into mapbox:master Oct 5, 2026
44 of 45 checks passed
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.

2 participants