feat(ci): frontend eslint no-undef gate — catches renamed-function-caller class of bugs (fixes #1342)#1344
Open
Kpa-clawbot wants to merge 2 commits into
Open
feat(ci): frontend eslint no-undef gate — catches renamed-function-caller class of bugs (fixes #1342)#1344Kpa-clawbot wants to merge 2 commits into
Kpa-clawbot wants to merge 2 commits into
Conversation
added 2 commits
May 24, 2026 04:18
Adds the eslint frontend lint gate (.eslintrc.json + CI step in deploy.yml)
PLUS a synthetic canary file (public/_lint_canary.js) that references an
undefined variable. This commit is the RED commit per TDD discipline:
- CI must FAIL on this commit (canary's undef var trips no-undef:error).
- Verifies the gate is wired correctly and actually blocks merges.
- The next commit removes the canary and CI goes GREEN.
Config notes:
- 257 globals declared in .eslintrc.json — discovered by walking
public/*.js for window.X = ... assignments AND top-level
function/const/let/var declarations. Cross-file globals are a
real (pre-existing) reality of vanilla-JS-no-build CoreScope.
- Minimal fix in public/map.js: typeof esc -> typeof globalThis.esc
(esc is a local IIFE var in other files, not a true global).
- eslint@8 (legacy config). Did NOT migrate to flat-config / eslint@9.
Discovered via local lint run on master snapshot:
- 0 latent undef-var bugs after globals were declared honestly
(i.e., would-be #1318 candidates: none currently in tree).
- 80 unused-var warnings (not blocking; argsIgnorePattern=^_ honored).
Refs #1342
Removes public/_lint_canary.js. With the canary gone, `npx eslint public/*.js` exits 0 against the current tree (0 errors, 80 unused-var warnings — not blocking). Mutation check: re-adding the canary re-trips the gate (verified locally). This is the green commit that completes the red→green TDD cycle for #1342. Fixes #1342
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
TDD: red commit
03ea965(canary undef var → CI fails) → green commitb514aeb(canary removed → CI passes). CI URL appears in the Checks tab once GitHub Actions queues this branch.Fixes #1342What ships
.eslintrc.jsonat repo root — eslint 8 legacy-config format.no-undef: error,no-unused-vars: warn(with^_allowlist)..github/workflows/deploy.yml(jobgo-test, after JS unit tests, before proto + Playwright):npm install --no-save eslint@8 && npx eslint public/*.js.--no-savekeepsnode_modulesandpackage-lock.jsonout of the tree (already gitignored).public/map.js:typeof esc === 'function'→typeof globalThis.esc === 'function'.escis a local IIFE var in 5 other files, never exported as a true global; the optional lookup was structurally invalid underno-undef. Behavior unchanged.How this would have caught #1318 / PR #923
PR #923 renamed
drawAnimatedLine, updated one caller inpublic/live.js, missed the other — leaving a reference to the undefinedhashvar. Playwright didn't hit that path. Reverting #1325 locally (re-introducing the bug) → eslint flagshashasno-undef→ red. With the gate in place, #923 never lands.The "quiet pile of globals" reality
The config declares 257 globals. They were discovered by walking
public/*.jsfor two patterns:window.X = ...assignments (the explicit exports — 168 of them)function/const/let/vardeclarations in non-IIFE files (the implicit exports — Go-style cross-file linking via shared HTML<script>order)Plus 9 vendor/runtime names (
L,Chart,QRCode,qrcode,module,global,process,require,exports,__filename,__dirname) for dual-runtime files likeurl-state.js,packet-filter.js,hash-color.js,filter-ux.jsthat are alsorequire()-d by Node tests.This is honest documentation of an architectural reality, not a workaround. Future refactor → modules will collapse this list.
Latent bugs discovered
Zero
no-undeferrors against the currentpublic/*.jstree after globals were enumerated honestly. The would-be-#1318-class bug count today: 0. The gate's job is forward-looking — block the next one.Out of scope (acknowledged from acceptance criteria)
<script>blocks inpublic/*.html— separate ticket.Preflight
bash ~/.openclaw/skills/pr-preflight/scripts/run-all.sh origin/master→ exit 0, clean.