Replies: 4 comments 4 replies
-
Overall I'm in favor of this proposal. I would like to propose 2 adjustments Adjustment 1All tool overrides belong in the tool field and not the language field. Motivation Example {
"linter": {
"enabled": true,
"rules": {
"recommended": true
},
"overrides": [
{
"javascript": {
"rules": {
"all": false,
"performance": {
"noDelete": "error"
}
}
}
},
{
"json": {
"enabled": false
}
}
]
}
} This has the following impact:
Adjustment 2Use "collapsed" keys to pattern match overrides (similar to vscode language specific overrides)
Motivation Example {
"linter": {
"enabled": true,
"[json]": {
"enabled": false
},
"{generated/**}": {
"rules": {
"all": false,
"performance": {
"noDelete": "error"
}
}
}
}
} This has the following impact:
|
Beta Was this translation helpful? Give feedback.
-
A few thoughts:
|
Beta Was this translation helpful? Give feedback.
-
Sorry I’m late to the party here, but for me it’s important to be able to replicate the functionality that ESLint offers by nesting That said, I think @nstepien’s top-level |
Beta Was this translation helpful? Give feedback.
-
Umbrella issue created #491 |
Beta Was this translation helpful? Give feedback.
-
Description
Now that Biome has started to support multiple languages, we should be able to control better how those languages behave inside the internal tools.
For example, people might want to format JavaScript files with tabs, but JSON files with spaces. At the moment, this isn't possible via configuration.
Goals
Specifics
Formatter
Below are some examples of how we could better control the formatter:
Enable the tool via language
In this example, JavaScript files are regularly formatted, while JSON files aren't.
Inside
"formatter",
we will have the same options contained in the top-level formatter propertyChange options via language
We format JSON files with a different indentation style and line width in this example.
Inside
"formatter",
we will have the same options contained in the top-level formatter propertyChange language behaviour based on files
A new field, called
overrides
. This field already has some prior work in the ecosystem, such as Prettier and ESLint. However, Biome will use them slightly differently because we already distinguish the languages at the configuration level.overrides
is a configuration present right after the language key;overrides
is an array that contains the following objectWe can tinker with the tool based on the files specified in
files
.files
is an array of Unix-like patterns. If we match a file under these patterns, Biome will apply the configuration specified here.From the previous example:
The formatter won't be executed fir
.d.ts
files.The second example is particular. Inside
"formatter"
will have "base" options such asindentStyle
andtabWith
, and language-specific options likequoteStyle
.Here, JavaScript files under a
generated/
directory will be formatted using tabs with a double quote style.Linter
Enable the tool via language
Below are some examples of how we could better control the linter:
JavaScript files are regularly linted in this example, while JSON files aren't.
Tinker rules based on files
In this example:
generated/
directory should have all the rules turned off, exception fornoDelete
.external/**
directory.Beta Was this translation helpful? Give feedback.
All reactions