Skip to content
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

Bug: hermes-eslint: no-unused-vars crashes in Flow libdefs with class declarations #1516

Open
reosarevok opened this issue Sep 12, 2024 · 0 comments
Labels
bug Something isn't working

Comments

@reosarevok
Copy link

Environment

Node version: v20.13.0
npm version: v10.5.2
Local ESLint version: v9.10.0 (Currently used)
Operating System: linux 5.15.0-119-generic
hermes-eslint version: v0.23.1

What did you do?

See minimal example at https://github.com/reosarevok/eslint-no-unused-vars-bug

What did you expect to happen?

Trying eslint 9 (while upgrading from 8) on our flow-typed codebase (using hermes-eslint), I was expecting no new issues.

What actually happened?

Oops! Something went wrong! :(

ESLint: 9.10.0

TypeError: Cannot read properties of undefined (reading 'some')
Occurred while linting /home/reosarevok/musicbrainz-server/flow-typed/npm/jed_v1.x.x.js:1
Rule: "no-unused-vars"
    at collectUnusedVariables (/home/reosarevok/musicbrainz-server/node_modules/eslint/lib/rules/no-unused-vars.js:751:71)
    at collectUnusedVariables (/home/reosarevok/musicbrainz-server/node_modules/eslint/lib/rules/no-unused-vars.js:829:17)
    at Program:exit (/home/reosarevok/musicbrainz-server/node_modules/eslint/lib/rules/no-unused-vars.js:841:36)
    at ruleErrorHandler (/home/reosarevok/musicbrainz-server/node_modules/eslint/lib/linter/linter.js:1083:48)
    at /home/reosarevok/musicbrainz-server/node_modules/eslint/lib/linter/safe-emitter.js:45:58
    at Array.forEach (<anonymous>)
    at Object.emit (/home/reosarevok/musicbrainz-server/node_modules/eslint/lib/linter/safe-emitter.js:45:38)
    at NodeEventGenerator.applySelector (/home/reosarevok/musicbrainz-server/node_modules/eslint/lib/linter/node-event-generator.js:297:26)
    at NodeEventGenerator.applySelectors (/home/reosarevok/musicbrainz-server/node_modules/eslint/lib/linter/node-event-generator.js:326:22)
    at NodeEventGenerator.leaveNode (/home/reosarevok/musicbrainz-server/node_modules/eslint/lib/linter/node-event-generator.js:348:14)

The issue was apparently added with eslint/eslint@1c173dc in eslint, but I reported it there (as eslint/eslint#18876) and they think it might be effectively an issue in the parser (eslint/eslint#18876 (comment)) so reporting it here too.

Link to Minimal Reproducible Example

https://github.com/reosarevok/eslint-no-unused-vars-bug

@reosarevok reosarevok added the bug Something isn't working label Sep 12, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant