Skip to content
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

Allow trailing commas and comments in biome.json config file JSON schema #5278

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

mayfieldiv
Copy link

Summary

When using trailing commas or comments in the biome.json/biome.jsonc files in VS Code, warnings/errors are shown in the editor and Problems pane.

biome.json biome.jsonc
image image

Apparently, these warnings/errors can be controlled by using custom VS Code JSON schema extension fields allowTrailingComma and allowComments, seen here: https://github.com/microsoft/vscode/blob/201df9b990f871fad842dc9a6211bfa84c663e53/src/vs/base/common/jsonSchema.ts#L89

A solution suggested by a VS Code maintainer that seems to work is to use those custom fields in JSON schemas that declare they support trailing commas and comments.

VS Code does internally for its settings.json files, etc. and it would be nice if biome declared them as allowed since the biome tool allows them when parsing its JSON config file.

@ematipico
Copy link
Member

since the biome tool allows them when parsing its JSON config file.

Technically, it's not correct. When parsing biome.json, comments and trailing commas aren't allowed.

I'm not sure we can accept the PR as it is because the file you modified is auto-generated, so your changes will be gone next time we modify the configuration.

You'll have to change the Rust Code that generates the schema.

@mayfieldiv
Copy link
Author

Technically, it's not correct. When parsing biome.json, comments and trailing commas aren't allowed.

Ohh, okay I guess I was only actually testing with biome.jsonc and it was allowing trailing commas and comments. My mistake.

Would comments (and possibly trailing commas) be something you'd be interested in allowing for biome.json files? Comments are especially useful in configuration files -- I suppose that's why biome supports biome.jsonc files in the first place.

I guess the reason I started look at this is just that biome supports parsing/enforcing trailing commas in JSON files, but when I try to use them in biome.jsonc, VS Code complains because of the schema.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants