Skip to content

Commit 9506713

Browse files
authored
Merge pull request #16 from jsonjoy-com/biome
Biome
2 parents 5023711 + fdb43c8 commit 9506713

File tree

112 files changed

+413
-459
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

112 files changed

+413
-459
lines changed

.github/workflows/pr.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ jobs:
3838
- run: yarn install --frozen-lockfile
3939
- run: yarn build
4040
- run: yarn lint
41-
- run: yarn prettier:check
41+
- run: yarn format
4242
- run: yarn typedoc
4343
e2e-sample-api-http1:
4444
runs-on: ubuntu-latest

.github/workflows/release.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ jobs:
2121
cache: yarn
2222
- run: yarn install --frozen-lockfile
2323
- run: yarn prettier:check
24-
- run: yarn lint
24+
- run: yarn format
2525
- run: yarn test:ci --ci
2626
- run: PORT=10000 yarn test:e2e --server http1 --suite sample-api
2727
- run: PORT=10001 yarn test:e2e --server uws --suite sample-api

biome.json

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
{
2+
"$schema": "https://biomejs.dev/schemas/1.9.3/schema.json",
3+
"organizeImports": {
4+
"enabled": true
5+
},
6+
"formatter": {
7+
"indentStyle": "space",
8+
"lineWidth": 120
9+
},
10+
"javascript": {
11+
"formatter": {
12+
"quoteStyle": "single",
13+
"trailingCommas": "all",
14+
"bracketSpacing": false
15+
}
16+
},
17+
"linter": {
18+
"enabled": true,
19+
"rules": {
20+
"recommended": true,
21+
"style": {
22+
"noNonNullAssertion": "off",
23+
"useNodejsImportProtocol": "off",
24+
"useTemplate": "off",
25+
"noInferrableTypes": "off",
26+
"noUselessElse": "off",
27+
"noParameterAssign": "off",
28+
"noCommaOperator": "off",
29+
"useSingleVarDeclarator": "off"
30+
},
31+
"suspicious": {
32+
"noExplicitAny": "off",
33+
"useIsArray": "off",
34+
"noAssignInExpressions": "off"
35+
},
36+
"complexity": {
37+
"noStaticOnlyClass": "off",
38+
"useOptionalChain": "off"
39+
}
40+
}
41+
}
42+
}

package.json

Lines changed: 5 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -39,10 +39,10 @@
3939
],
4040
"license": "Apache-2.0",
4141
"scripts": {
42-
"prettier": "prettier --ignore-path .gitignore --write \"src/**/*.{ts,tsx,js,jsx}\"",
43-
"prettier:check": "prettier --ignore-path .gitignore --list-different 'src/**/*.{ts,tsx,js,jsx}'",
44-
"lint": "oxlint ./src/",
45-
"lint:fix": "oxlint ./src/ --fix --fix-suggestions",
42+
"format": "biome format ./src",
43+
"format:write": "biome format --write ./src",
44+
"lint": "biome lint ./src",
45+
"lint:fix": "biome lint --apply ./src",
4646
"clean": "rimraf lib typedocs coverage gh-pages yarn-error.log db dist",
4747
"build": "tsc --project tsconfig.build.json --module commonjs --target es2020 --outDir lib",
4848
"jest": "node -r ts-node/register ./node_modules/.bin/jest",
@@ -92,6 +92,7 @@
9292
"thingies": "^2.1.0"
9393
},
9494
"devDependencies": {
95+
"@biomejs/biome": "^1.9.3",
9596
"@types/benchmark": "^2.1.5",
9697
"@types/jest": "^29.5.12",
9798
"@types/react": "^18.3.8",
@@ -107,8 +108,6 @@
107108
"jest": "^29.7.0",
108109
"nano-theme": "^1.4.2",
109110
"nice-ui": "^1.9.2",
110-
"oxlint": "^0.9.9",
111-
"prettier": "^3.2.5",
112111
"react": "^18.3.1",
113112
"react-dom": "^18.3.1",
114113
"rimraf": "^5.0.5",
@@ -117,8 +116,6 @@
117116
"ts-loader": "^9.5.1",
118117
"ts-node": "^10.9.2",
119118
"tslib": "^2.6.2",
120-
"tslint": "^6.1.3",
121-
"tslint-config-common": "^1.6.2",
122119
"typedoc": "^0.25.13",
123120
"typescript": "^5.4.5",
124121
"uWebSockets.js": "uNetworking/uWebSockets.js#v20.44.0",
@@ -143,15 +140,5 @@
143140
},
144141
"transformIgnorePatterns": [],
145142
"testRegex": ".*/(__tests__|__jest__|demo)/.*\\.(test|spec)\\.ts$"
146-
},
147-
"prettier": {
148-
"arrowParens": "always",
149-
"printWidth": 120,
150-
"tabWidth": 2,
151-
"useTabs": false,
152-
"semi": true,
153-
"singleQuote": true,
154-
"trailingComma": "all",
155-
"bracketSpacing": false
156143
}
157144
}
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import {createCaller} from './routes';
1+
import type {createCaller} from './routes';
22

33
export {createCaller} from './routes';
44
export type JsonJoyDemoRpcCaller = ReturnType<typeof createCaller>['caller'];

src/__demos__/json-crdt-server/routes/block/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ export const block =
4848

4949
system.alias('BlockEvent', BlockEvent);
5050

51-
// prettier-ignore
51+
// biome-ignore format: each on its own line
5252
return (
5353
( new_(d)
5454
( get(d)

src/__demos__/json-crdt-server/routes/block/methods/get.ts

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import {ResolveType} from 'json-joy/lib/json-type';
1+
import type {ResolveType} from 'json-joy/lib/json-type';
22
import {BlockIdRef, BlockRef} from '../schema';
33
import type {RouteDeps, Router, RouterBase} from '../../types';
44

@@ -12,10 +12,7 @@ export const get =
1212
}),
1313
);
1414

15-
// prettier-ignore
16-
const Response = t.Object(
17-
t.prop('block', BlockRef),
18-
);
15+
const Response = t.Object(t.prop('block', BlockRef));
1916

2017
const Func = t.Function(Request, Response).options({
2118
title: 'Read Block',

src/__demos__/json-crdt-server/routes/block/methods/listen.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ export const listen =
1616

1717
const Func = t.Function$(Request, Response).options({
1818
title: 'Listen for block changes',
19-
description: `Subscribe to a block to receive updates when it changes.`,
19+
description: 'Subscribe to a block to receive updates when it changes.',
2020
});
2121

2222
return r.prop('block.listen', Func, (req$) => {

src/__demos__/json-crdt-server/routes/block/methods/new.ts

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,7 @@ export const new_ =
1616
}),
1717
);
1818

19-
// prettier-ignore
20-
const Response = t.Object(
21-
t.prop('snapshot', BlockSnapshotReturnRef),
22-
).options({
19+
const Response = t.Object(t.prop('snapshot', BlockSnapshotReturnRef)).options({
2320
title: 'New block creation response',
2421
description:
2522
'The response object for the new block creation, contains server generated metadata without blobs supplied by the client.',

src/__demos__/json-crdt-server/routes/block/methods/pull.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import type {RouteDeps, Router, RouterBase} from '../../types';
44
export const pull =
55
({t, services}: RouteDeps) =>
66
<R extends RouterBase>(r: Router<R>) => {
7-
// prettier-ignore
7+
// biome-ignore format: props
88
const Request = t.Object(
99
t.prop('id', BlockIdRef).options({
1010
title: 'Block ID',
@@ -26,7 +26,7 @@ export const pull =
2626
}),
2727
);
2828

29-
// prettier-ignore
29+
// biome-ignore format: props
3030
const Response = t.Object(
3131
t.prop('batches', t.Array(BlockBatchRef)).options({
3232
title: 'Batches',

0 commit comments

Comments
 (0)