@moderneinc/biome-plugins 6.1.0-alpha.f3c8fa → 7.0.0-next.4ff15f
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +40 -11
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -24,24 +24,53 @@ Install the package:
|
|
|
24
24
|
npm install --save-dev @moderneinc/biome-plugins
|
|
25
25
|
```
|
|
26
26
|
|
|
27
|
-
Add the plugin paths to your `biome.json
|
|
27
|
+
Add the plugin paths to your `biome.json`. These rules are about how *source* is
|
|
28
|
+
written, so scope them away from your tests — see [Scoping](#scoping) below:
|
|
28
29
|
|
|
29
30
|
```json
|
|
30
31
|
{
|
|
31
|
-
"
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
32
|
+
"overrides": [
|
|
33
|
+
{
|
|
34
|
+
"includes": ["**", "!**/tests/**"],
|
|
35
|
+
"plugins": [
|
|
36
|
+
"./node_modules/@moderneinc/biome-plugins/plugins/no-hardcoded-colors.grit",
|
|
37
|
+
"./node_modules/@moderneinc/biome-plugins/plugins/no-hardcoded-font-sizes.grit",
|
|
38
|
+
"./node_modules/@moderneinc/biome-plugins/plugins/no-hardcoded-font-weights.grit",
|
|
39
|
+
"./node_modules/@moderneinc/biome-plugins/plugins/no-hardcoded-spacing.grit",
|
|
40
|
+
"./node_modules/@moderneinc/biome-plugins/plugins/no-hardcoded-shadows.grit",
|
|
41
|
+
"./node_modules/@moderneinc/biome-plugins/plugins/no-pxToRem-non-font.grit",
|
|
42
|
+
"./node_modules/@moderneinc/biome-plugins/plugins/no-hardcoded-border-radius.grit",
|
|
43
|
+
"./node_modules/@moderneinc/biome-plugins/plugins/no-hardcoded-mui-classes.grit",
|
|
44
|
+
"./node_modules/@moderneinc/biome-plugins/plugins/no-css-variables.grit"
|
|
45
|
+
]
|
|
46
|
+
}
|
|
41
47
|
]
|
|
42
48
|
}
|
|
43
49
|
```
|
|
44
50
|
|
|
51
|
+
## Scoping
|
|
52
|
+
|
|
53
|
+
A test asserting what a token resolves to has to spell the literal out, so
|
|
54
|
+
pointing these rules at a test suite turns every such assertion into an error.
|
|
55
|
+
Scoping the plugin list, as above, is what exempts them.
|
|
56
|
+
|
|
57
|
+
Keep the leading `"**"`. `includes` is an allowlist, so `["!**/tests/**"]` alone
|
|
58
|
+
matches nothing and silently disables every plugin in the list.
|
|
59
|
+
|
|
60
|
+
Per-plugin scoping works too on Biome 2.5+, if you want different globs per rule
|
|
61
|
+
(earlier versions reject `path` as an unknown key):
|
|
62
|
+
|
|
63
|
+
```json
|
|
64
|
+
{ "plugins": [{ "path": "./…/no-hardcoded-colors.grit", "includes": ["**", "!**/tests/**"] }] }
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
What does *not* work is subtracting in an override: `overrides[].plugins` adds to
|
|
68
|
+
the top-level list rather than replacing it, so there is no way to switch a
|
|
69
|
+
plugin off for a path once it is declared at the top level. For a one-off escape,
|
|
70
|
+
`// biome-ignore lint/plugin: reason` suppresses at a single site — note the
|
|
71
|
+
selector is `lint/plugin`, not the `plugin` category the diagnostic reports, and
|
|
72
|
+
it silences every plugin there rather than one.
|
|
73
|
+
|
|
45
74
|
## Requirements
|
|
46
75
|
|
|
47
76
|
- [Biome](https://biomejs.dev/) v2.0+ with GritQL plugin support
|