Lint the frontend with eslint in its own Docker stage (closes #47)
check / check (push) Successful in 3m48s
check / check (push) Successful in 3m48s
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 was merged in pull request #97.
This commit is contained in:
@@ -0,0 +1,27 @@
|
||||
// eslint's recommended rules over every JavaScript file in the repo.
|
||||
// script/frontend-lint runs it, in the frontend-lint stage of Dockerfile.
|
||||
import js from "@eslint/js";
|
||||
import globals from "globals";
|
||||
import { defineConfig } from "eslint/config";
|
||||
|
||||
export default defineConfig([
|
||||
js.configs.recommended,
|
||||
{
|
||||
// The page, and facts.js, which the viewport test runs inside it.
|
||||
files: ["src/**/*.js", "test/viewport/facts.js"],
|
||||
languageOptions: {
|
||||
globals: {
|
||||
...globals.browser,
|
||||
// vite.config.js defines these when it builds the page.
|
||||
__COMMIT_HASH__: "readonly",
|
||||
__COMMIT_FULL__: "readonly",
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
// Run by node: the tests, the viewport harness and these configs.
|
||||
files: ["test/**/*.js", "*.js"],
|
||||
ignores: ["test/viewport/facts.js"],
|
||||
languageOptions: { globals: globals.node },
|
||||
},
|
||||
]);
|
||||
Reference in New Issue
Block a user