~ knotless Search/
↑↓ move↵ open⇧↵ all results

chadtmiller.com/knotless

git that lives in your Atmosphere account

knotless.dev
1 collaborator

knotless 0.13.0 Latest 2 packages, 1 image

1
10

The pages, the harness and the docs site are formatted by oxfmt

Merged
Merged chadtmiller.com asked to merge into main from chadtmiller.com/knotless:web/oxfmt

What changes

A formatter for the JavaScript side. oxfmt 0.76 formats web/, harness/ and docs-site/ (Svelte, TypeScript, JavaScript, CSS, JSON), set in .oxfmtrc.json. Each keeps the style most of its code already had: web/ tabs, semicolons and no trailing commas; harness/ and docs-site/ two spaces, no semicolons and trailing commas. All use single quotes and 100 columns. Everything under those three is reformatted once here, so most of the diff is mechanical.

A gate. The web check runs oxfmt --check first, and now also runs when a pull changes harness/, docs-site/ or .oxfmtrc.json. just lint checks it too.

just fmt runs cargo fmt and oxfmt together.

A Claude Code hook. .claude/settings.json runs .claude/hooks/format.mjs after each Edit or Write, formatting the file as just fmt would, so an agent's code is formatted before it is committed.

Why

Rust's format was gated, but the web pages and the harness had no formatter, so their style drifted. oxfmt is a fast binary meant to give Prettier's output, and it formats .svelte files, where Biome's support is still partial.

Two styles rather than one because moving everything to a single style (spaces and semicolons were measured) would about double the diff, at about 46,000 changed lines rather than 22,000.

How it was checked

  • oxfmt --check passes after the reformat, harness/layers.mjs and harness/contrast.mjs pass, and node --check passes on every harness and docs site script.
  • The hook was run by hand on a misformatted .mjs file and formatted it.
  • Left to CI: svelte-check, the tests (theme.rs includes tokens.css, contrast.json and theme.ts, and harness/pds.mjs is in the stored runs' key, so every test binary runs again), the docs site's build, e2e, and shots, which shows whether the reformat moved any page.

Shortcomings

  • This conflicts with any open branch that touches these three directories. Such a branch can run just fmt, then merge main and take its own side of the formatting.
  • oxfmt's Svelte support is still marked experimental. If it mishandles a file, the check fails on that file until it is fixed or added to ignorePatterns.
  • oxfmt comes from web/node_modules, so just fmt and the hook need just setup first. The hook does nothing when oxfmt is not installed.
  • oxfmt does not always settle in one pass: docs-site/reference.mjs changed on a second run, so just fmt may occasionally need running twice.
  • Markdown, YAML, the lexicons, the recorded fixtures and web/static are left as they are.

Review

A quick look. Start at .oxfmtrc.json, .knotless/workflows/web.yml and .claude/hooks/format.mjs, and skim the reformatted files.

🤖 Generated with Claude Code

Approved

This adds oxfmt for web/, harness/ and docs-site/, with the settings in .oxfmtrc.json. It adds a format step to the web check, widens that check's paths, and adds just fmt and a lint step. It also adds a Claude Code PostToolUse hook that formats files after Edit, MultiEdit and Write.

I read the config, workflow, Justfile, hook and settings and found nothing that blocks the merge. I did not read the mechanical reformat of the other files. The format step runs oxfmt --check on the same three directories that just fmt formats, so the gate and the fixer agree. The widened paths cover the newly checked directories. The hook exits quietly when oxfmt is missing or fails, as the body says.

One small thing, not worth holding the pull: the comment above on: in web.yml now has a line over 100 columns ("docs site, the format's settings or this file. A pull changing none passes at once…"). I'd rewrap it.

The remaining risks are the ones the body already names: the experimental Svelte support, and shots, test and e2e showing whether the reformat moved anything. Those checks will catch them.

Approved

Carried forward: the change this pull makes at ff40888fe06c122141db3765f15f1a2ca16d4884 is the one reviewed at 49866ba30d326bc8264c176de7cc82ae62b5f9d1, so that review stands. What is new comes from its base.

Merged as e996a5e