-
-
Notifications
You must be signed in to change notification settings - Fork 2.8k
destructuring-assignment is too greedy. Should only apply within components. #1800
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
It’s possible that our component detection breaks with the TypeScript parser. Do the errors still occur if the files are converted to regular JS? |
I also see that this only seems to complain about context; so maybe there’s a specific bug around that facet of the rule. |
I'll try and double check JS only files, will be a bit tough. |
Every single file in my project is now errors - no react imported or used anywhere close. Seems you guys just look for any variable calls "props" or "context" and expect you're in a react component... export default (context: $Context) => ({
extensions: ['.js', '.jsx', '.json'],
modules: [
/**
* Resolve imports throughout the application in this order.
* This allows us to import various parts of the application
* easier for better organization.
*
* Modules always resolve top-down.
*/
context.dirs.view(),
path.join(context.dirs.src(), 'libraries'),
'shared',
'node_modules',
],
});
|
@bradennapier that's a separate issue (and definitely a bug) - can you file that as a separate issue? |
Maybe this temporary solution works. add following line in "rules" of .eslintrc.js
but It may also occur again with some other eslint-plugin-react rules later, in .js file. |
I enabled this rule and immediately ran into issues within files that aren't React related, nor do they look like a component. For example:
I had to rename these to
properties
instead ofprops
: milesj/shapeshifter@52e33fe#diff-392ca8d88bc7e496ea34c73c8cc8258cHad to disable this line because it thought
context
was React related: https://github.com/milesj/boost/blob/master/tests/Routine.test.js#L825And all of these errors when pulled into another project. None of which is React.
I see that you're checking for a component, but perhaps TS is conflicting.
The text was updated successfully, but these errors were encountered: