lint-prepush ensures that linters are automatically run on committed files before you push to a remote, maintaining code quality and consistency within teams.
Make sure you have:
- Node.js
>=18.18.0β Download Node.js - Git Hook Manager β Husky is recommended to integrate with your Git hooks
npm install --save-dev lint-prepushyarn add --dev lint-prepushOnce installed, configure lint-prepush in your package.json to lint specific file types before pushing.
"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.
You can run multiple tasks simultaneously on the same file type for faster processing:
"lint-prepush": {
"tasks": {
"*.js": {
"concurrent": ["eslint", "jest"]
}
}
}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.
- 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.
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!
- git pre-push hook
- linting automation
- code quality
- eslint
- concurrent tasks
- git hooks
- husky
This project is licensed under the MIT License.