Skip to content

Commit 4844eaf

Browse files
authored
refactor(lint): replace typecheck with oxlint --type-check (#200)
* refactor(lint): replace typecheck with oxlint --type-check - Replace typecheck scripts with oxlint --type-check in lint and format - Remove dedicated typecheck, typecheck:root, typecheck:submodules scripts - Add lint:submodule and format:submodule for workspace linting/formatting - Update examples to use lint and format with oxlint directly - Simplify lefthook configuration: remove nested groups, add type-check to hook This consolidates type checking into oxlint, eliminating the need for separate tsgo --noEmit invocations. Introduces explicit submodule commands for workspace-level operations. * chore(knip): ignore @typescript/native-preview Add @typescript/native-preview to knip's ignoreDependencies list to prevent false positive unused dependency warnings. This package is required for TypeScript native preview features and is not directly imported in source code. * ci: remove obsolete typecheck step from CI workflow The typecheck functionality is now integrated into the lint step via oxlint --type-check, so the dedicated typecheck step is no longer needed. * chore(hooks): add knip check to push hook Add knip dependency check to the push hook to catch unused dependencies before they are pushed to the repository.
1 parent 15e849f commit 4844eaf

5 files changed

Lines changed: 23 additions & 27 deletions

File tree

‎.github/workflows/ci.yaml‎

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,9 +31,6 @@ jobs:
3131
- name: Run Lint
3232
run: nix develop --command pnpm run lint
3333

34-
- name: Run Type Check
35-
run: nix develop --command pnpm run typecheck
36-
3734
- name: Run Build
3835
run: nix develop --command pnpm run build
3936

‎examples/package.json‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,8 @@
44
"private": true,
55
"type": "module",
66
"scripts": {
7-
"typecheck": "tsgo --noEmit"
7+
"lint": "oxlint --max-warnings=0 --type-aware --type-check",
8+
"format": "oxlint --max-warnings=0 --type-aware --type-check --fix"
89
},
910
"dependencies": {
1011
"@stackone/ai": "workspace:*"

‎knip.config.ts‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,9 @@ export default {
1313
},
1414
ignore: ['**/*.test.ts', '**/*.spec.ts', '**/*.test-d.ts'],
1515
ignoreBinaries: ['only-allow'],
16+
ignoreDependencies: ['@typescript/native-preview', 'lefthook'],
1617
rules: {
1718
optionalPeerDependencies: 'off',
19+
devDependencies: 'warn',
1820
},
1921
} satisfies KnipConfig;

‎lefthook.yaml‎

Lines changed: 13 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,16 @@
11
pre-commit:
2-
parallel: true
2+
piped: true
33
jobs:
4-
- name: lint-fmt
5-
group:
6-
piped: true
7-
jobs:
8-
- name: oxlint
9-
glob: '*.{ts,tsx,js,jsx,mts,cts}'
10-
run: bun oxlint --max-warnings=0 --type-aware --fix {staged_files}
11-
stage_fixed: true
12-
- name: oxfmt
13-
glob: '*'
14-
run: bun oxfmt --no-error-on-unmatched-pattern {staged_files}
15-
stage_fixed: true
4+
- name: oxlint
5+
glob: '*.{ts,tsx,js,jsx,mts,cts}'
6+
run: bun oxlint --max-warnings=0 --type-aware --type-check --fix {staged_files}
7+
stage_fixed: true
8+
- name: oxfmt
9+
glob: '*'
10+
run: bun oxfmt --no-error-on-unmatched-pattern {staged_files}
11+
stage_fixed: true
1612

17-
- name: typecheck
18-
glob: '*.{ts,tsx,mts,cts}'
19-
run: bun run typecheck
13+
push:
14+
jobs:
15+
- name: knip
16+
run: pnpm run lint:knip

‎package.json‎

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -21,19 +21,18 @@
2121
"build": "tsdown",
2222
"format": "pnpm --no-bail --aggregate-output run '/^format:/'",
2323
"format:oxfmt": "oxfmt --no-error-on-unmatched-pattern .",
24-
"format:oxlint": "oxlint --max-warnings=0 --type-aware --fix",
24+
"format:oxlint": "oxlint --max-warnings=0 --type-aware --type-check --fix",
2525
"format:knip": "knip --fix --no-exit-code",
26-
"lint": "pnpm --no-bail --aggregate-output run '/^lint:/'",
26+
"format:submodule": "pnpm --parallel -r --aggregate-output format",
27+
"lint": "pnpm --aggregate-output run '/^lint:/'",
2728
"lint:oxfmt": "oxfmt --no-error-on-unmatched-pattern --check .",
28-
"lint:oxlint": "oxlint --max-warnings=0 --type-aware",
29+
"lint:oxlint": "oxlint --max-warnings=0 --type-aware --type-check",
30+
"lint:submodule": "pnpm --parallel -r --aggregate-output lint",
2931
"lint:knip": "knip",
3032
"preinstall": "npx only-allow pnpm",
3133
"prepack": "npm pkg delete scripts.preinstall && pnpm run build",
3234
"test": "vitest",
33-
"coverage": "vitest run --coverage",
34-
"typecheck": "pnpm --aggregate-output run '/^typecheck:/'",
35-
"typecheck:submodules": "pnpm --parallel -r --aggregate-output typecheck",
36-
"typecheck:root": "tsgo --noEmit"
35+
"coverage": "vitest run --coverage"
3736
},
3837
"dependencies": {
3938
"@modelcontextprotocol/sdk": "catalog:prod",

0 commit comments

Comments
 (0)