Skip to content
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 simple Set/Map-initialized objects in no-array-prototype-extensions rule #1538

Merged

Conversation

bmish
Copy link
Member

@bmish bmish commented Jul 22, 2022

(partially) fixes #1537.

Copy link
Contributor

@gilest gilest left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Beauty

@bmish bmish changed the title Ignore Set/Map objects to reduce false positives in no-array-prototype-extensions rule Fix false positives with simple Set/Map-initialized objects in no-array-prototype-extensions rule Jul 23, 2022
@bmish bmish merged commit 2494212 into ember-cli:master Jul 23, 2022
@bmish bmish changed the title Fix false positives with simple Set/Map-initialized objects in no-array-prototype-extensions rule Fix false positive with simple Set/Map-initialized objects in no-array-prototype-extensions rule Jul 23, 2022
ef4 added a commit that referenced this pull request Aug 10, 2022
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
bmish added a commit that referenced this pull request Aug 18, 2022
…#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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Additional false positives with no-array-prototype-extensions rule
2 participants