-
-
Notifications
You must be signed in to change notification settings - Fork 2.5k
Expand file tree
/
Copy pathknip.ts
More file actions
82 lines (79 loc) · 2.8 KB
/
knip.ts
File metadata and controls
82 lines (79 loc) · 2.8 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
import { KnipConfig } from "knip";
// Specify this as knip loads config files which may conditionally add reporters, e.g. `@casualbot/jest-sonar-reporter'
process.env.GITHUB_ACTIONS = "1";
export default {
workspaces: {
"packages/shared-components": {},
"packages/playwright-common": {
ignoreDependencies: [
// Used in playwright-screenshots.sh
"wait-on",
],
ignoreBinaries: ["awk"],
},
"apps/web": {
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",
"res/themes/*/css/*.pcss",
],
ignore: [
// Keep for now
"src/hooks/useLocalStorageState.ts",
],
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",
],
},
"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"],
},
".": {
entry: ["scripts/**", "docs/**"],
},
},
ignoreExportsUsedInFile: true,
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"),
},
nx: {
config: ["{nx,package,project}.json", "{apps,packages,modules}/**/{package,project}.json"],
},
playwright: {
config: ["playwright.config.ts", "playwright-merge.config.ts"],
},
tags: ["-knipignore"],
} satisfies KnipConfig;