-
Notifications
You must be signed in to change notification settings - Fork 5
Open
Description
Setup Husky and Linting Checks Before Commit
Description
Set up Husky to automatically run linting and formatting checks before a commit is made.
This ensures code consistency, prevents lint errors from being committed, and maintains a clean and standardized codebase.
Tasks
- Install and configure Husky for Git hooks
- Install lint-staged to run checks only on staged files
- Ensure ESLint and Prettier configurations are in place
- Create a pre-commit hook to run linting and formatting
- Add scripts in
package.jsonfor:"lint""format""prepare"(for Husky installation)
- Verify that lint and format run automatically before commits
Acceptance Criteria
- Pre-commit hook successfully prevents commits when linting fails
- ESLint and Prettier run only on staged files (using lint-staged)
- Developers can commit only clean, formatted code
- Setup works across all packages in the monorepo (if applicable)
Example Configuration
package.json
{
"scripts": {
"prepare": "husky install",
"lint": "eslint . --ext .ts,.tsx,.js",
"format": "prettier --write ."
},
"lint-staged": {
"*.{ts,tsx,js,jsx}": ["eslint --fix", "prettier --write"]
}
}Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels