Visitar URL original
chore: Migrate to ESLint 10 flat config with @feathers-community/eslint-config (v6) by fratzinger · Pull Request #3721 · feathersjs/feathers · GitHub
Skip to content

chore: Migrate to ESLint 10 flat config with @feathers-community/eslint-config (v6) - #3721

Open
fratzinger wants to merge 2 commits into
feathersjs:v6from
fratzinger:chore/eslint-flat-config
Open

fratzinger wants to merge 2 commits into
feathersjs:v6from
fratzinger:chore/eslint-flat-config

Conversation

@fratzinger

Copy link
Copy Markdown
Member

Summary

The legacy .eslintrc.js only worked because the eslint script forced ESLINT_USE_FLAT_CONFIG=false, and ESLint 10 no longer supports that. This PR moves to ESLint 10 with a flat config based on @feathers-community/eslint-config:

-.eslintrc.js
+eslint.config.mjs        # @feathers-community/eslint-config + Feathers overrides
 package.json
-  "eslint": "ESLINT_USE_FLAT_CONFIG=false eslint \"packages/**/*.ts\" --fix"
+  "eslint": "eslint packages --fix"
-  eslint@9, @typescript-eslint/*, eslint-config-prettier, eslint-plugin-prettier
+  eslint@10, @feathers-community/eslint-config, globals

The overrides in eslint.config.mjs are:

  • Formatting does not change. The existing .prettierrc (printWidth: 110, trailingComma: none) still applies, so files are not reformatted.
  • e18e/prefer-spread-syntax is off. Its autofix turns a.concat(b) into [...a, b], which is not the same when b is an array. With the autofix applied, 35 tests failed.
  • e18e/prefer-object-has-own, prefer-array-at, prefer-array-to-sorted and prefer-array-to-reversed are off. They require ES2022+, and Feathers targets ES2020 (browsers, React Native).
  • e18e/prefer-static-regex is off for tests.
  • packages/*/bin/** gets Node globals, and import-x/no-unresolved is off there. The bin scripts import the compiled lib/, which does not exist yet when CI lints, since lint runs before compile.

The code changes in the other files are the safe autofixes: separate type imports, the node: protocol and assert.ok. A few issues are fixed by hand:

  • empty catch blocks now use optional catch binding and a comment
  • hasOwnProperty is called through Object.prototype
  • unused template arguments are renamed to _ctx
  • a useless assignment in the event emitter is removed
  • the intentional duplicate Channel export is annotated

There are no behaviour changes.

Depends on #3720. eslint-plugin-unicorn requires Node.js 22 or later, and CI on Node.js 20 fails while loading the config. Until #3720 is merged, this PR also shows its commit.

Evidence

  • Before: npm run eslint only works with the deprecated eslintrc mode on ESLint 9. On Node.js 20 the new config fails to load with TypeError: mapTypes.union is not a function (eslint-plugin-unicorn).
    After: eslint packages --max-warnings 0 reports no errors and no warnings. npm run lint leaves the tree unchanged. In a fresh checkout without build output, npm ci && npm test passes on Node.js 24.16 and 26.10 with Tests 497 passed | 1 skipped, and CI is green on 24 and 26.

Merge Danger

Door: two-way

Blast Radius: small

The PR touches 65 files, but outside the dev tooling every change is mechanical, mostly import statements, and the test suite passes unchanged. Most of the added lines are in package-lock.json. Open PRs against v6 that touch the same imports may need a rebase.

🤖 Generated with Claude Code

fratzinger and others added 2 commits October 21, 2026 21:04
Node.js 20 is end-of-life and the development tooling (ESLint plugins)
already requires newer versions. All packages now require Node.js 24 or
later and CI tests on Node.js 24 and 26.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…nt-config (v6)

- Replace the legacy `.eslintrc.js` (which required `ESLINT_USE_FLAT_CONFIG=false`
  and no longer works with ESLint 10) with `eslint.config.mjs` based on
  `@feathers-community/eslint-config`
- Keep the existing `.prettierrc` formatting options
- Disable `e18e/prefer-spread-syntax` (`[].concat(x)` and `[...x]` behave differently
  when `x` is not an array) and the e18e rules that require ES2022+ since Feathers
  targets ES2020 (browsers, React Native)
- Apply the autofixes (type imports, `node:` protocol, `assert.ok`, ...) and fix the
  remaining issues by hand (empty catch blocks, `hasOwnProperty`, template arguments)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

This branch has not been deployed

No deployments
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.

1 participant