lint-prepush
v3.0.3
Published
Run linters on committed files in a Branch🔬
Maintainers
Readme
lint-prepush: Automate Code Quality Before Every Push 🚀
lint-prepush ensures that linters are automatically run on committed files before you push to a remote, maintaining code quality and consistency within teams.
⚙️ Prerequisites
Make sure you have:
- Node.js
>=18.18.0– Download Node.js - Git Hook Manager – Husky is recommended to integrate with your Git hooks
🚀 Installation
Using npm:
npm install --save-dev lint-prepushUsing yarn:
yarn add --dev lint-prepush🛠️ Configuration
Once installed, configure lint-prepush in your package.json to lint specific file types before pushing.
Basic Example: Lint JavaScript Files with ESLint
"lint-prepush": {
"base": "main",
"tasks": {
"*.js": [
"eslint"
]
}
}This ensures that eslint runs on all .js files in your commit, blocking pushes if any errors are found.
⚡ Concurrent Task Execution
You can run multiple tasks simultaneously on the same file type for faster processing:
"lint-prepush": {
"tasks": {
"*.js": {
"concurrent": ["eslint", "jest"]
}
}
}📢 Verbose Logging
Want more details during the lint process? Enable verbose mode:
"lint-prepush": {
"verbose": true,
"tasks": { ... }
}This will log every step in the process, even when there are no errors.
🎯 How It Works
- Hooks into Git's Pre-Push: By using Husky, lint-prepush leverages Git hooks to automatically run specified tasks on your code before it leaves your local environment.
- Ensures Code Quality: Stop bad code from being pushed by enforcing linting standards.
- Faster Feedback: Concurrent task execution helps you catch problems quickly, reducing the time spent in code review.
🤝 Acknowledgments
This project draws inspiration from:
- Husky for handling Git hooks
- Lint-staged for ideas on managing tasks effectively
We appreciate the efforts of these projects!
🔑 Keywords
- git pre-push hook
- linting automation
- code quality
- eslint
- concurrent tasks
- git hooks
- husky
📜 License
This project is licensed under the MIT License.
