knip
Identify and remove unused dependencies, files, and exports in TypeScript and JavaScript projects. Use when detecting unused code, cleaning up dead code, improving maintainability, or reducing bundle sizes.
安装与使用
请根据来源仓库和你的 AI 工具说明安装此技能。先阅读技能文件和依赖要求,再添加到工作流。
查看来源 ↗使用指南技能说明
Knip
Find unused files, dependencies, and exports in TypeScript/JavaScript projects.
Usage
bunx knip # Analyze project
bunx knip --production # Production only (no tests, devDeps)
bunx knip --strict # Direct dependencies only
bunx knip --fix # Auto-remove unused (use cautiously)
bunx knip --include files # Only unused files
bunx knip --include exports # Only unused exports
bunx knip --include dependencies # Only unused deps
Output Formats
bunx knip --reporter compact # Compact output
bunx knip --reporter json # JSON for tooling
bunx knip --reporter github-actions # CI annotations
Filtering
bunx knip --workspace packages/client # Specific workspace
bunx knip --exclude "test/**/*" # Exclude patterns
Debugging
bunx knip --debug # Debug output
bunx knip --trace-file src/utils.ts # Trace file
bunx knip --trace-export myFunction # Trace export
Configuration
Configure via .knip.json or knip.config.js for custom entry points and exclusions.
使用示例
查看来源仓库中的使用示例与配置说明。
查看来源 ↗来源历史
- 收录时间
- 2026-01-20
- 索引更新时间
- 2026-01-26
- Branch
- main
收录与同步日期属于本站记录。源码修改历史请查看来源仓库。
GitHub ↗chat Comments (0)
Sign in to join the discussion and leave a comment.
No comments yet. Be the first to share your thoughts!