Skip to content

Commit 6229bd7

Browse files
authored
chore: improve linting rules (#8)
1 parent c6d8a41 commit 6229bd7

8 files changed

Lines changed: 301 additions & 413 deletions

File tree

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
id: no-function-declaration
2+
language: TypeScript
3+
rule:
4+
kind: function_declaration
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
id: no-inline-export
2+
language: TypeScript
3+
rule:
4+
kind: export_statement
5+
not:
6+
has:
7+
kind: export_clause
8+
stopBy: end

.oxlintrc.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
"typeAware": true
44
},
55
"rules": {
6+
"no-unused-vars": ["error", { "args": "all", "argsIgnorePattern": "^_" }],
67
"typescript/no-floating-promises": "error",
78
"typescript/return-await": ["error", "in-try-catch"]
89
},

biome.json

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"$schema": "https://biomejs.dev/schemas/2.4.16/schema.json",
2+
"$schema": "./node_modules/@biomejs/biome/configuration_schema.json",
33
"vcs": { "enabled": true, "clientKind": "git", "useIgnoreFile": true },
44
"files": { "ignoreUnknown": false },
55
"formatter": {
@@ -19,7 +19,7 @@
1919
"linter": {
2020
"enabled": true,
2121
"rules": {
22-
"recommended": false,
22+
"preset": "none",
2323
"complexity": {
2424
"noAdjacentSpacesInRegex": "error",
2525
"noArguments": "error",
@@ -47,6 +47,7 @@
4747
"noUnreachableSuper": "error",
4848
"noUnsafeFinally": "error",
4949
"noUnsafeOptionalChaining": "error",
50+
"noUnusedFunctionParameters": "error",
5051
"noUnusedImports": "error",
5152
"noUnusedLabels": "error",
5253
"noUnusedPrivateClassMembers": "error",

package.json

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,10 @@
1616
"format": "npm-run-all format:arrows format:braces format:biome format:check",
1717
"lint:biome": "pnpm biome format .",
1818
"lint:oxlint": "pnpm oxlint .",
19-
"lint": "npm-run-all lint:biome lint:oxlint",
19+
"lint": "npm-run-all lint:biome lint:oxlint lint:exports lint:functions",
2020
"strip-braces": "pnpm exec sg scan --rule .ast-grep/rules/strip-braces.yml -U",
21+
"lint:exports": "pnpm exec sg scan --rule .ast-grep/rules/no-inline-export.yml --error=no-inline-export --globs '!**/*.d.ts' .",
22+
"lint:functions": "pnpm exec sg scan --rule .ast-grep/rules/no-function-declaration.yml --error=no-function-declaration --globs '!**/*.d.ts' .",
2123
"test": "pnpm vitest run"
2224
},
2325
"dependencies": {
@@ -30,14 +32,15 @@
3032
},
3133
"devDependencies": {
3234
"@ast-grep/cli": "^0.43.0",
33-
"@biomejs/biome": "^2.4.16",
34-
"@types/node": "^25.9.2",
35-
"convert-to-arrow": "^1.0.21",
36-
"npm-run-all2": "^9.0.1",
37-
"oxlint": "^1.69.0",
35+
"@ast-grep/cli-linux-x64-gnu": "^0.43.0",
36+
"@biomejs/biome": "^2.5.0",
37+
"@types/node": "^26.0.0",
38+
"convert-to-arrow": "^1.1.4",
39+
"npm-run-all2": "^9.0.2",
40+
"oxlint": "^1.70.0",
3841
"oxlint-tsgolint": "^0.23.0",
3942
"tsx": "^4.22.4",
4043
"typescript": "^6.0.3",
41-
"vitest": "^4.1.8"
44+
"vitest": "^4.1.9"
4245
}
4346
}

0 commit comments

Comments
 (0)