Comments (9)
This chart on NPM shows an higher use of JSON5 parser:
https://npmtrends.com/hjson-vs-json5-vs-jsonc-parser-vs-relaxed-json
It is really easy to support JSONC in an existing JSON parser, because all you have to do is comments and trailing comma handling. So it is not surprising that few people use the jsonc parser directly. I was not aware of its existence.
How do you measure the popularity of JSON5 vs JSONC?
Mostly of experience.
Most of the configurations I am aware of use JSONC (tsconfig.json
, vscode configurations, ...).
If I search for all files using jsonc
on GitHub extension I found 32k files. However, this doesn't take JSONC files using .json
extensions such as tsconfig.json
(930k files), vscode configs (31k files), and so on.
With a pessimistic measure we are already to more than 1M files using JSONC on GitHub.
33k files use the JSON5 extension.
Chromium uses JSON5 for internal configs
If I remember correctly, the creator of JSON5 is from Google? That's not surprising that some of their project use JSON5.
from biome.
I'd also like to put in a word for supporting JSON5 and ideally recommending it over JSONC if you have a choice between the two. There are a few good reasons mentioned in microsoft/vscode#100688 (comment) but the main one is:
There is no standard of JSONC, just conventions. However, JSON5 is a format with spec.
JSONC is a bit of a liability as a result: feature set/compatibility/conformance/security/etc.
Since JSONC support is new for Biome, it's possible to make a more future-proof choice.
from biome.
If you're interested, you can try creating a parser using our infrastructure, and we can evaluate its inclusion.
JSON5 is outside our roadmap and interests, so I don't think we have the capacity to help you.
from biome.
The terse syntax of biome.json5
would be nice as well.
.jsonc
is also great anyway, thanks!
from biome.
The terse syntax of
biome.json5
would be nice as well.
.jsonc
is also great anyway, thanks!
Unfortunately Biome doesn't support the json5
file extensios. Do you know if they have differences in their grammar?
from biome.
There are many differences. For example JSON5 allows unquoted properties, single quoted strings, hexadecimal numbers, NaN, Infinity constants, ...
There are many competing standards out there to make JSON more convenient: JSON5, JSON6, HJSON. They don't seem to be as widespread as JSONC.
from biome.
How do you measure the popularity of JSON5 vs JSONC?
This chart on NPM shows an higher use of JSON5 parser:
https://npmtrends.com/hjson-vs-json5-vs-jsonc-parser-vs-relaxed-json
Also:
Chromium uses JSON5 for internal configs, e.g. runtime_enabled_features.json5.
Craft elaborately sequenced animation timelines using ProStyle. Write your stories in a declarative JSON5 syntax and ProStyle will generate the web content and scripts that animate it. (examples)
A web-based JSON-to-CSV converter. The application is open source, and conversion is performed in the browser and data is never uploaded to a server.
WebStorm natively supports JSON5.
Taken from https://github.com/json5/json5/wiki/In-The-Wild#apps
Since both JSONC and JSON5 have valid JS syntax, hence Biome knows it, I wish they could be both supported.
from biome.
Came here looking for this issue before opening one of my own.
I'd imagine that implementing a linter/formatter for JSONC
(json w/ comments) would be significantly easier than an implementation for JSON5
, JSON6
, and HJSON
due to the numerous additions in each format. I'd also imagine that extending this further to YAML 1.2
(a strict-superset of JSON
) and Google's DSL jsonnet
would be out of scope for this project.
I'm unsure if this could be of any help to whomever implements this parser, but the neovim implementation of treesitter has a parser for JSONC
which can be found here. It also has parsers for JSON5
, HJSON
, jsonnet
, and YAML
.
Looking forward to what this project has in store for the future. Keep up the good work!
from biome.
Same recommendation for me : json5
> jsonc
from biome.
Related Issues (20)
- 💅 useJsxKeyInIterable reports missing key even if JSX element is not returned in interable
- 💅 possible difference in scope between biome useliteralkeys and eslint dot-notation rules HOT 5
- 🐛 `biome ci` passes locally on macOS but fails on Linux on CI (GHA) HOT 1
- 🐛 Parser fails with "Expected a compound selector" due to @media query HOT 3
- 💅 noUnknownProperty throws warning for CSS custom properties HOT 2
- 📎 Migrate from `stylelint` HOT 2
- 🐛 Impossible to satisfy biome.json schema for rules with no options
- Css formatter doesn't inherit global formatter settings HOT 1
- 🐛 Migration quit on node warning. HOT 7
- 🐛 Trying to override `useConst` doesn't work. .svelte files HOT 2
- 🐛 "Unexpected value or character. biome(parse)" can i disable biome css parser?
- 💅 `noEmptyInterface` may break global augmentation HOT 1
- 🐛 Potential Bug...? HOT 2
- 📎 Implement `unicorn/prefer-array-index-of`
- 🐛 invalid char boundary in diagnostics
- 📎 Forbid `undefined` as type name
- 🐛 <WasmError> HOT 4
- 💅 [nursery/useDateNow] Incorrect applying to Date.now() to all Date.prototype.getTime
- 💅 `lint/correctness/noStringCaseMismatch` false positives
- 💅 `lint/correctness/noUnusedVariables` false positives
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from biome.