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

Add explicit exceptions to no-extend-native and no-native-reassign #2355

Closed
ljharb opened this issue Apr 22, 2015 · 8 comments
Closed

Add explicit exceptions to no-extend-native and no-native-reassign #2355

ljharb opened this issue Apr 22, 2015 · 8 comments
Labels
accepted There is consensus among the team that this change meets the criteria for inclusion archived due to age This issue has been archived; please open a new issue for any further discussion enhancement This change enhances an existing feature of ESLint rule Relates to ESLint's core rules

Comments

@ljharb
Copy link
Sponsor Contributor

ljharb commented Apr 22, 2015

I can certainly disable these rules when desired, but I'd prefer to enable the rule, and supply explicit exceptions. A specific example: in https://github.com/es-shims/RegExp.prototype.flags , I'd like to allow no-extend-native of RegExp.prototype only.

Is this something you'd be open to adding?

@doberkofler
Copy link
Contributor

I had the same problem and did disable the rule for each individual exception. The ability to specify explicit exception would be a helpful addition.

@ilyavolodin ilyavolodin added the triage An ESLint team member will look at this issue soon label Apr 22, 2015
@nzakas
Copy link
Member

nzakas commented Apr 22, 2015

Possibly, do you have an idea about how it should be implemented? What would you expect to specify as exceptions?

@doberkofler
Copy link
Contributor

I imagined that the rule could offer an array of object names that are allowed to have their prototypes modified.

@ljharb
Copy link
Sponsor Contributor Author

ljharb commented Apr 22, 2015

Exactly that - like capIsNewExceptions, an array of values that are allowed. So [2, { "exceptions": ["RegExp.prototype"] }] would allow my RegExp#flags polyfill to modify RegExp.prototype.

@doberkofler
Copy link
Contributor

What about only using the object name? [2, {"exceptions": ["RegExp", "Array"]}]

@ljharb
Copy link
Sponsor Contributor Author

ljharb commented Apr 22, 2015

That would be fine too, since it appears the rule only covers .prototype modifications.

@nzakas
Copy link
Member

nzakas commented Apr 23, 2015

Yeah, I think just the constructor name makes the most sense.

@nzakas nzakas added enhancement This change enhances an existing feature of ESLint rule Relates to ESLint's core rules accepted There is consensus among the team that this change meets the criteria for inclusion and removed triage An ESLint team member will look at this issue soon labels Apr 23, 2015
@nzakas nzakas closed this as completed in 8257b4f Apr 27, 2015
@ljharb
Copy link
Sponsor Contributor Author

ljharb commented Apr 27, 2015

Thanks!

@eslint-deprecated eslint-deprecated bot locked and limited conversation to collaborators Feb 7, 2018
@eslint-deprecated eslint-deprecated bot added the archived due to age This issue has been archived; please open a new issue for any further discussion label Feb 7, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
accepted There is consensus among the team that this change meets the criteria for inclusion archived due to age This issue has been archived; please open a new issue for any further discussion enhancement This change enhances an existing feature of ESLint rule Relates to ESLint's core rules
Projects
None yet
Development

No branches or pull requests

4 participants