Skip to content

Latest commit

Β 

History

History
38 lines (22 loc) Β· 1.51 KB

File metadata and controls

38 lines (22 loc) Β· 1.51 KB

7. githooks

Date: 2022-08-09

Status

2022-08-09 Accepted

Context

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?

Decision

Add Githooks

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.

Options

  1. Github Actions eg. Lint Action
  2. typicode/husky: Git hooks made easy 🐢 woof! : Selected
    1. More popular; many tutorials available
  3. toplenboren/simple-git-hooks: A simple git hooks manager for small projects
  4. pre-commit/pre-commit: A framework for managing and maintaining multi-language pre-commit hooks.

Use husky with lint-staged.

Consequences

  • All commits will linted with the same linting standard before commit
  • Takes a few more seconds to run pre-commit before every commit.

Links