Skip to content

Commit 373654e

Browse files
committed
Migrate to Biome
1 parent dba0fec commit 373654e

15 files changed

+308
-2369
lines changed

.eslintignore

-14
This file was deleted.

.eslintrc.cjs

-72
This file was deleted.

.github/workflows/deploy.yml

+10-17
Original file line numberDiff line numberDiff line change
@@ -35,27 +35,20 @@ jobs:
3535
- name: Check formatting
3636
run: npm run pretty
3737

38-
eslint:
39-
name: ESLint
38+
biome:
39+
name: Biome
4040
runs-on: ubuntu-latest
4141
steps:
4242
- name: Checkout repo
4343
uses: actions/checkout@v4
4444

45-
- name: Setup Node
46-
uses: actions/setup-node@v4
45+
- name: Setup Biome
46+
uses: biomejs/setup-biome@v2
4747
with:
48-
node-version: 18
49-
cache: npm
50-
51-
- name: Install dependencies
52-
run: npm ci
53-
54-
- name: Check config
55-
run: npm run lint:check-config
48+
version: latest
5649

57-
- name: Lint
58-
run: npm run lint
50+
- name: Run Biome
51+
run: biome ci .
5952

6053
typescript:
6154
name: TypeScript
@@ -138,7 +131,7 @@ jobs:
138131
deploy:
139132
name: Deploy
140133
runs-on: ubuntu-latest
141-
needs: [prettier, eslint, typescript, vitest, playwright]
134+
needs: [prettier, biome, typescript, vitest, playwright]
142135
# only deploy main/dev branch on pushes
143136
if: ${{ (github.ref == 'refs/heads/main' || github.ref == 'refs/heads/dev') && github.event_name == 'push' }}
144137

@@ -150,8 +143,8 @@ jobs:
150143
uses: SebRollen/[email protected]
151144
id: app_name
152145
with:
153-
file: "fly.toml"
154-
field: "app"
146+
file: 'fly.toml'
147+
field: 'app'
155148

156149
- name: Set up Fly
157150
uses: superfly/flyctl-actions/setup-flyctl@master

.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ node_modules
66

77
# text editors
88
.idea
9+
.zed
910

1011
# secrets
1112
.env*.local

app/components/Comments.tsx

+20-24
Original file line numberDiff line numberDiff line change
@@ -24,30 +24,26 @@ export default function Comments() {
2424
theme = 'github-light'
2525
}
2626

27-
const initialize = useCallback<React.RefCallback<HTMLDivElement>>(
28-
(node) => {
29-
if (!node) return
30-
31-
if (import.meta.hot) {
32-
node.replaceChildren()
33-
}
34-
35-
const scriptEl = document.createElement('script')
36-
37-
scriptEl.src = SOURCE
38-
scriptEl.async = true
39-
scriptEl.setAttribute('crossorigin', 'anonymous')
40-
41-
scriptEl.setAttribute('repo', REPO)
42-
scriptEl.setAttribute('issue-term', ISSUE_TERM)
43-
scriptEl.setAttribute('theme', theme)
44-
45-
node.appendChild(scriptEl)
46-
},
47-
// comment section should not reset when the theme changes in case the reader is typing a comment
48-
// eslint-disable-next-line react-hooks/exhaustive-deps
49-
[],
50-
)
27+
// biome-ignore lint/correctness/useExhaustiveDependencies: comment section should not reset when the theme changes in case the reader is typing a comment
28+
const initialize = useCallback<React.RefCallback<HTMLDivElement>>((node) => {
29+
if (!node) return
30+
31+
if (import.meta.hot) {
32+
node.replaceChildren()
33+
}
34+
35+
const scriptEl = document.createElement('script')
36+
37+
scriptEl.src = SOURCE
38+
scriptEl.async = true
39+
scriptEl.setAttribute('crossorigin', 'anonymous')
40+
41+
scriptEl.setAttribute('repo', REPO)
42+
scriptEl.setAttribute('issue-term', ISSUE_TERM)
43+
scriptEl.setAttribute('theme', theme)
44+
45+
node.appendChild(scriptEl)
46+
}, [])
5147

5248
return <div ref={initialize} />
5349
}

app/components/Header.tsx

+3-2
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ export default function Header() {
3737
y="0.025"
3838
width="64"
3939
height="64"
40-
></rect>
40+
/>
4141
<path
4242
className="fill-current text-white"
4343
d="M31.989,22.518c-0.031,-4.597 -0.902,-8.134 -2.612,-10.613c-1.71,-2.478 -4.165,-3.717 -7.365,-3.717c-3.2,0 -5.655,1.251 -7.365,3.753c-1.71,2.502 -2.565,6.114 -2.565,10.836l0,6.471c0.063,4.549 0.953,8.043 2.671,10.483c1.718,2.439 4.153,3.659 7.306,3.659c3.185,0 5.636,-1.255 7.354,-3.765c1.717,-2.51 2.576,-6.134 2.576,-10.871l0,-6.236Zm-6.682,7.647c-0.032,2.605 -0.31,4.538 -0.836,5.801c-0.525,1.263 -1.329,1.894 -2.412,1.894c-1.145,0 -1.988,-0.675 -2.529,-2.024c-0.542,-1.349 -0.812,-3.404 -0.812,-6.165l0,-8.541c0.078,-4.942 1.176,-7.413 3.294,-7.413c1.13,0 1.961,0.675 2.494,2.024c0.534,1.349 0.801,3.373 0.801,6.071l0,8.353Z"
@@ -50,7 +50,8 @@ export default function Header() {
5050
y="0.025"
5151
width="64"
5252
height="64"
53-
></rect>
53+
/>
54+
5455
<path
5556
className="fill-current text-white"
5657
d="M44.945,55.261l-6.553,0l0,-25.659l-6.392,2.469l0,-5.446l12.253,-5.007l0.692,0l0,33.643Z"

app/components/HotTip.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import React from 'react'
1+
import type React from 'react'
22

33
interface Props {
44
children: React.ReactNode

app/components/ProseImage.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ export default function ProseImage({
4444
'--height': height,
4545
}}
4646
>
47-
{/* eslint-disable-next-line jsx-a11y/alt-text */}
47+
{/* biome-ignore lint/a11y/useAltText: alt is passed through props */}
4848
<img
4949
{...props}
5050
className={clsx(props.className, 'rounded-lg')}

app/routes/feed[.]rss.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import type { LoaderFunction } from '@remix-run/node'
22
import { Feed } from 'feed'
3-
import path from 'path'
3+
import path from 'node:path'
44
import cloudinary from '~/utils/cloudinary'
55
import { getAllPostsMeta } from '~/utils/posts.server'
66
import { getDomainUrl } from '~/utils/http'

app/utils/posts.server.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
import fs from 'fs/promises'
2-
import { basename, dirname, join as joinPath } from 'path'
1+
import fs from 'node:fs/promises'
2+
import { basename, dirname, join as joinPath } from 'node:path'
33

44
const standalonePostFrontmatter = import.meta.glob<StandalonePostFrontmattter>(
55
'/posts/*.mdx',

biome.json

+41
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
{
2+
"$schema": "https://biomejs.dev/schemas/1.9.4/schema.json",
3+
"vcs": {
4+
"enabled": true,
5+
"clientKind": "git",
6+
"useIgnoreFile": true
7+
},
8+
"files": {
9+
"ignoreUnknown": false,
10+
"ignore": []
11+
},
12+
"formatter": {
13+
"enabled": false
14+
},
15+
"organizeImports": {
16+
"enabled": false
17+
},
18+
"linter": {
19+
"enabled": true,
20+
"rules": {
21+
"recommended": true,
22+
"style": {
23+
"noNonNullAssertion": "off",
24+
"noParameterAssign": "off",
25+
"noUnusedTemplateLiteral": "off"
26+
},
27+
"security": {
28+
"noDangerouslySetInnerHtml": "off"
29+
},
30+
"correctness": {
31+
"noUnknownFunction": "off"
32+
},
33+
"a11y": {
34+
"noSvgWithoutTitle": "off"
35+
},
36+
"complexity": {
37+
"useRegexLiterals": "off"
38+
}
39+
}
40+
}
41+
}

lefthook.yml

+4-6
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,10 @@
33
pre-commit:
44
piped: true
55
commands:
6-
eslint:
6+
biome:
77
priority: 1
8-
glob: "*.{js,cjs,ts,tsx}"
9-
run: npx eslint --fix {staged_files}
8+
glob: '*.{js,ts,tsx}'
9+
run: npx biome check --write {staged_files}
1010
stage_fixed: true
1111
prettier:
1212
priority: 2
@@ -16,9 +16,7 @@ pre-commit:
1616
pre-push:
1717
parallel: true
1818
commands:
19-
eslint-check-config:
20-
run: npm run lint:check-config
21-
eslint:
19+
biome:
2220
run: npm run lint
2321
prettier:
2422
run: npm run pretty

0 commit comments

Comments
 (0)