Camelcase rule change for #9470
See original GitHub issueWhat rule do you want to change?
camelcase: fix quoted properties being ignored (#9470) but allow use of the old behavior through an option.
Does this change cause the rule to produce more or fewer warnings?
More.
How will the change be implemented? (New option, new default behavior, etc.)?
The default behavior will be to warn about non-camelcase quoted properties, and the previous behavior of ignoring quoted properties will be behind a new option, ignoreQuotedProperties
.
Please provide some example code that this change will affect:
var foo = {
barBaz: 1,
"qux_quux": 2
};
foo.camelCased = 10;
foo["snake_cased"] = 11;
What does the rule currently do for this code?
Currently, the camelcase rule emits no warnings for this code.
What will the rule do after it’s changed?
A warning will be produced for the "qux_quux"
and "snake_cased"
properties because they are not camelcase. If ignoreQuotedProperties
is enabled, the old behavior is retained and no warnings are produced.
Are you willing to submit a pull request to implement this change?
Yes, see #12777.
Issue Analytics
- State:
- Created 4 years ago
- Reactions:2
- Comments:7 (3 by maintainers)
Top GitHub Comments
I think the default value should be non-breaking
true
.The actual behavior of this rule may be an oversight, but it has some use cases (e.g., to quote names required by a third-party API), so it might be better to retain it for the start and maybe change the default later in another major version.
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.