typescript-eslint: Bug: [no-unused-expressions, no-empty-functions, possibly others...] extension rules crash with eslint v9.15.0
Before You File a Bug Report Please Confirm You Have Done The Following…
- I have tried restarting my IDE and the issue persists.
- I have updated to the latest version of the packages.
- I have searched for related issues and found none that matched my issue.
- I have read the FAQ and my problem is not listed.
Issue Description
eslint crashes when using the latest version of node 22 and the latest version of typescript-eslint.
Oops! Something went wrong! :(
ESLint: 9.15.0
TypeError: Error while loading rule '@typescript-eslint/no-unused-expressions': Cannot read properties of undefined (reading 'allowShortCircuit')
Occurred while linting /home/ext4cats/Projects/tseslint-8.14.0-bug/index.js
at Object.create (/home/ext4cats/Projects/tseslint-8.14.0-bug/node_modules/.pnpm/eslint@9.15.0/node_modules/eslint/lib/rules/no-unused-expressions.js:75:13)
at create (/home/ext4cats/Projects/tseslint-8.14.0-bug/node_modules/.pnpm/@typescript-eslint+eslint-plugin@8.14.0_@typescript-eslint+parser@8.14.0_eslint@9.15.0_typesc_u2crwq53uno6k5fweinf7nowby/node_modules/@typescript-eslint/eslint-plugin/dist/rules/no-unused-expressions.js:28:32)
at Object.create (/home/ext4cats/Projects/tseslint-8.14.0-bug/node_modules/.pnpm/@typescript-eslint+utils@8.14.0_eslint@9.15.0_typescript@5.6.3/node_modules/@typescript-eslint/utils/dist/eslint-utils/RuleCreator.js:31:20)
at createRuleListeners (/home/ext4cats/Projects/tseslint-8.14.0-bug/node_modules/.pnpm/eslint@9.15.0/node_modules/eslint/lib/linter/linter.js:944:21)
at /home/ext4cats/Projects/tseslint-8.14.0-bug/node_modules/.pnpm/eslint@9.15.0/node_modules/eslint/lib/linter/linter.js:1082:84
at Array.forEach (<anonymous>)
at runRules (/home/ext4cats/Projects/tseslint-8.14.0-bug/node_modules/.pnpm/eslint@9.15.0/node_modules/eslint/lib/linter/linter.js:1013:34)
at #flatVerifyWithoutProcessors (/home/ext4cats/Projects/tseslint-8.14.0-bug/node_modules/.pnpm/eslint@9.15.0/node_modules/eslint/lib/linter/linter.js:1911:31)
at Linter._verifyWithFlatConfigArrayAndWithoutProcessors (/home/ext4cats/Projects/tseslint-8.14.0-bug/node_modules/.pnpm/eslint@9.15.0/node_modules/eslint/lib/linter/linter.js:1993:49)
at Linter._verifyWithFlatConfigArray (/home/ext4cats/Projects/tseslint-8.14.0-bug/node_modules/.pnpm/eslint@9.15.0/node_modules/eslint/lib/linter/linter.js:2082:21)
Reproduction Repository Link
https://github.com/ext4cats/tseslint-8.14.0-bug
Repro Steps
- clone the repo
- follow steps in readme
Versions
| package | version |
|---|---|
typescript-eslint |
8.14.0 |
TypeScript |
5.6.3 |
ESLint |
9.15.0 |
node |
22.11.0 |
About this issue
- Original URL
- State: closed
- Created 2 years ago
- Reactions: 73
- Comments: 29 (9 by maintainers)
Commits related to this issue
- chore: downgrade eslint version to 9.14.0 see https://github.com/eslint/eslint/issues/19134 and https://github.com/typescript-eslint/typescript-eslint/issues/10338 — committed to ShiinaKin/hoshizora-pics by ShiinaKin 2 years ago
- downgrade ESLint to address bug https://github.com/typescript-eslint/typescript-eslint/issues/10338 — committed to signal24/vue-foundation by fergusean 2 years ago
- fix: pin eslint until this is resolved: https://github.com/typescript-eslint/typescript-eslint/issues/10338 — committed to NaturalCycles/dev-lib by kirillgroshkov 2 years ago
- Release version 1.5.4 — committed to printfn/fend by printfn 2 years ago
- Lock ESLint to 9.14 due to typescript-eslint issue Ref: typescript-eslint/typescript-eslint#10338 — committed to zjkmxy/ndn-workspace-solid by zjkmxy 2 years ago
- Lock ESLint to 9.14 due to typescript-eslint issue (#154) Ref: typescript-eslint/typescript-eslint#10338 — committed to UCLA-IRL/ndn-workspace-solid by zjkmxy 2 years ago
- Temporarily downgrade ESLint due to https://github.com/typescript-eslint/typescript-eslint/issues/10338 — committed to seek-oss/fake-hr by AaronMoat 2 years ago
- deps: lock file maintenance (#95) * deps: lock file maintenance * Temporarily downgrade ESLint due to https://github.com/typescript-eslint/typescript-eslint/issues/10338 --------- Co-authored-by: ... — committed to seek-oss/fake-hr by renovate[bot] 2 years ago
I downgraded my project to eslint v9.14.0 and the crash is gone. Seems to be a regression in eslint itself.
The fix has merged and will soon be released to our
canarytag. The fix will release tolatestwith our next release in a few days. https://typescript-eslint.io/users/releasesTotally fair! Rest assured that the root cause of this type of bug is very well understood by each of the maintenance team members, and will be addressed as soon as our bandwidth permits, unless a community champion is able to get to it first 🙂
This is the eslint patch I used to get it working with typescript-eslint and unicorn
@AviVahl our utilities have always supported a top-level
defaultOptionsproperty for as long as they have existed! Our API design was to pass the merged options as a second parameter to thecreatefunction rather than changing the options on thecontextobject because it allowed greater flexibility – it gives you the option to see BOTH the user’s actual config and the merged config – which can sometimes be useful if you want to act differently when a user skipped an option but also avoid havingundefineds around the place.Unfortunately ESLint core chose a different location for the
defaultOptionsproperty just added in v9.15.0:meta.defaultOptionsrather than as a top-level property, andcontext.optionsrather than pass it as a separate argument.In the next major we’ll likely converge on their solution to deduplicate things.
The issue is known. The fix is in progress. Locking to avoid further noise.
Please subscribe to this issue to keep updated.
I originally hit this bug with
typescript-eslint/no-empty-function. It was only after completely turning off that rule, I found the rule in this issue. Which then searching online found this GitHub issue. So yes, there are other rules that are affected.