-
-
Notifications
You must be signed in to change notification settings - Fork 300
Expand file tree
/
Copy pathknip.config.mts
More file actions
292 lines (288 loc) · 10.5 KB
/
Copy pathknip.config.mts
File metadata and controls
292 lines (288 loc) · 10.5 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
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
import type { KnipConfig } from 'knip';
const config: KnipConfig = {
workspaces: {
'.': {
entry: [
'scripts/**/*.{ts,js,sh}',
'tests/**/*.ts',
'*.config.{js,cjs,mjs,ts}',
'.prettierrc.js',
],
project: ['scripts/**/*.ts', 'tests/**/*.ts', '*.{js,cjs,mjs,ts}'],
ignore: ['scripts/create-package/package-template/**'],
// The `preset: 'ts-jest'` shorthand expands to `ts-jest/jest-preset`,
// which knip can't resolve to an actual file even though `ts-jest` is
// listed in `devDependencies`.
ignoreUnresolved: ['ts-jest/jest-preset'],
// `bats` (used to run the shell script tests) ships a non-standard `bin`
// field, so it has no `.bin` shim and is invoked by path. knip can't tie
// that invocation back to the dependency, so both are declared here.
ignoreBinaries: ['bats/bin/bats'],
ignoreDependencies: ['bats'],
},
'packages/perps-controller': {
// Run directly (`npx tsx tests/e2e/...`) rather than imported, so knip
// needs telling it is an entry point — otherwise the dependencies only
// it uses look unused.
entry: ['tests/e2e/*.ts'],
ignoreDependencies: ['@metamask/accounts-controller'],
},
// -- Per-workspace `ignoreDependencies` snapshots --
//
// The entries below were captured when knip's scope expanded from "root
// only" to the whole monorepo. Each one is a real signal — either a
// missing direct dep (relying on transitive resolution), a dead dep, or a
// knip blind spot — and should be re-evaluated by the owning team. Drop
// an entry once you've either fixed the issue or confirmed it's a
// permanent false positive worth recording.
'packages/account-tree-controller': {
ignoreDependencies: [
'@metamask/controller-utils',
'@metamask/keyring-internal-api',
'lodash',
],
},
'packages/analytics-data-regulation-controller': {
ignoreDependencies: ['cockatiel'],
},
'packages/assets-controller': {
ignoreDependencies: ['@metamask/snaps-sdk'],
},
'packages/assets-controllers': {
ignoreDependencies: [
'@metamask/multichain-account-service',
'bitcoin-address-validation',
],
},
'packages/bridge-controller': {
ignoreDependencies: [
'@metamask/eth-json-rpc-provider',
'@metamask/keyring-internal-api',
],
},
'packages/bridge-status-controller': {
ignoreDependencies: [
'@metamask/gas-fee-controller',
'@metamask/remote-feature-flag-controller',
'lodash',
'nock',
],
},
'packages/compliance-controller': {
ignoreDependencies: ['cockatiel'],
},
'packages/config-registry-controller': {
ignoreDependencies: ['cockatiel'],
},
'packages/core-backend': {
ignoreDependencies: ['@metamask/keyring-internal-api'],
},
'packages/earn-controller': {
ignoreDependencies: ['@metamask/keyring-internal-api'],
},
'packages/eip-5792-middleware': {
ignoreDependencies: [
'@metamask/accounts-controller',
'@metamask/keyring-internal-api',
'@metamask/preferences-controller',
],
},
'packages/eip-7702-internal-rpc-middleware': {
ignoreDependencies: ['@metamask/controller-utils'],
},
'packages/eip1193-permission-middleware': {
ignoreDependencies: ['@metamask/rpc-errors'],
},
'packages/foundryup': {
// `anvil` and `sysctl` are external system binaries, not npm packages.
ignoreBinaries: ['anvil', 'sysctl'],
ignoreDependencies: ['yargs-parser'],
},
'packages/java-tron-up': {
// `sysctl` is an external system binary, not an npm package.
ignoreBinaries: ['sysctl'],
},
'packages/keyring-controller': {
ignoreDependencies: ['@metamask/controller-utils'],
},
'packages/local-node-utils': {
// `sysctl` is an external system binary, not an npm package.
ignoreBinaries: ['sysctl'],
},
'packages/gas-fee-controller': {
ignoreDependencies: ['@metamask/ethjs-unit', 'jest-when'],
},
'packages/geolocation-controller': {
ignoreDependencies: ['cockatiel'],
},
'packages/logging-controller': {
ignoreDependencies: ['@metamask/controller-utils'],
},
'packages/message-manager': {
ignoreDependencies: ['@metamask/eth-sig-util', 'immer', 'jsonschema'],
},
'packages/multichain-account-service': {
ignoreDependencies: [
'@metamask/base-controller',
'@metamask/superstruct',
'lodash',
],
},
'packages/multichain-network-controller': {
ignoreDependencies: ['@solana/addresses', 'immer', 'nock'],
},
'packages/multichain-transactions-controller': {
ignoreDependencies: ['@metamask/polling-controller'],
},
'packages/phishing-controller': {
ignoreDependencies: ['immer', 'punycode'],
},
'packages/platform-api-docs': {
// This package has both a CLI (`src/`) and a Docusaurus site (`site/`).
// Scan both so the CLI's deps (e.g. `glob`, `ts-morph`) and the site's
// `@docusaurus/*` / `prism-react-renderer` imports in
// `docusaurus.config.ts` are seen and neither gets flagged as unused.
entry: ['site/docusaurus.config.ts'],
project: ['src/**/*.{ts,tsx}', 'site/**/*.{ts,tsx}'],
ignoreDependencies: [
// Docusaurus runtime and React peers loaded by the framework at build
// time; the `docusaurus` binary is invoked via execa, never imported
// by source.
'@docusaurus/core',
'@docusaurus/plugin-content-docs',
'@mdx-js/react',
'react',
'react-dom',
// Loaded by docusaurus as a plugin name string (themes[0]); knip
// doesn't trace string-referenced plugins.
'@easyops-cn/docusaurus-search-local',
// Pulled in transitively by `@docusaurus/preset-classic`; pinned here
// so the framework's webpack/theme resolution finds a single version.
'@docusaurus/theme-common',
],
},
'packages/profile-metrics-controller': {
ignoreDependencies: ['cockatiel'],
},
'packages/profile-sync-controller': {
ignoreDependencies: [
'@metamask/controller-utils',
'@metamask/keyring-api',
'@metamask/keyring-internal-api',
'@metamask/snaps-utils',
'immer',
'loglevel',
],
},
'packages/ramps-controller': {
ignoreDependencies: ['immer'],
},
'packages/remote-feature-flag-controller': {
ignoreDependencies: ['cockatiel', 'nock'],
},
'packages/selected-network-controller': {
ignoreDependencies: ['immer', 'lodash', 'nock'],
},
'packages/signature-controller': {
ignoreDependencies: ['lodash'],
},
'packages/snap-account-service': {
ignoreDependencies: [
'@metamask/account-tree-controller',
'@metamask/snaps-utils',
],
},
'packages/subscription-controller': {
ignoreDependencies: ['@metamask/controller-utils'],
},
'packages/transaction-controller': {
ignoreDependencies: [
'@ethereumjs/util',
'@metamask/keyring-controller',
'nock',
],
},
'packages/transaction-pay-controller': {
ignoreDependencies: [
'@ethersproject/contracts',
'@ethersproject/providers',
'bn.js',
],
},
'packages/user-operation-controller': {
ignoreDependencies: ['immer'],
},
'packages/wallet-cli': {
// `anvil` (from Foundry) is an external system binary the real-chain send
// e2e probes and spawns; it's installed via `foundryup`, not an npm
// package, so knip can't tie the invocation to a dependency.
ignoreBinaries: ['anvil'],
// `tsx` is the dev-mode loader: it's referenced only as a `node --import`
// argument string (in `daemon-spawn`'s source-entry path and `bin/dev`),
// never as a traceable import, so knip can't see it.
ignoreDependencies: ['tsx'],
},
'packages/wallet-framework-docs': {
// Source lives under `site/` instead of `src/`; tell knip to scan it
// so the type imports of `@docusaurus/*` / `prism-react-renderer` in
// `docusaurus.config.ts` and `sidebars.ts` are seen and the matching
// devDeps don't get flagged as unused.
entry: ['site/docusaurus.config.ts', 'site/sidebars.ts'],
project: ['content/**/*.{ts,tsx}', 'site/**/*.{ts,tsx}'],
ignoreDependencies: [
// Loaded by docusaurus as a plugin name string (themes[0]); knip
// doesn't trace string-referenced plugins.
'@easyops-cn/docusaurus-search-local',
// Pulled in transitively by `@docusaurus/preset-classic`; pinned
// here so the framework's webpack/theme resolution finds a single
// matching version.
'@docusaurus/theme-common',
// Webpack loader used by docusaurus' build pipeline; never imported
// by source.
'raw-loader',
],
},
},
ignoreDependencies: [
// -- Dependencies used implicitly by the tooling stack --
// Used by Yarn binaries vendored under `.yarn/`.
/^@yarnpkg\//u,
'clipanion',
'typanion',
// Implicitly imported by TypeScript via triple-slash references or
// ambient module declarations.
/^@types\//u,
// CLI tools we invoke as binaries via shell wrappers or root scripts;
// knip can't always trace shell invocations or `yarn <bin>` shims.
'@lavamoat/allow-scripts',
'@lavamoat/preinstall-always-fail',
'@metamask/auto-changelog',
'@metamask/create-release-branch',
'eslint-interactive',
'rimraf',
'simple-git-hooks',
'ts-node',
'typedoc',
// ESLint plugins / configs / parsers loaded by name via the eslint config.
/^@typescript-eslint\//u,
/^eslint-config-/u,
/^eslint-plugin-/u,
'eslint-import-resolver-typescript',
'jest-silent-reporter',
'prettier-plugin-packagejson',
'typescript-eslint',
// Jest test environments referenced as strings in jest configs.
'jest-environment-node',
'jest-environment-jsdom',
// Only `client-controller` actually loads `typedoc-plugin-missing-exports`
// via its `typedoc.json`; the other packages declare it as a devDep but
// never use it. Cleanup is a per-package follow-up.
'typedoc-plugin-missing-exports',
// Pulled in by jest setup files / mocks; many consumer packages list
// these as devDeps "just in case". Real cleanup is a per-package
// follow-up.
'@metamask/providers',
'webextension-polyfill',
],
};
export default config;