Repository navigation
Conversation
oxfmt 0.69.0 (oxlint's sibling, a native binary from PyPI) joins the
optional `js` group. `.oxfmtrc.json` sets the style (width 120, 4-space
indent, single quotes in JS; 2-space JSON and YAML) and ignores Markdown,
TOML, data, generated files and the two Pygments sheets that
generate_minimal_pygments_css.py reads line by line.
Five template components hold Jinja ({% include %}, {# #}), which oxfmt
cannot parse. scripts/fmt_templates.py masks each construct as a
`/* jinja:N */` comment, formats the masked copy in a staging directory,
and restores the constructs verbatim; a construct sharing a line with code
is refused. `just fmt-js` formats, `just fmt-check` checks.
Machinery only: nothing is reformatted yet, and fmt-check is not part of
`just ci` or CI until the reformat lands.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Annotate the four untyped containers so the script is pyright-strict clean, like lint_js.py. fmt-check now runs the template check even when the plain oxfmt check fails, so one run lists every file to format. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configuration
⛔ Files ignored due to path filters (1)
📒 Files selected for processing (6)
Included review availability: This review used your included allowance. Your plan provides up to 4 included reviews per hour; 3 remain after this review. 📝 WalkthroughWalkthroughThis change adds oxfmt configuration and commands for JS, CSS, JSON, and YAML. It adds a script that masks standalone Jinja constructs in component files, formats the masked files, then restores the constructs. Tests cover masking, restoration, and formatter ignore-pattern requirements. ChangesFormatting workflow
Priority: ⬇️ Low Estimated code review effort: 3 (Moderate) | ~20 minutes Change: Feature Suggested reviewers: Merge Risk: ⚪ Minimal · up to The formatting workflow is mergeable after normal checks. No actionable issue remains. 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
Full details: Docstring CoverageExplanation Docstring coverage is 28.57% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 14 functions across 2 files. (4 skipped: 4 unsupported.)
✨ Finishing Touches 💡 1📝 Generate docstrings 💡
🧪 Generate unit tests (beta)
Warning Some tools did not complete. Review the errors below. 🔧 Biome (2.5.14).oxfmtrc.jsonFile contains syntax errors that prevent linting: Line 2: Expected a property but instead found '// oxfmt formats the JS, CSS, JSON and YAML; ... [truncated 283 characters] ... 35: End of file expected; Line 35: End of file expected; Line 36: End of file expected; Line 36: End of file expected; Line 37: End of file expected; Line 37: End of file expected; Line 38: End of file expected; Line 38: End of file expected; Line 39: End of file expected; Line 39: End of file expected; Line 40: End of file expected; Line 40: End of file expected; Line 43: End of file expected; Line 43: End of file expected; Line 44: End of file expected; Line 44: End of file expected; Line 46: End of file expected; Line 46: End of file expected; Line 47: End of file expected; Line 47: End of file expected; Line 48: End of file expected; Line 48: End of file expected; Line 49: End of file expected; Line 49: End of file expected; Line 50: End of file expected; Line 51: End of file expected Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
Love it, I'm all for oxfmt and oxlint, but agree on preventing yaml threshing |
This adds a formatter for the JavaScript, CSS, JSON and YAML in the repo — oxfmt, oxlint's sibling — without running it yet. It is the first of three PRs, so the approach can be agreed on before anything is reformatted.
What's in it
oxfmt 0.69.0 in the optional
jsgroup, next to oxlint. It is a native binary from PyPI: no Node. The version is pinned exactly, because its output changes between releases..oxfmtrc.json: width 120 and a 4-space indent with single quotes in JS, close to how the files are written today, plus 2-space JSON and YAML. ItsignorePatternsleave out, each with a comment saying why:scripts/generate_minimal_pygments_css.pyreads line by line.scripts/fmt_templates.pyfor the five template components that hold Jinja (an{% include %}or a{# comment #}), which no JS or CSS parser accepts. The script:/* jinja:N */comment, which is valid in both languages;A construct that shares a line with code is refused rather than guessed at. Files are found by their content, and a unit test checks that each one is also in
ignorePatterns.just fmt-jsformats andjust fmt-checkchecks. Neither is part ofjust cior CI yet.CONTRIBUTING: a "Formatting JS, CSS, JSON and YAML" section.
Why not TOML
oxfmt collapses multi-line TOML arrays and squashes aligned comments. Worse,
uv addwritespyproject.toml's dependency groups back out multi-line, so the formatter and uv would undo each other's work.Planned impact (PRs 2 and 3)
Both follow only if you agree with the approach here.
PR 2 reformats the tree in one commit, together with the regenerated HTML snapshot. The numbers are from a trial run on a copy of the tree:
components/**/*.js)-w: most of it is dropping the 8–16-space base indent the files carry.minimal_dag.jsalone is +2255/−1842.vscode,.claude)ci.yml, and[ main ]becomes[main].ambr)<style>/<script>Every change was checked for meaning:
.5/0.5are normalized.yaml.safe_loadgives equal results, with comments, anchors and block scalars kept.With
<style>and<script>stripped, the snapshot is identical before and after, so no page markup changes. oxlint reports nothing, and the browser suite passes on the formatted tree. The component sources shrink by 9.6 KB in all (2%), from the dropped indent.PR 3 adds PR 2's commit on
mainto a new.git-blame-ignore-revs, sogit blameskips it (GitHub's blame view reads that file too), and turnsjust fmt-checkon injust ciand in CI's primary job.The reformat and the blame-ignore entry are separate PRs because a squash merge gives the reformat a new SHA, and only that SHA can be listed.
🤖 Generated with Claude Code
Summary by CodeRabbit