-
-
Notifications
You must be signed in to change notification settings - Fork 2.8k
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
[Fix] destructuring-assignment
: remove useContext
destructuring check
#3583
Conversation
Codecov Report
@@ Coverage Diff @@
## master #3583 +/- ##
==========================================
- Coverage 97.62% 97.61% -0.01%
==========================================
Files 132 132
Lines 9295 9280 -15
Branches 3400 3391 -9
==========================================
- Hits 9074 9059 -15
Misses 221 221
|
I'm not sure we need an option - since the return value of |
This will basically reduce the changes to reverting #2797, if I understand it correctly (and I’m absolutely ok with this option, can update the PR shortly) |
ah, hmm. cc @Zinyon - what are your thoughts here? |
We can also make the option to do the opposite — ignore by default, but allow users to enable the |
Hi @ljharb, @Zinyon, do you have any thoughts on the further steps? |
@Zinyon it seems like that since useContext can be any kind of value, that it's simply incorrect to force destructuring of it. |
@ljharb i agree on second thought. seems better to remove logic for reporting about destruturing |
…Context in SFC" - [Tests] `destructuring-assignment`: Add more modern context cases This reverts commit 523db20 / jsx-eslint#2797 Fixes jsx-eslint#3536.
destructuring-assignment
: add ignoreUseContext
optiondestructuring-assignment
: remove useContext
destructuring checks
destructuring-assignment
: remove useContext
destructuring checksdestructuring-assignment
: remove useContext
destructuring check
@ljharb, @Zinyon, the |
@102 thanks for your work ! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks!
It seems that the use of modern context is forced to use the destructuring assignment after #2797; the problem was raised in #3536.
This PR introduces additional flag that won't affect the existing behavior when it is unset, but will allow users to upgrade the lib version without having this rule disabled.The approach was reviewed and now it consists of the following:
destructuring-assignment
: Handle destructuring of useContext in SFC #2797 changes were reverteduseContext
could now be used both with destructuring and without itFixes #3536