check / check (push) Waiting to run
`REPO_POLICIES.md` binds the repo to a JavaScript styleguide, but nothing checked `static/js/`. ESLint, pinned by `package.json` and `yarn.lock`, now lints it with the styleguide's two checkable rules, `no-var` and `prefer-const`. It runs only in Docker on a digest-pinned node image: a `js-deps` stage installs ESLint and stays cached until the manifests change, and a `js-lint` stage runs it. `script/lint` builds `js-lint`, so `make lint` and `make check` fail on a violation, and the image build depends on it as on the repo's other checks. ESLint, node and yarn are not prerequisites, and `make lint` never uses a host copy. Model: opus-5-5
19 lines
714 B
JavaScript
19 lines
714 B
JavaScript
// ESLint configuration for static/js/. script/lint and the image build run
|
|
// ESLint in the Dockerfile's js-lint stage, never on the host.
|
|
//
|
|
// The rules are the ones the JavaScript styleguide linked from
|
|
// REPO_POLICIES.md states that a linter can check: const for everything,
|
|
// let only for a variable that is reassigned, never var.
|
|
export default [
|
|
// Alpine.js, extracted from 3p/ by make assets; not ours to lint.
|
|
{ ignores: ["static/js/alpine.min.js"] },
|
|
{
|
|
// The pages load static/js/app.js as a classic script, not a module.
|
|
languageOptions: { sourceType: "script" },
|
|
rules: {
|
|
"no-var": "error",
|
|
"prefer-const": "error",
|
|
},
|
|
},
|
|
];
|