Repository navigation
Adopt §15 lint, and delete a dead buttons option six call sites were passing - #2
Conversation
…e passing
First of the source-only packages to adopt, using the library CI template from
tgwab-standards #107. This repo had no CI at all, because the only workflow
template available gated a build it does not have.
THE UNUSED-VARIABLE RULE FOUND THE THING IT WAS ADDED FOR. `createEditor()` in
features/_editor.js destructured `buttons` and never used it, while SIX callers
passed `buttons: ACTIONS` into it -- text-tools, analyzers, translators,
case-converter, code-data and generators. `toolbarLeft` and `toolbarRight` next
to it ARE rendered; `buttons` was dropped on the floor.
The actions still appear, because the host reads the tool descriptor's own
`actions: ACTIONS` key. So six call sites passed an argument that did nothing and
looked exactly like the thing that made them work. That is the herald defect --
a parameter standing in as evidence for wiring that is not there -- and it is the
first time this rule has caught its own class in the estate rather than style
noise.
Removed in full: the ignored binding and all six call sites. Leaving the callers
passing a key nothing reads would have preserved the confusion the rule just
removed.
WORTH A SECOND OPINION: if `buttons` was MEANT to render into the toolbar and
never got wired, this change surfaces that rather than hiding it -- the revert is
one line plus a real implementation. On the evidence I could see it is a leftover
from an earlier design, since the actions already render via the descriptor.
THE OTHER TEN FINDINGS
3 no-useless-escape `\[` inside a character class and a trailing `\-`.
Verified behaviour-identical before changing: each old
and new regex run over 14 samples, byte-identical output.
4 no-empty localStorage try/catch. Annotated, not suppressed --
each now says why the failure is ignorable.
1 no-control-regex `\x1B` in the ANSI stripper. Intentional: ESC IS what
starts an ANSI sequence, so matching it is the point.
An inline disable with a reason, placed adjacent to the
line -- the first attempt put it two lines up behind a
comment, where ESLint correctly reported it as an unused
directive.
2 no-restricted-syntax DECLARED EXEMPTION, not a code change. Both are in
features/code-data.js, which builds a regex-match REPORT:
`lines.push('@12 "matched"')` into an array that ends in
`lines.join('\n')` and renders as plain text. Nothing is
parsed as HTML, so the `</script>` escape cannot happen.
The exemption names the file and the reason. "It returns
a string" would not be a valid reason; "joined with
newlines and shown as text" is, and that is what I read.
ALSO CREATED, because this package never had a dependency: package-lock.json
(npm ci fails outright without one), .nvmrc (node-version-file fails without it),
and a .gitignore -- the repo had none, so node_modules would have been committed.
VERIFIED: npm ci from a clean tree rc 0 (the new lockfile works), lint rc 0,
2/2 tests. The fixture control asserts -- five hazards flagged, both negative
controls untouched. A planted hazard fails lint (rc 1) and the same hazard inside
the exempted file does NOT, which is what makes the exemption narrow rather than
a repo-wide off switch.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_0126UXfnHngrTg7kqmw87ipV
|
DevOps gate read — ready for review. The dead That is the Verified the disables: the fixture's expected This repo is one of the two with no lockfile, so this adoption creates one as part of the change — Flipping ready. |
First source-only package to adopt, using the library CI template from
tgwab-standards#107. This repo had no CI at all, because the only workflow template available gated a build it does not have.The unused-variable rule found the thing it was added for
createEditor()infeatures/_editor.jsdestructuredbuttonsand never used it — while six callers passedbuttons: ACTIONSinto it:text-tools,analyzers,translators,case-converter,code-data, andgenerators.toolbarLeftandtoolbarRightbeside it are rendered;buttonswas dropped on the floor.The actions still appear on screen, because the host reads the tool descriptor's own
actions: ACTIONSkey. So six call sites passed an argument that did nothing and looked exactly like the thing that made them work.That is the herald defect — a parameter standing in as evidence for wiring that is not there — and it is the first time this rule has caught its own class in the estate rather than style noise.
Removed in full: the ignored binding and all six call sites. Leaving callers passing a key nothing reads would have preserved the confusion the rule just removed.
Worth a second opinion: if
buttonswas meant to render into the toolbar and never got wired, this change surfaces that rather than hiding it — the revert is one line plus a real implementation. On the evidence I could see it is a leftover from an earlier design, since the actions already render via the descriptor.The other ten findings
no-useless-escape\[inside a character class, and a trailing\-. Verified behaviour-identical before changing — each old and new regex run over 14 samples, byte-identical output.no-emptylocalStoragetry/catch. Annotated, not suppressed — each now says why the failure is ignorable.no-control-regex\x1Bin the ANSI stripper. Intentional: ESC is what starts an ANSI sequence. Inline disable with a reason, placed adjacent to the line — my first attempt put it two lines up behind a comment, where ESLint correctly reported it as an unused directive.no-restricted-syntaxThe exemption, and why it is narrow
Both
no-restricted-syntaxhits are infeatures/code-data.js, which builds a regex-match report:lines.push('@12 "matched"')into an array that ends inlines.join('\n')and renders as plain text. Nothing is parsed as HTML, so the</script>escape the rule exists to stop cannot happen.The exemption names the file and the reason. "It returns a string" would not be a valid reason; "joined with newlines and shown as text" is, and that is what I actually read before writing it.
Proven narrow: a hazard planted elsewhere fails lint (rc 1), and the same hazard inside the exempted file does not — so this is a scoped exemption, not a repo-wide off switch.
Also created, because this package never had a dependency
package-lock.json—npm cifails outright without one..nvmrc—node-version-filefails without it..gitignore— the repo had none, sonode_modules/would have been committed on the first install.Verification
npm cifrom a clean tree, rc 0 — the newly created lockfile worksnpm run lintrc 0Opened as a draft: devops flips on the green.
🤖 Generated with Claude Code
https://claude.ai/code/session_0126UXfnHngrTg7kqmw87ipV