Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -317,6 +317,16 @@ jobs:
GOOS: ${{ matrix.config.goos }}
GOARCH: ${{ matrix.config.goarch }}

knip:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
- uses: actions/setup-node@820762786026740c76f36085b0efc47a31fe5020 # v7.0.0
with:
node-version: 'lts/*'
- run: npm ci
- run: npm run knip

format:
runs-on: ubuntu-slim
steps:
Expand Down Expand Up @@ -401,6 +411,7 @@ jobs:
- format
- generate
- go-test
- knip
- go-test-wasm
- lint
- misc
Expand Down
20 changes: 20 additions & 0 deletions Herebyfile.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -1399,6 +1399,25 @@ export const lint = task({
run: runLint,
});

export const knip = task({
name: "knip",
description: "Runs knip.",
run: runKnip,
});

async function runKnip() {
const fixArgs = options.fix ? ["--fix"] : [];
await run(process.execPath, ["node_modules/knip/bin/knip.js", ...fixArgs]);
await run(process.execPath, [
"node_modules/knip/bin/knip.js",
"--include-entry-exports",
"--tags=+internal",
"--tags=-knipignore",
"--include=exports,types",
...fixArgs,
]);
}

async function runLint() {
const lintArgs = ["run"];
if (defaultGoBuildTags.length) {
Expand Down Expand Up @@ -1506,6 +1525,7 @@ export const validate = task({
});
await runValidation("test:smoke", runSmokeTest); // in CI this is run with `--race`
}
await runValidation("knip", runKnip);
await runValidation("lint", runLint);
await runValidation("format", runFormat);

Expand Down
63 changes: 63 additions & 0 deletions knip.jsonc
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
{
"$schema": "https://unpkg.com/knip@6/schema.json",
"exclude": ["duplicates", "enumMembers"],
"tags": ["-knipignore"],
"includeEntryExports": false,
"ignoreExportsUsedInFile": {
"enum": true,
"interface": true,
"type": true
},
"workspaces": {
".": {
"entry": [
"Herebyfile.mjs",
"tools/scripts/lsp/fetchModel.mts",
"tools/scripts/tsc/generate.ts",
"tools/scripts/wasm/go-wasip1-exec.mts",
"tools/scripts/**/*.test.{mts,ts}",
"tsc/internal/stringutil/_scripts/*.mts"
],
"project": [
"tools/scripts/**/*.{mjs,mts,ts}",
"tsc/internal/stringutil/_scripts/*.mts"
],
"ignore": ["tools/scripts/lsp/metaModelSchema.mts"],
"ignoreDependencies": [
"@dprint/json",
"@dprint/typescript",
"@jakebailey/dprint-plugin-gofumpt",
// Loaded through a computed import in generate-unicode-data.mts.
"@unicode/unicode-15.1.0",
"dprint",
"dprint-plugin-yaml"
]
},
"packages/typescript": {
"entry": [
"test/**/*.test.ts",
"test/**/*.bench.ts"
],
"paths": {
"#enums/*": ["src/enums/*.ts"]
},
"project": [
"scripts/**/*.ts",
"src/**/*.ts",
"test/**/*.ts"
],
"ignoreDependencies": [
"vscode-jsonrpc",
// Browser smoke tests use the extension workspace's build tool.
"esbuild"
]
},
"packages/vscode-typescript": {
"project": [
"src/**/*.ts",
"test/**/*.ts"
],
"ignoreDependencies": ["@vscode/vsce", "vscode-languageserver-protocol"]
}
}
}
Loading
Loading