Skip to content

Commit e05a6c6

Browse files
committed
feat: migrate from ESLint to Biome for linting and formatting
1 parent bfef9bf commit e05a6c6

File tree

2 files changed

+118
-40
lines changed

2 files changed

+118
-40
lines changed

biome.json

Lines changed: 108 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -2,40 +2,28 @@
22
"$schema": "./node_modules/@biomejs/biome/configuration_schema.json",
33
"vcs": {
44
"clientKind": "git",
5-
"useIgnoreFile": false,
5+
"useIgnoreFile": true,
66
"defaultBranch": "main"
77
},
88
"files": {
99
"maxSize": 10000000,
1010
"ignoreUnknown": true,
11-
"includes": [
12-
"**/*.ts",
13-
"**/*.tsx",
14-
"**/*.js",
15-
"**/*.jsx",
16-
"**/*.json"
17-
],
11+
"includes": ["**/*.ts", "**/*.tsx", "**/*.js", "**/*.jsx", "**/*.json"],
1812
"experimentalScannerIgnores": [
19-
".next/",
20-
".pnpm-store/",
21-
"coverage/",
22-
"/public/outdated",
23-
"/public/.well-known",
2413
"**/node_modules/",
25-
"**/storybook-static",
14+
"**/dist/",
15+
"**/build/",
16+
"**/coverage/",
17+
"**/examples/",
18+
"**/*.gen.ts",
19+
"**/*.min.js",
20+
".pnpm-store/",
21+
".next/",
2622
".turbo/**",
27-
"dist",
28-
"build",
29-
"out",
30-
"node_modules/**",
31-
"**/pnpm-lock.yaml",
32-
"**/package.json",
33-
"**/CHANGELOG.md",
34-
"*.snap",
35-
"**/__snapshots__/",
23+
"storybook-static",
3624
".docusaurus",
3725
".vitest-reports",
38-
"**/*.gen.ts"
26+
"**/__snapshots__/"
3927
]
4028
},
4129
"formatter": {
@@ -72,13 +60,103 @@
7260
}
7361
},
7462
"linter": {
75-
"enabled": false
63+
"enabled": true,
64+
"rules": {
65+
"recommended": true,
66+
"complexity": {
67+
"noForEach": "warn",
68+
"noExcessiveCognitiveComplexity": "warn",
69+
"noUselessStringConcat": "error"
70+
},
71+
"correctness": {
72+
"noUnusedVariables": "warn",
73+
"noUnusedImports": "warn",
74+
"useExhaustiveDependencies": "warn"
75+
},
76+
"style": {
77+
"noDefaultExport": "error",
78+
"useNamingConvention": {
79+
"level": "error",
80+
"options": {
81+
"strictCase": false,
82+
"conventions": [
83+
{
84+
"selector": {
85+
"kind": "enumMember"
86+
},
87+
"formats": ["PascalCase"]
88+
},
89+
{
90+
"selector": {
91+
"kind": "classMember",
92+
"modifiers": ["private"]
93+
},
94+
"formats": ["camelCase"],
95+
"match": "_?[a-z].*"
96+
}
97+
]
98+
}
99+
},
100+
"useConsistentArrayType": "off",
101+
"noParameterAssign": "warn",
102+
"noNonNullAssertion": "warn"
103+
},
104+
"suspicious": {
105+
"noExplicitAny": "warn",
106+
"noEmptyBlockStatements": "warn",
107+
"noArrayIndexKey": "warn"
108+
},
109+
"nursery": {
110+
"useSortedClasses": "off"
111+
}
112+
}
76113
},
77-
"assist": {
78-
"actions": {
79-
"source": {
80-
"organizeImports": "off"
114+
"overrides": [
115+
{
116+
"includes": ["**/*.test.ts", "**/__tests__/**/*.ts", "**/vite.config.ts", "vitest.config.ts"],
117+
"linter": {
118+
"rules": {
119+
"correctness": {
120+
"noUnusedVariables": "off"
121+
}
122+
}
123+
}
124+
},
125+
{
126+
"includes": [
127+
"packages_generated/dedibox/src/v1/*.ts",
128+
"packages/clients/src/api/dedibox/v1/*.ts"
129+
],
130+
"linter": {
131+
"rules": {
132+
"correctness": {
133+
"noUnusedVariables": "off"
134+
},
135+
"style": {
136+
"useConsistentArrayType": "off"
137+
},
138+
"suspicious": {
139+
"noExplicitAny": "off"
140+
}
141+
}
142+
}
143+
},
144+
{
145+
"includes": [
146+
"packages/clients/src/scw/**/*.ts",
147+
"packages/clients/src/internal/**/*.ts"
148+
],
149+
"linter": {
150+
"rules": {
151+
"correctness": {
152+
"noUnusedVariables": "off"
153+
},
154+
"style": {
155+
"useConsistentArrayType": "off"
156+
}
157+
}
81158
}
82159
}
83-
}
160+
]
84161
}
162+

package.json

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -23,29 +23,29 @@
2323
"build:profile": "cross-env PROFILE=true pnpm run build",
2424
"commit": "npx git-cz -a",
2525
"doc": "typedoc",
26-
"format": "biome check --linter-enabled=false --write .",
27-
"format:check": "biome check --linter-enabled=false --verbose .",
26+
"format": "biome check --write .",
27+
"format:check": "biome check .",
2828
"prettier": "prettier --write '**/*.{md,mdx,yml,yaml}'",
29-
"lint": "eslint --cache .",
29+
"lint": "biome lint .",
30+
"lint:fix": "biome check --write .",
3031
"prepare": "husky",
3132
"test": "vitest run",
3233
"test:coverage": "vitest run --coverage",
3334
"test:junit": "vitest --reporter=junit --outputFile=test-report.junit.xml",
3435
"test:ui": "vitest --ui"
3536
},
3637
"lint-staged": {
37-
"*.ts": [
38-
"pnpm run format",
39-
"eslint --fix --quiet ."
38+
"*.{ts,tsx,js,jsx}": [
39+
"biome check --write --no-errors-on-unmatched --files-ignore-unknown=true"
4040
],
4141
"*.json": [
42-
"pnpm run format"
42+
"biome check --write --no-errors-on-unmatched --files-ignore-unknown=true"
4343
],
4444
"*.y?(a)ml": [
45-
"prettier --write '**/*.{yml,yaml}'"
45+
"prettier --write"
4646
],
47-
".md?(x)": [
48-
"prettier --write '**/*.{md,mdx}'"
47+
"*.md?(x)": [
48+
"prettier --write"
4949
]
5050
},
5151
"config": {

0 commit comments

Comments
 (0)