chore: integrate knip for dead code detection in the codebase
📌 Overview
This Merge Request integrates Knip into the project to enable detection of dead code, including unused files, exports, and dependencies.
The goal is to improve overall code quality, maintainability, and reduce unnecessary code in the repository.
❗ Problem
As the project grows, unused files, functions, and dependencies can accumulate over time. This leads to:
- Increased codebase complexity
- Reduced readability
- Potential maintenance issues
- Unnecessary bundle size
Currently, there is no automated way to detect such dead code in the project.
💡 Solution
Integrate Knip, a powerful static analysis tool, to identify:
- Unused files
- Unused exports
- Unused dependencies
This allows developers to easily detect and clean up dead code.
⚙ ️ Changes Made
- Installed
knipas a development dependency - Added
knip.jsonconfiguration file - Defined project entry points and source scope
- Added npm scripts for running Knip:
npm run knipnpm run knip:fix
- Ensured compatibility with TypeScript (
.ts,.tsx) files
📂 Configuration Details
knip.json
{
"$schema": "https://unpkg.com/knip/schema.json",
"entry": ["src/main.tsx", "src/App.tsx"],
"project": ["src/**/*.{ts,tsx}"],
"ignore": ["node_modules", "dist", "build"]
}