-
Notifications
You must be signed in to change notification settings - Fork 92
Expand file tree
/
Copy pathknip.ts
More file actions
248 lines (221 loc) · 5.64 KB
/
Copy pathknip.ts
File metadata and controls
248 lines (221 loc) · 5.64 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
import type { KnipConfig } from "knip";
import fs from "fs";
// Create an empty file to satisfy the knip rule for async-rewriter2
fs.writeFileSync(
"packages/async-rewriter2/src/runtime-support.out.nocov.ts",
"",
);
const config: KnipConfig = {
rules: {
// Disable checking for unused exports, unused exported types, and duplicate dependencies.
exports: "off",
types: "off",
duplicates: "off",
},
// Ignore patterns for files that should not be analyzed
ignore: [
// Build outputs
"**/lib/**",
"**/dist/**",
"**/build/**",
"**/coverage/**",
"**/.nyc_output/**",
// Generated files
"**/tmp/**",
"**/.sbom/**",
"**/test/data/**",
// Configuration files
".evergreen/**",
"config/**",
"configs/**",
"**/.eslintrc.js",
],
// Received from @mongodb-js/sbom-tools
ignoreBinaries: ["mongodb-sbom-tools"],
// Workspace-specific configurations
workspaces: {
// Root package (monorepo root, no entry file needed)
".": {
entry: ["scripts/*.ts"],
project: [],
ignoreBinaries: [
// Lerna is listed as an optional dependency.
"lerna",
],
ignoreDependencies: [
// Shared lint and build-related dependencies
"@mongodb-js/eslint-config-mongosh",
"@mongodb-js/tsconfig-mongosh",
],
},
// Config packages
"configs/eslint-config-mongosh": {
entry: ["utils.js"],
},
"configs/tsconfig-mongosh": {
entry: ["tsconfig.common.json"],
},
// Special cases for packages with different entry points
"packages/cli-repl": {
project: ["src/**/*.ts!", "bin/**/*.js", "test/**/*.ts"],
ignoreDependencies: [
// Eagerly loaded startup snapshot dependencies
"@mongodb-js/saslprep",
"socks",
"emphasize",
"ipv6-normalize",
"bindings",
"system-ca",
"@mongodb-js/socksv5",
"lru-cache",
// Used for monkey-patching our s390x fix
"@tootallnate/quickjs-emscripten",
],
},
"packages/shell-api": {
entry: ["src/api.ts!", "scripts/*.ts", "test/*.ts"],
},
"packages/mongosh": {
project: ["bin/**/*.js"],
},
"packages/e2e-tests": {
entry: ["test/**/*.ts", "test/fixtures/**/*"],
ignoreDependencies: [
// This is used for version check. TODO: Consider changing that test.
"@mongosh/cli-repl",
],
},
"scripts/docker": {
ignoreDependencies: [
// Used by build.sh script.
"mongodb-crypt-library-version",
],
},
"packages/node-runtime-worker-thread": {
ignoreDependencies: [
// Used in worker thread context
"system-ca",
],
ignoreFiles: [
// Used in package.json
"tests/register-worker.js",
],
},
"packages/errors": {
entry: ["src/index.ts!", "scripts/*.ts"],
},
"packages/browser-repl": {
entry: ["src/index.tsx!", "config/*.js"],
project: ["src/**/*.{ts,tsx}!"],
ignoreDependencies: [
"@wojtekmaj/enzyme-adapter-react-17",
"enzyme",
// Karma test runner plugins
"karma-chrome-launcher",
"karma-mocha",
"karma-mocha-reporter",
"karma-typescript",
// Resolved as `<depname>/` in config/webpack.config.base.js
"assert",
"buffer",
"events",
"process",
"punycode",
"string_decoder",
"util",
],
},
"packages/java-shell": {
entry: ["src/test/js/run-tests.ts"],
project: ["src/main/js/**/*"],
ignoreDependencies: [
// Used in webpack and build scripts
"tr46",
"assert",
"buffer",
"events",
"punycode",
"string_decoder",
"util",
// Needed to run tests
"@mongosh/cli-repl",
],
},
"packages/connectivity-tests": {
entry: ["scripts/disable-dns-srv.js"],
// This package only contains bash test scripts
ignoreDependencies: [
// Used by test scripts
"mongosh",
],
},
"packages/async-rewriter2": {
entry: [
"src/index.ts!",
"bin/*.js!",
"scripts/*.js",
"benchmark/index.ts",
],
ignoreFiles: [
// Used by make-runtime-support.js
"src/runtime-support.nocov.js",
],
},
"packages/async-rewriter-spec": {
entry: [
"src/index.ts",
"test/fixtures/**/*",
]
},
"packages/snippet-manager": {
entry: ["test/fixtures/**/*"],
},
testing: {
entry: ["src/**/*.ts"],
project: ["src/**/*.ts"],
},
},
// Mocha test files configuration
mocha: {
config: ["**/mocharc.{js,json,yml,yaml}", "**/.mocharc.{js,json,yml,yaml}"],
entry: ["**/*.spec.{ts,tsx,js}", "**/*.test.{ts,tsx,js}"],
},
// TypeScript configuration
typescript: {
config: [
"tsconfig.json",
"tsconfig-lint.json",
"**/tsconfig.json",
"**/tsconfig-lint.json",
"configs/tsconfig-mongosh/tsconfig.common.json",
],
},
// Webpack configuration
webpack: {
config: [
"config/webpack.base.config.js",
"**/webpack.config.js",
"**/webpack.config.*.js",
],
},
// ESLint configuration
eslint: {
config: [
"configs/eslint-config-mongosh/index.js",
"**/.eslintrc.{js,json}",
],
},
// Prettier configuration
prettier: {
config: [
".prettierrc",
".prettierrc.{js,json,yml,yaml}",
"prettier.config.js",
],
},
// Nyc (test coverage) configuration
nyc: {
config: [".nycrc", ".nycrc.{json,yml,yaml}", "nyc.config.js"],
},
};
export default config;