Skip to content

Latest commit

 

History

History
48 lines (33 loc) · 984 Bytes

lint-staged.md

File metadata and controls

48 lines (33 loc) · 984 Bytes

lint-staged

Design

Root .husky/pre-commit

  • pre-commit git hook is triggered once from git root
  • hook uses yarn to spawn "precommit" scripts from workspaces
  • only run on workspaces changed since branching from master
  • stream output from the spawned child processes
yarn workspaces foreach --parallel --since="master" --topological-dev --verbose run precommit

Package package.json

  • run lint-staged on "precommit"
{
  "scripts": {
    "precommit": "lint-staged"
  }
}

Package .lintstagedrc.json

  • scripts to execute on pre-commit
{
  "*": ["..."]
}

Rationale

Follow recommended configuration from lint-staged for monorepos.

Configuration ensures pre-commit scripts are only triggered once. yarn is used to filter workspaces for more efficient linting.

References