-
-
Notifications
You must be signed in to change notification settings - Fork 2.8k
Bug: [prefer-nullish-coalescing] <internal error when linting on binary expression (||) with destruct tuple and object with rename property> #8261
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
The problem is that it doesn't know what to do when type of Minimal repro: playground Probably a bug. The rule shouldn't throw when it encounters |
I have the same issue. |
This comment has been minimized.
This comment has been minimized.
Linting error caused by bug in eslint rule typescript-eslint/typescript-eslint#8261
It's also throwing in javascript-files (ie non-typescript files), where it's a little harder to correct the type. |
I'm getting the same error when eslint tries to run the rule on one of my JS based eslint rule definitions in
|
prefer-nullish-coalescing broke in the 6.19.0 update with a funky bug which has an open PR to be fixed typescript-eslint/typescript-eslint#8261
typescript-eslint/typescript-eslint#8261 ``` TypeError: Cannot read properties of undefined (reading 'some') Occurred while linting /home/runner/work/pnpm/pnpm/cli/default-reporter/src/reporterForClient/pkgsDiff.ts:70 Rule: "@typescript-eslint/prefer-nullish-coalescing" at LogicalExpression[operator = "||"] (/home/runner/work/pnpm/pnpm/node_modules/.pnpm/@typescript-eslint+eslint-plugin@6.19.0_@typescript-eslint+parser@6.19.0_eslint@8.56.0_typescript@5.3.3/node_modules/@typescript-eslint/eslint-plugin/dist/rules/prefer-nullish-coalescing.js:267:32) at ruleErrorHandler (/home/runner/work/pnpm/pnpm/node_modules/.pnpm/eslint@8.56.0/node_modules/eslint/lib/linter/linter.js:1076:28) at /home/runner/work/pnpm/pnpm/node_modules/.pnpm/eslint@8.56.0/node_modules/eslint/lib/linter/safe-emitter.js:45:58 at Array.forEach (<anonymous>) at Object.emit (/home/runner/work/pnpm/pnpm/node_modules/.pnpm/eslint@8.56.0/node_modules/eslint/lib/linter/safe-emitter.js:45:38) at NodeEventGenerator.applySelector (/home/runner/work/pnpm/pnpm/node_modules/.pnpm/eslint@8.56.0/node_modules/eslint/lib/linter/node-event-generator.js:297:26) at NodeEventGenerator.applySelectors (/home/runner/work/pnpm/pnpm/node_modules/.pnpm/eslint@8.56.0/node_modules/eslint/lib/linter/node-event-generator.js:326:22) at NodeEventGenerator.enterNode (/home/runner/work/pnpm/pnpm/node_modules/.pnpm/eslint@8.56.0/node_modules/eslint/lib/linter/node-event-generator.js:340:14) at CodePathAnalyzer.enterNode (/home/runner/work/pnpm/pnpm/node_modules/.pnpm/eslint@8.56.0/node_modules/eslint/lib/linter/code-path-analysis/code-path-analyzer.js:803:23) at /home/runner/work/pnpm/pnpm/node_modules/.pnpm/eslint@8.56.0/node_modules/eslint/lib/linter/linter.js:1111:32 ```
* chore: uppdate @typescript-eslint/* 6.11.0 -> 6.18.1 typescript-eslint/typescript-eslint#8261 ``` TypeError: Cannot read properties of undefined (reading 'some') Occurred while linting /home/runner/work/pnpm/pnpm/cli/default-reporter/src/reporterForClient/pkgsDiff.ts:70 Rule: "@typescript-eslint/prefer-nullish-coalescing" at LogicalExpression[operator = "||"] (/home/runner/work/pnpm/pnpm/node_modules/.pnpm/@typescript-eslint+eslint-plugin@6.19.0_@typescript-eslint+parser@6.19.0_eslint@8.56.0_typescript@5.3.3/node_modules/@typescript-eslint/eslint-plugin/dist/rules/prefer-nullish-coalescing.js:267:32) at ruleErrorHandler (/home/runner/work/pnpm/pnpm/node_modules/.pnpm/eslint@8.56.0/node_modules/eslint/lib/linter/linter.js:1076:28) at /home/runner/work/pnpm/pnpm/node_modules/.pnpm/eslint@8.56.0/node_modules/eslint/lib/linter/safe-emitter.js:45:58 at Array.forEach (<anonymous>) at Object.emit (/home/runner/work/pnpm/pnpm/node_modules/.pnpm/eslint@8.56.0/node_modules/eslint/lib/linter/safe-emitter.js:45:38) at NodeEventGenerator.applySelector (/home/runner/work/pnpm/pnpm/node_modules/.pnpm/eslint@8.56.0/node_modules/eslint/lib/linter/node-event-generator.js:297:26) at NodeEventGenerator.applySelectors (/home/runner/work/pnpm/pnpm/node_modules/.pnpm/eslint@8.56.0/node_modules/eslint/lib/linter/node-event-generator.js:326:22) at NodeEventGenerator.enterNode (/home/runner/work/pnpm/pnpm/node_modules/.pnpm/eslint@8.56.0/node_modules/eslint/lib/linter/node-event-generator.js:340:14) at CodePathAnalyzer.enterNode (/home/runner/work/pnpm/pnpm/node_modules/.pnpm/eslint@8.56.0/node_modules/eslint/lib/linter/code-path-analysis/code-path-analyzer.js:803:23) at /home/runner/work/pnpm/pnpm/node_modules/.pnpm/eslint@8.56.0/node_modules/eslint/lib/linter/linter.js:1111:32 ``` * refactor: fix instance of no-floating-promises in calc-dep-state package ``` packages/calc-dep-state/src/index.ts 70:5 error An array of Promises may be unintentional. Consider handling the promises' fulfillment or rejection with Promise.all or similar, or explicitly marking the expression as ignored with the `void` operator @typescript-eslint/no-floating-promises ```
Before You File a Bug Report Please Confirm You Have Done The Following...
Playground Link
https://typescript-eslint.io/play/#ts=5.3.3&fileType=.tsx&code=PTAEEkDNQTwewK6gMZwLZoKYDsAuoBLbUSOAGzLgHciBzUOAJ1AEMATNu0AAxYGcUcbH1zdQuOKEaZcCRsQBuLMgkwNopOABpQAQQqEBAeQDSAWABQIcTAAOagGJxJAXlABtAEbOymFth0Ab1BKdjoALlBvcj9iAF8AXQBuS2tIBGxkXAIhEmcACgBKSKdJQNSwUCkZOWJ3SGU%2BTCCQuDDsWkiGsibQRIq%2By0t0zOzczSLQcosq6Vl5D26moNDODq7GzH6LOKGLVGF8D08WRhW2tc7WRNA3CcK9g5Eo25JNyyf8ZFelzA%2BhZ6rLhuFigAA%2BYJeEJQSSAA&eslintrc=N4KABGBEBOCuA2BTAzpAXGUEKQAIBcBPABxQGNoBLY-AWhXkoDt8B6Y6RAM0WlqYSNkAC1pkA9gEMkyMswDm6KL2jjokcGAC%2BILUA&tsconfig=N4KABGBEDGD2C2AHAlgGwKYCcDyiAuysAdgM6QBcYoEEkJemy0eFYDAruuGAL4g9A&tokens=false
Repro Code
ESLint Config
tsconfig
Expected Result
No lint and internal errors
Actual Result
Following internal error happened
Additional Info
No response
The text was updated successfully, but these errors were encountered: