11import type { KnipConfig } from "knip" ;
22
33const config : KnipConfig = {
4+ rules : {
5+ // Disable checking for unused exports, unused exported types, and duplicate dependencies.
6+ exports : "off" ,
7+ types : "off" ,
8+ duplicates : "off" ,
9+ } ,
410 // Ignore patterns for files that should not be analyzed
511 ignore : [
612 // Build outputs
@@ -12,135 +18,151 @@ const config: KnipConfig = {
1218 // Generated files
1319 "**/tmp/**" ,
1420 "**/.sbom/**" ,
15- // Test fixtures and data
16- "**/test/fixtures/**" ,
1721 "**/test/data/**" ,
18- // Docker and scripts that are executed directly
19- "scripts/docker/**" ,
20- // Async rewriter3 has its own build system (Rust/WASM)
21- "packages/async-rewriter3/**" ,
22- // Configuration files
22+ // Configuration files (from depcheck ignore-patterns)
2323 ".evergreen/**" ,
2424 "config/**" ,
2525 "configs/**" ,
26+ "**/.eslintrc.js" ,
2627 ] ,
2728
28- // Ignore dependencies that are used in build processes or special contexts
29- ignoreDependencies : [
30- // Used in build scripts and webpack configs
31- "terser-webpack-plugin" ,
32- "webpack-bundle-analyzer" ,
33- "webpack-cli" ,
34- "webpack-merge" ,
35- // Used in special build contexts
36- "mongodb-runner" ,
37- "mongodb-crypt-library-dummy" ,
38- // Used in scripts
39- "mongodb-sbom-tools" ,
40- "@pkgjs/nv" ,
41- // Used for husky git hooks
42- "husky" ,
43- // CLI tool
44- "depcheck" ,
45- ] ,
46-
47- // Ignore binaries that are used in scripts
48- ignoreBinaries : [ "depalign" , "monorepo-where" , "precommit" ] ,
49-
50- // Global entry files at root level
51- entry : [ "scripts/**/*.{js,ts,mjs}" , "testing/**/*.ts" ] ,
52-
53- // Project files to analyze at root level
54- project : [
55- "scripts/**/*.{js,ts,mjs}" ,
56- "testing/**/*.ts" ,
57- "configs/**/*.{js,ts}" ,
58- ] ,
29+ // Received from @mongodb -js/sbom-tools
30+ ignoreBinaries : [ "mongodb-sbom-tools" ] ,
5931
6032 // Workspace-specific configurations
6133 workspaces : {
34+ // Root package (monorepo root, no entry file needed)
6235 "." : {
63- // Root workspace configuration
64- entry : [ "scripts/**/*.{js,ts,mjs}" , "testing/**/*.ts" ] ,
36+ entry : [ "scripts/*.ts" ] ,
37+ project : [ ] ,
38+ ignoreBinaries : [
39+ // Lerna is listed as an optional dependency.
40+ "lerna" ,
41+ ] ,
6542 } ,
6643
6744 // Config packages
6845 "configs/eslint-config-mongosh" : {
69- entry : [ "index.js" , " utils.js"] ,
46+ entry : [ "utils.js" ] ,
7047 } ,
7148
7249 "configs/tsconfig-mongosh" : {
7350 entry : [ "tsconfig.common.json" ] ,
7451 } ,
7552
76- // Main packages
77- "packages/*" : {
78- entry : [ "src/index.ts" , "src/index.tsx" , "lib/index.js" , "bin/**/*.js" ] ,
79- project : [ "src/**/*.{ts,tsx}" , "bin/**/*.js" ] ,
80- } ,
81-
8253 // Special cases for packages with different entry points
8354 "packages/cli-repl" : {
84- entry : [ "bin/mongosh.js" , "src/run.ts" , "dist/add-module-mapping.js" ] ,
85- project : [ "src/**/*.ts" , "bin/**/*.js" ] ,
55+ project : [ "src/**/*.ts" , "bin/**/*.js" , "test/**/*.ts" ] ,
56+ ignoreDependencies : [
57+ // Eagerly loaded startup snapshot dependencies
58+ "@mongodb-js/saslprep" ,
59+ "socks" ,
60+ "emphasize" ,
61+ "ipv6-normalize" ,
62+ "bindings" ,
63+ "system-ca" ,
64+ // Used for monkey-patching our s390x fix
65+ "@tootallnate/quickjs-emscripten" ,
66+ ] ,
8667 } ,
8768
8869 "packages/shell-api" : {
8970 entry : [ "src/api.ts" ] ,
90- project : [ "src/**/*.ts" ] ,
9171 } ,
9272
93- "packages/build" : {
94- entry : [
95- "src/evergreen-release.ts" ,
96- "src/release.ts" ,
97- "src/update-cta.ts" ,
98- ] ,
99- project : [ "src/**/*.ts" ] ,
73+ "packages/mongosh" : {
74+ project : [ "bin/**/*.js" ] ,
10075 } ,
10176
10277 "packages/e2e-tests" : {
103- entry : [ "test/**/*.ts" ] ,
104- project : [ "test/**/*.ts" ] ,
78+ entry : [ "test/**/*" , "test/fixtures/**/*" ] ,
79+ ignoreDependencies : [
80+ // Used indirectly
81+ "@mongosh/cli-repl" ,
82+ ] ,
83+ } ,
84+
85+ "scripts/docker" : {
86+ ignoreDependencies : [
87+ // Used by build.sh script.
88+ "mongodb-crypt-library-version" ,
89+ ] ,
90+ } ,
91+
92+ "packages/service-provider-node-driver" : {
93+ ignoreDependencies : [
94+ // Used for MONGODB-AWS auth
95+ // See: https://github.com/mongodb-js/mongosh/pull/1149
96+ // See: https://jira.mongodb.org/browse/NODE-5005
97+ "aws4" ,
98+ ] ,
99+ } ,
100+
101+ "packages/node-runtime-worker-thread" : {
102+ ignoreDependencies : [
103+ // Used in worker thread context
104+ "system-ca" ,
105+ ] ,
106+ ignoreFiles : [
107+ // Used in package.json
108+ "tests/register-worker.js" ,
109+ ] ,
105110 } ,
106111
107112 "packages/browser-repl" : {
108- entry : [ "src/index.tsx " ] ,
113+ entry : [ "config/*.js " ] ,
109114 project : [ "src/**/*.{ts,tsx}" ] ,
115+ ignoreDependencies : [
116+ "@wojtekmaj/enzyme-adapter-react-17" ,
117+ "enzyme" ,
118+ // Karma test runner plugins
119+ "karma-chrome-launcher" ,
120+ "karma-mocha" ,
121+ "karma-mocha-reporter" ,
122+ "karma-typescript" ,
123+ // Resolved as `<depname>/` so depcheck doesn't see it being used
124+ "buffer" ,
125+ "util" ,
126+ ] ,
110127 } ,
111128
112129 "packages/java-shell" : {
113- entry : [
114- "src/main/kotlin/**/*.kt" ,
115- "src/test/kotlin/**/*.kt" ,
116- "gen-doc/**/*.js" ,
117- "gen-kotlin/**/*.js" ,
118- ] ,
119- project : [
120- "src/main/kotlin/**/*.kt" ,
121- "gen-doc/**/*.js" ,
122- "gen-kotlin/**/*.js" ,
130+ entry : [ "src/test/js/run-tests.ts" ] ,
131+ project : [ "src/main/js/**/*" ] ,
132+ ignoreDependencies : [
133+ // Used in webpack and build scripts
134+ "bson" ,
135+ "tr46" ,
136+ "assert" ,
137+ "buffer" ,
138+ "util" ,
123139 ] ,
124140 } ,
125141
126142 "packages/connectivity-tests" : {
127- entry : [ "index.js" ] ,
128- project : [ "**/*.js" ] ,
143+ entry : [ "scripts/disable-dns-srv.js" ] ,
144+ // This package only contains bash test scripts
145+ ignoreDependencies : [
146+ // Used by test scripts
147+ "mongosh" ,
148+ ] ,
129149 } ,
130150
131- testing : {
132- entry : [
133- "eventually.ts" ,
134- "fake-kms.ts" ,
135- "integration-testing-hooks.ts" ,
136- "disable-dns-srv.js" ,
151+ "packages/async-rewriter2" : {
152+ entry : [ "test/fixtures/**/*" ] ,
153+ ignoreFiles : [
154+ // Used by make-runtime-support.js
155+ "src/runtime-support.nocov.js" ,
137156 ] ,
138- project : [ "**/*.{ts,js}" ] ,
139157 } ,
140158
141- "scripts/docker" : {
142- entry : [ "**/*.js" ] ,
143- project : [ "**/*.js" ] ,
159+ "packages/snippet-manager" : {
160+ entry : [ "test/fixtures/**/*" ] ,
161+ } ,
162+
163+ testing : {
164+ entry : [ "src/**/*.ts" ] ,
165+ project : [ "src/**/*.ts" ] ,
144166 } ,
145167 } ,
146168
0 commit comments