-
-
Notifications
You must be signed in to change notification settings - Fork 204
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 false positive with Set/Map-initialized *public* class properties in no-array-prototype-extensions
rule
#1543
Fix false positive with Set/Map-initialized *public* class properties in no-array-prototype-extensions
rule
#1543
Conversation
9eb696a
to
224b18a
Compare
Thanks for staging this @bmish 🙇🏻♂️ I'm not familiar with the implementation but the test cases look thorough! I tried running it for you by installing it in Unfortunately export default class FileDropzoneComponent extends Component<FileDropzoneArgs> { Perhaps we should add spec examples covering classes with TypeScript syntax? Or have I run ESLint wrong somehow?
Let me know if I can help with more reproductions. |
224b18a
to
6cf5850
Compare
…rray-prototype-extensions rule
6cf5850
to
71f5cc5
Compare
@gilest thanks so much for testing this! I fixed the bug with the value-less property definition that was causing a crash for you. I also added some basic TypeScript test cases. After this PR, there should only be one remaining issue, which is handling private identifiers as I mentioned in #1537 (comment). I'll work on that next. |
no-array-prototype-extensions
ruleno-array-prototype-extensions
rule
no-array-prototype-extensions
ruleno-array-prototype-extensions
rule
The `no-array-prototype-extensions` rule is trying to do an impossible thing. It's going to produce a never-ending stream of false positives. You cannot statically tell which calls are actually relying on the array prototype extensions. A correct implementation is probably possible, but only in typescript (where eslint rules can take advantage of type information), not in javascript. I'm all in favor of pushing people away from using array prototype extensions, but that is going to require runtime implementation. It cannot be checked statically. A rule that is so often wrong will just encourage people not to trust it anyway. I don't think it should be in the recommended set. Examples: #1561 #1552 #1547 #1546 #1544 #1543 #1538 #1539 #1536
…#1562) * Remove no-array-prototype-extensions from recommended The `no-array-prototype-extensions` rule is trying to do an impossible thing. It's going to produce a never-ending stream of false positives. You cannot statically tell which calls are actually relying on the array prototype extensions. A correct implementation is probably possible, but only in typescript (where eslint rules can take advantage of type information), not in javascript. I'm all in favor of pushing people away from using array prototype extensions, but that is going to require runtime implementation. It cannot be checked statically. A rule that is so often wrong will just encourage people not to trust it anyway. I don't think it should be in the recommended set. Examples: #1561 #1552 #1547 #1546 #1544 #1543 #1538 #1539 #1536 * docs: mentioned recommend rule removal in changelog * docs: explain why no-array-prototype-extensions is not in recommended config Co-authored-by: Bryan Mishkin <698306+bmish@users.noreply.github.com>
Partially fixes #1537.
CC: @gilest @smilland