ci: add knip for unused dependencies detection#1095
Merged
Conversation
Rsdoctor Bundle Diff AnalysisFound 12 projects in monorepo, 0 projects with changes. 📊 Quick Summary
Generated by Rsdoctor GitHub Action |
- Add knip with workspace-aware configuration for the monorepo - Add check-unused-deps script and CI step in lint workflow - Explicitly declare prettier-plugin-packagejson in .prettierrc - Reformat package.json files per prettier-plugin-packagejson ordering - Move fs-extra and @types/fs-extra from root to e2e where actually used - Add cross-env to e2e devDependencies (used in e2e scripts) - Remove genuinely unused devDependencies: - root: @rstest/coverage-istanbul - browser-ui: @rstest/tsconfig - browser: picocolors - core: @rstest/browser-ui - vscode: @rstest/coverage-istanbul Co-authored-by: factory-droid[bot] <138933559+factory-droid[bot]@users.noreply.github.com>
…nt CI The lint CI runs pnpm install --ignore-scripts (no build), so @rstest/core/dist does not exist. Knip fails when it tries to load rstest.config.mts which imports from @rstest/core. Ignoring the config file lets knip run without needing built packages. Co-authored-by: factory-droid[bot] <138933559+factory-droid[bot]@users.noreply.github.com>
Co-authored-by: factory-droid[bot] <138933559+factory-droid[bot]@users.noreply.github.com>
The browser-coverage e2e fixture relies on @rstest/coverage-istanbul being hoisted from root. Added ignoreDependencies in knip config to suppress the false positive. Co-authored-by: factory-droid[bot] <138933559+factory-droid[bot]@users.noreply.github.com>
Move the dependency from root devDeps into the fixture that actually uses it, instead of relying on hoisting. Co-authored-by: factory-droid[bot] <138933559+factory-droid[bot]@users.noreply.github.com>
The e2e/reporter/fixtures-merge fixture uses the istanbul coverage provider but was relying on the dependency being hoisted from root. Now that we've removed it from root, we need to declare it explicitly in e2e/reporter. Amp-Thread-ID: https://ampcode.com/threads/T-019d22fb-58e7-72a8-9344-a5556e76ecc4 Co-authored-by: Amp <amp@ampcode.com>
- Move @types/is-url from e2e dependencies to devDependencies - Add detailed comments for all ignoreDependencies in knip.json explaining: - @typescript/native-preview: used by rslib for fast DTS generation - @rstest/browser-manifest: virtual module resolved at build time - @tailwindcss/postcss: used in postcss.config.cjs - @rstest/browser: path-mapped imports via tsconfig - ovsx: CLI tool for publishing - @rsbuild/plugin-react: used in sample config for testing Amp-Thread-ID: https://ampcode.com/threads/T-019d22fb-58e7-72a8-9344-a5556e76ecc4 Co-authored-by: Amp <amp@ampcode.com>
…rrors Amp-Thread-ID: https://ampcode.com/threads/T-019d236f-f3b2-72c6-b22a-d5561a8d86a4 Co-authored-by: Amp <amp@ampcode.com>
d140d3d to
3b0ed5f
Compare
9aoy
approved these changes
Mar 25, 2026
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Summary
Background
The monorepo had no tooling to detect unused or misplaced dependencies, allowing dead packages to accumulate silently across workspaces.
Implementation
knip.json) covering allpackages/*and the root workspacecheck-unused-depsscript (knip --dependencies) and a CI step in the lint workflow@rstest/coverage-istanbul(root, vscode),@rstest/tsconfig(browser-ui),picocolors(browser),@rstest/browser-ui(core)fs-extraand@types/fs-extrafrom root toe2e/package.jsonwhere they are actually importedcross-envtoe2e/devDependencies(used in e2e scripts but was only hoisted from root)prettier-plugin-packagejsonin.prettierrcso knip can trace it, and reformatpackage.jsonfiles accordinglyUser Impact
None — internal tooling and dependency hygiene improvement.
Checklist