-
Notifications
You must be signed in to change notification settings - Fork 22
/
knip.mjs
78 lines (68 loc) · 2.35 KB
/
knip.mjs
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 configFactory from "./webpack.config.mjs";
const config = configFactory(process.env, {});
/**
* https://knip.dev/overview/configuration#customize
* @type {import("knip").KnipConfig}
*/
const knipConfig = {
$schema: "https://unpkg.com/knip@5/schema.json",
entry: [
...Object.values(config.entry).map((x) =>
`${x}.{ts,tsx,js,jsx}`.replace("./", ""),
),
// Loaded via .eslintrc
"eslint-local-rules/*",
// Imported via .html files and manifest.json
"static/*",
// App messenger and common storage
"src/background/messenger/external/api.ts",
"src/store/browserExtensionIdStorage.ts",
// Scripting/config entry points that are not being picked up
"src/testUtils/FixJsdomEnvironment.js",
"end-to-end-tests/auth.setup.ts",
"scripts/DiscardFilePlugin.mjs",
],
// https://knip.dev/guides/handling-issues#mocks-and-other-implicit-imports
ignore: [
"@contrib/**",
// Test Mocks
"**/__mocks__/**",
// Dummy file to test lint rules
"eslint-local-rules/noRestrictedSyntax.tsx",
// Polyfills
"src/vendors/process.js",
// Aliases defined in tsconfig.json
"src/contrib/uipath/quietLogger.ts",
// Development/debugging helpers
"src/development/hooks/**",
// Type-only strictNullChecks helper
"src/types/typeOnlyMessengerRegistration.ts",
// https://knip.dev/reference/jsdoc-tsdoc-tags/#tags-cli
// Instead of adding files to this list, prefer adding a @knip JSDoc comment with explanation, like:
// /** @knip We want to use this later */
// export const someValue = 0;
],
ignoreDependencies: [
// Browser environment types
"@types/chrome",
"@types/dom-navigation",
// Provides require.context, etc.
"@types/webpack-env",
// Used by src/contrib/google/sheets/core/types.ts
"@types/gapi.client",
"@types/gapi.client.drive-v3",
"@types/gapi.client.oauth2-v2",
"@types/gapi.client.sheets-v4",
// Used by Code Editor so format on save matches pre-commit behavior
"prettier",
// Referenced in scss files
"bootstrap",
"compass-mixins",
// Not getting detected by webpack plugin for .storybook/main.js
"style-loader",
"@storybook/react-webpack5",
],
};
// Echo settings to console to make CI results easier to understand/debug
console.log(JSON.stringify(knipConfig, null, 2));
export default knipConfig;