Skip to content

Commit e3ab552

Browse files
committed
Replace ESLint and Prettier with Biome (#941)
1 parent b2cd009 commit e3ab552

21 files changed

+204
-1501
lines changed

.github/workflows/ci.yml

+6-45
Original file line numberDiff line numberDiff line change
@@ -18,32 +18,11 @@ jobs:
1818
- name: Checkout
1919
uses: actions/checkout@v4
2020

21-
- name: Cache Yarn cache
22-
uses: actions/cache@v4
23-
env:
24-
cache-name: yarn-cache
25-
with:
26-
path: ~/.yarn/berry/cache
27-
key: ${{ runner.os }}-${{ env.cache-name }}-${{ hashFiles('**/yarn.lock') }}
28-
restore-keys: |
29-
${{ runner.os }}-${{ env.cache-name }}
30-
31-
- name: Use Node.js
32-
uses: actions/setup-node@v4
33-
with:
34-
node-version: '20'
35-
36-
- name: Enable Corepack
37-
run: corepack enable
38-
39-
- name: Install dependencies
40-
run: yarn --immutable
41-
42-
- name: Build package
43-
run: yarn build
21+
- name: Setup Biome
22+
uses: biomejs/setup-biome@v2
4423

4524
- name: Run tests
46-
run: yarn lint
25+
run: biome lint
4726

4827
typescript:
4928
name: Type checking
@@ -88,29 +67,11 @@ jobs:
8867
- name: Checkout
8968
uses: actions/checkout@v4
9069

91-
- name: Cache Yarn cache
92-
uses: actions/cache@v4
93-
env:
94-
cache-name: yarn-cache
95-
with:
96-
path: ~/.yarn/berry/cache
97-
key: ${{ runner.os }}-${{ env.cache-name }}-${{ hashFiles('**/yarn.lock') }}
98-
restore-keys: |
99-
${{ runner.os }}-${{ env.cache-name }}
100-
101-
- name: Use Node.js
102-
uses: actions/setup-node@v4
103-
with:
104-
node-version: '20'
105-
106-
- name: Enable Corepack
107-
run: corepack enable
108-
109-
- name: Install dependencies
110-
run: yarn --immutable
70+
- name: Setup Biome
71+
uses: biomejs/setup-biome@v2
11172

11273
- name: Run formatting
113-
run: yarn format
74+
run: biome format
11475

11576
unit:
11677
name: Unit tests

.husky/pre-commit

+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
yarn lint-staged
1+
yarn format --staged --no-errors-on-unmatched --write

.lintstagedrc.json

-3
This file was deleted.

.prettierignore

-3
This file was deleted.

.prettierrc.json

-4
This file was deleted.

.vscode/extensions.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
{
2-
"recommendations": ["dbaeumer.vscode-eslint", "eamodio.gitlens", "esbenp.prettier-vscode"],
2+
"recommendations": ["biomejs.biome", "eamodio.gitlens"],
33
"unwantedRecommendations": ["dbaeumer.jshint"]
44
}

.vscode/settings.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"editor.defaultFormatter": "esbenp.prettier-vscode",
2+
"editor.defaultFormatter": "biomejs.biome",
33
"editor.formatOnSave": true,
44
"search.exclude": {
55
"**/.yarn": true

biome.json

+43
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
{
2+
"$schema": "https://biomejs.dev/schemas/1.8.0/schema.json",
3+
"files": {
4+
"ignore": [".tsimp", "coverage", "dist", ".pnp.cjs", ".pnp.loader.mjs"]
5+
},
6+
"formatter": {
7+
"lineWidth": 100,
8+
"indentStyle": "space"
9+
},
10+
"linter": {
11+
"rules": {
12+
"complexity": {
13+
"noUselessSwitchCase": "off"
14+
},
15+
"suspicious": {
16+
"noConsoleLog": "warn"
17+
}
18+
}
19+
},
20+
"javascript": {
21+
"formatter": {
22+
"quoteStyle": "single"
23+
}
24+
},
25+
"overrides": [
26+
{
27+
"include": ["**/package.json"],
28+
"formatter": {
29+
"lineWidth": 1
30+
}
31+
},
32+
{
33+
"include": ["**/vite.config.ts"],
34+
"linter": {
35+
"rules": {
36+
"suspicious": {
37+
"noConsoleLog": "off"
38+
}
39+
}
40+
}
41+
}
42+
]
43+
}

package.json

+1-6
Original file line numberDiff line numberDiff line change
@@ -19,12 +19,7 @@
1919
"unit": "yarn workspaces foreach --all run unit"
2020
},
2121
"devDependencies": {
22-
"husky": "^9.0.0",
23-
"lint-staged": "^15.0.0",
24-
"prettier": "^3.2.0"
25-
},
26-
"resolutions": {
27-
"eslint-plugin-import": "npm:eslint-plugin-i@^2.28.0"
22+
"husky": "^9.0.0"
2823
},
2924
"packageManager": "[email protected]"
3025
}

packages/react-calendar/.eslintignore

-2
This file was deleted.

packages/react-calendar/.eslintrc.json

-3
This file was deleted.

packages/react-calendar/.prettierignore

-1
This file was deleted.

packages/react-calendar/package.json

+3-5
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,8 @@
2525
"build-js-cjs-package": "echo '{\n \"type\": \"commonjs\"\n}' > dist/cjs/package.json",
2626
"clean": "rimraf dist",
2727
"copy-styles": "cpy 'src/**/*.css' dist",
28-
"format": "prettier --check . --cache",
29-
"lint": "eslint . --ext .js,.jsx,.ts,.tsx",
28+
"format": "biome format",
29+
"lint": "biome lint",
3030
"prepack": "yarn clean && yarn build",
3131
"test": "yarn lint && yarn tsc && yarn format && yarn unit",
3232
"tsc": "tsc",
@@ -52,17 +52,15 @@
5252
"warning": "^4.0.0"
5353
},
5454
"devDependencies": {
55+
"@biomejs/biome": "^1.8.0",
5556
"@testing-library/jest-dom": "^6.0.0",
5657
"@testing-library/react": "^15.0.0",
5758
"@types/node": "*",
5859
"@types/react": "*",
5960
"@types/warning": "^3.0.0",
6061
"cpy-cli": "^5.0.0",
61-
"eslint": "^8.56.0",
62-
"eslint-config-wojtekmaj": "^1.0.0",
6362
"happy-dom": "^12.6.0",
6463
"nodemon": "^3.0.0",
65-
"prettier": "^3.2.0",
6664
"react": "^18.2.0",
6765
"react-dom": "^18.2.0",
6866
"rimraf": "^3.0.0",

packages/react-calendar/src/Flex.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { Children, cloneElement } from 'react';
22

33
type FlexProps = React.HTMLAttributes<HTMLDivElement> & {
4-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
4+
// biome-ignore lint/suspicious/noExplicitAny: Too complex to type
55
children: React.ReactElement<any>[];
66
className?: string;
77
count: number;

packages/react-calendar/src/MonthView/WeekNumber.tsx

+1
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ export default function WeekNumber(props: WeekNumberProps) {
3535
{children}
3636
</button>
3737
);
38+
// biome-ignore lint/style/noUselessElse: TypeScript is unhappy if we remove this else
3839
} else {
3940
const { date, onClickWeekNumber, weekNumber, ...otherProps } = props;
4041

test/.eslintignore

-2
This file was deleted.

test/.eslintrc.json

-3
This file was deleted.

test/.prettierignore

-1
This file was deleted.

test/Test.tsx

-2
Original file line numberDiff line numberDiff line change
@@ -66,8 +66,6 @@ const tileContent = ({ date, view }: { date: Date; view: View }) => {
6666
const nineteenNinetyFive = new Date(1995, now.getUTCMonth() + 1, 15, 12);
6767
const fifteenthOfNextMonth = new Date(now.getUTCFullYear(), now.getUTCMonth() + 1, 15, 12);
6868

69-
/* eslint-disable no-console */
70-
7169
type ReturnValue = 'start' | 'end' | 'range';
7270

7371
export default function Test() {

test/package.json

+3-5
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@
77
"scripts": {
88
"build": "vite build",
99
"dev": "vite",
10-
"format": "prettier --check . --cache",
11-
"lint": "eslint . --ext .js,.jsx,.ts,.tsx",
10+
"format": "biome format",
11+
"lint": "biome lint",
1212
"preview": "vite preview",
1313
"test": "yarn lint && yarn tsc && yarn format",
1414
"tsc": "tsc"
@@ -26,11 +26,9 @@
2626
"react-dom": "^18.2.0"
2727
},
2828
"devDependencies": {
29+
"@biomejs/biome": "^1.8.0",
2930
"@types/react": "*",
3031
"@vitejs/plugin-react": "^4.2.0",
31-
"eslint": "^8.56.0",
32-
"eslint-config-wojtekmaj": "^1.0.0",
33-
"prettier": "^3.2.0",
3432
"typescript": "^5.4.2",
3533
"vite": "^5.0.0"
3634
}

0 commit comments

Comments
 (0)