-
-
Notifications
You must be signed in to change notification settings - Fork 11
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
Dangling commas in JSONC #135
Comments
Updated lint config, and fixed a few spurious lint issues, particularly with trailing commas in JSONC. See: humanwhocodes/momoa#135 This moved us to eleventy@3.0.0. I tested with their update tooling, which got me to include their info in a meta generator tag, and made me notice that the README.md file needed to be ignored.
I hadn't realized this, but it appears you are correct: I'll take a look at adding this. |
Are you likely to want to make it an option, or just always accept trailing commas? I'd prefer always-accept, or for the option to default to always-accept, so that I don't have to ask @eslint/json for extra work. I would understand the opposite preference, however. |
I think always on is the right choice as that is probably what most people expect. |
Actually, it looks like the default is to not allow trailing commas. 🤔 I tested this in VS Code by switching a normal JSON file to JSONC and it flagged the trailing comma as a problem. So, I think I should match that behavior and have an option that is disabled by default. |
Tell us about your environment
Momoa Version:
3.2.2
Node Version:
v22.9.0
npm Version:
10.9.0
Which function(s) is causing a problem?
[ ]
interpret()
[ ]
iterator()
[ ]
parse()
[x]
print()
[ ]
traverse()
[ ]
tokenize()
Example JSON code that demonstrates the problem:
What did you do?
What did you expect to happen?
(with end positions slightly different. I just parsed without the trailing comma.)
What actually happened?
What do you think the solution is?
JSONC doesn't have a formal definition that I could find, but the one that @eslint/json points to is Microsoft's implementation. Both typescript and vscode accept trailing commas in their config files, so I believe
allowTrailingComma
should at least be an option for jsonc mode.The text was updated successfully, but these errors were encountered: