@mkappelhof/biome-config 1.0.0 → 1.1.0
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/AGENTS.md +26 -14
- package/CHANGELOG.md +13 -0
- package/README.md +17 -6
- package/biome.json +34 -18
- package/package.json +6 -16
package/AGENTS.md
CHANGED
|
@@ -6,9 +6,12 @@ This project's `biome.json` extends `@mkappelhof/biome-config`. Biome handles li
|
|
|
6
6
|
|
|
7
7
|
- `pnpm biome check .` lints, checks formatting and checks import order.
|
|
8
8
|
- `pnpm biome check --write .` applies safe fixes, formats and sorts imports.
|
|
9
|
-
- `pnpm biome check --write
|
|
9
|
+
- `pnpm biome check --write --unsafe .` also applies unsafe fixes (e.g. `useBlockStatements`
|
|
10
|
+
wrapping a bare `if (x) return;` in braces). Review the diff — unsafe fixes are low-risk here,
|
|
11
|
+
not unreviewed.
|
|
12
|
+
- `pnpm biome check --write <files>` (optionally with `--unsafe`) does the same for specific files.
|
|
10
13
|
|
|
11
|
-
Run `pnpm biome check --write` on the files you changed before you finish a task. The task is not done while `pnpm biome check .` reports errors. Files listed in `.gitignore` are skipped.
|
|
14
|
+
Run `pnpm biome check --write --unsafe` on the files you changed before you finish a task. The task is not done while `pnpm biome check .` reports errors. Files listed in `.gitignore` are skipped.
|
|
12
15
|
|
|
13
16
|
## Formatting (applied automatically, do not fight it)
|
|
14
17
|
|
|
@@ -19,37 +22,46 @@ Run `pnpm biome check --write` on the files you changed before you finish a task
|
|
|
19
22
|
## Import order
|
|
20
23
|
|
|
21
24
|
Imports are sorted into these groups, in this order:
|
|
22
|
-
|
|
23
25
|
1. Node/Bun built-ins (`node:fs`, `bun:test`)
|
|
24
26
|
2. `react`
|
|
25
27
|
3. URLs, packages and aliases
|
|
26
|
-
4.
|
|
27
|
-
5.
|
|
28
|
+
4. _(blank line)_ CSS / SCSS imports
|
|
29
|
+
5. _(blank line)_ SVG imports
|
|
28
30
|
|
|
29
31
|
Let `biome check --write` order imports for you. Do not order them by hand.
|
|
30
32
|
|
|
31
33
|
## Lint rules
|
|
32
34
|
|
|
33
35
|
The `recommended` preset is enabled, plus these rules as errors:
|
|
34
|
-
|
|
35
36
|
- **No `any`** (`noExplicitAny`). Use `unknown` and narrow it, or write a proper type.
|
|
36
37
|
- **No `console`** (`noConsole`). Use the project's logger, or remove debug output before you finish. Allowed in `*.config.*`, `scripts/**` and `bin/**` files, where logging is normal.
|
|
37
38
|
- **No unused imports or variables** (`noUnusedImports`, `noUnusedVariables`). Prefix intentionally unused variables or parameters with `_`.
|
|
38
39
|
- **Type-only imports and exports use `type`** (`useImportType`, `useExportType`): `import type { Foo } from './foo'` or `import { type Foo, bar } from './foo'`.
|
|
39
40
|
- **Node built-ins use the `node:` prefix** (`useNodejsImportProtocol`): `import { readFile } from 'node:fs/promises'`.
|
|
40
41
|
- **Arrow functions that only return a value use a concise body** (`useConsistentArrowReturn`): `(x) => x * 2`, not `(x) => { return x * 2; }`.
|
|
42
|
+
- **Braceless single-statement bodies are not allowed** (`useBlockStatements`): write `if (!x) { throw new Error(); }`, not `if (!x) throw new Error();` or `if (x) return;`. Applies to `if`/`else`, loops and similar. The auto-fix for this one is unsafe (see Commands above), not unavailable.
|
|
41
43
|
|
|
42
44
|
Framework-specific rules (React, Next.js, test runners) are turned on automatically based on the dependencies in `package.json`. If the project's `biome.json` sets `linter.domains` explicitly (see its README), treat that as the source of truth instead.
|
|
43
45
|
|
|
44
46
|
Fix the cause of a diagnostic. Do not add `// biome-ignore` unless there is no reasonable alternative, and always give a reason: `// biome-ignore lint/<group>/<rule>: <reason>`. Do not disable rules or change formatter settings in the project's `biome.json` to get a check to pass.
|
|
45
47
|
|
|
46
|
-
##
|
|
48
|
+
## CSS/SCSS
|
|
47
49
|
|
|
48
|
-
Biome
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
50
|
+
Biome 2.6+ fully parses, formats and lints `.scss` files (not just CSS Modules), and
|
|
51
|
+
`files.includes` matches them by default. On top of `recommended`, these are pinned as errors:
|
|
52
|
+
`useGenericFontNames`, `noInvalidDirectionInLinearGradient`, `noInvalidGridAreas`,
|
|
53
|
+
`noInvalidPositionAtImportRule`, `noMissingVarFunction`, `noUnknownMediaFeatureName`,
|
|
54
|
+
`noUnknownProperty`, `noUnknownPseudoClass`, `noUnknownPseudoElement`, `noUnknownTypeSelector`,
|
|
55
|
+
`noUnknownUnit`, `noUnmatchableAnbSelector`, `noDeprecatedMediaType`, `noDuplicateAtImportRules`,
|
|
56
|
+
`noDuplicateCustomProperties`, `noDuplicateFontNames`, `noDuplicateProperties`,
|
|
57
|
+
`noDuplicateSelectorsKeyframeBlock`, `noEmptyBlock`, `noEmptySource`, `noImportantInKeyframe` and
|
|
58
|
+
`noIrregularWhitespace`. Use `// biome-ignore lint/<group>/<rule>: <reason>` the same as for JS/TS,
|
|
59
|
+
not a `/* stylelint-disable */` comment.
|
|
60
|
+
|
|
61
|
+
## Tool boundaries
|
|
52
62
|
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
63
|
+
Biome covers JS/TS/JSON/CSS/SCSS (and HTML, via `experimentalFullSupportEnabled`). If the project
|
|
64
|
+
also lints CSS/SCSS with Stylelint (see `@mkappelhof/stylelint-config`) rather than relying on
|
|
65
|
+
Biome's CSS rules, the project's own `biome.json` must exclude style files from this config's
|
|
66
|
+
`files.includes` (`"!**/*.css"`, `"!**/*.scss"`) so the two tools don't both process them — check
|
|
67
|
+
there before assuming Biome owns `.scss` files in a given project.
|
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,18 @@
|
|
|
1
1
|
# @mkappelhof/biome-config
|
|
2
2
|
|
|
3
|
+
## 1.1.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- 3c4c6b4: Enable `useBlockStatements` so braceless single-statement bodies (`if (!x) throw ...;`, `if (x) return;`) are flagged. Its fix is unsafe, so apply it with `biome check --write --unsafe` rather than plain `--write`.
|
|
8
|
+
- 3c4c6b4: Bump Biome to 2.6.2, which adds full SCSS support (not just CSS Modules) to Biome's own parser, formatter and linter. Pin the CSS/SCSS lint rules that mirror `@mkappelhof/stylelint-config`'s rule set (`noUnknownProperty`, `noDuplicateProperties`, `noEmptyBlock`, etc.) as explicit errors, on top of the `recommended` preset that already covers most of them. `@mkappelhof/stylelint-config` is unchanged and still recommended for SCSS-heavy projects, since Biome's CSS linter doesn't yet cover SCSS-specific or stylistic rules.
|
|
9
|
+
|
|
10
|
+
## 1.0.1
|
|
11
|
+
|
|
12
|
+
### Patch Changes
|
|
13
|
+
|
|
14
|
+
- eb2577f: Add new configs
|
|
15
|
+
|
|
3
16
|
## 2.0.0
|
|
4
17
|
|
|
5
18
|
### Major Changes
|
package/README.md
CHANGED
|
@@ -92,18 +92,29 @@ Install the Biome extension for your editor and make it the default formatter. F
|
|
|
92
92
|
|
|
93
93
|
## What's included
|
|
94
94
|
|
|
95
|
-
- **Files:** everything Biome supports (JS/TS/JSX, JSON, CSS, HTML, GraphQL), except files in `.gitignore` and `dist`, `build`, `out`, `coverage`, `.next`, `.astro`, `.vercel` and `.turbo`.
|
|
95
|
+
- **Files:** everything Biome supports (JS/TS/JSX, JSON, CSS, SCSS, Markdown, YAML, HTML, GraphQL), except files in `.gitignore` and `dist`, `build`, `out`, `coverage`, `.next`, `.astro`, `.vercel` and `.turbo`.
|
|
96
96
|
- **Formatter:** 2 spaces, 100-character lines, single quotes, semicolons, ES5 trailing commas. An `.editorconfig` takes precedence.
|
|
97
|
-
- **Linter:** the `recommended` preset, plus these rules as errors:
|
|
97
|
+
- **Linter:** the `recommended` preset, plus these rules as errors:
|
|
98
|
+
- JS/TS: `noExplicitAny`, `noConsole`, `noUnusedImports`, `noUnusedVariables`, `useImportType`, `useExportType`, `useNodejsImportProtocol`, `useConsistentArrowReturn` and `useBlockStatements` (no braceless `if (x) return;`/`if (!x) throw ...;` — its fix is unsafe, so run `biome check --write --unsafe` to apply it). `noConsole` is off again in `*.config.*`, `scripts/**` and `bin/**` files.
|
|
99
|
+
- CSS/SCSS: `useGenericFontNames`, `noInvalidDirectionInLinearGradient`, `noInvalidGridAreas`, `noInvalidPositionAtImportRule`, `noMissingVarFunction`, `noUnknownMediaFeatureName`, `noUnknownProperty`, `noUnknownPseudoClass`, `noUnknownPseudoElement`, `noUnknownTypeSelector`, `noUnknownUnit`, `noUnmatchableAnbSelector`, `noDeprecatedMediaType`, `noDuplicateAtImportRules`, `noDuplicateCustomProperties`, `noDuplicateFontNames`, `noDuplicateProperties`, `noDuplicateSelectorsKeyframeBlock`, `noEmptyBlock`, `noEmptySource`, `noImportantInKeyframe` and `noIrregularWhitespace` — these are every rule Biome 2.6+ ships with a direct equivalent to `@mkappelhof/stylelint-config`'s rule set (`stylelint-config-standard` + `stylelint-config-recommended-scss`), most already in the `recommended` preset but pinned explicitly here.
|
|
100
|
+
- Framework rules (React, Next.js, tests) are turned on automatically based on your dependencies — see [below](#deterministic-framework-rules) to pin them explicitly instead.
|
|
98
101
|
- **HTML:** `experimentalFullSupportEnabled` is on, so Biome formats full HTML/Astro templates rather than only the parts it previously supported.
|
|
99
102
|
- **Imports:** sorted into groups: Node/Bun built-ins, React, packages/aliases, then stylesheets and SVGs, each after a blank line.
|
|
100
103
|
|
|
101
104
|
## Pairing with Stylelint
|
|
102
105
|
|
|
103
|
-
Biome
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
106
|
+
As of Biome 2.6, SCSS support is no longer limited to CSS Modules — Biome fully parses, formats
|
|
107
|
+
and lints `.scss` files, and `files.includes` matches them by default (no opt-in needed). If the
|
|
108
|
+
project also uses `@mkappelhof/stylelint-config`, the two tools will now process the same files
|
|
109
|
+
unless you stop one of them: exclude style files from this config's `files.includes` in the
|
|
110
|
+
project's `biome.json` (`"!**/*.css"`, `"!**/*.scss"`), or don't point Stylelint at files Biome
|
|
111
|
+
already covers.
|
|
112
|
+
|
|
113
|
+
`@mkappelhof/stylelint-config` still covers more ground — SCSS-specific checks (`scss/*` rules,
|
|
114
|
+
`@use`/`@mixin`/`@include` correctness) and most stylistic rules (empty-line conventions, color
|
|
115
|
+
notation, quoting, etc.) that Biome's CSS linter doesn't have an equivalent for yet — so for new
|
|
116
|
+
SCSS-heavy projects, or any project not yet on Biome 2.6+, keep using it instead of relying on
|
|
117
|
+
Biome alone.
|
|
107
118
|
|
|
108
119
|
## AI agents
|
|
109
120
|
|
package/biome.json
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
{
|
|
2
|
-
"$schema": "https://biomejs.dev/schemas/2.
|
|
2
|
+
"$schema": "https://biomejs.dev/schemas/2.6.2/schema.json",
|
|
3
3
|
"vcs": {
|
|
4
4
|
"enabled": true,
|
|
5
5
|
"clientKind": "git",
|
|
@@ -38,19 +38,45 @@
|
|
|
38
38
|
"enabled": true,
|
|
39
39
|
"rules": {
|
|
40
40
|
"preset": "recommended",
|
|
41
|
+
"a11y": {
|
|
42
|
+
"useGenericFontNames": "error"
|
|
43
|
+
},
|
|
41
44
|
"correctness": {
|
|
42
45
|
"noUnusedImports": "error",
|
|
43
|
-
"noUnusedVariables": "error"
|
|
46
|
+
"noUnusedVariables": "error",
|
|
47
|
+
"noInvalidDirectionInLinearGradient": "error",
|
|
48
|
+
"noInvalidGridAreas": "error",
|
|
49
|
+
"noInvalidPositionAtImportRule": "error",
|
|
50
|
+
"noMissingVarFunction": "error",
|
|
51
|
+
"noUnknownMediaFeatureName": "error",
|
|
52
|
+
"noUnknownProperty": "error",
|
|
53
|
+
"noUnknownPseudoClass": "error",
|
|
54
|
+
"noUnknownPseudoElement": "error",
|
|
55
|
+
"noUnknownTypeSelector": "error",
|
|
56
|
+
"noUnknownUnit": "error",
|
|
57
|
+
"noUnmatchableAnbSelector": "error"
|
|
44
58
|
},
|
|
45
59
|
"suspicious": {
|
|
46
60
|
"noConsole": "error",
|
|
47
|
-
"noExplicitAny": "error"
|
|
61
|
+
"noExplicitAny": "error",
|
|
62
|
+
"noDeprecatedMediaType": "error",
|
|
63
|
+
"noDuplicateAtImportRules": "error",
|
|
64
|
+
"noDuplicateCustomProperties": "error",
|
|
65
|
+
"noDuplicateFontNames": "error",
|
|
66
|
+
"noDuplicateProperties": "error",
|
|
67
|
+
"noDuplicateSelectorsKeyframeBlock": "error",
|
|
68
|
+
"noEmptyBlock": "error",
|
|
69
|
+
"noEmptySource": "error",
|
|
70
|
+
"noImportantInKeyframe": "error",
|
|
71
|
+
"noIrregularWhitespace": "error",
|
|
72
|
+
"noShorthandPropertyOverrides": "error"
|
|
48
73
|
},
|
|
49
74
|
"style": {
|
|
50
75
|
"useImportType": "error",
|
|
51
76
|
"useExportType": "error",
|
|
52
77
|
"useNodejsImportProtocol": "error",
|
|
53
|
-
"useConsistentArrowReturn": "error"
|
|
78
|
+
"useConsistentArrowReturn": "error",
|
|
79
|
+
"useBlockStatements": "error"
|
|
54
80
|
}
|
|
55
81
|
}
|
|
56
82
|
},
|
|
@@ -75,11 +101,7 @@
|
|
|
75
101
|
},
|
|
76
102
|
"overrides": [
|
|
77
103
|
{
|
|
78
|
-
"includes": [
|
|
79
|
-
"**/*.config.*",
|
|
80
|
-
"**/scripts/**",
|
|
81
|
-
"**/bin/**"
|
|
82
|
-
],
|
|
104
|
+
"includes": ["**/*.config.*", "**/scripts/**", "**/bin/**"],
|
|
83
105
|
"linter": {
|
|
84
106
|
"rules": {
|
|
85
107
|
"suspicious": {
|
|
@@ -97,10 +119,7 @@
|
|
|
97
119
|
"level": "on",
|
|
98
120
|
"options": {
|
|
99
121
|
"groups": [
|
|
100
|
-
[
|
|
101
|
-
":NODE:",
|
|
102
|
-
":BUN:"
|
|
103
|
-
],
|
|
122
|
+
[":NODE:", ":BUN:"],
|
|
104
123
|
"react",
|
|
105
124
|
[
|
|
106
125
|
":URL:",
|
|
@@ -113,10 +132,7 @@
|
|
|
113
132
|
"!**/*.svg"
|
|
114
133
|
],
|
|
115
134
|
":BLANK_LINE:",
|
|
116
|
-
[
|
|
117
|
-
"**/*.css",
|
|
118
|
-
"**/*.scss"
|
|
119
|
-
],
|
|
135
|
+
["**/*.css", "**/*.scss"],
|
|
120
136
|
":BLANK_LINE:",
|
|
121
137
|
"**/*.svg"
|
|
122
138
|
]
|
|
@@ -125,4 +141,4 @@
|
|
|
125
141
|
}
|
|
126
142
|
}
|
|
127
143
|
}
|
|
128
|
-
}
|
|
144
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mkappelhof/biome-config",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.1.0",
|
|
4
4
|
"description": "Shared Biome configuration (linting + formatting)",
|
|
5
5
|
"main": "biome.json",
|
|
6
6
|
"exports": {
|
|
@@ -8,12 +8,7 @@
|
|
|
8
8
|
"./biome": "./biome.json",
|
|
9
9
|
"./package.json": "./package.json"
|
|
10
10
|
},
|
|
11
|
-
"files": [
|
|
12
|
-
"biome.json",
|
|
13
|
-
"AGENTS.md",
|
|
14
|
-
"README.md",
|
|
15
|
-
"CHANGELOG.md"
|
|
16
|
-
],
|
|
11
|
+
"files": ["biome.json", "AGENTS.md", "README.md", "CHANGELOG.md"],
|
|
17
12
|
"license": "MIT",
|
|
18
13
|
"repository": "git@github.com:mkappelhof/frontend-tools.git",
|
|
19
14
|
"author": "Maurice Kappelhof <maurice@mauricekappelhof.nl>",
|
|
@@ -22,15 +17,10 @@
|
|
|
22
17
|
"test": "node test/run.mjs"
|
|
23
18
|
},
|
|
24
19
|
"peerDependencies": {
|
|
25
|
-
"@biomejs/biome": "^2.
|
|
20
|
+
"@biomejs/biome": "^2.6.0"
|
|
26
21
|
},
|
|
27
22
|
"devDependencies": {
|
|
28
|
-
"@biomejs/biome": "2.
|
|
23
|
+
"@biomejs/biome": "2.6.2"
|
|
29
24
|
},
|
|
30
|
-
"keywords": [
|
|
31
|
-
|
|
32
|
-
"lint",
|
|
33
|
-
"format",
|
|
34
|
-
"config"
|
|
35
|
-
]
|
|
36
|
-
}
|
|
25
|
+
"keywords": ["biome", "lint", "format", "config"]
|
|
26
|
+
}
|