Lint the frontend with eslint in its own Docker stage (closes #47)
check / check (push) Successful in 3m54s
check / check (push) Successful in 3m54s
script/lint ran prettier --check, the same check script/fmt-check runs, so the JavaScript had no linter. eslint now runs with its recommended rules, set in eslint.config.js, in a new frontend-lint stage of Dockerfile built from the pinned node image and the lockfile. The frontend stage copies a file from it, as the builder stage does from the Go lint stage, so the image cannot build unless eslint passed. script/lint builds both lint stages with --no-cache and runs no linter on the host; script/fmt-check keeps prettier on the host, and script/frontend-check drops its lint step. The viewport harness fixes the two kinds of finding eslint made. bootstrap wants node 22.13.0, as eslint 10 does. Also covers item 2 of #28. Model: opus-5-5
This commit is contained in:
+10
-8
@@ -1,19 +1,21 @@
|
||||
#!/bin/sh
|
||||
# script/lint: lint the whole repo: prettier over the frontend, then the
|
||||
# Go linter over backend/.
|
||||
# script/lint: lint the whole repo: eslint over the frontend, then the Go
|
||||
# linter over backend/.
|
||||
#
|
||||
# The Go linter runs only in Docker: this builds the lint stage of
|
||||
# Dockerfile, the digest-pinned golangci-lint image, which runs the
|
||||
# backend's fmt-check and lint targets. --no-cache makes the linter
|
||||
# really run every time rather than reuse an earlier result, and the
|
||||
# stage is built for its checks alone, so no image is kept.
|
||||
# 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"
|
||||
"$ROOT/script/frontend-lint"
|
||||
timeout 300 docker build --no-cache --target frontend-lint \
|
||||
--output type=cacheonly .
|
||||
timeout 300 docker build --no-cache --target lint \
|
||||
--output type=cacheonly .
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user