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

camelcase rule should ignore global variables by default #11716

Closed
hrax opened this issue May 14, 2019 · 3 comments
Closed

camelcase rule should ignore global variables by default #11716

hrax opened this issue May 14, 2019 · 3 comments
Labels
archived due to age This issue has been archived; please open a new issue for any further discussion auto closed The bot closed this issue enhancement This change enhances an existing feature of ESLint evaluating The team will evaluate this issue to decide whether it meets the criteria for inclusion rule Relates to ESLint's core rules

Comments

@hrax
Copy link

hrax commented May 14, 2019

What rule do you want to change?
camelcase

Does this change cause the rule to produce more or fewer warnings?
Change should produce fewer warnings

How will the change be implemented? (New option, new default behavior, etc.)?
Change should be implemented as a new default behavior.

Please provide some example code that this change will affect:

/* globals g_form */
g_form.setValue("field", "value");

What does the rule currently do for this code?
Produces an error "Identifier 'g_form' is not in camel case." unless the variable is set as exception in camelcase rule allow property.

What will the rule do after it's changed?
In case the defined global variable is not present for the script, setting the variable as an exception in the camelcase rule would allow the developer to set said variable in the script and therefore avoid checks for camelcase. This is even more potentially harmful if you set up these variables as a regular expression.

Are you willing to submit a pull request to implement this change?
Not at the moment.

@hrax hrax added enhancement This change enhances an existing feature of ESLint rule Relates to ESLint's core rules triage An ESLint team member will look at this issue soon labels May 14, 2019
@platinumazure
Copy link
Member

Hi @hrax, thanks for the issue.

I could support a new option for this, but not a default behavior change.

@platinumazure platinumazure added evaluating The team will evaluate this issue to decide whether it meets the criteria for inclusion and removed triage An ESLint team member will look at this issue soon labels May 14, 2019
@hrax
Copy link
Author

hrax commented May 14, 2019

Hi @platinumazure, thank you for the reply.
New option sounds great as well.

@eslint-deprecated eslint-deprecated bot added the auto closed The bot closed this issue label Jun 14, 2019
@eslint-deprecated
Copy link

Unfortunately, it looks like there wasn't enough interest from the team
or community to implement this change. While we wish we'd be able to
accommodate everyone's requests, we do need to prioritize. We've found
that issues failing to reach accepted status after 21 days tend to
never be accepted, and as such, we close those issues.
This doesn't mean the idea isn't interesting or useful, just that it's
not something the team can commit to.

Thanks for contributing to ESLint and we appreciate your understanding.

@eslint-deprecated eslint-deprecated bot locked and limited conversation to collaborators Dec 12, 2019
@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 Dec 12, 2019
kaicataldo pushed a commit that referenced this issue Jun 26, 2020
…12782)

* Update: Add option "ignoreGlobals" to camelcase rule (fixes 11716)

* Change reference check to look for global variable

* Fix behavior for global references and add tests

* Add more valid tests to camelcase rule

* Add more invalid tests for camelcase rule

* Don't ignore non-camelcase global variable used as object key

* Corrections to camelcase documentation
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
archived due to age This issue has been archived; please open a new issue for any further discussion auto closed The bot closed this issue enhancement This change enhances an existing feature of ESLint evaluating The team will evaluate this issue to decide whether it meets the criteria for inclusion rule Relates to ESLint's core rules
Projects
None yet
Development

No branches or pull requests

2 participants