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

False positives for prototype methods #29

Closed
robatwilliams opened this issue Mar 18, 2021 · 11 comments
Closed

False positives for prototype methods #29

robatwilliams opened this issue Mar 18, 2021 · 11 comments
Labels
enhancement New feature or request wontfix This will not be worked on

Comments

@robatwilliams
Copy link
Owner

Some features are detected with a chance of false positives - https://github.com/robatwilliams/es-compat/blob/master/packages/eslint-plugin-ecmascript-compat/lib/features/es-versions.md

This will happen all the time if you're using e.g. lodash, or a library that tests for feature presence before using it.

There should be a way of ignoring these, and only report problems that we have full confidence in.

@robatwilliams robatwilliams added the enhancement New feature or request label Mar 18, 2021
@robatwilliams
Copy link
Owner Author

There should be a new optional option detectPrototypeMethods (detect-prototype-methods on the CLI), which when set to false ignores those rules. Document it in the readmes under the packages folder.

The option should be passed into forbiddenFeatures() in compatibility.js, and used to filter out rules. Rule objects in the features folder should have a new optional property isPrototypeMethod: true to identify them.

@robatwilliams
Copy link
Owner Author

If you're working around this by parsing the error messages to decide what to ignore, the correct way (i.e. without also ignoring definite real problems) is to look for .prototype. in the message.

@robatwilliams
Copy link
Owner Author

@robatwilliams
Copy link
Owner Author

robatwilliams commented Jan 14, 2022

Solution will probably be:

  1. use the es plugin rules
  2. let the parent project specify aggressive (or not) in its own eslintrc
  3. option on the CLI tool

Need to wait for aggressive mode to be released.

@robatwilliams robatwilliams added the blocked This cannot be worked on until something external happens label Jan 14, 2022
@robatwilliams
Copy link
Owner Author

robatwilliams commented Jan 21, 2022

If you're working around this by parsing the error messages to decide what to ignore, the correct way (i.e. without also ignoring definite real problems) is to look for .prototype. in the message.

Recommend that you do each prototype method individually and make sure you have a polyfill in place for each one. See #2

@robatwilliams
Copy link
Owner Author

Note this about es plugin aggressive mode:

If using this plugin and TypeScript, this plugin reports prototype methods by default because we can easily know types.

@robatwilliams
Copy link
Owner Author

Unblocked by #56

@robatwilliams robatwilliams removed the blocked This cannot be worked on until something external happens label May 3, 2023
@robatwilliams
Copy link
Owner Author

Readme would need updating, including footnotes.

Also features/es-versions.md

@robatwilliams
Copy link
Owner Author

Used aggressive mode for es2022 .at() - need to align that with whatever solution is for this issue

@robatwilliams
Copy link
Owner Author

These prototype methods have quite distinct names, which developers would normally strive to avoid using for their own methods. So I don't think this is important.

This issue has been open for 2 years and received no comments or thumbs up, which also suggests it's not important.

If you use lodash, add a polyfills entry to silence the false alarms.

Feel free to comment if you read this and want this feature.

@robatwilliams robatwilliams closed this as not planned Won't fix, can't repro, duplicate, stale May 11, 2023
@robatwilliams robatwilliams added the wontfix This will not be worked on label May 11, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request wontfix This will not be worked on
Projects
None yet
Development

No branches or pull requests

1 participant