-
-
Notifications
You must be signed in to change notification settings - Fork 2.8k
Regression for react-hooks
- Cannot read property 'parent' of null
#2513
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
This is because the plugin makes assumptions about the variables declared. There are issues such as facebook/react#19742 tracking this. Suggest filing an issue for them if you think that issue doesn't cover it. |
FWIW it lints fine using |
v4.1.0 added JSX as a first-class citizen of the scope analyser (because it's a first-class citizen of TS). This is likely why the new version has caused an issue. |
It only happens if one Regardless, I can open an issue over there (tomorrow, getting late here 🙂) |
I think that it's because you're declaring It's really hard for me to even glance at this as they bundle their tooling ( If someone can investigate and create a small, isolated repro - then I'd be happy to look into this. |
As far as I got was here: https://www.runpkg.com/?eslint-plugin-react-hooks@4.1.0/cjs/eslint-plugin-react-hooks.development.js#1193 - From debugging, the difference is that with the default espree parse we get (when first entering
whilst with the ts-eslint parser we get
and it fails when it looks at reference within the child scope for whatever reason. What's correct here I have no idea 😅 |
Repro
Expected Result
It should not throw an error
Actual Result
Additional Info
@typescript-eslint/parser@3.10.1
does not throw an errorVersions
@typescript-eslint/parser
4.1.0
TypeScript
4.0.2
ESLint
7.8.1
node
12.18.1
eslint-plugin-react-hooks
4.1.0
The text was updated successfully, but these errors were encountered: