Date: 2022-08-09
2022-08-09 Accepted
The eslint config setup is heavily dependent on precise config of VS Code. Not all developers use the same config and IDE for development. Code with different linting / formatting standards may be pushed into the codebase.
How do we ensure linting standards in the code base? Git hooks?
Git Hooks are scripts that Git executes before or after events such as: commit, push, and receive. Git hooks are a built-in feature - no need to download anything. Git hooks are run locally.
- Github Actions eg. Lint Action
- typicode/husky: Git hooks made easy πΆ woof! : Selected
- More popular; many tutorials available
- toplenboren/simple-git-hooks: A simple git hooks manager for small projects
- pre-commit/pre-commit: A framework for managing and maintaining multi-language pre-commit hooks.
Use husky with lint-staged.
- All commits will linted with the same linting standard before commit
- Takes a few more seconds to run
pre-commitbefore every commit.