Skip to content

Commit

Permalink
trailingCommas with S, and codegen
Browse files Browse the repository at this point in the history
  • Loading branch information
ematipico committed Mar 6, 2024
1 parent aefd29d commit 4a3c7f6
Show file tree
Hide file tree
Showing 14 changed files with 3,224 additions and 301 deletions.
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -670,7 +670,7 @@ Additionally, the following rules are now recommended:

#### New features

- Add option `json.formatter.trailingComma`, to provide a better control over the trailing comma in JSON/JSONC files. Its default value is `"none"`.
- Add option `json.formatter.trailingCommas`, to provide a better control over the trailing comma in JSON/JSONC files. Its default value is `"none"`.

#### Bug fixes

Expand Down
4 changes: 2 additions & 2 deletions crates/biome_service/src/configuration/json.rs
Original file line number Diff line number Diff line change
Expand Up @@ -69,10 +69,10 @@ pub struct JsonFormatter {
#[partial(bpaf(long("json-formatter-line-width"), argument("NUMBER"), optional))]
pub line_width: Option<LineWidth>,

/// Print trailing commas wherever possible in multi-line comma-separated syntactic structures. Defaults to "omit".
/// Print trailing commas wherever possible in multi-line comma-separated syntactic structures. Defaults to "none".
#[partial(bpaf(
long("json-formatter-trailing-commas"),
argument("omit|allow"),
argument("none|all"),
optional
))]
pub trailing_commas: Option<TrailingCommas>,
Expand Down
2 changes: 1 addition & 1 deletion packages/@biomejs/biome/configuration_schema.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions website/src/content/blog/biome-v1-6.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -146,12 +146,12 @@ When `formatter.attributePosition` has the value `multiline`, all attributes of
</div>


### Option `json.formatter.trailingComma`
### Option `json.formatter.trailingCommas`

Previously, Biome parser introduced an option that would allow to parse JSON and JSONC files that contained a trailing comma. This was required to ease the friction caused by other tools that
tolerate trailing commas by default (e.g. VSCode, Prettier, etc.).

Unfortunately, our formatter wasn't as tolerant. But with this release, we've introduced the option `json.formatter.trailingComma`. It allows you to apply the same rules as with `js.formatter.trailingComma`.
Unfortunately, our formatter wasn't as tolerant. But with this release, we've introduced the option `json.formatter.trailingCommas`. It allows you to apply the same rules as with `js.formatter.trailingComma`.

<div class="card">
<div class="card-column">
Expand Down
4 changes: 2 additions & 2 deletions website/src/content/docs/guides/getting-started.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ After running the `init` command, you'll now have a new `biome.json` file in you

```json title="biome.json"
{
"$schema": "https://biomejs.dev/schemas/1.5.3/schema.json",
"$schema": "https://biomejs.dev/schemas/1.6.0/schema.json",
"organizeImports": {
"enabled": false
},
Expand All @@ -65,7 +65,7 @@ Alternatively, you can run `biome init --jsonc` , and emit a `biome.jsonc` file:

```json title="biome.jsonc"
{
"$schema": "https://biomejs.dev/schemas/1.5.3/schema.json",
"$schema": "https://biomejs.dev/schemas/1.6.0/schema.json",
"organizeImports": {
"enabled": false
},
Expand Down
6 changes: 3 additions & 3 deletions website/src/content/docs/guides/how-biome-works.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -78,14 +78,14 @@ The `extends` option allows to break down a configuration in multiple file and "

```json title="biome.json"
{
"$schema": "https://biomejs.dev/schemas/1.5.3/schema.json",
"$schema": "https://biomejs.dev/schemas/1.6.0/schema.json",
"extends": ["./formatter.json", "./linter.json"]
}
```

```json title="formatter.json"
{
"$schema": "https://biomejs.dev/schemas/1.5.3/schema.json",
"$schema": "https://biomejs.dev/schemas/1.6.0/schema.json",
"formatter": {
"indentSize": 2
},
Expand All @@ -99,7 +99,7 @@ The `extends` option allows to break down a configuration in multiple file and "

```json title="linter.json"
{
"$schema": "https://biomejs.dev/schemas/1.5.3/schema.json",
"$schema": "https://biomejs.dev/schemas/1.6.0/schema.json",
"linter": {
"rules": {
"complexity": {
Expand Down
2 changes: 1 addition & 1 deletion website/src/content/docs/internals/changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -676,7 +676,7 @@ Additionally, the following rules are now recommended:

#### New features

- Add option `json.formatter.trailingComma`, to provide a better control over the trailing comma in JSON/JSONC files. Its default value is `"none"`.
- Add option `json.formatter.trailingCommas`, to provide a better control over the trailing comma in JSON/JSONC files. Its default value is `"none"`.

#### Bug fixes

Expand Down
2 changes: 1 addition & 1 deletion website/src/content/docs/ja/guides/getting-started.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ Biomeをインストールする際には、バージョン範囲演算子を使

```json title="biome.json"
{
"$schema": "https://biomejs.dev/schemas/1.5.3/schema.json",
"$schema": "https://biomejs.dev/schemas/1.6.0/schema.json",
"organizeImports": {
"enabled": false
},
Expand Down
2 changes: 1 addition & 1 deletion website/src/content/docs/pt-br/guides/getting-started.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ Após utilizar o comando, você terá um novo arquivo `biome.json` no seu diret

```json title="biome.json"
{
"$schema": "https://biomejs.dev/schemas/1.5.3/schema.json",
"$schema": "https://biomejs.dev/schemas/1.6.0/schema.json",
"organizeImports": {
"enabled": false
},
Expand Down
Loading

0 comments on commit 4a3c7f6

Please sign in to comment.