Skip to content

Commit 128d741

Browse files
committed
chore: [STMS-4058] Add biomejs
1 parent e3174bb commit 128d741

29 files changed

+1097
-777
lines changed

.codesandbox/ci.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"node": "16",
2+
"node": "20",
33
"buildCommand": "build",
44
"packages": [
55
"packages/babel-preset",

.github/workflows/check.yml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,12 +16,13 @@ jobs:
1616
- uses: umidbekk/actions/prepare-node-repo@v2
1717
with:
1818
cache-key: npm-v2-
19+
node-version: 20
1920

2021
- run: yarn tsc
21-
- run: yarn lint
22+
- run: yarn build
23+
- run: yarn biome
2224
- uses: superdispatch/actions/[email protected]
2325
with:
2426
command: yarn test
2527
update-command: yarn test -u
2628
- uses: codecov/codecov-action@v2
27-
- run: yarn build

biome.json

Lines changed: 100 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,100 @@
1+
{
2+
"$schema": "https://biomejs.dev/schemas/2.0.6/schema.json",
3+
"formatter": {
4+
"enabled": true,
5+
"formatWithErrors": false,
6+
"indentStyle": "space",
7+
"indentWidth": 2,
8+
"lineEnding": "lf",
9+
"lineWidth": 80,
10+
"attributePosition": "auto",
11+
"bracketSameLine": false,
12+
"bracketSpacing": true,
13+
"expand": "auto",
14+
"useEditorconfig": true
15+
},
16+
"files": {
17+
"ignoreUnknown": true,
18+
"includes": ["**/*", "!**/dist/**"]
19+
},
20+
"linter": {
21+
"enabled": true,
22+
"rules": { "recommended": false }
23+
},
24+
"javascript": {
25+
"formatter": {
26+
"jsxQuoteStyle": "double",
27+
"quoteProperties": "asNeeded",
28+
"trailingCommas": "all",
29+
"semicolons": "always",
30+
"arrowParentheses": "always",
31+
"bracketSameLine": false,
32+
"quoteStyle": "single"
33+
}
34+
},
35+
"overrides": [
36+
{
37+
"includes": ["*.js", "!public/**/*.js", "!src/**/*.js"],
38+
"linter": {
39+
"rules": { "correctness": { "noUndeclaredDependencies": "error" } }
40+
}
41+
},
42+
{
43+
"includes": ["scripts/**/*.ts"],
44+
"linter": {
45+
"rules": { "correctness": { "noUndeclaredDependencies": "error" } }
46+
}
47+
},
48+
{
49+
"includes": ["**/*.{ts,tsx}"],
50+
"linter": {
51+
"rules": {
52+
"complexity": { "noBannedTypes": "warn", "useOptionalChain": "warn" },
53+
"correctness": { "useExhaustiveDependencies": "warn" },
54+
"style": { "noRestrictedImports": "warn" },
55+
"suspicious": { "noAlert": "warn", "noEmptyBlockStatements": "warn" }
56+
}
57+
}
58+
},
59+
{ "includes": ["src/**/*.{js,jsx}"], "linter": { "rules": {} } },
60+
{
61+
"includes": ["src/service-worker.ts"],
62+
"linter": {
63+
"rules": {
64+
"style": { "noRestrictedGlobals": { "level": "off", "options": {} } }
65+
}
66+
}
67+
},
68+
{
69+
"includes": [
70+
"setup-vitest.ts",
71+
"**/*.{test,spec}.{ts,tsx,js,jsx}",
72+
"**/{__tests__,__testutils__}/**/*.{ts,tsx,js,jsx}"
73+
],
74+
"linter": {
75+
"rules": {
76+
"correctness": { "noUndeclaredDependencies": "error" },
77+
"style": {
78+
"noNonNullAssertion": "off",
79+
"noRestrictedImports": "off"
80+
},
81+
"suspicious": {
82+
"noEmptyBlockStatements": "warn",
83+
"noExplicitAny": "off"
84+
}
85+
}
86+
}
87+
},
88+
{
89+
"includes": ["e2e/**/*.{ts,tsx}"],
90+
"linter": {
91+
"rules": {
92+
"complexity": { "noBannedTypes": "warn" },
93+
"correctness": { "noUndeclaredDependencies": "error" }
94+
}
95+
}
96+
},
97+
{ "includes": ["types"] }
98+
],
99+
"html": { "formatter": { "selfCloseVoidElements": "always" } }
100+
}

lerna.json

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,16 +2,11 @@
22
"version": "0.12.0",
33
"npmClient": "yarn",
44
"useWorkspaces": true,
5-
"packages": [
6-
"packages/*"
7-
],
5+
"packages": ["packages/*"],
86
"command": {
97
"publish": {
108
"message": "%s",
11-
"ignoreChanges": [
12-
"**/__tests__/*.*",
13-
"**/__testutils__/*.*"
14-
]
9+
"ignoreChanges": ["**/__tests__/*.*", "**/__testutils__/*.*"]
1510
}
1611
}
1712
}

package.json

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -4,19 +4,19 @@
44
"private": true,
55
"license": "MIT",
66
"workspaces": {
7-
"packages": [
8-
"packages/*"
9-
]
7+
"packages": ["packages/*"]
108
},
119
"scripts": {
10+
"biome": "biome check",
11+
"biome:fix": "biome check --write",
1212
"build": "lerna run build --parallel",
1313
"prelint": "yarn build",
1414
"lint": "js-tools lint",
1515
"prepare": "husky install",
1616
"prerelease": "yarn --force && yarn tsc && yarn lint && yarn test",
1717
"release": "lerna publish",
1818
"tdd": "jest --watch",
19-
"test": "jest --coverage"
19+
"test": "NODE_OPTIONS=\"$NODE_OPTIONS --experimental-vm-modules\" jest --coverage"
2020
},
2121
"lint-staged": {
2222
"*": "js-tools lint --fix"
@@ -37,9 +37,7 @@
3737
"<rootDir>/packages/eslint-plugin",
3838
"<rootDir>/packages/prettier-config"
3939
],
40-
"snapshotSerializers": [
41-
"snapshot-diff/serializer"
42-
],
40+
"snapshotSerializers": ["snapshot-diff/serializer"],
4341
"watchPlugins": [
4442
"jest-watch-typeahead/filename",
4543
"jest-watch-typeahead/testname"
@@ -49,12 +47,13 @@
4947
"@babel/cli": "7.18.10",
5048
"@babel/core": "7.26.9",
5149
"@babel/runtime": "7.26.9",
50+
"@biomejs/biome": "^2.0.6",
5251
"@types/eslint": "8.4.6",
5352
"@types/find-cache-dir": "3.2.1",
5453
"@types/jest": "27.5.2",
5554
"@types/listr": "0.14.4",
5655
"@types/lodash": "4.14.186",
57-
"@types/node": "16.18.0",
56+
"@types/node": "24.0.10",
5857
"@types/prettier": "2.7.1",
5958
"enhanced-resolve": "5.10.0",
6059
"eslint": "8.23.0",
@@ -70,6 +69,6 @@
7069
"typescript": "4.8.4"
7170
},
7271
"engines": {
73-
"node": ">=16"
72+
"node": "20"
7473
}
7574
}

packages/babel-preset/package.json

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,11 @@
22
"name": "@superdispatch/babel-preset",
33
"version": "0.12.0",
44
"description": "Shared Babel preset",
5-
"keywords": [
6-
"babel"
7-
],
5+
"keywords": ["babel"],
86
"repository": "https://github.com/superdispatch/js-tools.git",
97
"license": "MIT",
108
"main": "dist/preset.js",
11-
"files": [
12-
"dist"
13-
],
9+
"files": ["dist"],
1410
"scripts": {
1511
"build": "rimraf dist && tsc -b"
1612
},
@@ -25,13 +21,14 @@
2521
"@babel/preset-typescript": "^7.26.0",
2622
"babel-plugin-annotate-pure-calls": "^0.4.0",
2723
"babel-plugin-dev-expression": "^0.2.2",
28-
"babel-plugin-transform-react-remove-prop-types": "^0.4.24"
24+
"babel-plugin-transform-react-remove-prop-types": "^0.4.24",
25+
"snapshot-diff": "^0.10.0"
2926
},
3027
"peerDependencies": {
3128
"@babel/runtime": "^7.0.0"
3229
},
3330
"engines": {
34-
"node": ">=12"
31+
"node": "20"
3532
},
3633
"publishConfig": {
3734
"access": "public"

packages/babel-preset/src/preset.spec.ts

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -83,8 +83,9 @@ test('basic', () => {
8383
}
8484
`);
8585

86-
expect(presetDiff(defaultPreset, createPreset('test')))
87-
.toMatchInlineSnapshot(`
86+
expect(
87+
presetDiff(defaultPreset, createPreset('test')),
88+
).toMatchInlineSnapshot(`
8889
Snapshot Diff:
8990
- First value
9091
+ Second value
@@ -115,14 +116,16 @@ test('basic', () => {
115116
"useBuiltIns": true,
116117
`);
117118

118-
expect(presetDiff(defaultPreset, createPreset('production')))
119-
.toMatchInlineSnapshot(`
119+
expect(
120+
presetDiff(defaultPreset, createPreset('production')),
121+
).toMatchInlineSnapshot(`
120122
Snapshot Diff:
121123
Compared values have no visual difference.
122124
`);
123125

124-
expect(presetDiff(defaultPreset, createPreset('development')))
125-
.toMatchInlineSnapshot(`
126+
expect(
127+
presetDiff(defaultPreset, createPreset('development')),
128+
).toMatchInlineSnapshot(`
126129
Snapshot Diff:
127130
- First value
128131
+ Second value
@@ -229,8 +232,9 @@ test('options.jsx', () => {
229232
],
230233
`);
231234

232-
expect(presetDiff(createPreset('test'), createPreset('test', { jsx: false })))
233-
.toMatchInlineSnapshot(`
235+
expect(
236+
presetDiff(createPreset('test'), createPreset('test', { jsx: false })),
237+
).toMatchInlineSnapshot(`
234238
Snapshot Diff:
235239
- First value
236240
+ Second value

packages/babel-preset/src/preset.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ export default function preset(
7979
);
8080
}
8181

82-
if (typeof transpileJSX != 'boolean' && transpileJSX !== 'runtime') {
82+
if (typeof transpileJSX !== 'boolean' && transpileJSX !== 'runtime') {
8383
throw new Error(
8484
format(
8585
'Invalid "jsx" option, expected "boolean" or "runtime", but got: %j',
@@ -107,8 +107,8 @@ export default function preset(
107107
targets === 'esmodules'
108108
? { esmodules: true }
109109
: targets
110-
? { browsers: targets }
111-
: undefined,
110+
? { browsers: targets }
111+
: undefined,
112112

113113
/**
114114
* Enable "loose" transformations for any plugins in this preset that

packages/eslint-plugin/package.json

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,21 +2,18 @@
22
"name": "@superdispatch/eslint-plugin",
33
"version": "0.12.0",
44
"description": "Shared ESLint plugin",
5-
"keywords": [
6-
"eslint"
7-
],
5+
"keywords": ["eslint"],
86
"repository": "https://github.com/superdispatch/js-tools.git",
97
"license": "MIT",
108
"main": "dist/plugin.js",
11-
"files": [
12-
"dist"
13-
],
9+
"files": ["dist"],
1410
"scripts": {
1511
"build": "rimraf dist && tsc -b"
1612
},
1713
"dependencies": {
1814
"@typescript-eslint/eslint-plugin": "6.21.0",
1915
"@typescript-eslint/parser": "6.21.0",
16+
"@typescript-eslint/types": "^8.35.1",
2017
"@typescript-eslint/typescript-estree": "5.8.0",
2118
"confusing-browser-globals": "^1.0.10",
2219
"eslint-config-prettier": "^8.3.0",
@@ -30,15 +27,16 @@
3027
"eslint-plugin-react": "^7.28.0",
3128
"eslint-plugin-react-hooks": "^4.3.0",
3229
"eslint-plugin-testing-library": "^5.0.1",
33-
"lodash": "^4.17.19"
30+
"lodash": "^4.17.19",
31+
"snapshot-diff": "0.10.0"
3432
},
3533
"peerDependencies": {
3634
"eslint": "^7.0.0 || ^8.0.0",
3735
"prettier": "^2.0.0",
3836
"typescript": "^4"
3937
},
4038
"engines": {
41-
"node": ">=12"
39+
"node": "20"
4240
},
4341
"publishConfig": {
4442
"access": "public"

packages/eslint-plugin/src/configs/base.spec.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
'use strict';
2-
31
import { getConfigData } from './__testutils__/test-eslint-config';
42

53
it('extends dependencies', async () => {

0 commit comments

Comments
 (0)