Skip to content

Commit a8ea4b4

Browse files
feat(js): add biome linter and formatter
1 parent a1fa913 commit a8ea4b4

36 files changed

+1149
-1200
lines changed

.github/workflows/ci.yml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,8 +56,18 @@ jobs:
5656
with:
5757
node-version: '24'
5858

59+
- name: Setup mise
60+
uses: jdx/mise-action@5228313ee0372e111a38da051671ca30fc5a96db # v3
61+
with:
62+
install: true
63+
install_args: biome
64+
cache: true
65+
5966
- run: pnpm install
6067

68+
- name: Lint
69+
run: mise run lint:ts:sdk-js
70+
6171
- name: Typecheck
6272
run: pnpm --filter @grafana/sigil-sdk-js run typecheck
6373

js/biome.json

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
{
2+
"$schema": "https://biomejs.dev/schemas/2.4.11/schema.json",
3+
"vcs": {
4+
"enabled": true,
5+
"clientKind": "git",
6+
"useIgnoreFile": true,
7+
"root": ".."
8+
},
9+
"files": {
10+
"includes": ["src/**", "test/**", "!dist", "!.test-dist"]
11+
},
12+
"formatter": {
13+
"enabled": true,
14+
"indentStyle": "space",
15+
"indentWidth": 2,
16+
"lineWidth": 120,
17+
"lineEnding": "lf"
18+
},
19+
"javascript": {
20+
"formatter": {
21+
"quoteStyle": "single",
22+
"trailingCommas": "all",
23+
"semicolons": "always",
24+
"arrowParentheses": "always",
25+
"bracketSpacing": true
26+
}
27+
},
28+
"json": {
29+
"formatter": {
30+
"trailingCommas": "none"
31+
}
32+
},
33+
"linter": {
34+
"enabled": true,
35+
"rules": {
36+
"recommended": true,
37+
"correctness": {
38+
"noUnusedImports": "error"
39+
},
40+
"suspicious": {
41+
"noExplicitAny": "off"
42+
},
43+
"style": {
44+
"useImportType": "error",
45+
"useNodejsImportProtocol": "off"
46+
},
47+
"complexity": {
48+
"noForEach": "off",
49+
"noUselessSwitchCase": "off"
50+
}
51+
}
52+
}
53+
}

js/package.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,9 @@
5050
"typecheck": "tsc --project tsconfig.json --noEmit",
5151
"test:build": "rm -rf .test-dist && tsc --project tsconfig.test.json",
5252
"test": "pnpm run test:build && node --test test/**/*.test.mjs",
53-
"test:ci": "pnpm run test"
53+
"test:ci": "pnpm run test",
54+
"lint": "biome check .",
55+
"lint:fix": "biome check --fix ."
5456
},
5557
"dependencies": {
5658
"@anthropic-ai/sdk": "^0.80.0",

0 commit comments

Comments
 (0)