Skip to content

Commit 28c56cb

Browse files
committed
Housekeep
1 parent 4cb05c9 commit 28c56cb

11 files changed

Lines changed: 83 additions & 71 deletions

File tree

.github/DEVELOPMENT.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -176,7 +176,7 @@ Knip has a few tools set up to verify code quality and to format code and
176176
documentation:
177177

178178
```shell
179-
pnpm format
179+
pnpm fmt
180180
pnpm lint
181181
pnpm knip
182182
pnpm knip --strict
Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
# Legacy pipeline: knip v5 has typescript and @types/node as peer dependencies
2+
3+
name: Tests (against typescript@5.0.4 in Node.js v20)
4+
5+
on:
6+
workflow_dispatch:
7+
pull_request:
8+
push:
9+
branches:
10+
- '**'
11+
tags:
12+
- '!**'
13+
14+
jobs:
15+
test:
16+
strategy:
17+
matrix:
18+
os:
19+
- macos-latest
20+
- ubuntu-latest
21+
- windows-latest
22+
node:
23+
- 20
24+
- 22
25+
26+
runs-on: ${{ matrix.os }}
27+
name: ${{ matrix.os }} (Node v${{ matrix.node }})
28+
29+
steps:
30+
- uses: actions/checkout@v6
31+
- uses: actions/setup-node@v6
32+
with:
33+
node-version: ${{ matrix.node }}
34+
- uses: pnpm/action-setup@v5
35+
- name: Install dependencies
36+
run: pnpm install
37+
- name: Build knip
38+
run: pnpm run build
39+
working-directory: packages/knip
40+
- name: Install earliest supported peer dependencies
41+
run: pnpm add typescript@5.0.4 @types/node@20
42+
working-directory: packages/knip
43+
- name: Type-check against TS 5.0.4
44+
run: |
45+
node -e "let f=require('fs'),p='tsconfig.json';f.writeFileSync(p,f.readFileSync(p,'utf8').replace(/.*(?:rewriteRelativeImportExtensions|erasableSyntaxOnly).*\n/g,''))"
46+
pnpm tsc --noEmit
47+
working-directory: packages/knip
48+
- name: Test knip
49+
run: pnpm run test:smoke
50+
working-directory: packages/knip
51+
- name: Run knip
52+
run: ./packages/knip/bin/knip.js --reporter github-actions
53+
- name: Run knip in strict mode
54+
run: ./packages/knip/bin/knip.js --production --strict
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
# Legacy pipeline: knip v5 has typescript and @types/node as peer dependencies
2+
13
name: Tests (against typescript@latest in Node.js v22)
24

35
on:

.github/workflows/ci-ts-next.yml

Lines changed: 0 additions & 36 deletions
This file was deleted.

.github/workflows/ci.yml

Lines changed: 9 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: Tests (against typescript@5.0.4 in Node.js v20)
1+
name: Tests (against typescript@next in Node.js v24)
22

33
on:
44
workflow_dispatch:
@@ -11,42 +11,26 @@ on:
1111

1212
jobs:
1313
test:
14-
strategy:
15-
matrix:
16-
os:
17-
- macos-latest
18-
- ubuntu-latest
19-
- windows-latest
20-
node:
21-
- 20
22-
- 22
23-
24-
runs-on: ${{ matrix.os }}
25-
name: ${{ matrix.os }} (Node v${{ matrix.node }})
26-
14+
runs-on: ubuntu-latest
15+
name: Ubuntu/Node v24
2716
steps:
2817
- uses: actions/checkout@v6
2918
- uses: actions/setup-node@v6
3019
with:
31-
node-version: ${{ matrix.node }}
20+
node-version: 24
3221
- uses: pnpm/action-setup@v5
3322
- name: Install dependencies
3423
run: pnpm install
24+
- name: Install latest peer dependencies
25+
run: pnpm add typescript@next @types/node@24
26+
working-directory: packages/knip
3527
- name: Build knip
3628
run: pnpm run build
3729
working-directory: packages/knip
38-
- name: Install earliest supported peer dependencies
39-
run: pnpm add typescript@5.0.4 @types/node@20
40-
working-directory: packages/knip
41-
- name: Type-check against TS 5.0.4
42-
run: |
43-
node -e "let f=require('fs'),p='tsconfig.json';f.writeFileSync(p,f.readFileSync(p,'utf8').replace(/.*(?:rewriteRelativeImportExtensions|erasableSyntaxOnly).*\n/g,''))"
44-
pnpm tsc --noEmit
45-
working-directory: packages/knip
4630
- name: Test knip
47-
run: pnpm run test:smoke
31+
run: pnpm run test:node
4832
working-directory: packages/knip
4933
- name: Run knip
50-
run: ./packages/knip/bin/knip.js --reporter github-actions
34+
run: ./packages/knip/bin/knip.js
5135
- name: Run knip in strict mode
5236
run: ./packages/knip/bin/knip.js --production --strict

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
node_modules
22
/.idea/*
33
!/.idea/runConfigurations
4+
.agents
5+
.claude
46
.DS_Store
57
.npmrc
68
packages/*/dist

knip.json

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,15 @@
22
"$schema": "https://unpkg.com/knip@6/schema.json",
33
"workspaces": {
44
".": {
5-
"project": ["!templates/**"]
5+
"project": ["!templates"],
6+
"ignoreBinaries": ["tsc"]
67
},
78
"packages/knip": {
89
"project": [
910
"src/**/*.ts!",
1011
"test/**/*.ts",
1112
"!src/util/empty.ts",
12-
"!**/_template/**"
13+
"!**/_template"
1314
],
1415
"ignoreDependencies": ["prettier"]
1516
},

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
"watch": "pnpm run --dir packages/knip watch",
2323
"docs": "pnpm run --dir packages/docs dev",
2424
"test": "pnpm run --dir packages/knip test",
25-
"format": "oxfmt",
25+
"fmt": "oxfmt",
2626
"lint": "oxlint",
2727
"ci": "oxlint && oxfmt --check && installed-check --ignore-dev",
2828
"release": "./scripts/release.sh"

packages/knip/package.json

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -80,13 +80,12 @@
8080
"knip": "node ./src/cli.ts --directory ../..",
8181
"knip:production": "node ./src/cli.ts --directory ../.. --production --strict",
8282
"lint": "oxlint",
83-
"format": "oxfmt -c ../../.oxfmtrc.json --ignore-path ../../.prettierignore",
83+
"fmt": "oxfmt -c ../../.oxfmtrc.json --ignore-path ../../.prettierignore",
8484
"test": "node scripts/run-test.ts",
8585
"test:node": "tsx --test test/*.test.ts test/**/*.test.ts",
8686
"test:bun": "bun test test/*.test.ts test/**/*.test.ts",
8787
"test:smoke": "glob -c \"tsx --test\" \"test/*.test.ts\" && glob -c \"tsx --test\" \"test/plugins/*.test.ts\" && glob -c \"tsx --test\" \"test/util/*.test.ts\"",
8888
"test:bun:smoke": "bun test test/*.test.ts test/{plugins,util}/*.test.ts",
89-
"watch": "npm link && tsc --watch",
9089
"prebuild": "pnpm run generate-plugin-defs && node rmdir.js dist",
9190
"build": "tsgo",
9291
"qa": "pnpm lint && pnpm build && pnpm knip && pnpm knip:production && pnpm run test",

packages/knip/src/util/load-tsconfig.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { parseTsconfig, type TsConfigJsonResolved } from 'get-tsconfig';
22
import type { CompilerOptions } from '../types/project.ts';
3-
import { isFile as _isFile } from './fs.ts';
3+
import { isFile } from './fs.ts';
44
import { _syncGlob } from './glob.ts';
55
import { dirname, isAbsolute, join, toAbsolute } from './path.ts';
66

@@ -59,9 +59,9 @@ const expandFileNames = (
5959

6060
const resolveReference = (refPath: string, dir: string): string | undefined => {
6161
const abs = isAbsolute(refPath) ? refPath : join(dir, refPath);
62-
if (_isFile(abs)) return abs;
62+
if (isFile(abs)) return abs;
6363
const withTsconfig = join(abs, 'tsconfig.json');
64-
return _isFile(withTsconfig) ? withTsconfig : undefined;
64+
return isFile(withTsconfig) ? withTsconfig : undefined;
6565
};
6666

6767
const fillFromReferences = (
@@ -86,7 +86,7 @@ const fillFromReferences = (
8686
};
8787

8888
export const loadTSConfig = async (tsConfigFilePath: string) => {
89-
if (_isFile(tsConfigFilePath)) {
89+
if (isFile(tsConfigFilePath)) {
9090
try {
9191
const config = parseTsconfig(tsConfigFilePath);
9292

0 commit comments

Comments
 (0)