Can quote-props: as-needed respect camelCase with properties: always?
See original GitHub issueWhat rule do you want to change? quote-props dot-notation
Does this change cause the rule to produce more or fewer warnings? Fewer
How will the change be implemented? (New option, new default behavior, etc.)? Preferably new default. If we have
"camelcase": ["error", {
"properties": "always"
}],
Then quote-props as-needed should make it okay and in fact force you to quote non camel case properties.
Please provide some example code that this change will affect:
const whatever = {
id: 123,
snake_case_word: "test"
};
What does the rule currently do for this code? Allows it, and if you put quotes rules on it complains the quotes are not required, even though it is not a valid property name if you have camelcase checking properties. Essentially you have to turn off one of these rules which is a bad compromise.
What will the rule do after it’s changed? Allow you to have both camelCase properties rule and as-needed quote props work to enforce quotes on snake_case non camelCase propertis IF camelCase is on and properties is on.
Are you willing to submit a pull request to implement this change? Maybe
Issue Analytics
- State:
- Created 4 years ago
- Comments:5 (3 by maintainers)
Top GitHub Comments
@csciubbach thanks for the issue!
Rules are, by design, unaware of other rules’ configuration, so this would have to be an additional option in the
quote-props
rule.As @anikethsaha mentioned, allowPattern in
dot-notation
is particularly designed for this use case.A similar option in
quote-props
seems reasonable to me 👍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.