Giter Club home page Giter Club logo

Comments (4)

hougesen avatar hougesen commented on July 22, 2024 1

The reason json is formatted as jsonc is because people often have comments in their json codeblocks, which isn't part of the specification.

But I just did a quick test and it seems that both prettier and deno supports formatting json files with comments. Sadly Biome does not expose the argument for allowing comments (https://github.com/biomejs/biome/blob/a6f5f0e8187912b389bf88ece65a51f1e02027a6/crates/biome_service/src/configuration/json.rs#L31).

I was already planning on introducing language โ€œflavorsโ€ (css -> css, scss, sass, less, json -> json, jsonc, json5, sh -> sh, zsh, bash), which should fix the issue.

from mdsf.

ccoVeille avatar ccoVeille commented on July 22, 2024

The point I raised in #146 is interesting here as I have no way to know what formatter is being applied.

from mdsf.

ccoVeille avatar ccoVeille commented on July 22, 2024

It seems to me you are using jsonc format which supports comments and extra trailing comma

These two formats should be handled separately.

```json
{
        "foo": "bar",
        "user_id": "2313",
        "scope": ["internal"]
}
```
```jsonc
{
        "foo": "bar",
        "user_id": "2313",
        "scope": ["internal"] // some comment
}
```

from mdsf.

ccoVeille avatar ccoVeille commented on July 22, 2024

it might be related to this prettier/prettier#15956

so you will have to allow "allowTrailingCommas" for jsonc formatter and allowTrailingCommas=false for regular json

Or maybe the "bug" is already fixed, are you up 2 date on prettier ?

from mdsf.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.