Skip to content

chore: strict Credo and ESLint, and the JavaScript layout enforced - #16

Merged
HackTuah merged 9 commits into
mainfrom
silver/lint-strict
Oct 6, 2026
Merged

HackTuah merged 9 commits into
mainfrom
silver/lint-strict

Conversation

@HackTuah

@HackTuah HackTuah commented Oct 6, 2026

Copy link
Copy Markdown
Member

What

This covers silver warnings_strict and coding_standards_enforced.

  • Credo strict. All 18 findings are fixed in code, with no credo:disable: 12 nested module calls now use aliases, 5 aliases are reordered, and 1 escaped doc string changed.
    • server/.credo.exs sets strict: true, so a plain mix credo reports what CI reports.
    • CI runs mix credo --strict and mix test --warnings-as-errors.
  • JavaScript layout enforced by ESLint with @stylistic/eslint-plugin 5.10.0 (pinned dev dependency). About 45 rules match how the code is already written: 12 files changed, +22/−26, all whitespace and quotes. npm run lint:fix applies them.
    • Why not Prettier: measured at print widths 100/120/160/200, every width reformats 137–188 files and pushes the popup past its 131,072-byte budget (132,441–137,377 bytes at open).
  • Stricter ESLint, about 60 rules: eqeqeq (except == null), no-shadow, unused arguments, no-param-reassign, no-unused-expressions, no-loop-func, prefer-const, no-var, no-eval/no-implied-eval/no-new-func, no-implicit-coercion, curly, and others. About 70 findings are fixed in code, with no new suppressions. The popup is now 29 bytes smaller at open.
  • docs/CODING_STANDARDS.md says what each tool enforces and why; CONTRIBUTING.md is updated.
  • After merging main, the new rules caught a closure inside a loop in scripts/bestpractices-links.mjs (merged in docs(best-practices): answer every badge level, with links that prefill the form #10). It's fixed here.

Not enforced, with reasons: line length and one-argument-per-line (both would reflow and grow the popup), no-implicit-globals (background.js is a classic service-worker script, and its globals are used by tests), HTML/CSS formatting (popup budget).

Checked (after merging main)

  • npm run lint: 0 errors. npm test: 1873 pass. npm run perf: all ok. npx playwright test: 99 passed, 4 skipped (on the branch before the merge).
  • reuse lint, check-old-name, check-base-neutral and check-forbidden-files pass.
  • Server: mix format, compile --warnings-as-errors and mix credo --strict ("found no issues") pass. mix test --warnings-as-errors: 1000 tests, 0 failures.

Expect small ci.yml merge conflicts with #13, #15 and the coverage PR (the same server job lines). I'll resolve them as each one lands.

🤖 Generated with Claude Code

Ayla Croft and others added 4 commits October 6, 2026 15:43
Credo's strict mode also reports its low-priority checks. It found 18 issues,
all fixed in the code rather than switched off: nested modules called by their
full name now have an alias at the top of the module, aliases are in
alphabetical order, and a doc string with escaped quotes uses a sigil.

The Credo config now sets strict mode, so a plain `mix credo` reports what CI
reports. CI runs `mix credo --strict` and compiles the tests with
`mix test --warnings-as-errors`, so a warning in a test file fails the build
like one in the server code does.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: Ayla Croft <dev@scriptkittyos.com>
…ules

ESLint now checks the layout the code already follows, with
@stylistic/eslint-plugin (the formatting rules ESLint moved out of its core):
two-space indent, double quotes, semicolons, trailing commas, a multi-line
ternary's ? and : at the start of the line, and the usual spacing.
`npm run lint:fix` applies it. Adopting it changed 12 files by 22 lines.

Prettier was measured instead and not adopted: at print widths from 100 to
200 it rewrote 137 to 188 files and grew what the popup loads at open by
1.6 to 6.5 KB, past its 128 KB cap.

ESLint also gains stricter rules that catch real mistakes: === except for
`x == null`, no shadowed names, no unused arguments, no assignments to
parameters, no expression statements, no closures over a loop's changing
variables, eval and its relatives banned, and const and modern operators
where they apply. Every finding was fixed in the code (renames, blocks
instead of comma expressions, Number() instead of unary +); there are no new
suppressions. What the popup loads at open is 29 bytes smaller.

Playwright tests may still shadow a name: a callback that runs in the
browser takes the test's values under the same name.

docs/CODING_STANDARDS.md and CONTRIBUTING.md say what is enforced and by
which tool, and that Credo runs in strict mode.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: Ayla Croft <dev@scriptkittyos.com>
The stricter ESLint rules (no-loop-func) flagged bestpractices-links.mjs,
which landed on main after this branch started: a closure inside the loop
read the loop's header variable. A plain loop builds the cells instead.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: Ayla Croft <dev@scriptkittyos.com>
@HackTuah
HackTuah requested a review from a team as a code owner October 6, 2026 20:01
@HackTuah
HackTuah requested a review from minitru as a code owner October 6, 2026 20:31
HackTuah pushed a commit that referenced this pull request Oct 6, 2026
…re Met with PR #16

PR #16 runs Credo in strict mode and tests with --warnings-as-errors, adds
about 60 stricter ESLint rules, and enforces the JavaScript layout with
@stylistic/eslint-plugin. These were the last two silver MUSTs. Merge #16
before this, so the answers are true when they are saved on the form.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: Ayla Croft <dev@scriptkittyos.com>
HackTuah pushed a commit that referenced this pull request Oct 6, 2026
The stricter ESLint rules in PR #16 (no-shadow) flag the page builder's
local 'links', which hides the exported links(). Renamed to 'parts'.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: Ayla Croft <dev@scriptkittyos.com>
@HackTuah
HackTuah merged commit 426e6be into main Oct 6, 2026
15 checks passed
@HackTuah
HackTuah deleted the silver/lint-strict branch October 6, 2026 20:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant