#!/bin/sh # script/precommit: run by the git pre-commit hook; fails the commit if # checks fail. Our own extension to scripts-to-rule-them-all. # # Runs lint but deliberately NOT the tests, so the TDD red-phase commit # (failing tests, no implementation yet) can land. CI runs # script/cibuild, which builds both images and so catches any branch # that ships red. # # The formatting check is still enforced here, because script/lint is a # build of Dockerfile.lint and that runs `prettier --check .` as a build # step: a badly formatted tree fails this hook, and therefore the # commit. Calling script/fmt-check as well would only run prettier a # second time over the same tree for the same verdict. # # script/lint is a docker build (Dockerfile.lint); docker is required to # commit, which is the point of linting one way, everywhere. set -eu SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd -P)" main() { "$SCRIPT_DIR/lint" } main "$@"