Skip to content

Commit

Permalink
fix(json-schema): remove field options for rules without options (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
Conaclos authored Apr 7, 2024
1 parent 3c2c1c2 commit 39b91e9
Show file tree
Hide file tree
Showing 4 changed files with 56 additions and 3 deletions.
24 changes: 24 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,30 @@ our [guidelines for writing a good changelog entry](https://github.com/biomejs/b

Contributed by @Conaclos

- `options` is no longer required for rules without any options ([#2313](https://github.com/biomejs/biome/issues/2313)).

Previously, the JSON schema required to set `options` to `null` when an object is used to set the diagnostic level of a rule without any option.
However, if `options` is set to `null`, Biome emits an error.

The schema is now fixed and it no longer requires specifying `options`.
This makes the following configuration valid:

```json
{
"linter": {
"rules": {
"style": {
"noDefaultExport": {
"level": "off"
}
}
}
}
}
```

Contributed by @Conaclos

### Editors

### Formatter
Expand Down
5 changes: 2 additions & 3 deletions packages/@biomejs/biome/configuration_schema.json

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

24 changes: 24 additions & 0 deletions website/src/content/docs/internals/changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,30 @@ our [guidelines for writing a good changelog entry](https://github.com/biomejs/b

Contributed by @Conaclos

- `options` is no longer required for rules without any options ([#2313](https://github.com/biomejs/biome/issues/2313)).

Previously, the JSON schema required to set `options` to `null` when an object is used to set the diagnostic level of a rule without any option.
However, if `options` is set to `null`, Biome emits an error.

The schema is now fixed and it no longer requires specifying `options`.
This makes the following configuration valid:

```json
{
"linter": {
"rules": {
"style": {
"noDefaultExport": {
"level": "off"
}
}
}
}
}
```

Contributed by @Conaclos

### Editors

### Formatter
Expand Down
6 changes: 6 additions & 0 deletions xtask/codegen/src/generate_schema.rs
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,12 @@ fn rename_partial_references_in_schema(mut schema: RootSchema) -> RootSchema {
key = stripped.to_string();
} else if key == "RuleWithOptions_for_Null" {
key = "RuleWithNoOptions".to_string();
if let Schema::Object(schema_object) = &mut schema {
if let Some(object) = &mut schema_object.object {
object.required.remove("options");
object.properties.remove("options");
}
}
} else if key == "RuleConfiguration_for_Null" {
key = "RuleConfiguration".to_string();
} else if let Some(stripped) = key.strip_prefix("RuleWithOptions_for_") {
Expand Down

0 comments on commit 39b91e9

Please sign in to comment.