-
Notifications
You must be signed in to change notification settings - Fork 47.2k
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
Update eslint rule exhaustive deps to use new suggestions feature #17385
Update eslint rule exhaustive deps to use new suggestions feature #17385
Conversation
This pull request is automatically built and testable in CodeSandbox. To see build info of the built libraries, click here or the icon next to each commit SHA. Latest deployment of this branch, based on commit b496ed7:
|
Details of bundled changes.Comparing: 8e74a31...b496ed7 eslint-plugin-react-hooks
Size changes (stable) |
Details of bundled changes.Comparing: 8e74a31...b496ed7 eslint-plugin-react-hooks
Size changes (experimental) |
Nice! Please ping this PR when it lands. |
Suggestions have been merged. Waiting on a release now. |
Suggestions released in 6.7.0 |
What happens if you have older ESLint? Do we just lose the suggestions? Should we only fix this forward? |
I was assuming that we would bump the major version of this package and possibly set the peer dependency of eslint to I don't think we'd want to try to support both suggestions and the autofixer at the same time based on something like the eslint version because then the functionality would unexpectedly change when someone updated their version of eslint. Also, I don't think we want to support the autofix option going forward as it is ultimately unsafe. I personally think it would be better to have no fixes for folks that happen to have an older version of eslint. For example, at my company, I enabled the |
Just tried this with VS Code and couldn't get suggestions to show up. Does it mean extensions need to be updated? |
Yes. I have opened this issue for the vscode extension |
We probably shouldn’t merge until mainstream extensions catch up. |
Is there any chance we could release a beta prerelease with the suggestions feature while we wait for extensions to catch up? |
For reference, I'm hoping that this |
I’d feel comfortable releasing after VSCode plugin update is live. Can you check if there’s anything holding it back on that end? |
Can you test that the rule works as expected with this release? microsoft/vscode-eslint#814 (comment) |
This PR is published as |
Works in my testing. |
|
This is great work. Thank you for doing it. |
My pleasure. It looks good on my end as well. Glad it finally got out. |
I prefered the rule with autofix working. Would it be possible to add an option to make it autofixable again? |
Thing is, that is a common rule of eslint, that it does not change the code in regards of how it works. Which it in fact did with the autofix of the dependencies, expecially with useeffect. Altough a opt-in option for readding autofix could work, there is still the question if it SHOULD be there at all. The update of the extension is already on the way, you can install it using @next . Regular version should be updated on the weekend as there corresponding thread of the vscode extension suggests. |
This pull request closes #16313
Assuming that eslint/eslint#12384 moves forward and adds the suggestions feature to
eslint
, this pull request updates thereact-hooks/exhaustive-deps
eslint
rule to use the suggestions feature. This will result in the rule no-longer modifying code functionality when runningeslint
's autofixer while providing a new method to explicitly accept code suggestions for the rule.For more details see: #16313