-
Notifications
You must be signed in to change notification settings - Fork 84
chore: use knip for dependency checking #2613
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
gagik
wants to merge
35
commits into
main
Choose a base branch
from
gagik/adopt-knip
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+1,084
−1,141
Open
Changes from all commits
Commits
Show all changes
35 commits
Select commit
Hold shift + click to select a range
3de5611
chore: turn the testing folder into a package
gagik c22d196
chore: move testing folder to packages
gagik d5fb0c4
chore: package-lock
gagik fcfa3cc
chore: fix testing src
gagik c3f1a28
chore: use scripts for test-vscode
gagik 52c0478
chore: export getTestCertificatePath
gagik 0d96836
chore: fix setup-env
gagik a57a1fc
Apply suggestion from @Copilot
gagik 4fcbdd2
chore: move certificates inside
gagik 8b1c261
chore: remove compilation step
gagik 8ca19bc
chore: empty commit
gagik 11615ee
Merge branch 'main' of github.com:mongodb-js/mongosh into gagik/testi…
gagik e18ce64
chore: adjust testing file directory
gagik 48cec6d
chore: fix global file?
gagik f10f53f
chore: use 6.0 mongodb-runner
gagik 486e101
chore: sanity check: import directly
gagik cc857c0
chore: service-provider alignment
gagik dd4a547
chore: one less ..
gagik c909d88
chore: empty commit
gagik 1c165af
chore: fixup browser-repl
gagik 03d6f77
Merge branch 'main' of github.com:mongodb-js/mongosh into gagik/testi…
gagik 97e50ce
chore: package-lock
gagik 29ddf23
chore: fix chore, package-lock
gagik 7139b80
chore: setup knip
gagik cd9fa57
chore: finalize config, fix all non-prod knip issues
gagik 3ae0157
chore: fix knip --production
gagik 0183a87
chore: fix depalign
gagik cd26c47
Merge branch 'main' of github.com:mongodb-js/mongosh into gagik/adopt…
gagik 4e6d08b
chore: package-lock
gagik dc52f81
chore: remove depcheck at package level
gagik 21baf75
chore: rename fix
gagik 5c1c479
chore: fix check, get rid of depcheck completely
gagik 197e772
chore: handle sinon update fallout
gagik 231b794
chore: fix depalign, use script for runtime-support-nocov
gagik a4c2d77
chore: ../lib -> ../
gagik File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,43 @@ | ||
| # Knip ignore file - patterns to exclude from analysis | ||
|
|
||
| # Build outputs | ||
| **/lib/** | ||
| **/dist/** | ||
| **/build/** | ||
|
|
||
| # Coverage and test outputs | ||
| **/coverage/** | ||
| **/.nyc_output/** | ||
|
|
||
| # Generated files | ||
| **/tmp/** | ||
| **/.sbom/** | ||
|
|
||
| # Test fixtures | ||
| **/test/fixtures/** | ||
| **/test/data/** | ||
|
|
||
| # Evergreen CI specific | ||
| .evergreen/** | ||
|
|
||
| # Async rewriter3 (Rust/WASM project) | ||
| packages/async-rewriter3/** | ||
|
|
||
| # Lock files and dependencies | ||
| **/node_modules/** | ||
| package-lock.json | ||
| npm-shrinkwrap.json | ||
| yarn.lock | ||
| pnpm-lock.yaml | ||
|
|
||
| # IDE and editor files | ||
| **/.vscode/** | ||
| **/.idea/** | ||
| **/*.swp | ||
| **/*.swo | ||
| **/*~ | ||
|
|
||
| # OS files | ||
| **/.DS_Store | ||
| **/Thumbs.db | ||
|
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,235 @@ | ||
| 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", | ||
| ], | ||
| }, | ||
|
|
||
| // 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", | ||
| // 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/service-provider-node-driver": { | ||
| ignoreDependencies: [ | ||
| // Used for MONGODB-AWS auth | ||
| // See: https://github.com/mongodb-js/mongosh/pull/1149 | ||
| // See: https://jira.mongodb.org/browse/NODE-5005 | ||
| "aws4", | ||
| ], | ||
| }, | ||
|
|
||
| "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>/` | ||
| "buffer", | ||
| "util", | ||
| ], | ||
| }, | ||
|
|
||
| "packages/java-shell": { | ||
| entry: ["src/test/js/run-tests.ts"], | ||
| project: ["src/main/js/**/*"], | ||
| ignoreDependencies: [ | ||
| // Used in webpack and build scripts | ||
| "bson", | ||
| "tr46", | ||
| "assert", | ||
| "buffer", | ||
| "util", | ||
| ], | ||
| }, | ||
|
|
||
| "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!", | ||
| "test/fixtures/**/*", | ||
| "scripts/*.js", | ||
| "benchmark/index.ts", | ||
| ], | ||
| ignoreFiles: [ | ||
| // Used by make-runtime-support.js | ||
| "src/runtime-support.nocov.js", | ||
| ], | ||
| }, | ||
|
|
||
| "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; | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.