-
Notifications
You must be signed in to change notification settings - Fork 364
Expand file tree
/
Copy pathknip.config.ts
More file actions
78 lines (74 loc) · 2.78 KB
/
knip.config.ts
File metadata and controls
78 lines (74 loc) · 2.78 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
import type {KnipConfig} from "knip";
/**
* knip is a tool for discovering dead code:
* https://knip.dev/
*
* To use: `pnpm knip`
*/
// About `project` and `entry`: Knip will only look for dead code in `project`
// files. Files and exports in `project` are reported as unused if they are
// not reachable from any of the `entry` files.
// See: https://knip.dev/guides/configuring-project-files#unused-files
// Paths marked with `!` are production files.
const basePackageConfig = {
project: ["src/**/*.{ts,tsx,js,jsx}!"],
entry: [
"src/index.{ts,tsx}!",
"src/**/*.cypress.{ts,tsx}",
"src/**/*.test.{ts,tsx}",
"src/**/*.typetest.{ts,tsx}",
"src/**/*.stories.{ts,tsx}",
],
};
const config: KnipConfig = {
workspaces: {
".": {
project: ["{config,utils}/**/*.{ts,tsx,js,jsx}"],
entry: [
// CLI tools
"utils/**/*.{ts,tsx,js,jsx}",
],
},
"packages/*": basePackageConfig,
"packages/perseus-core": {
...basePackageConfig,
entry: [
...basePackageConfig.entry,
// These files contain test data. They are dynamically imported via
// glob patterns, so Knip can't figure out that they're used.
"src/parse-perseus-json/regression-tests/{article,item,user-input,renderer}-data/**",
// CLI used for testing against production data.
"src/parse-perseus-json/exhaustive-test-tool/index.ts",
],
},
},
// These are packages that are listed in package.json files but not
// directly imported in our code.
ignoreDependencies: [
// perseus-build-settings is listed as a dependency so package
// versions will get automatically bumped when there is a change to
// our build tooling.
"perseus-build-settings",
// WB Themeing support comes via CSS variables that are imported from
// this tokens package and are included from
// .storybook/styles/shared.css
"@khanacademy/wonder-blocks-tokens",
// @swc-node/register is used in the shabang of executable TypeScript
// files.
"@swc-node/register",
// nyc measures code coverage.
"nyc",
// swc_mut_cjs_exports is a plugin for swc, configured like
// `swcrc.jsc.experimental.plugins.push(["swc_mut_cjs_exports", {}]);`
// (hence, not imported).
"swc_mut_cjs_exports",
// @swc/helpers is referenced via externalHelpers in .swcrc, not imported directly.
"@swc/helpers",
],
// Scripts we use in `package.json`
ignoreBinaries: [
"utils/pre-publish-check-ci.ts",
"utils/update-catalog-hashes-cli.ts",
],
};
export default config;