Skip to content

Commit 553ce29

Browse files
authored
dev: use biome (#1405)
* refactor: biome * fix: fix all errors * fix: fix all types and such * fix: restore head * fix: restore ci * fix: remove mentions of prettier * fix: fix issues impacting tests * fix: remove console.logs * fix: roll back some dependency arrays * fix: restore import react statements in emails
1 parent 13241c2 commit 553ce29

File tree

973 files changed

+32073
-34230
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

973 files changed

+32073
-34230
lines changed

.github/workflows/ci.yml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,7 @@ jobs:
2020
strategy:
2121
matrix:
2222
task:
23-
- format
24-
- lint
23+
- lint:ci
2524
- type-check
2625
- test-run
2726
env:

.vscode/settings.json

Lines changed: 50 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,55 @@
1010
"SKIP_VALIDATION": "true",
1111
"DATABASE_URL": "postgresql://postgres:postgres@localhost:54322/postgres"
1212
},
13-
"prettier.documentSelectors": ["**/*.astro"],
13+
14+
"prettier.enable": false,
15+
"[typescript]": {
16+
"editor.defaultFormatter": "biomejs.biome",
17+
"editor.codeActionsOnSave": {
18+
"source.biome": "always",
19+
"source.fixAll.biome": "always"
20+
}
21+
},
22+
"[javascript]": {
23+
"editor.defaultFormatter": "biomejs.biome",
24+
"editor.codeActionsOnSave": {
25+
"source.biome": "always",
26+
"source.fixAll.biome": "always"
27+
}
28+
},
29+
"[typescriptreact]": {
30+
"editor.defaultFormatter": "biomejs.biome",
31+
"editor.codeActionsOnSave": {
32+
"source.biome": "always",
33+
"source.fixAll.biome": "always"
34+
}
35+
},
36+
"[javascriptreact]": {
37+
"editor.defaultFormatter": "biomejs.biome",
38+
"editor.codeActionsOnSave": {
39+
"source.biome": "always",
40+
"source.fixAll.biome": "always"
41+
}
42+
},
43+
"[json]": {
44+
"editor.defaultFormatter": "biomejs.biome",
45+
"editor.codeActionsOnSave": {
46+
"source.biome": "always",
47+
"source.fixAll.biome": "always"
48+
}
49+
},
1450
"[astro]": {
15-
"editor.defaultFormatter": "esbenp.prettier-vscode"
16-
}
51+
"editor.defaultFormatter": "biomejs.biome",
52+
"editor.codeActionsOnSave": {
53+
"source.biome": "always",
54+
"source.fixAll.biome": "always"
55+
}
56+
},
57+
"tailwindCSS.files.exclude": [
58+
"**/.git/**",
59+
"**/node_modules/**",
60+
"**/.hg/**",
61+
"**/.svn/**",
62+
".local_data/**"
63+
]
1764
}

DEVELOPMENT.md

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -35,12 +35,6 @@ docker compose -f docker-compose.dev.yml up
3535

3636
you can now address on `localhost:3000` as before. note that `pnpm dev` uses the same ports and cannot be running at the same time.
3737

38-
## Prettier
39-
40-
At the moment, the repo simply uses prettier before adding any additional complexity with ESLint configs. Just auto-format (either on save, or on commit), and let the .prettierrc hold the small subset of decisions.
41-
42-
For a nicer DX, bind `Format Document` to a familiar keyboard shortcut so you can format the doc as you go (similar to format-on-save and then saving frequently).
43-
4438
## Git Hooks
4539

4640
Two hooks are defined using `husky` and stored in `.husky`.

babel.config.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
module.exports = {
22
presets: ["@babel/preset-env", "@babel/preset-react", "@babel/preset-typescript"],
3-
};
3+
}

biome.jsonc

Lines changed: 312 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,312 @@
1+
{
2+
"$schema": "https://biomejs.dev/schemas/2.3.6/schema.json",
3+
"files": {
4+
"includes": ["**", "!!**/*stoplight.styles.css"]
5+
},
6+
"formatter": {
7+
"enabled": true,
8+
"formatWithErrors": false,
9+
"indentStyle": "tab",
10+
"indentWidth": 4,
11+
"lineEnding": "lf",
12+
"lineWidth": 100,
13+
"attributePosition": "auto",
14+
"bracketSameLine": false,
15+
"bracketSpacing": true,
16+
"expand": "auto",
17+
"useEditorconfig": true,
18+
"includes": [
19+
"**",
20+
"!app/c/\\[communitySlug\\]/developers/docs/stoplight.styles.css",
21+
"!**/vitest-bench.local.json",
22+
"!**/*.html",
23+
"!node_modules/**"
24+
]
25+
},
26+
"linter": {
27+
"rules": {
28+
"recommended": true,
29+
"a11y": {
30+
"noAccessKey": "error",
31+
"noAriaUnsupportedElements": "error",
32+
"noAutofocus": "error",
33+
"noDistractingElements": "error",
34+
"noHeaderScope": "error",
35+
"noInteractiveElementToNoninteractiveRole": "error",
36+
"noLabelWithoutControl": "error",
37+
"noNoninteractiveElementInteractions": "error",
38+
"noNoninteractiveElementToInteractiveRole": "error",
39+
"noNoninteractiveTabindex": "error",
40+
"noPositiveTabindex": "error",
41+
"noRedundantAlt": "error",
42+
"noRedundantRoles": "error",
43+
"noStaticElementInteractions": "error",
44+
"useAltText": "error",
45+
"useAnchorContent": "error",
46+
"useAriaActivedescendantWithTabindex": "error",
47+
"useAriaPropsForRole": "error",
48+
"useAriaPropsSupportedByRole": "error",
49+
"useFocusableInteractive": "error",
50+
"useHeadingContent": "error",
51+
"useHtmlLang": "error",
52+
"useIframeTitle": "error",
53+
"useKeyWithClickEvents": "error",
54+
"useKeyWithMouseEvents": "error",
55+
"useMediaCaption": "error",
56+
"useValidAnchor": "error",
57+
"useValidAriaProps": "error",
58+
"useValidAriaRole": "error",
59+
"useValidAriaValues": "error",
60+
"useValidAutocomplete": "error"
61+
},
62+
"style": {
63+
"useImportType": "error",
64+
"useNodejsImportProtocol": {
65+
"level": "info",
66+
"fix": "safe"
67+
}
68+
},
69+
"suspicious": {
70+
"noUnknownAtRules": {
71+
"level": "error",
72+
"options": {
73+
"ignore": ["tailwind", "theme"]
74+
}
75+
}
76+
},
77+
"correctness": {
78+
"noUnusedVariables": {
79+
"level": "warn",
80+
"fix": "safe"
81+
},
82+
"noUnusedImports": {
83+
"level": "warn",
84+
"fix": "safe"
85+
},
86+
"useExhaustiveDependencies": "warn",
87+
"useHookAtTopLevel": "error",
88+
"useJsxKeyInIterable": "error"
89+
},
90+
"nursery": {
91+
"useSortedClasses": {
92+
"fix": "safe",
93+
"level": "error",
94+
"options": {
95+
"functions": ["cn", "cva"]
96+
}
97+
}
98+
}
99+
},
100+
"includes": [
101+
"**",
102+
"!node_modules/**",
103+
"!app/c/\\[communitySlug\\]/developers/docs/stoplight.styles.css"
104+
]
105+
},
106+
"javascript": {
107+
"formatter": {
108+
"jsxQuoteStyle": "double",
109+
"quoteProperties": "asNeeded",
110+
"trailingCommas": "es5",
111+
"semicolons": "asNeeded",
112+
"arrowParentheses": "always",
113+
"bracketSameLine": false,
114+
"quoteStyle": "double",
115+
"attributePosition": "auto",
116+
"bracketSpacing": true
117+
},
118+
"globals": []
119+
},
120+
"html": {
121+
"experimentalFullSupportEnabled": true,
122+
"formatter": {
123+
"indentScriptAndStyle": false,
124+
"selfCloseVoidElements": "always"
125+
}
126+
},
127+
"vcs": {
128+
"enabled": true,
129+
"clientKind": "git",
130+
"useIgnoreFile": true
131+
},
132+
"assist": {
133+
"actions": {
134+
"source": {
135+
"organizeImports": {
136+
"level": "on",
137+
"options": {
138+
"groups": [
139+
{
140+
"type": true,
141+
"source": [":NODE:", ":BUN:"]
142+
},
143+
":BLANK_LINE:",
144+
{
145+
"type": true
146+
},
147+
":BLANK_LINE:",
148+
{
149+
"type": true,
150+
"source": ["react", "react-dom", "react-native"]
151+
},
152+
{
153+
"type": true,
154+
"source": ["next", "next/**"]
155+
},
156+
{
157+
"type": true,
158+
"source": [
159+
":PACKAGE:",
160+
"!lib/**",
161+
"!db/**",
162+
"!ui/**",
163+
"!@pubpub/**",
164+
"!utils/**",
165+
"!contracts/**",
166+
"!logger/**",
167+
"!lib",
168+
"!db",
169+
"!ui",
170+
"!@pubpub",
171+
"!utils",
172+
"!contracts",
173+
"!logger"
174+
]
175+
},
176+
":BLANK_LINE:",
177+
{
178+
"type": true,
179+
"source": [
180+
"lib/**",
181+
"db/**",
182+
"ui/**",
183+
"@pubpub/**",
184+
"utils/**",
185+
"contracts/**",
186+
"logger/**",
187+
"lib",
188+
"db",
189+
"ui",
190+
"@pubpub",
191+
"utils",
192+
"contracts",
193+
"logger"
194+
]
195+
},
196+
":BLANK_LINE:",
197+
{
198+
"type": true,
199+
"source": [":ALIAS:", ":RELATIVE:"]
200+
},
201+
":BLANK_LINE:",
202+
{
203+
"type": false,
204+
"source": ["react", "react-dom", "react-native"]
205+
},
206+
{
207+
"type": false,
208+
"source": ["next", "next/**"]
209+
},
210+
{
211+
"type": false,
212+
"source": [
213+
":PACKAGE:",
214+
":NODE:",
215+
":BUN:",
216+
"!lib/**",
217+
"!db/**",
218+
"!ui/**",
219+
"!@pubpub/**",
220+
"!utils/**",
221+
"!contracts/**",
222+
"!logger/**",
223+
"!lib",
224+
"!db",
225+
"!ui",
226+
"!@pubpub",
227+
"!utils",
228+
"!contracts",
229+
"!logger"
230+
]
231+
},
232+
":BLANK_LINE:",
233+
{
234+
"type": false,
235+
"source": [
236+
"lib/**",
237+
"db/**",
238+
"ui/**",
239+
"@pubpub/**",
240+
"utils/**",
241+
"contracts/**",
242+
"logger/**",
243+
"lib",
244+
"db",
245+
"ui",
246+
"@pubpub",
247+
"utils",
248+
"contracts",
249+
"logger"
250+
]
251+
},
252+
":BLANK_LINE:",
253+
{
254+
"type": false,
255+
"source": [":ALIAS:", ":RELATIVE:"]
256+
},
257+
{
258+
"type": false,
259+
"source": ["**/*.css"]
260+
}
261+
]
262+
}
263+
},
264+
"recommended": true
265+
}
266+
}
267+
},
268+
"css": {
269+
"parser": {
270+
"tailwindDirectives": true
271+
}
272+
},
273+
274+
"overrides": [
275+
{
276+
"includes": [
277+
"packages/ui/**/*.tsx",
278+
"packages/context-editor/**/*.tsx",
279+
"packages/emails/**/*.tsx"
280+
],
281+
// so that the `import React from "react"` is not removed
282+
"javascript": {
283+
"jsxRuntime": "reactClassic"
284+
}
285+
},
286+
{
287+
// disabled until https://github.com/biomejs/biome/issues/7912 is fixed
288+
"includes": ["**/*.astro"],
289+
"linter": {
290+
"rules": {
291+
"correctness": {
292+
// it's unable to properly detect unused variables in Astro templates
293+
"noUnusedVariables": "off",
294+
"noUnusedImports": "off"
295+
}
296+
}
297+
},
298+
// "css": {
299+
// "formatter": {
300+
// "enabled": false
301+
// }
302+
// },
303+
"assist": {
304+
"actions": {
305+
"source": {
306+
"organizeImports": "off"
307+
}
308+
}
309+
}
310+
}
311+
]
312+
}

0 commit comments

Comments
 (0)