question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Can quote-props: as-needed respect camelCase with properties: always?

See original GitHub issue

What 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:closed
  • Created 4 years ago
  • Comments:5 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
mdjermanoviccommented, Mar 17, 2020

@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 👍

0reactions
eslint-deprecated[bot]commented, Apr 18, 2020

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.

Read more comments on GitHub >

github_iconTop Results From Across the Web

quote-props - ESLint - Pluggable JavaScript Linter
"always" (default) requires quotes around all object literal property names; "as-needed" disallows quotes around object literal property names that are not ...
Read more >
How to force Prettier to use always quote props (and respect ...
Unfortunately Prettier has no always but as-needed|preserve|consistent for quote-props . So the result is always that it removes my quote props ...
Read more >
eslint-config-eslint | Yarn - Package Manager
Contains the ESLint configuration used for projects maintained by the ESLint team. Installation. You can install ESLint using npm: npm install eslint --save-dev....
Read more >
_ field names, CamelCase Properties??? - Unity Forum
Of course it does. The Unity coding convention is that classes and methods are UpperCase, variables and properties are lowerCase.
Read more >
Code Issues - Embold Help Center
This rule counts the number of unique attributes, local variables, and return types within an object. A number higher than the specified threshold...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found