mirror of
https://github.com/kevinveenbirkenbach/computer-playbook.git
synced 2026-11-06 19:01:54 +00:00
Wires JavaScript linting into the project for the first time, scoped to the Playwright specs and persona helpers under `roles/**/files/**/*.js`. Setup ----- - `package.json` + `package-lock.json` pin eslint v9, eslint-plugin- playwright v2, @eslint/js, globals. - `eslint.config.js` (flat config) loads `eslint:recommended` and `playwright/flat/recommended`. Browser globals are injected so `page.evaluate(() => window.foo)` callbacks lint cleanly. Project- idiomatic patterns are explicitly turned off with rationale: the service-gating contract (req 006/019) uses test.skip on disabled services; persona helpers branch on isVisible/isServiceEnabled before expect; some specs deliberately use waitForTimeout / networkidle for OIDC settle. `no-empty` allows the empty-catch idiom; the autofixer for `prefer-web-first-assertions` and `no-wait-for-navigation` is unsafe in this codebase (broken diff in dashboard.js), so both are off pending a hand-migration pass. - `scripts/lint/javascript.sh` mirrors the markdown.sh shape (skip on missing, exit 127 with "make install-lint" hint). - `scripts/lint/autoformat.sh` gets a `run_eslint` worker (treats rc≤1 as OK, like markdownlint). - `scripts/install/lint.sh` gets `ensure_eslint` (npm-local install in the repo root, matching the markdownlint pattern), a `javascript` group, and `install_javascript_tools` is wired into the `all` group. - `Makefile` exposes `lint-javascript` and folds it into the aggregate `lint` target. - `.github/workflows/lint-javascript.yml` follows the lint-makefile.yml shape (Node 20, npm cache, `npm ci`, `make lint-javascript`); the ci-orchestrator wires it into the lint pipeline + lint-gate `needs:`. - `.gitignore` adds `node_modules/`. Real lint findings fixed in this commit --------------------------------------- - `roles/web-app-decidim/files/playwright.spec.js` was using `runBiberFlow` / `runAdminFlow` without ever requiring `./personas` (would have failed at runtime). Adds the require. - Same file: two nutzlose `\\'csrf-token\\'` escapes in a double-quoted query selector — eslint flagged, fixed. - `roles/web-app-moodle/files/playwright.spec.js`: `expect(await locator.count()).toBe(0)` → `await expect(locator).toHaveCount(0)` (Playwright auto-retrying assertion; safe `prefer-to-have-count` autofix). Lint baseline: 0 errors, 285 warnings (mostly `no-unused-vars` and `playwright/expect-expect` — addressable as follow-up cleanup, not blocking). Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
30 lines
564 B
YAML
30 lines
564 B
YAML
name: "🔍 Lint: JavaScript"
|
|
|
|
on:
|
|
workflow_call:
|
|
|
|
permissions:
|
|
contents: read
|
|
|
|
jobs:
|
|
lint-javascript:
|
|
name: 🧹 Lint JavaScript
|
|
runs-on: ubuntu-latest
|
|
timeout-minutes: 5
|
|
|
|
steps:
|
|
- name: Checkout repository
|
|
uses: actions/checkout@v6
|
|
|
|
- name: Set up Node.js
|
|
uses: actions/setup-node@v4
|
|
with:
|
|
node-version: "20"
|
|
cache: "npm"
|
|
|
|
- name: Install ESLint dependencies
|
|
run: npm ci --no-fund --no-audit
|
|
|
|
- name: Run lint-javascript via make
|
|
run: make lint-javascript
|