-
-
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
[New] 'destructuring-assigment' : add 'useContext' rule in SFC #2787
[New] 'destructuring-assigment' : add 'useContext' rule in SFC #2787
Conversation
}, { | ||
code: `const MyComponent = (props, { color }) => ( | ||
<div id={props.id} className={props.className} /> | ||
);`, | ||
options: ['never'], | ||
errors: [ | ||
{message: 'Must never use destructuring context assignment in SFC argument'} | ||
] |
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.
why is this test changed? this implies it's a breaking change.
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.
i think that case is legacy context assignment which is not used in current react version.
sorry for change without any comments.
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.
This plugin supports all react versions; nothing can be removed.
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.
i'm sorry. actually i want to ask about that. my mistake. then should I edit and make new PR?
plus, const destructuringContext = node.params && node.params[1] && node.params[1].type === 'ObjectPattern';
should be added in function handleStatelessComponent(node)
right?
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.
@ljharb
i did revive test cases which i deleted and rules associated. please check again
a2e350c
to
635c617
Compare
59af733
to
865ed16
Compare
069314a
to
181c68f
Compare
resolve issue #2309
delete rule about variable happens to be named
context
set rule on
useContext
withoptions: always
andoptions: never
contextSet
to detect any renamed variable that is being assigned byuseContext