@rammio/biome-config 0.0.0-stage → 0.1.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/LICENSE +21 -0
- package/README.md +134 -2
- package/config.json +174 -0
- package/package.json +21 -3
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 rammio contributors
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -1,3 +1,135 @@
|
|
|
1
|
-
#
|
|
1
|
+
# @rammio/biome-config
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Shared Biome 2 config.
|
|
4
|
+
|
|
5
|
+
```jsonc
|
|
6
|
+
// biome.json
|
|
7
|
+
{
|
|
8
|
+
"$schema": "./node_modules/@biomejs/biome/configuration_schema.json",
|
|
9
|
+
"extends": ["@rammio/biome-config/biome"]
|
|
10
|
+
}
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
Install it alongside Biome, pinning Biome to an exact version:
|
|
14
|
+
|
|
15
|
+
```sh
|
|
16
|
+
pnpm add -D -E @biomejs/biome @rammio/biome-config
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
Biome recommends the exact pin because patch releases can change lint and format output.
|
|
20
|
+
|
|
21
|
+
## What it enforces
|
|
22
|
+
|
|
23
|
+
| Convention | Rule |
|
|
24
|
+
| ---------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
25
|
+
| kebab-case file names | `style/useFilenamingConvention` (off under `routes/` for router file conventions) |
|
|
26
|
+
| Named exports only | `style/noDefaultExport` (off for `*.config.*`, stories, `.storybook/`, `.d.ts`) |
|
|
27
|
+
| No barrels inside apps | `performance/noBarrelFile`, `performance/noReExportAll` (both off for `src/index.{ts,tsx,js,jsx}`, a library's public entry point; `noBarrelFile` alone off for `features/*/index.{ts,tsx}` and `components/*/index.{ts,tsx}`, so a feature or component folder may have an index that names its exports but not `export *`) |
|
|
28
|
+
| `import type` / `export type` | `style/useImportType`, `style/useExportType` |
|
|
29
|
+
| Fast Refresh safe component files | `style/useComponentExportOnlyModules` (warn) |
|
|
30
|
+
| `type` over `interface` | `style/useConsistentTypeDefinitions` (warn) |
|
|
31
|
+
| No `enum` / `namespace` / parameter properties | `style/noEnum`, `style/noNamespace`, `style/noParameterProperties` |
|
|
32
|
+
| Function components only | `style/useReactFunctionComponents` |
|
|
33
|
+
| Naming conventions | `style/useNamingConvention` (warn, off in tests; object and type property keys may use any case so API payloads, MSW handlers and HTTP headers stay quiet) |
|
|
34
|
+
| Hooks rules | `correctness/useHookAtTopLevel`, `correctness/useExhaustiveDependencies` |
|
|
35
|
+
|
|
36
|
+
Formatting: 2 spaces, width 80, double quotes (in JSX too), semicolons, trailing commas. Biome's assist sorts imports, JSX attributes, interface members, CSS properties and `package.json` fields.
|
|
37
|
+
|
|
38
|
+
## Overriding in a project
|
|
39
|
+
|
|
40
|
+
Local settings win over extended ones:
|
|
41
|
+
|
|
42
|
+
```jsonc
|
|
43
|
+
{
|
|
44
|
+
"extends": ["@rammio/biome-config/biome"],
|
|
45
|
+
"linter": { "rules": { "style": { "useNamingConvention": "off" } } }
|
|
46
|
+
}
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
## Respecting `.gitignore`
|
|
50
|
+
|
|
51
|
+
The shared config ignores `dist`, `coverage`, generated `*.gen.ts` files (including TanStack Router's `routeTree.gen.ts`), `.changeset`, `.agents/skills` and `.claude/skills`, but it does not turn on Biome's VCS integration, because Biome exits with an error when that is enabled outside a git repository (a Docker build without `.git`, for example). To skip everything in your `.gitignore`, enable it in the project:
|
|
52
|
+
|
|
53
|
+
```jsonc
|
|
54
|
+
{
|
|
55
|
+
"extends": ["@rammio/biome-config/biome"],
|
|
56
|
+
"vcs": { "enabled": true, "clientKind": "git", "useIgnoreFile": true }
|
|
57
|
+
}
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
## Enabling Tailwind
|
|
61
|
+
|
|
62
|
+
Biome's CSS parser rejects Tailwind 4 directives such as `@theme`, `@utility`, `@variant`, `@source` and `@apply` unless told to expect them. The shared config leaves this off, so projects that use Tailwind turn it on:
|
|
63
|
+
|
|
64
|
+
```jsonc
|
|
65
|
+
{
|
|
66
|
+
"extends": ["@rammio/biome-config/biome"],
|
|
67
|
+
"css": { "parser": { "tailwindDirectives": true } }
|
|
68
|
+
}
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
## VS Code setup
|
|
72
|
+
|
|
73
|
+
Install the [Biome extension](https://marketplace.visualstudio.com/items?itemName=biomejs.biome) (`biomejs.biome`), then add this to the project's `.vscode/settings.json`:
|
|
74
|
+
|
|
75
|
+
```jsonc
|
|
76
|
+
{
|
|
77
|
+
"editor.defaultFormatter": "biomejs.biome",
|
|
78
|
+
"editor.formatOnSave": true,
|
|
79
|
+
"editor.codeActionsOnSave": {
|
|
80
|
+
"source.fixAll.biome": "explicit"
|
|
81
|
+
},
|
|
82
|
+
"css.lint.unknownAtRules": "ignore"
|
|
83
|
+
}
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
- `editor.defaultFormatter` and `editor.formatOnSave` format files with Biome on save.
|
|
87
|
+
- `source.fixAll.biome` applies Biome's safe lint fixes on save.
|
|
88
|
+
- `css.lint.unknownAtRules` stops VS Code's built-in CSS linter from flagging Tailwind directives such as `@theme` and `@apply`. Biome still checks CSS once [Tailwind is enabled](#enabling-tailwind).
|
|
89
|
+
|
|
90
|
+
## Pre-commit filename check
|
|
91
|
+
|
|
92
|
+
The kebab-case file name rule exists to stop case-only differences in file names, which behave differently on macOS and Linux. Biome's editor extension doesn't show this rule, because the diagnostic has no line to attach to, so a badly named file is easy to commit without noticing.
|
|
93
|
+
|
|
94
|
+
This command checks only that rule, and only on staged files. Other lint errors and formatting don't block the commit, so work in progress can still be committed:
|
|
95
|
+
|
|
96
|
+
```sh
|
|
97
|
+
biome lint --only=style/useFilenamingConvention --staged --no-errors-on-unmatched
|
|
98
|
+
```
|
|
99
|
+
|
|
100
|
+
To run it on every commit with [Husky](https://typicode.github.io/husky/):
|
|
101
|
+
|
|
102
|
+
```sh
|
|
103
|
+
pnpm add -D husky
|
|
104
|
+
pnpm exec husky init
|
|
105
|
+
```
|
|
106
|
+
|
|
107
|
+
Then replace the contents of `.husky/pre-commit` with:
|
|
108
|
+
|
|
109
|
+
```sh
|
|
110
|
+
pnpm exec biome lint --only=style/useFilenamingConvention --staged --no-errors-on-unmatched
|
|
111
|
+
```
|
|
112
|
+
|
|
113
|
+
Files under `routes/` are exempt from the rule, but `--only` still prints an info-level note for them. It doesn't fail the commit.
|
|
114
|
+
|
|
115
|
+
The hook can be skipped with `git commit --no-verify`, so keep running the full `biome check` in CI.
|
|
116
|
+
|
|
117
|
+
## Opt-in key sorting
|
|
118
|
+
|
|
119
|
+
Object keys are deliberately **not** sorted by this config. TanStack Router and TanStack Query infer types from the order of option properties (for example `validateSearch` before `loaderDeps`, or `queryKey` before `queryFn`), so sorting them can break inference.
|
|
120
|
+
|
|
121
|
+
Turn sorting on per file or folder where order carries no meaning, such as translation catalogues or lookup tables. In Biome 2 it's an assist action, so `biome check` reports unsorted keys and `biome check --write` sorts them:
|
|
122
|
+
|
|
123
|
+
```jsonc
|
|
124
|
+
{
|
|
125
|
+
"extends": ["@rammio/biome-config/biome"],
|
|
126
|
+
"overrides": [
|
|
127
|
+
{
|
|
128
|
+
"includes": ["src/i18n/**"],
|
|
129
|
+
"assist": { "actions": { "source": { "useSortedKeys": "on" } } }
|
|
130
|
+
}
|
|
131
|
+
]
|
|
132
|
+
}
|
|
133
|
+
```
|
|
134
|
+
|
|
135
|
+
Your `overrides` are added to the shared ones; they don't replace them. Don't enable it project-wide. Key sorting stays off for `package.json`, which `useSortedPackageJson` orders by its own conventions instead.
|
package/config.json
ADDED
|
@@ -0,0 +1,174 @@
|
|
|
1
|
+
{
|
|
2
|
+
"assist": {
|
|
3
|
+
"actions": {
|
|
4
|
+
"source": {
|
|
5
|
+
"organizeImports": "on",
|
|
6
|
+
"useSortedAttributes": "on",
|
|
7
|
+
"useSortedInterfaceMembers": "on",
|
|
8
|
+
"useSortedPackageJson": "on",
|
|
9
|
+
"useSortedProperties": "on"
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
},
|
|
13
|
+
"files": {
|
|
14
|
+
"ignoreUnknown": true,
|
|
15
|
+
"includes": [
|
|
16
|
+
"**",
|
|
17
|
+
"!**/dist",
|
|
18
|
+
"!**/coverage",
|
|
19
|
+
"!**/*.gen.ts",
|
|
20
|
+
"!**/routeTree.gen.ts",
|
|
21
|
+
"!**/.changeset",
|
|
22
|
+
"!**/.agents/skills",
|
|
23
|
+
"!**/.claude/skills"
|
|
24
|
+
]
|
|
25
|
+
},
|
|
26
|
+
"formatter": {
|
|
27
|
+
"enabled": true,
|
|
28
|
+
"formatWithErrors": false,
|
|
29
|
+
"indentStyle": "space",
|
|
30
|
+
"indentWidth": 2,
|
|
31
|
+
"lineWidth": 80
|
|
32
|
+
},
|
|
33
|
+
"javascript": {
|
|
34
|
+
"formatter": {
|
|
35
|
+
"jsxQuoteStyle": "double",
|
|
36
|
+
"quoteStyle": "double",
|
|
37
|
+
"semicolons": "always",
|
|
38
|
+
"trailingCommas": "all"
|
|
39
|
+
}
|
|
40
|
+
},
|
|
41
|
+
"linter": {
|
|
42
|
+
"domains": {
|
|
43
|
+
"react": "recommended"
|
|
44
|
+
},
|
|
45
|
+
"enabled": true,
|
|
46
|
+
"rules": {
|
|
47
|
+
"correctness": {
|
|
48
|
+
"useExhaustiveDependencies": "error",
|
|
49
|
+
"useHookAtTopLevel": "error"
|
|
50
|
+
},
|
|
51
|
+
"performance": {
|
|
52
|
+
"noBarrelFile": "error",
|
|
53
|
+
"noReExportAll": "error"
|
|
54
|
+
},
|
|
55
|
+
"style": {
|
|
56
|
+
"noDefaultExport": "error",
|
|
57
|
+
"noEnum": "error",
|
|
58
|
+
"noNamespace": "error",
|
|
59
|
+
"noParameterProperties": "error",
|
|
60
|
+
"useComponentExportOnlyModules": {
|
|
61
|
+
"level": "warn",
|
|
62
|
+
"options": { "allowConstantExport": true }
|
|
63
|
+
},
|
|
64
|
+
"useConsistentTypeDefinitions": {
|
|
65
|
+
"level": "warn",
|
|
66
|
+
"options": { "style": "type" }
|
|
67
|
+
},
|
|
68
|
+
"useExportType": "error",
|
|
69
|
+
"useFilenamingConvention": {
|
|
70
|
+
"level": "error",
|
|
71
|
+
"options": {
|
|
72
|
+
"filenameCases": ["kebab-case"],
|
|
73
|
+
"requireAscii": true,
|
|
74
|
+
"strictCase": true
|
|
75
|
+
}
|
|
76
|
+
},
|
|
77
|
+
"useImportType": "error",
|
|
78
|
+
"useNamingConvention": {
|
|
79
|
+
"level": "warn",
|
|
80
|
+
"options": {
|
|
81
|
+
"conventions": [
|
|
82
|
+
{
|
|
83
|
+
"formats": [
|
|
84
|
+
"camelCase",
|
|
85
|
+
"PascalCase",
|
|
86
|
+
"snake_case",
|
|
87
|
+
"CONSTANT_CASE"
|
|
88
|
+
],
|
|
89
|
+
"selector": { "kind": "objectLiteralProperty" }
|
|
90
|
+
},
|
|
91
|
+
{
|
|
92
|
+
"formats": [
|
|
93
|
+
"camelCase",
|
|
94
|
+
"PascalCase",
|
|
95
|
+
"snake_case",
|
|
96
|
+
"CONSTANT_CASE"
|
|
97
|
+
],
|
|
98
|
+
"selector": { "kind": "typeProperty" }
|
|
99
|
+
}
|
|
100
|
+
],
|
|
101
|
+
"requireAscii": true,
|
|
102
|
+
"strictCase": false
|
|
103
|
+
}
|
|
104
|
+
},
|
|
105
|
+
"useReactFunctionComponents": "error"
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
},
|
|
109
|
+
"overrides": [
|
|
110
|
+
{
|
|
111
|
+
"includes": [
|
|
112
|
+
"**/*.config.*",
|
|
113
|
+
"**/*.stories.tsx",
|
|
114
|
+
"**/.storybook/**",
|
|
115
|
+
"**/*.d.ts"
|
|
116
|
+
],
|
|
117
|
+
"linter": {
|
|
118
|
+
"rules": {
|
|
119
|
+
"style": { "noDefaultExport": "off" }
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
},
|
|
123
|
+
{
|
|
124
|
+
"includes": ["**/routes/**"],
|
|
125
|
+
"linter": {
|
|
126
|
+
"rules": {
|
|
127
|
+
"style": { "useFilenamingConvention": "off" }
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
},
|
|
131
|
+
{
|
|
132
|
+
"includes": ["**/src/index.{ts,tsx,js,jsx}"],
|
|
133
|
+
"linter": {
|
|
134
|
+
"rules": {
|
|
135
|
+
"performance": { "noBarrelFile": "off", "noReExportAll": "off" }
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
},
|
|
139
|
+
{
|
|
140
|
+
"includes": [
|
|
141
|
+
"**/features/*/index.{ts,tsx}",
|
|
142
|
+
"**/components/*/index.{ts,tsx}"
|
|
143
|
+
],
|
|
144
|
+
"linter": {
|
|
145
|
+
"rules": {
|
|
146
|
+
"performance": { "noBarrelFile": "off" }
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
},
|
|
150
|
+
{
|
|
151
|
+
"includes": [
|
|
152
|
+
"**/*.test.ts",
|
|
153
|
+
"**/*.test.tsx",
|
|
154
|
+
"**/*.spec.ts",
|
|
155
|
+
"**/*.spec.tsx"
|
|
156
|
+
],
|
|
157
|
+
"linter": {
|
|
158
|
+
"rules": {
|
|
159
|
+
"style": { "useNamingConvention": "off" }
|
|
160
|
+
}
|
|
161
|
+
}
|
|
162
|
+
},
|
|
163
|
+
{
|
|
164
|
+
"assist": {
|
|
165
|
+
"actions": {
|
|
166
|
+
"source": {
|
|
167
|
+
"useSortedKeys": "off"
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
},
|
|
171
|
+
"includes": ["**/package.json"]
|
|
172
|
+
}
|
|
173
|
+
]
|
|
174
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,24 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rammio/biome-config",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"
|
|
5
|
-
"
|
|
3
|
+
"version": "0.1.1",
|
|
4
|
+
"description": "Shared Biome config: formatting, import sorting and React/TS naming + export conventions",
|
|
5
|
+
"repository": {
|
|
6
|
+
"type": "git",
|
|
7
|
+
"url": "git+https://github.com/carnold84/rammio.git",
|
|
8
|
+
"directory": "packages/biome-config"
|
|
9
|
+
},
|
|
10
|
+
"license": "MIT",
|
|
11
|
+
"exports": {
|
|
12
|
+
"./biome": "./config.json",
|
|
13
|
+
"./package.json": "./package.json"
|
|
14
|
+
},
|
|
15
|
+
"files": [
|
|
16
|
+
"config.json"
|
|
17
|
+
],
|
|
18
|
+
"peerDependencies": {
|
|
19
|
+
"@biomejs/biome": "^2.5.0"
|
|
20
|
+
},
|
|
21
|
+
"publishConfig": {
|
|
22
|
+
"access": "public"
|
|
23
|
+
}
|
|
6
24
|
}
|