destructuring-assignment is too greedy. Should only apply within components.
See original GitHub issueI 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 of props
: https://github.com/milesj/shapeshifter/commit/52e33fed6c5386f80ffffa3a270e6d6fd9997b05#diff-392ca8d88bc7e496ea34c73c8cc8258c
Had to disable this line because it thought context
was React related: https://github.com/milesj/boost/blob/master/tests/Routine.test.js#L825
And all of these errors when pulled into another project. None of which is React.
/Users/Miles/Sites/beemo/packages/core/src/Beemo.ts
188:23 error Must use destructuring context assignment react/destructuring-assignment
221:73 error Must use destructuring context assignment react/destructuring-assignment
244:41 error Must use destructuring context assignment react/destructuring-assignment
/Users/Miles/Sites/beemo/packages/core/src/CleanupRoutine.ts
25:7 error Must use destructuring context assignment react/destructuring-assignment
/Users/Miles/Sites/beemo/packages/core/src/configure/CreateConfigRoutine.ts
49:34 error Must use destructuring context assignment react/destructuring-assignment
55:5 error Must use destructuring context assignment react/destructuring-assignment
124:21 error Must use destructuring context assignment react/destructuring-assignment
124:46 error Must use destructuring context assignment react/destructuring-assignment
/Users/Miles/Sites/beemo/packages/core/src/driver/RunCommandRoutine.ts
43:26 error Must use destructuring context assignment react/destructuring-assignment
73:5 error Must use destructuring context assignment react/destructuring-assignment
214:24 error Must use destructuring context assignment react/destructuring-assignment
215:25 error Must use destructuring context assignment react/destructuring-assignment
241:11 error Must use destructuring context assignment react/destructuring-assignment
268:20 error Must use destructuring context assignment react/destructuring-assignment
269:47 error Must use destructuring context assignment react/destructuring-assignment
/Users/Miles/Sites/beemo/packages/core/src/ExecuteScriptRoutine.ts
25:32 error Must use destructuring context assignment react/destructuring-assignment
/Users/Miles/Sites/beemo/packages/core/src/SyncDotfilesRoutine.ts
36:32 error Must use destructuring context assignment react/destructuring-assignment
I see that you’re checking for a component, but perhaps TS is conflicting.
Issue Analytics
- State:
- Created 5 years ago
- Comments:6 (3 by maintainers)
Top Results From Across the Web
destructuring-assignment is too greedy. Should only apply ...
I enabled this rule and immediately ran into issues within files that aren't React related, nor do they look like a component.
Read more >Destructuring of Props in ReactJS - GeeksforGeeks
Destructuring is a characteristic of JavaScript, It is used to take out sections of data from an array or objects, We can assign...
Read more >Destructuring assignment - JavaScript - MDN Web Docs
The destructuring assignment syntax is a JavaScript expression that makes it possible to unpack values from arrays, or properties from ...
Read more >Destructuring Assignment In JavaScript - W3docs
This chapter is dedicated to exploring the destructuring assignment - a unique syntax that helps to unpack objects or arrays into a group...
Read more >ReactJS Tutorial - 12 - Destructuring props and state - YouTube
ReactJS Tutorial - 13 - Event Handling · Why Is Array/Object Destructuring So Useful And How To Use It · React Hooks Tutorial...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
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…
react/destructuring-assignment
I’ll try and double check JS only files, will be a bit tough.