#!/bin/sh # script/fmt-check: check the formatting of this repo's markdown and # CSS (read-only). Like script/lint, it runs only in Docker: it builds # the `fmt-check` stage of Dockerfile.lint, where prettier runs as a # build step. Leaving prettier to run on the host here would have left # `make check` with a host lint path, which is the thing being removed. # # The version, scope and flags live in Dockerfile.lint and must stay in # sync with script/fmt, which is the authoritative copy and stays on the # host because it writes to the working tree. # # Dockerfile.lint requires the CHECK_EPOCH build argument, generated # here exactly as script/cibuild generates it -- see that script for why # the check layer must not be allowed to cache, and why the value is # built in an assignment rather than inline. set -eu ROOT="$(cd "$(dirname "$0")/.." && pwd -P)" main() { cd "$ROOT" epoch="$(date +%s%N)$$" docker build -f Dockerfile.lint --target fmt-check \ --build-arg CHECK_EPOCH="$epoch" . } main "$@"