Skip to content

Take ESLint 10 and react-hooks 7, and drop two dead assignments they found - #188

Merged
fstubner merged 1 commit into
mainfrom
chore/eslint-10
Aug 17, 2026
Merged

fstubner merged 1 commit into
mainfrom
chore/eslint-10

Conversation

@fstubner

Copy link
Copy Markdown
Owner

Supersedes #180 (eslint), #182 (@eslint/js) and #179 (eslint-plugin-react-hooks).

None of the three could merge alone — @eslint/js 10 peer-depends on eslint@^10, so they move together.

Nothing else was blocking them

package peer range satisfied
typescript-eslint 8.67 eslint: ^8.57.0 || ^9.0.0 || ^10.0.0 yes
eslint-plugin-react-hooks 7.1.1 eslint: … || ^10.0.0 yes
eslint 10.8.1 node: ^20.19.0 || ^22.13.0 || >=24 yes — via the Node 22 move in #187

The config needed no changes. Note the last row: on the old Node 20 runner this bump would have been blocked too, for the same reason jsdom was.

What the upgrade found

no-useless-assignment is new in ESLint 10's recommended set, and it caught two real dead assignments — same shape in both places:

let next = current;
switch (event.key) {
  case 'ArrowDown': next = ...; break;   // every arm assigns
  default: return;                       // ...or returns
}

The seed value can never be read. Both are now declared without an initialiser, so the compiler enforces "every path assigns or returns" instead of a plausible-looking default quietly absorbing a missing case. tsc accepting it is the proof that the property actually holds.

Verification

The rule set still fires — checked rather than inferred from a green exit. A throwaway probe file containing a conditional hook, an any, and a bad dependency array produced all three diagnostics:

error    Unexpected any                                 @typescript-eslint/no-explicit-any
error    React Hook "useState" is called conditionally  react-hooks/rules-of-hooks
warning  useEffect has a missing dependency             react-hooks/exhaustive-deps

That matters here because a major-version bump that silently stopped registering the plugin would still exit 0, and react-hooks is the rule set that catches the stale-closure bugs this project has actually shipped.

Lint: 0 errors, 3 warnings — the same three pre-existing exhaustive-deps warnings as before. 94 tests and the build pass.

Still blocked

#134 (TypeScript 7) is unaffected. typescript-eslint 8.67 caps TypeScript at >=4.8.4 <6.1.0, so no ESLint-side bump helps it.

…found

Supersedes #180 (eslint), #182 (@eslint/js) and #179
(eslint-plugin-react-hooks). None of the three could merge alone:
@eslint/js 10 peer-depends on eslint ^10, so they move together.

Nothing else blocked them. typescript-eslint 8.67 already accepts
eslint ^10.0.0, and react-hooks 7 accepts it too, so the config needed no
changes. ESLint 10 wants Node ^20.19 || ^22.13 || >=24, which CI only
satisfies because of the Node 22 move in the previous commit.

`no-useless-assignment` is new in ESLint 10's recommended set and found two
real dead assignments, both the same shape:

    let next = current;
    switch (event.key) {
      case ...: next = ...; break;   // every arm assigns
      default: return;               // or returns
    }

The seed value can never be read. Both are now declared without an
initialiser, so the compiler enforces "every path assigns or returns"
rather than a plausible-looking default hiding a missing case. tsc accepts
it, which is the proof that the property actually holds.

Verified the rule set still fires rather than trusting a green exit — a
throwaway probe file with a conditional hook, an `any`, and a bad
dependency array produced all three diagnostics:

  error    Unexpected any                          @typescript-eslint/no-explicit-any
  error    React Hook "useState" is called conditionally  react-hooks/rules-of-hooks
  warning  useEffect has a missing dependency       react-hooks/exhaustive-deps

Lint is 0 errors / 3 warnings, the same three pre-existing exhaustive-deps
warnings as before. 94 tests and the build pass.
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