#!/bin/sh
# script/lint: lint the whole repo: eslint over the frontend, then the Go
# linter over backend/.
#
# No linter runs on the host: this builds the frontend-lint and lint
# stages of Dockerfile, the digest-pinned node and golangci-lint images.
# The first runs eslint; the second runs the backend's fmt-check and
# lint targets. --no-cache makes each linter really run every time
# rather than reuse an earlier result, and each stage is built for its
# checks alone, so no image is kept.
set -eu

ROOT="$(cd "$(dirname "$0")/.." && pwd -P)"

main() {
    cd "$ROOT"
    timeout 300 docker build --no-cache --target frontend-lint \
        --output type=cacheonly .
    timeout 300 docker build --no-cache --target lint \
        --output type=cacheonly .
}

main "$@"
