Skip to content

Commit 59e33f9

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

31 files changed

+4267
-3149
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: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ 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
2122
- run: yarn lint
@@ -24,4 +25,3 @@ jobs:
2425
command: yarn test
2526
update-command: yarn test -u
2627
- uses: codecov/codecov-action@v2
27-
- run: yarn build

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: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
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"
@@ -54,7 +54,7 @@
5454
"@types/jest": "27.5.2",
5555
"@types/listr": "0.14.4",
5656
"@types/lodash": "4.14.186",
57-
"@types/node": "16.18.0",
57+
"@types/node": "24.0.10",
5858
"@types/prettier": "2.7.1",
5959
"enhanced-resolve": "5.10.0",
6060
"eslint": "8.23.0",
@@ -70,6 +70,6 @@
7070
"typescript": "4.8.4"
7171
},
7272
"engines": {
73-
"node": ">=16"
73+
"node": "20"
7474
}
7575
}

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/biome-config/README.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
### `@superdispatch/biome-config`
2+
3+
[![npm](https://img.shields.io/npm/v/@superdispatch/biome-config)](https://www.npmjs.com/package/@superdispatch/biome-config)
4+
5+
#### Installation
6+
7+
```bash
8+
yarn add @superdispatch/biome-config -D
9+
```

packages/biome-config/biome.json

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

packages/biome-config/package.json

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
{
2+
"name": "@superdispatch/biome-config",
3+
"version": "0.12.0",
4+
"description": "Shared config for Biomejs.",
5+
"keywords": [
6+
"biome"
7+
],
8+
"repository": "https://github.com/superdispatch/js-tools.git",
9+
"license": "MIT",
10+
"main": "biome.json",
11+
"files": [
12+
"biome.json"
13+
],
14+
"engines": {
15+
"node": "20"
16+
},
17+
"publishConfig": {
18+
"access": "public"
19+
},
20+
"devDependencies": {
21+
"@biomejs/biome": "2.0.6"
22+
}
23+
}

0 commit comments

Comments
 (0)