@dvashim/biome-config 1.8.0 → 1.9.1
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 +64 -98
- package/dist/biome.react-balanced-stable.json +1 -1
- package/dist/biome.react-balanced.json +4 -1
- package/dist/biome.react-recommended.json +1 -1
- package/dist/biome.react-strict-stable.json +1 -1
- package/dist/biome.react-strict.json +4 -1
- package/dist/biome.recommended.json +1 -1
- package/package.json +7 -5
package/README.md
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
# Biome Configurations
|
|
2
2
|
|
|
3
|
+
Shared [Biome](https://biomejs.dev) configuration presets — a base recommended config plus a family of React presets (`recommended`, `strict`, `balanced`, and nursery-free `-stable` variants) that you extend in your own `biome.json`.
|
|
4
|
+
|
|
3
5
|
[![CI][ci-badge]][ci-url]
|
|
4
6
|
[![npm version][version-badge]][npm-url]
|
|
5
7
|
[![npm downloads][downloads-badge]][npm-url]
|
|
@@ -19,123 +21,63 @@
|
|
|
19
21
|
[socket-badge]: https://socket.dev/api/badge/npm/package/@dvashim/biome-config
|
|
20
22
|
[socket-url]: https://socket.dev/npm/package/@dvashim/biome-config
|
|
21
23
|
|
|
24
|
+
## Table of Contents
|
|
25
|
+
|
|
26
|
+
- [Installation](#installation)
|
|
27
|
+
- [Configurations](#configurations)
|
|
28
|
+
- [Usage](#usage)
|
|
29
|
+
- [Defaults](#defaults)
|
|
30
|
+
- [Rules](#rules)
|
|
31
|
+
- [FAQ](#faq)
|
|
32
|
+
- [Contributing](#contributing)
|
|
33
|
+
- [License](#license)
|
|
34
|
+
|
|
22
35
|
## Installation
|
|
23
36
|
|
|
37
|
+
Install the presets together with [Biome](https://biomejs.dev) (which is not bundled) as dev dependencies.
|
|
38
|
+
|
|
24
39
|
npm:
|
|
25
40
|
|
|
26
41
|
```bash
|
|
27
|
-
npm install -D @dvashim/biome-config
|
|
42
|
+
npm install -D @dvashim/biome-config @biomejs/biome
|
|
28
43
|
```
|
|
29
44
|
|
|
30
45
|
or pnpm:
|
|
31
46
|
|
|
32
47
|
```bash
|
|
33
|
-
pnpm add -D @dvashim/biome-config
|
|
48
|
+
pnpm add -D @dvashim/biome-config @biomejs/biome
|
|
34
49
|
```
|
|
35
50
|
|
|
51
|
+
> **Requirements:** Biome **2.4.16+** (the version these presets target) and Node.js **>= 24**.
|
|
52
|
+
|
|
36
53
|
## Configurations
|
|
37
54
|
|
|
38
55
|
| Domain | Level | Path |
|
|
39
|
-
|
|
40
|
-
| Base | recommended | `@dvashim/biome-config` or `@dvashim/biome-config/recommended` |
|
|
41
|
-
| React | recommended | `@dvashim/biome-config/react-recommended` |
|
|
42
|
-
| React | strict | `@dvashim/biome-config/react-strict` |
|
|
43
|
-
| React | strict-stable | `@dvashim/biome-config/react-strict-stable` |
|
|
44
|
-
| React | balanced | `@dvashim/biome-config/react-balanced` |
|
|
45
|
-
| React | balanced-stable | `@dvashim/biome-config/react-balanced-stable` |
|
|
56
|
+
|--------|-------|------|
|
|
57
|
+
| Base | [recommended](#base-recommended) | `@dvashim/biome-config` or `@dvashim/biome-config/recommended` |
|
|
58
|
+
| React | [recommended](#react-recommended) | `@dvashim/biome-config/react-recommended` |
|
|
59
|
+
| React | [strict](#react-strict) | `@dvashim/biome-config/react-strict` |
|
|
60
|
+
| React | [strict-stable](#react-strict-stable) | `@dvashim/biome-config/react-strict-stable` |
|
|
61
|
+
| React | [balanced](#react-balanced) | `@dvashim/biome-config/react-balanced` |
|
|
62
|
+
| React | [balanced-stable](#react-balanced-stable) | `@dvashim/biome-config/react-balanced-stable` |
|
|
46
63
|
|
|
64
|
+
_Not sure which to pick? See [Which config should I start with?](#which-config-should-i-start-with) in the FAQ._
|
|
47
65
|
|
|
48
|
-
##
|
|
66
|
+
## Usage
|
|
49
67
|
|
|
50
|
-
|
|
68
|
+
Add a `biome.json` to your project root and extend a preset. The only line you change between presets is the `extends` path:
|
|
51
69
|
|
|
52
70
|
```jsonc
|
|
53
|
-
// biome.json
|
|
54
|
-
// ────────────────────────────────────────
|
|
55
|
-
// This configuration provides a base setup for linting,
|
|
56
|
-
// formatting, and code consistency across JavaScript,
|
|
57
|
-
// JSX, JSON, and HTML files.
|
|
58
|
-
// No files.includes is set — Biome will process all supported
|
|
59
|
-
// files in the project directory by default.
|
|
60
|
-
|
|
71
|
+
// biome.json
|
|
61
72
|
{
|
|
62
73
|
"$schema": "https://biomejs.dev/schemas/latest/schema.json",
|
|
63
74
|
"extends": ["@dvashim/biome-config"]
|
|
64
75
|
}
|
|
65
76
|
```
|
|
66
77
|
|
|
67
|
-
React
|
|
68
|
-
|
|
69
|
-
```jsonc
|
|
70
|
-
// biome.json (React recommended)
|
|
71
|
-
// ────────────────────────────────────────
|
|
72
|
-
// This configuration extends the base recommended configuration
|
|
73
|
-
// and enables the recommended rules for the React domain.
|
|
74
|
-
// Includes all files except dist/ (files.includes: ["**", "!!**/dist"]).
|
|
75
|
-
|
|
76
|
-
{
|
|
77
|
-
"$schema": "https://biomejs.dev/schemas/latest/schema.json",
|
|
78
|
-
"extends": ["@dvashim/biome-config/react-recommended"]
|
|
79
|
-
}
|
|
80
|
-
```
|
|
81
|
-
|
|
82
|
-
React strict configuration:
|
|
78
|
+
To use a different preset, swap the `extends` value for any path from the [Configurations](#configurations) table above — for example `"@dvashim/biome-config/react-balanced"`. The React presets automatically exclude build output (`files.includes: ["**", "!!**/dist"]`); the base preset sets no `files.includes`, so Biome processes all supported files by default.
|
|
83
79
|
|
|
84
|
-
|
|
85
|
-
// biome.json (React strict)
|
|
86
|
-
// ────────────────────────────────────────
|
|
87
|
-
// The most opinionated configuration — enables recommended rules,
|
|
88
|
-
// React-specific rules, and 200+ optional and nursery (experimental) rules.
|
|
89
|
-
// Includes all files except dist/ (files.includes: ["**", "!!**/dist"]).
|
|
90
|
-
|
|
91
|
-
{
|
|
92
|
-
"$schema": "https://biomejs.dev/schemas/latest/schema.json",
|
|
93
|
-
"extends": ["@dvashim/biome-config/react-strict"]
|
|
94
|
-
}
|
|
95
|
-
```
|
|
96
|
-
|
|
97
|
-
React strict-stable configuration:
|
|
98
|
-
|
|
99
|
-
```jsonc
|
|
100
|
-
// biome.json (React strict-stable)
|
|
101
|
-
// ────────────────────────────────────────
|
|
102
|
-
// Same as React strict, but without nursery (experimental) rules.
|
|
103
|
-
// Includes all files except dist/ (files.includes: ["**", "!!**/dist"]).
|
|
104
|
-
|
|
105
|
-
{
|
|
106
|
-
"$schema": "https://biomejs.dev/schemas/latest/schema.json",
|
|
107
|
-
"extends": ["@dvashim/biome-config/react-strict-stable"]
|
|
108
|
-
}
|
|
109
|
-
```
|
|
110
|
-
|
|
111
|
-
React balanced configuration:
|
|
112
|
-
|
|
113
|
-
```jsonc
|
|
114
|
-
// biome.json (React balanced)
|
|
115
|
-
// ────────────────────────────────────────
|
|
116
|
-
// Same as React strict, with targeted relaxations
|
|
117
|
-
// to reduce false positives / noise.
|
|
118
|
-
// Includes all files except dist/ (files.includes: ["**", "!!**/dist"]).
|
|
119
|
-
|
|
120
|
-
{
|
|
121
|
-
"$schema": "https://biomejs.dev/schemas/latest/schema.json",
|
|
122
|
-
"extends": ["@dvashim/biome-config/react-balanced"]
|
|
123
|
-
}
|
|
124
|
-
```
|
|
125
|
-
|
|
126
|
-
React balanced-stable configuration:
|
|
127
|
-
|
|
128
|
-
```jsonc
|
|
129
|
-
// biome.json (React balanced-stable)
|
|
130
|
-
// ────────────────────────────────────────
|
|
131
|
-
// Same as React balanced, but without nursery (experimental) rules.
|
|
132
|
-
// Includes all files except dist/ (files.includes: ["**", "!!**/dist"]).
|
|
133
|
-
|
|
134
|
-
{
|
|
135
|
-
"$schema": "https://biomejs.dev/schemas/latest/schema.json",
|
|
136
|
-
"extends": ["@dvashim/biome-config/react-balanced-stable"]
|
|
137
|
-
}
|
|
138
|
-
```
|
|
80
|
+
> The examples use the `latest` schema URL for convenience. To match a preset exactly and silence editor warnings about unknown fields, pin it to the version shown under [Defaults → Schema](#schema).
|
|
139
81
|
|
|
140
82
|
## Defaults
|
|
141
83
|
|
|
@@ -143,7 +85,7 @@ All configurations share the same base defaults.
|
|
|
143
85
|
|
|
144
86
|
### Schema
|
|
145
87
|
|
|
146
|
-
`https://biomejs.dev/schemas/2.4.
|
|
88
|
+
`https://biomejs.dev/schemas/2.4.16/schema.json`
|
|
147
89
|
|
|
148
90
|
### Formatter
|
|
149
91
|
|
|
@@ -209,10 +151,10 @@ All configurations share the same base defaults.
|
|
|
209
151
|
|
|
210
152
|
### Overrides
|
|
211
153
|
|
|
212
|
-
| File pattern
|
|
213
|
-
|
|
214
|
-
| `**/package.json` | assist.actions.source.useSortedKeys
|
|
215
|
-
| `**/package.json` | json.formatter.expand
|
|
154
|
+
| File pattern | Setting | Value |
|
|
155
|
+
|------|---------|-------|
|
|
156
|
+
| `**/package.json` | assist.actions.source.useSortedKeys | `"off"` |
|
|
157
|
+
| `**/package.json` | json.formatter.expand | `"always"` |
|
|
216
158
|
|
|
217
159
|
### Assist
|
|
218
160
|
|
|
@@ -239,23 +181,24 @@ Same as base recommended, plus enables the **React domain** (`"react": "recommen
|
|
|
239
181
|
|
|
240
182
|
The most opinionated configuration. Enables all recommended rules plus **200+ optional and nursery rules** across 8 categories. Every non-recommended JS/TS rule available in Biome is explicitly configured.
|
|
241
183
|
|
|
242
|
-
- **a11y** — Selectively disables noisy rules (`useButtonType`, `useKeyWithClickEvents`, `useSemanticElements`, `noStaticElementInteractions`, `noNoninteractiveElementToInteractiveRole`) while keeping the rest at recommended defaults.
|
|
184
|
+
- **a11y** — Selectively disables noisy rules (`useButtonType`, `useKeyWithClickEvents`, `useSemanticElements`, `noStaticElementInteractions`, `noNoninteractiveElementToInteractiveRole`) and downgrades `useFocusableInteractive` to `info`, while keeping the rest at recommended defaults.
|
|
243
185
|
|
|
244
186
|
- **complexity** (12 rules) — Monitors cognitive complexity, function length, nested test suites, and logic expressions. Warns on `forEach`, implicit coercions, `void`, and useless patterns.
|
|
245
187
|
|
|
246
188
|
- **correctness** (12 rules) — Ensures no undeclared variables/dependencies, proper React patterns (`noReactPropAssignments`, `noNestedComponentDefinitions`), Node.js guards (`noNodejsModules`, `noProcessGlobal`, `noGlobalDirnameFilename`), and JSON import attributes. `noUnresolvedImports` is disabled since TypeScript already performs these checks.
|
|
247
189
|
|
|
248
|
-
- **nursery** (
|
|
190
|
+
- **nursery** (100 rules) — Opts into all experimental rules. Highlights include:
|
|
249
191
|
- **Errors:** `noJsxPropsBind`, `noLeakedRender`, `noMisusedPromises`, `noMultiAssign`, `noMultiStr`, `noParametersOnlyUsedInRecursion`
|
|
250
192
|
- **Complexity:** `noExcessiveClassesPerFile`, `noExcessiveLinesPerFile`, `noExcessiveNestedCallbacks`
|
|
251
193
|
- **Promises:** `noFloatingPromises`, `noNestedPromises`, `useAwaitThenable`
|
|
252
194
|
- **TypeScript:** `useConsistentEnumValueType`, `useConsistentMethodSignatures`, `useExhaustiveSwitchCases`, `useExplicitReturnType`, `noMisleadingReturnType`, `noUselessTypeConversion`, `useNullishCoalescing`, `useReduceTypeParameter`
|
|
195
|
+
- **Object/class hygiene:** `noBaseToString` (catches accidental `"[object Object]"` stringification), `useThisInClassMethods`
|
|
253
196
|
- **Resource management:** `useDisposables` (enforces `using` for `Disposable`/`AsyncDisposable`)
|
|
254
197
|
- **Regex:** `useNamedCaptureGroup`, `useUnicodeRegex`, `useRegexpExec`, `useRegexpTest`
|
|
255
198
|
- **DOM:** `useDomNodeTextContent`, `useDomQuerySelector`
|
|
256
199
|
- **Math:** `useMathMinMax`
|
|
257
200
|
- **Styling:** `noDuplicateSelectors`, `noInlineStyles`, `noExcessiveSelectorClasses`
|
|
258
|
-
- **Testing:** `useConsistentTestIt`, `useExpect`, `noConditionalExpect`, `noIdenticalTestTitle`, `useTestHooksOnTop`
|
|
201
|
+
- **Testing:** `useConsistentTestIt`, `useExpect`, `noConditionalExpect`, `noIdenticalTestTitle`, `useTestHooksInOrder`, `useTestHooksOnTop`
|
|
259
202
|
- **Playwright:** Full suite of 11 Playwright rules
|
|
260
203
|
- **Drizzle:** `noDrizzleDeleteWithoutWhere`, `noDrizzleUpdateWithoutWhere`
|
|
261
204
|
- **Tailwind:** `useSortedClasses`, `noFloatingClasses`
|
|
@@ -316,6 +259,16 @@ Same as React balanced, but **without nursery (experimental) rules**. All non-nu
|
|
|
316
259
|
- **Non-React projects** — use `@dvashim/biome-config` (base recommended).
|
|
317
260
|
- **React projects** — start with `react-balanced` for a good trade-off between strictness and practicality. Move to `react-strict` once your codebase is clean, or `react-recommended` if you only want Biome's built-in defaults. Use the `-stable` variants if you want to avoid nursery (experimental) rules.
|
|
318
261
|
|
|
262
|
+
### What version of Biome and Node do I need?
|
|
263
|
+
|
|
264
|
+
These presets are built and tested against **Biome 2.4.16** — the version their `$schema` is pinned to (see [Defaults → Schema](#schema)) — and require **Node.js >= 24**. Biome is not bundled, so install a compatible version yourself:
|
|
265
|
+
|
|
266
|
+
```bash
|
|
267
|
+
pnpm add -D @biomejs/biome@^2.4.16
|
|
268
|
+
```
|
|
269
|
+
|
|
270
|
+
The `$schema` in the examples uses `.../schemas/latest/schema.json` for convenience; pin it to `.../schemas/2.4.16/schema.json` to match the presets exactly and silence editor warnings about unknown fields.
|
|
271
|
+
|
|
319
272
|
### How do I override a rule from the preset?
|
|
320
273
|
|
|
321
274
|
Add a `linter.rules` section in your `biome.json`. Local settings merge with and take precedence over the preset:
|
|
@@ -361,3 +314,16 @@ Yes. Biome natively supports TypeScript — no additional configuration is neede
|
|
|
361
314
|
### Can I use this in a monorepo?
|
|
362
315
|
|
|
363
316
|
Yes. Install the package at the root and reference it in each workspace's `biome.json`. Each workspace can extend a different preset and add its own overrides.
|
|
317
|
+
|
|
318
|
+
## Contributing
|
|
319
|
+
|
|
320
|
+
Issues and pull requests are welcome. The repo uses [pnpm](https://pnpm.io) and [Changesets](https://github.com/changesets/changesets):
|
|
321
|
+
|
|
322
|
+
1. `pnpm install`
|
|
323
|
+
2. Edit the presets in `dist/` — they are checked in directly, so there is no build step. After changing `react-strict` or `react-balanced`, run `pnpm run sync-stable` to regenerate the `-stable` variants.
|
|
324
|
+
3. `pnpm run check` to validate formatting, package exports, and `-stable` sync.
|
|
325
|
+
4. `pnpm changeset` to record a user-facing change.
|
|
326
|
+
|
|
327
|
+
## License
|
|
328
|
+
|
|
329
|
+
[MIT](LICENSE)
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
{
|
|
2
|
-
"$schema": "https://biomejs.dev/schemas/2.4.
|
|
2
|
+
"$schema": "https://biomejs.dev/schemas/2.4.16/schema.json",
|
|
3
3
|
|
|
4
4
|
"assist": {
|
|
5
5
|
"actions": {
|
|
@@ -103,6 +103,7 @@
|
|
|
103
103
|
},
|
|
104
104
|
"nursery": {
|
|
105
105
|
"noAmbiguousAnchorText": "warn",
|
|
106
|
+
"noBaseToString": "warn",
|
|
106
107
|
"noComponentHookFactories": "warn",
|
|
107
108
|
"noConditionalExpect": "warn",
|
|
108
109
|
"noContinue": "info",
|
|
@@ -195,7 +196,9 @@
|
|
|
195
196
|
"useSortedClasses": "warn",
|
|
196
197
|
"useSpread": "warn",
|
|
197
198
|
"useStringStartsEndsWith": "warn",
|
|
199
|
+
"useTestHooksInOrder": "warn",
|
|
198
200
|
"useTestHooksOnTop": "warn",
|
|
201
|
+
"useThisInClassMethods": "warn",
|
|
199
202
|
"useUnicodeRegex": "warn",
|
|
200
203
|
"useVarsOnTop": "warn",
|
|
201
204
|
"noIncrementDecrement": {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
{
|
|
2
|
-
"$schema": "https://biomejs.dev/schemas/2.4.
|
|
2
|
+
"$schema": "https://biomejs.dev/schemas/2.4.16/schema.json",
|
|
3
3
|
|
|
4
4
|
"assist": {
|
|
5
5
|
"actions": {
|
|
@@ -98,6 +98,7 @@
|
|
|
98
98
|
},
|
|
99
99
|
"nursery": {
|
|
100
100
|
"noAmbiguousAnchorText": "warn",
|
|
101
|
+
"noBaseToString": "warn",
|
|
101
102
|
"noComponentHookFactories": "warn",
|
|
102
103
|
"noConditionalExpect": "warn",
|
|
103
104
|
"noContinue": "warn",
|
|
@@ -191,7 +192,9 @@
|
|
|
191
192
|
"useSortedClasses": "warn",
|
|
192
193
|
"useSpread": "warn",
|
|
193
194
|
"useStringStartsEndsWith": "warn",
|
|
195
|
+
"useTestHooksInOrder": "warn",
|
|
194
196
|
"useTestHooksOnTop": "warn",
|
|
197
|
+
"useThisInClassMethods": "warn",
|
|
195
198
|
"useUnicodeRegex": "warn",
|
|
196
199
|
"useVarsOnTop": "warn"
|
|
197
200
|
},
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dvashim/biome-config",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.9.1",
|
|
4
4
|
"description": "Shared Biome Configurations",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"biome",
|
|
@@ -46,10 +46,10 @@
|
|
|
46
46
|
"dist"
|
|
47
47
|
],
|
|
48
48
|
"devDependencies": {
|
|
49
|
-
"@biomejs/biome": "^2.4.
|
|
50
|
-
"@changesets/changelog-github": "^0.
|
|
49
|
+
"@biomejs/biome": "^2.4.16",
|
|
50
|
+
"@changesets/changelog-github": "^0.7.0",
|
|
51
51
|
"@changesets/cli": "^2.31.0",
|
|
52
|
-
"validate-package-exports": "^0.
|
|
52
|
+
"validate-package-exports": "^1.0.0"
|
|
53
53
|
},
|
|
54
54
|
"engines": {
|
|
55
55
|
"node": ">=24"
|
|
@@ -61,6 +61,8 @@
|
|
|
61
61
|
"changeset": "changeset",
|
|
62
62
|
"check": "pnpm run \"/^check:.*/\"",
|
|
63
63
|
"check:exports": "validate-package-exports --check",
|
|
64
|
-
"check:format": "biome format"
|
|
64
|
+
"check:format": "biome format",
|
|
65
|
+
"check:sync-stable": "node scripts/sync-stable.mjs --check",
|
|
66
|
+
"sync-stable": "node scripts/sync-stable.mjs"
|
|
65
67
|
}
|
|
66
68
|
}
|