Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Dec 11, 2025

Integrates Knip into the lint workflow to automatically detect unused files, dependencies, exports, and duplicate exports across the monorepo.

Changes

  • Added Knip v5.73.1 as devDependency
  • Created knip.json with workspace-specific configuration:
    • Entry points for root scripts, jaeger-ui (Vite), and plexus (Webpack)
    • Ignore patterns for demo directories
    • Explicit ignore for indirect dependencies (@tanstack/react-virtual, react-side-effect)
  • Integrated into npm run lint via npm-run-all (runs in parallel with existing linters)
  • Updated documentation (README.md, AGENTS.md) to reflect new lint step

What Knip Detects

  • Unused files and dependencies
  • Unlisted dependencies
  • Unused/duplicate exports
  • Dead TypeScript types and enum members

Auto-detected Plugins

TypeScript, React, Vite, Webpack, Jest, Babel, ESLint, Prettier, GitHub Actions, husky, lint-staged

Usage

# Full lint (includes Knip)
npm run lint

# Knip only
npm run knip

# Filter by issue type
npm run knip -- --include files
npm run knip -- --include dependencies

The lint script now fails when dead code is detected, enforcing a cleaner codebase.

Original prompt

I would like to add a step to the npm run lint script that would run Knip to detect and report dead code. Knip should be configured with plugins relevant to this repository,


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

Copilot AI and others added 2 commits December 11, 2025 01:36
- Install knip as dev dependency
- Create knip.json configuration with appropriate plugins
- Add knip script to package.json
- Integrate knip into the lint script using npm-run-all

Co-authored-by: yurishkuro <[email protected]>
Copilot AI changed the title [WIP] Add Knip to npm lint script for dead code detection Add Knip to lint script for dead code detection Dec 11, 2025
Copilot AI requested a review from yurishkuro December 11, 2025 01:45
Signed-off-by: Yuri Shkuro <[email protected]>
@codecov
Copy link

codecov bot commented Dec 11, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 97.89%. Comparing base (60b5118) to head (c3acf11).
⚠️ Report is 1 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #3208      +/-   ##
==========================================
- Coverage   97.89%   97.89%   -0.01%     
==========================================
  Files         262      261       -1     
  Lines        8214     8209       -5     
  Branches     2087     2173      +86     
==========================================
- Hits         8041     8036       -5     
  Misses        172      172              
  Partials        1        1              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@Parship12
Copy link

should it immediately stop merge if it find unused code, or should we first run it in the background without blocking PRs?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants