Join GitHub today
GitHub is home to over 40 million developers working together to host and review code, manage projects, and build software together.
Sign upDisallow quotes around object literal property names that are not strictly required (quote-props) #791
Comments
feross
added
the
enhancement
label
Feb 21, 2017
This comment has been minimized.
This comment has been minimized.
|
NACK.
|
This comment has been minimized.
This comment has been minimized.
|
Me too, but it is messy for the eyes and we have autofix feature, so absolutely no problem. |
This comment has been minimized.
This comment has been minimized.
|
@tunnckoCore not true. If I have an object with 100 properties that has no quotes, then suddenly introduce What a mess that would be for any diff too. |
This comment has been minimized.
This comment has been minimized.
|
Kinda didn't thout for that case. But in any way
is some exotic case |
This comment has been minimized.
This comment has been minimized.
If we're using objects this much, even an object of 3-5 properties would feel like 100 properties. NACK. |
This comment has been minimized.
This comment has been minimized.
|
The intention of this rule is good, however I agree with @dcousens. Requoting unrelated keys due to adding a single property that needs quoting is not great.
I think we should avoid any rules while lean heavily on |
This comment has been minimized.
This comment has been minimized.
|
So, maybe I believe everyone should by default call standard with I even would suggest |
This comment has been minimized.
This comment has been minimized.
ghost
commented
Mar 22, 2017
|
|
This comment has been minimized.
This comment has been minimized.
|
@tunnckoCore I added a recommendation to use
This is correct. As cool as |
This comment has been minimized.
This comment has been minimized.
|
The ecosystem impact of this is 7.5%.
However, this is mitigated by the fact that the rule is fixable. Most of the failing cases are places where folks were consistently using quoted props, even though they're not needed. Like this: var yargKeys = {
'boolean': { transform: null, error: null },
'count': { transform: null, error: null },
'string': { transform: null, error: null },
'array': { transform: null, error: null },
'required': { transform: null, error: null },
'default:': { transform: null, error: null },
'choices:': { transform: null, error: null },
}We could try enabling this in a future beta version, so I'll leave this open for now. |
feross
added this to the
standard v11 milestone
Apr 4, 2017
feross
changed the title
Proposal: Consistent quote props
Disallow quotes around object literal property names that are not strictly required (quote-props)
Apr 4, 2017
This comment has been minimized.
This comment has been minimized.
jaridmargolin
commented
Jun 30, 2018
|
Prettier implements I prefer
I would prefer standard does not take a stance on this. I philosophically believe in what standardjs is doing in order avoid bikeshedding (or at least move it to a single repo |
This comment has been minimized.
This comment has been minimized.
jaridmargolin
commented
Jun 30, 2018
|
One additional note: Prettier is considering "Consistently add quotes to object keys" for v2.0. I would assume this change is due to overwhelming community feedback (although my assumption is probably based on my bias): With the following comment coming from @vjeux who appears to want to adjust this rule regardless of a v2.0 release:
|
feross
modified the milestones:
standard v12,
standard v13
Aug 28, 2018
This comment has been minimized.
This comment has been minimized.
|
|
This comment has been minimized.
This comment has been minimized.
|
I think we should go ahead with the following rule in
Ecosystem breakage is only 4%. |

tunnckoCore commentedFeb 21, 2017
•
edited
Digging more and more in ESLint rules, i found some good ones which enforces good style and more readable code. This issue is for quote-props rule - fixable.
Suggested configuration.
{ "quote-props": ["error", "consistent-as-needed", { "keywords": true }] }Invalid
Valid