Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork2.8k
feat(jsx-key): check for array related method calls with jsx elements/fragments#3938
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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
base:master
Are you sure you want to change the base?
Uh oh!
There was an error while loading.Please reload this page.
Conversation
I'm not sure it's a good idea to assume any method named "push" or "splice" is happening on an array, unless it's a TS codebase. |
That was kinda my thinking too but I'm unsure how much better we can do without types. I thought about trying to trace the symbol we are pushing to and see if it is a array declaration but that feels very much like a hack. On the other hand I'd assume Question it if it is rare enough to proceed with this vague targetting strategy? I did some rough searching viahttps://github.com/search?type=code&q=%28path%3A*.tsx+OR+path%3A*.jsx%29+%2F.%2B%5C.push%5C%28%3C.%2B%5C%29%3B%2F and found nothing that stands out, had to vary the search query a fair bit since github code search seems to limit results to 100 for some reason. |
Adding this change under an option is smart if it has a nonzero risk of false positives, though. |
I'll add an option then, and also fix the failing tests for legacy versions (I really wish those get pruned 😢 ). |
WIP, pending initial feedback, slightly worried this check may be overly broad.
Things to add:
Fixes#3937