add ESLint pre-commit hook to enforce code quality
Summary
This pull request introduces a pre-commit hook that uses Husky to automatically run ESLint on staged files before each commit. The goal is to enforce consistent code quality and catch potential issues early in the development process.
Changes
Added a pre-commit hook using Husky in the .husky/ directory. Updated package.json to include the necessary scripts for running ESLint. Fixed existing ESLint issues to ensure compliance with the project’s style guide.
Motivation
By integrating this pre-commit hook, we aim to: Enforce consistent code quality by automatically linting code before every commit. Reduce the risk of committing code that doesn't adhere to the coding standards. Ensure uniform code formatting across the team by catching issues before they are committed.
How to Test
Make a code change in any JavaScript file.
Stage the changes using git add
Additional Information
The pre-commit hook only checks the staged files and runs ESLint on them. If no issues are found, the commit will proceed normally.
Review the following changes in direct dependencies. Learn more about Socket for GitHub.
| Diff | Package | Supply Chain Security |
Vulnerability | Quality | Maintenance | License |
|---|---|---|---|---|---|---|
| husky@9.1.7 |
Unfortunately we need to migrate a lot of code before we can do this. Also there is an o going conversation on how we want to fix the linking going forward. I won't close this, but also it might sit for a while.
@wesleytodd I implement a fix https://github.com/expressjs/express/pull/6644 which also solve the same problem using single script npm run lint:fix