Skip to content

feat(eslint-config)!: upgrade typescript-eslint to v8 - #11811

Open
raymondfeng wants to merge 5 commits into
masterfrom
feat/typescript-eslint-8
Open

raymondfeng wants to merge 5 commits into
masterfrom
feat/typescript-eslint-8

Conversation

@raymondfeng

Copy link
Copy Markdown
Contributor

Upgrades typescript-eslint from v7 to v8, which TypeScript 6+ requires. Split out of #11793 so it can be reviewed and released on its own. #11793 builds on this PR.

Commits

  1. feat(eslint-config)!: the dependency bump and rule config. This is the only commit with BREAKING CHANGE:, so lerna's conventional-commit bump makes a major release of @loopback/eslint-config only.
    • Rules that v8 renamed or split are turned off, which keeps the existing rule set (no-require-imports, no-empty-object-type, no-unsafe-function-type, no-wrapper-object-types).
    • prefer-nullish-coalescing now ignores primitive operands. Lint runs without strictNullChecks (tsconfig.build.json), so v8 reports || even on string/number/boolean operands, where ?? changes the result for '', 0 and false. One example on master is check(value) || check(...) in relation.helpers.ts, where both sides are booleans.
  2. feat(cli): generated projects use typescript-eslint v8.
  3. refactor:: fixes for the findings v8 reports on master with TypeScript 5.2:
    • unused catch bindings
    • optional chains where they are equivalent
    • ??= for == null guards and for !x guards on objects/arrays
    • the duplicate RestApplication.route() overload
    • stale eslint-disable directives

Behavior: this PR doesn't change it. || is kept wherever the operand can be '' or 0. The passport-login example keeps its explicit !user.credentials guard.

Checklist

  • DCO (Developer Certificate of Origin) signed in all commits
  • npm test passes on your machine: build and lint pass. Mocha: 4492 passing, but the CLI generator tests can't run in a non-interactive shell, and the todo geocoder tests fail against live data, on master as well. Relying on CI for those.
  • New tests added or existing tests modified to cover all changes
  • Code conforms with the style guide
  • API Documentation in code was updated
  • Documentation in /docs/site was updated
  • Affected artifact templates in packages/cli were updated
  • Affected example projects in examples/* were updated

🤖 Generated with Claude Code

raymondfeng and others added 3 commits October 1, 2026 21:01
typescript-eslint v7 does not support TypeScript 6 or later, so it blocks the
TypeScript upgrade.

Rules that v8 renamed or split are disabled to keep the rule set this
configuration already had: `no-require-imports` replaces `no-var-requires`, and
`ban-types` is split into `no-empty-object-type`, `no-unsafe-function-type` and
`no-wrapper-object-types`.

`prefer-nullish-coalescing` now ignores primitive operands. The rule runs
without `strictNullChecks`, so it cannot tell whether a `string`, `number` or
`boolean` operand may be nullish, and v8 reports `||` on such operands, where
switching to `??` changes the result for `''`, `0` and `false`.

BREAKING CHANGE: `@loopback/eslint-config` requires `@typescript-eslint/parser`
and `@typescript-eslint/eslint-plugin` v8. Projects using it can get new
findings, such as unused `catch` bindings (`no-unused-vars`),
`prefer-optional-chain`, and `prefer-nullish-coalescing` for
`if (x == null) x = y`.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: Raymond Feng <enjoyjava@gmail.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: Raymond Feng <enjoyjava@gmail.com>
- Drop unused `catch` bindings (`no-unused-vars`).
- Use optional chains where they are equivalent (`prefer-optional-chain`).
- Use `??=` for `if (x == null) x = y` and for `!x` guards on values that are
  objects or arrays, where it is equivalent (`prefer-nullish-coalescing`).
- Remove the `route()` overload that `RestApplication` declared twice
  (`unified-signatures`).
- Remove `eslint-disable` directives that no longer suppress anything.

`||` is kept wherever the left operand may be `''` or `0`. The passport-login
example keeps its explicit `!user.credentials` guard, since
`user.credentials?.password !== password` accepts a user without credentials
when `password` is `undefined`.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: Raymond Feng <enjoyjava@gmail.com>
raymondfeng and others added 2 commits October 1, 2026 22:15
The US Census geocoder now returns slightly different coordinates for the test
address, so `GeoLookupService` and `TodoApplication` tests fail on every
platform, on master as well.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: Raymond Feng <enjoyjava@gmail.com>
The hook that launches puppeteer and loads the page intermittently exceeds
15 seconds on the ubuntu-latest runners. It now gets 30 seconds, the same as
the hook that generates the bundle.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: Raymond Feng <enjoyjava@gmail.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