eslint-plugin-cleanup-commented
v1.0.0
Published
An ESLint plugin to remove commented-out code and unused imports
Downloads
4
Maintainers
Readme
eslint-plugin-cleanup
🔍 ESLint plugin to remove commented-out code and help clean up unused imports.
✨ Features
- 🚫 Detects and removes commented-out code
- 🧹 Cleans unused variables and imports using native ESLint rules
- 🚰 Supports auto-fix for commented code
📆 Installation
npm install --save-dev eslint-plugin-cleanup🔧 Usage
Add cleanup to your ESLint configuration file (.eslintrc.json, .eslintrc.js, etc.):
Basic Setup
{
"plugins": ["cleanup"],
"rules": {
"cleanup/no-commented-code": "warn",
"no-unused-vars": "warn"
}
}💡 For better unused import detection, consider combining with:
🧪 Example
❌ Bad
// const unused = 123;
// function oldCode() {
// return false;
// }
const active = true;✅ Fixed
const active = true;⚙️ Recommended Config
You can also extend the recommended config:
{
"extends": ["plugin:cleanup/recommended"]
}This includes:
{
"rules": {
"cleanup/no-commented-code": "warn",
"no-unused-vars": "warn"
}
}🚀 Auto-fix
To automatically remove commented code:
npx eslint . --fix📜 License
MIT © Raza
🧠 Contributing
Pull requests welcome. For major changes, please open an issue first.
