-
Notifications
You must be signed in to change notification settings - Fork 2
Adjust trailing comma recommendation using RFC2119's terminology #14
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
base: main
Are you sure you want to change the base?
Conversation
|
LGTM - I think it might be worth mentioning why VSCode changed its stance. IIRC it's because they use the JSONC mode for some files whose parsers don't support trailing comments. I think |
|
Indeed, the main reason for warning against trailing commas was for the exact 2 files I mentioned above: microsoft/vscode#102061 (comment) There might be other reasons that were not expressed yet, so I don't want to write about the VS Code Team's motivation for the current behavior, but if people want to know they can find it. |
|
I would rather suggest a "should" than a "may", otherwise it feels pretty much like before in practice. (As you would probably expect me to suggest with my prior argument, that most user-facing uses of JSONC will have them enabled.) |
This seems a little unclear, since the second sentence doesn't use any of the RFC2119 terms. Perhaps it could be something like:
Reasoning: it seems like the |
Oh yeah sorry, I can't read apparently! |
Although I dunno if I would go this far because quite a few parsers still support comments but not trailing commas unfortunately. |
|
I'm sure there will always be some feature differences remaining, sadly, e.g. for comment styles too. |
|
|
The diff view seems confused so I can't see if anything else changed. I would be curious about the two points I brought up, and your thoughts on them. Sorry for taking up your time. |
@ell1e - Yeah, I expected that and it could be argued that a future version should take that stance, but it felt wrong going directly all the way to "SHOULD". Also, this wording is indeed close to what it was before, but at least it's less ambigous hopefully. This wording is basically what is currently applied in practice. If it can be demonstrated that the majority of parsers support trailing commas, then it could become an official recommendantion.
That's fair, I've adressed this issue in 840c623
@Timmmm - I'm only referring to parsers for theses 2 files in that case, not for all parsers.
@ell1e - What do you mean by comments styles? Is that something that should be specified in the spec you think? |
I just feel like the JSONC ecosystem is moving toward this trailing comma thing, and you know my conceptual points too. Edit: but I'm glad you expected my input 😊 and I agree the current wording is considerably more clear.
Pretty sure I've seen JSONC variants that support e.g. There's never going to be a point where all tools match the spec exactly, especially since there used not to be one. |
|
I guess the user just can't expect it, I brainfarted. |
Considering that:
tsconfig.jsonfiles officially support trailing commas (tsconfig.json actually supports trailing commas #12).eslintrc.jsonfiles are now depreciated.This spec needs to soften its position against trailing commas. Hence, a new wording is proposed using RFC2119's terminology.
New stance on trailing commas:
There is still something to be said about JSONC emitters, formatters and editors. This is only a first step and the other cases should be reflected on further.