Skip to content

Commit 517fb7f

Browse files
authored
Migrate from prettier+eslint to biome (#886)
1 parent 2fe61ca commit 517fb7f

21 files changed

+306
-1753
lines changed

.changeset/smooth-maps-happen.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"aws-sdk-js-codemod": minor
3+
---
4+
5+
Migrate from prettier+eslint to biome

.github/workflows/build.yml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,14 +15,15 @@ jobs:
1515
- uses: actions/checkout@v4
1616
- name: corepack
1717
run: corepack enable
18+
- uses: biomejs/setup-biome@v2
1819
- uses: actions/setup-node@v4
1920
with:
2021
node-version: ${{ matrix.node-version }}
2122
cache: "yarn"
2223
- name: install
2324
run: yarn
24-
- name: lint
25-
run: yarn lint
25+
- name: lint+format
26+
run: biome ci src
2627
- name: build
2728
run: yarn build
2829
- name: test

.prettierignore

Lines changed: 0 additions & 1 deletion
This file was deleted.

.prettierrc.json

Lines changed: 0 additions & 4 deletions
This file was deleted.

.vscode/extensions.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
{
2-
"recommendations": []
2+
"recommendations": ["biomejs.biome"]
33
}

.vscode/settings.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
"source.fixAll.eslint": "explicit"
44
},
55
"editor.formatOnSave": true,
6-
"editor.defaultFormatter": "esbenp.prettier-vscode",
6+
"editor.defaultFormatter": "biomejs.biome",
77
"editor.rulers": [80, 120],
88
"editor.tabSize": 2,
99
"search.exclude": {

biome.json

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
{
2+
"$schema": "https://biomejs.dev/schemas/1.8.0/schema.json",
3+
"files": {
4+
"maxSize": 5242880,
5+
"ignore": ["**/__fixtures__/**", "package.json"]
6+
},
7+
"formatter": {
8+
"enabled": true,
9+
"indentStyle": "space",
10+
"lineWidth": 100
11+
},
12+
"linter": {
13+
"rules": {
14+
"recommended": true,
15+
"complexity": {
16+
"noForEach": "off",
17+
"useFlatMap": "off",
18+
"useOptionalChain": "off"
19+
},
20+
"correctness": {
21+
"noNewSymbol": "error",
22+
"noUndeclaredVariables": "error",
23+
"noUnusedVariables": "error"
24+
},
25+
"performance": {
26+
"noAccumulatingSpread": "off"
27+
},
28+
"style": {
29+
"noNamespace": "error",
30+
"noNonNullAssertion": "off",
31+
"noUnusedTemplateLiteral": "off",
32+
"useConsistentArrayType": {
33+
"level": "error",
34+
"options": { "syntax": "shorthand" }
35+
},
36+
"useImportType": "off",
37+
"useNodejsImportProtocol": "off",
38+
"useTemplate": "off"
39+
},
40+
"suspicious": {
41+
"noEmptyBlockStatements": "error"
42+
}
43+
},
44+
"ignore": ["**/__fixtures__"]
45+
},
46+
"javascript": { "formatter": { "trailingCommas": "es5" } }
47+
}

lefthook.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
pre-commit:
2+
commands:
3+
check:
4+
glob: "*.{js,ts,cjs,mjs,d.cts,d.mts,jsx,tsx,json,jsonc}"
5+
run: yarn biome check --write --no-errors-on-unmatched --files-ignore-unknown=true {staged_files}
6+
stage_fixed: true

package.json

Lines changed: 5 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -34,28 +34,23 @@
3434
},
3535
"scripts": {
3636
"build": "tsc",
37-
"lint": "eslint 'src/**/*.ts'",
38-
"prepare": "simple-git-hooks",
37+
"format": "biome format --write .",
38+
"lint": "biome lint --write src",
39+
"prepare": "lefthook install",
3940
"release": "yarn build && changeset publish",
4041
"test": "vitest"
4142
},
4243
"dependencies": {
4344
"jscodeshift": "0.16.0"
4445
},
4546
"devDependencies": {
47+
"@biomejs/biome": "1.8.0",
4648
"@changesets/cli": "^2.27.1",
4749
"@tsconfig/node16": "^16.1.3",
4850
"@types/jscodeshift": "^0.11.11",
4951
"@types/node": "^16.18.101",
50-
"@typescript-eslint/eslint-plugin": "^7.14.1",
51-
"@typescript-eslint/parser": "^7.14.1",
5252
"aws-sdk": "2.1641.0",
53-
"eslint": "^8.57.0",
54-
"eslint-plugin-import": "^2.29.1",
55-
"eslint-plugin-sort-export-all": "^1.4.1",
56-
"lint-staged": "^15.2.2",
57-
"prettier": "3.2.5",
58-
"simple-git-hooks": "^2.11.0",
53+
"lefthook": "^1.6.15",
5954
"tsx": "^4.7.1",
6055
"typescript": "~5.5.2",
6156
"vitest": "~2.0.1"
@@ -64,13 +59,6 @@
6459
"node": ">=16.0.0"
6560
},
6661
"packageManager": "yarn@4.3.1",
67-
"lint-staged": {
68-
"*.ts": [
69-
"eslint --fix",
70-
"prettier --write"
71-
],
72-
"*.{json,md}": "prettier --write"
73-
},
7462
"publishConfig": {
7563
"provenance": true
7664
}

scripts/generateClientTypesMap/getClientTypesMap.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -125,6 +125,7 @@ export const getClientTypesMap = async (clientName: string): Promise<Record<stri
125125
});
126126

127127
const updatedClientTypesMap = getClientTypesMapWithKeysRemovedFromValues(clientTypesMap);
128+
// biome-ignore lint/complexity/useLiteralKeys: script
128129
clientTypesMap["ClientConfiguration"] = `${CLIENT_NAMES_MAP[clientName]}ClientConfig`;
129130

130131
return Object.entries(updatedClientTypesMap)

0 commit comments

Comments
 (0)