2024-11-05 18:36:34 +00:00
|
|
|
import { KnipConfig } from "knip";
|
|
|
|
|
|
2026-03-05 21:42:08 +00:00
|
|
|
// Specify this as knip loads config files which may conditionally add reporters, e.g. `@casualbot/jest-sonar-reporter'
|
|
|
|
|
process.env.GITHUB_ACTIONS = "1";
|
|
|
|
|
|
2024-11-05 18:36:34 +00:00
|
|
|
export default {
|
2026-01-21 13:33:53 +00:00
|
|
|
workspaces: {
|
2026-04-09 15:31:34 +01:00
|
|
|
"packages/shared-components": {},
|
2026-03-05 21:42:08 +00:00
|
|
|
"packages/playwright-common": {
|
2026-04-10 17:39:46 +01:00
|
|
|
entry: ["src/fixtures/index.ts", "src/testcontainers/index.ts"],
|
2026-02-24 16:10:34 +00:00
|
|
|
ignoreDependencies: [
|
2026-03-05 21:42:08 +00:00
|
|
|
// Used in playwright-screenshots.sh
|
|
|
|
|
"wait-on",
|
2026-02-24 16:10:34 +00:00
|
|
|
],
|
2026-03-20 19:41:13 +00:00
|
|
|
ignoreBinaries: ["awk"],
|
2026-01-21 13:33:53 +00:00
|
|
|
},
|
2026-04-13 09:30:22 +01:00
|
|
|
"packages/module-api": {},
|
2026-02-24 16:10:34 +00:00
|
|
|
"apps/web": {
|
2026-01-21 13:33:53 +00:00
|
|
|
entry: [
|
|
|
|
|
"src/serviceworker/index.ts",
|
|
|
|
|
"src/workers/*.worker.ts",
|
|
|
|
|
"src/utils/exportUtils/exportJS.js",
|
|
|
|
|
"src/vector/localstorage-fix.ts",
|
|
|
|
|
"scripts/**",
|
|
|
|
|
"playwright/**",
|
|
|
|
|
"test/**",
|
|
|
|
|
"res/decoder-ring/**",
|
|
|
|
|
"res/jitsi_external_api.min.js",
|
2026-03-05 21:42:08 +00:00
|
|
|
"res/themes/*/css/*.pcss",
|
2026-01-21 13:33:53 +00:00
|
|
|
],
|
|
|
|
|
ignore: [
|
|
|
|
|
// Keep for now
|
|
|
|
|
"src/hooks/useLocalStorageState.ts",
|
2026-02-24 16:10:34 +00:00
|
|
|
],
|
|
|
|
|
ignoreDependencies: [
|
|
|
|
|
// False positive
|
|
|
|
|
"sw.js",
|
|
|
|
|
// Used by webpack
|
|
|
|
|
"process",
|
|
|
|
|
"util",
|
|
|
|
|
// Embedded into webapp
|
|
|
|
|
"@element-hq/element-call-embedded",
|
|
|
|
|
|
|
|
|
|
// Used by matrix-js-sdk, which means we have to include them as a
|
|
|
|
|
// dependency so that // we can run `tsc` (since we import the typescript
|
|
|
|
|
// source of js-sdk, rather than the transpiled and annotated JS like you
|
|
|
|
|
// would with a normal library).
|
|
|
|
|
"@types/content-type",
|
|
|
|
|
"@types/sdp-transform",
|
|
|
|
|
],
|
|
|
|
|
},
|
2026-03-24 12:57:31 +00:00
|
|
|
"apps/desktop": {
|
|
|
|
|
entry: ["src/preload.cts", "electron-builder.ts", "scripts/**", "hak/**"],
|
|
|
|
|
project: ["**/*.{js,ts}"],
|
|
|
|
|
ignoreDependencies: [
|
|
|
|
|
// Brought in via hak scripts
|
|
|
|
|
"matrix-seshat",
|
|
|
|
|
],
|
|
|
|
|
ignoreBinaries: ["scripts/in-docker.sh"],
|
|
|
|
|
},
|
2026-02-24 16:10:34 +00:00
|
|
|
".": {
|
|
|
|
|
entry: ["scripts/**", "docs/**"],
|
2026-01-21 13:33:53 +00:00
|
|
|
},
|
|
|
|
|
},
|
2024-11-05 18:36:34 +00:00
|
|
|
ignoreExportsUsedInFile: true,
|
2026-03-05 21:42:08 +00:00
|
|
|
compilers: {
|
|
|
|
|
pcss: (text: string) =>
|
|
|
|
|
[...text.matchAll(/(?<=@)import[^;]+/g)]
|
|
|
|
|
.map(([line]) => {
|
|
|
|
|
if (line.startsWith("import url(")) {
|
|
|
|
|
return line.replace("url(", "").slice(0, -1);
|
|
|
|
|
}
|
|
|
|
|
return line;
|
|
|
|
|
})
|
|
|
|
|
.join("\n"),
|
|
|
|
|
},
|
2026-02-12 15:19:59 +00:00
|
|
|
nx: {
|
2026-03-05 21:42:08 +00:00
|
|
|
config: ["{nx,package,project}.json", "{apps,packages,modules}/**/{package,project}.json"],
|
2026-02-12 15:19:59 +00:00
|
|
|
},
|
2026-03-31 14:52:50 +02:00
|
|
|
playwright: {
|
|
|
|
|
config: ["playwright.config.ts", "playwright-merge.config.ts"],
|
|
|
|
|
},
|
2026-03-05 21:42:08 +00:00
|
|
|
tags: ["-knipignore"],
|
2024-11-05 18:36:34 +00:00
|
|
|
} satisfies KnipConfig;
|