Skip to content

Chore/lint cleanup and template fixes - #56

Merged
aowendev merged 12 commits into
mainfrom
chore/lint-cleanup-and-template-fixes
Aug 10, 2026
Merged

Chore/lint cleanup and template fixes#56
aowendev merged 12 commits into
mainfrom
chore/lint-cleanup-and-template-fixes

Conversation

@aowendev

Copy link
Copy Markdown
Owner

No description provided.

aowendev and others added 12 commits August 10, 2026 23:11
Docusaurus 3.10.1 -> 3.10.2, TinaCMS 3.8.4 -> 3.11.0, @tinacms/cli
2.4.2 -> 2.5.6, Biome 2.4.16 -> 2.5.7, React 19.2.6 -> 19.2.8, plus
sass, webpack, algolia and @types/react.

These changes were already present in the working tree. They land first
because the Biome 2.5 upgrade is what the config migration in the next
commit depends on: 2.5 renamed `recommended` to `preset` and changed the
folder-ignore syntax.
`biome check .` aborted before checking anything: Biome discovers nested
config files regardless of files.includes, and template/biome.json
tripped "found a nested root configuration". Excluding generated output
(static/admin, build, .docusaurus, theme-variables.css) and running
`biome migrate` for 2.5 fixes the rest. Lint scripts now cover the whole
repo instead of five hand-listed directories.

Also turns off complexity/noImportantStyles: all 178 hits are Infima
theme overrides in custom.css, where !important is the intended escape
hatch, and Biome's autofix simply deletes them.

mcp-server/claude-config.json carried // comments after the closing
brace, so Biome emitted hard parse errors. Renamed to .jsonc.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Pure `biome check --fix` output, no hand edits: these files changed only
by running the formatter over them. Kept separate so the behavioural
commits that follow are readable.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
theme/template.jsx: `const slug = usePageSlug()` ran at import time, so
it evaluated once — "" during SSR, then frozen at whatever page loaded
first. It was also entirely unused: the only other `slug` in the file is
the itemProps parameter that shadows it. Removed both.

custom.css: the `@import "../theme/Mermaid/mermaid-zoom.css"` sat 736
lines in, after hundreds of rules, so browsers ignored it. The component
already does `import "./mermaid-zoom.css"` itself, so the @import was
redundant rather than load-bearing — removed instead of relocated.

themeUtils: updateThemeCSS swallowed its own error, so
scripts/update-theme-css.js printed "success" and exited 0 even when the
write failed. It now throws so the caller's existing handler runs.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
The bulk of the project's lint debt lived here. Removed 60 unused
`catch (e)` bindings, four dead functions (escapeXmlWithLineBreaks,
annotateJsxPropsAndChildren, annotateMarkerProps, markerToAngle) and two
dead variables; replaced while/exec loops with matchAll, forEach with
for..of, and string concatenation with template literals.

Also removed the DEBUG tracing facility and its console calls, including
a block hardcoded to one specific document id. Every console.warn in the
import path was already paired with a results.push({status:"error"}) and
an onProgress call, so no diagnostic channel is lost.

Verified behaviour-preserving: exporting 40 real docs through
exportOutOfDateAsXliff produces byte-identical XLIFF before and after.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Mostly mechanical: node: import protocol, optional chaining, template
literals, for..of over forEach, matchAll over while/exec, and
type="button" on 30 buttons that lacked it.

Two things needed judgement:

Hook dependencies were fixed by hand, never by autofix. Biome's
useExhaustiveDependencies fix appends the missing name to the dep array
in place, which in StatusBar.jsx put `checkStatus` in the array two lines
above its own `const` declaration — a TDZ ReferenceError on every render.
The functions are now useCallback-wrapped and declared before the effects
that use them; pure helpers (getStatusColor, getStatusIcon, getStatus)
moved to module scope so they stop being dependencies at all.
GraphQLtest's concurrency guard moved from `loading` state to a ref so
the callback keeps a stable identity.

console calls are gone from src/ and mcp-server/. mcp-server/test.js used
console as its only output channel, so it now reports through exit codes
instead: 0 when the prerequisites are met, 1 otherwise.

Also fixes StatusField, which called tinaForm.change() while tinaForm was
not destructured, and GraphQLtest, whose default export named a binding
that never existed.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
GlossaryTerm: DefinitionBox was declared inside the render body, so React
saw a new component type every render and remounted the popup while it
was open. It is now a plain render function. Also deleted
getDefinitionStyle — 44 lines duplicating DefinitionBox's own viewport
math, already drifted (estimatedHeight 100 vs 120) and never called.

Settings/template.jsx: five navbar field definitions repeated the same
10-line useMemo, differing only in the string compared. Collapsed into
showWhenLinkIs(). The shared path walk was unguarded — an incomplete path
threw and took the whole settings form down — so it now walks safely.
docLink and docId both firing on "doc" is intentional (a doc reference
plus an anchor id) and is preserved. Also removed a dead
createLanguageOptions and fixed stroke-width -> strokeWidth and a <p>
wrapping <div>s, which logged React errors on every settings load.

ConditionsField: removed an unfinished select-all feature (a handler
wired to nothing plus two values computed every render and discarded) and
two empty catch blocks that swallowed input.onChange failures.

Footnote: the context value was rebuilt every render, re-rendering every
consumer and defeating the useCallbacks above it — now memoised. The
window.globalFootnotes fallbacks were unreachable, because createContext
supplies a default addFootnote, so they are gone. Note this means
footnotes still only work inside FootnotesProvider, i.e. on doc pages.

TagsField: "Popular Tags" was hardcoded to one site's taxonomy, including
an "a3-features" entry; it now derives from the tags actually present.
Dropped isLeaf/level, which were never read and whose isLeaf was wrong
once a leaf gained children.

CollapsibleField: dropped an unused hasValue and a {...field, name:
field.name} spread that re-assigned name to itself every render.

Figure: the lightbox had no keyboard exit — it now closes on Escape,
locks background scroll, and the thumbnail is a real button. Images with
no caption had no alt text at all.

ConditionalText: unwrapped the useDocusaurusContext try/catch (its
provider is always mounted); kept the useDoc one, which genuinely throws
off doc pages, with a documented suppression. checkLanguageConditions had
identical "all" and "any" branches, so languageLogic did nothing — "all"
now means every listed language matches.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
prebuild and predev were byte-identical five-link chains, and each
`yarn X` link spawned a whole yarn process. The five generators are
independent — no script reads another's output — so the chain is now
defined once as `generate` and invoked with direct node calls:
3.65s -> 0.94s on every dev start and every build.

Also adds prebuild-local. npm only fires `prebuild` for a script named
exactly `build`, so `yarn build-local` had been skipping generation
entirely.

Not folded into a single node process, though that measures 0.15s:
generate-docs-metadata.js has a `require.main === module` guard, so a
require()-based runner silently skips it. Verified — the build would
succeed while quietly not regenerating.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Shipping template/biome.json made `biome check .` abort at the repo root,
and marking it "root": false was worse: Biome then looks for a parent
root config and, finding none in a scaffolded site, silently ignores the
whole file. Verified by scaffolding from a real tarball — noImportantStyles
fired 20 times in a site whose config sets it to "off". Every site created
with create-docstatic would have had a dead lint config.

The template now ships biome.template.json, a byte-exact copy of the root
config, and the CLI renames it during scaffolding — the same trick as the
dotless "gitignore". The manifest carries a renameFiles map so `--update`
applies it too.

REMOVE_FILES fed both the template cleanup and the manifest's removeFiles,
so listing biome.json there told every existing site to delete its config
— and removals run after copies, so it would have won. Split into
REMOVE_FILES (sites lose these) and TEMPLATE_ONLY_REMOVE.

create-docstatic 0.2.0 -> 0.2.1: the two packages must be published
together, or an older CLI leaves biome.template.json unrenamed and the
scaffolded site has no biome.json at all.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Trailing-newline-only output from the same formatter sweep; these are
template content rather than files mirrored from the root, so they were
missed when the formatting commit was assembled.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
The --update path already refused a docstatic release too old to carry an
update manifest, but the scaffold path validated nothing: it copied the
tree, applied renames, and reported success regardless. That is how the
biome.template.json rename could have produced a site with no biome.json
and said nothing.

Adds two guards:

minCreateVersion in the manifest, checked on both paths. A docstatic
release can now name the oldest CLI able to consume it and be refused by
name instead of silently mis-scaffolding. Checked before anything is
written, so a refusal leaves no half-populated directory. Manifests
without the field predate the check and are still accepted.

Post-rename assertions on the scaffold path: every renameFiles entry must
have disappeared from its source name and appeared at its destination,
and no undeclared *.template.json may survive at the project root — the
catch-all for a template file added without a matching manifest entry.

Note this cannot rescue an already-published CLI, which will never know
about renameFiles; it stops the *next* drift from being silent. Since all
documented invocations use @latest, the realistic exposure is pinned
installs.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
@aowendev
aowendev merged commit 1abbc24 into main Aug 10, 2026
1 check failed
@aowendev
aowendev deleted the chore/lint-cleanup-and-template-fixes branch August 10, 2026 22:35
@aowendev
aowendev restored the chore/lint-cleanup-and-template-fixes branch August 10, 2026 22:36
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