You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
chore: adopt oxfmt and oxlint with a pre-commit hook - #19
Brings simple-xml onto the oxc toolchain already used by sf-formula-parser, soql-parser-js and simple-excel.
Changes
Formatter: Prettier is replaced by oxfmt. .prettierrc becomes .oxfmtrc.json with the settings the other libraries share.
Linter: oxlint is new; the repo had no linter before. It runs correctness, suspicious and perf as errors, with style and pedantic off. The only overrides are __dirname in the parse tests and the polling loop in the shared release script. It is locked at 1.85.0 to match the other three repos.
Scripts:format, format:check, lint, lint:fix, and a prepare script that sets core.hooksPath to .githooks on npm install.
Pre-commit hook:.githooks/pre-commit is the copy shared with the other libraries. It runs the format check and oxlint on staged files and blocks the commit if either fails.
CI: gates on format:check and lint, since the hook can be bypassed with --no-verify.
Parser cleanup (src/parse.ts), with no behaviour change:
addChild moves to module scope, so it isn't recreated on every parse() call.
parseAttributes drops a coerce parameter, unused since 1.1.0.
One .reverse() keeps an inline disable. The suggested toReversed() is ES2023, and esbuild doesn't polyfill it for the ES2022 target.
Reformat: cosmetic only: README table padding and a few test lines.
Docs: AGENTS.md gains formatting, linting and commit-hook sections. CHANGELOG has an entry under ### Changed, so the next release is a patch.
Verification
format:check, lint, typecheck, build and all 117 tests pass.
A probe commit that was both unformatted and had a lint error was blocked, and both problems were reported in the same attempt.
All four commits on this branch went through the hook.
After merging, run npm install once in an existing checkout to turn the hook on.
Adopt the oxc toolchain already used by sf-formula-parser, soql-parser-js
and simple-excel. .prettierrc becomes .oxfmtrc.json with the same settings
those repositories share, and .oxlintrc.json adds a linter, which the
repository did not have. Both are exposed as format, format:check, lint
and lint:fix.
oxlint runs correctness, suspicious and perf as errors; style and pedantic
stay off because oxfmt owns layout. The only overrides are the ones this
codebase needs: __dirname in the parse tests and the sequential polling
loop in the shared release script.
oxlint is locked at 1.85.0 to match the sibling repositories, so all four
lint with the same rule set.
The reformat touches only lines Prettier had also left unformatted: README
table padding and a few test assertions that fit within 140 columns.
.claude/settings.json now matches the copy the sibling repositories share.
No behaviour change.
- addChild captures nothing from parse(), so it moves to module scope
rather than being recreated on every call.
- parseAttributes drops its coerce parameter, unused since 1.1.0 stopped
coercing attribute values.
- The reverse() that orders the unclosed-tag error is kept and the rule
silenced on that line: it reverses the fresh array from map(), so
nothing shared is mutated, and the suggested toReversed() is ES2023,
which esbuild does not polyfill for the ES2022 build target.
A pre-commit hook blocks commits whose staged files are unformatted or
fail lint, running both so one attempt reports everything to fix. The
prepare script wires it up on npm install via core.hooksPath. The hook is
the copy shared with sf-formula-parser, soql-parser-js and simple-excel.
CI gates on format:check and lint ahead of typecheck, because the hook can
be bypassed with --no-verify.
AGENTS.md gains formatting, linting and commit hook sections, and lists
the hook and oxfmt config among the files shared with the sibling
repositories. The changelog records the change under Changed.
The reason will be displayed to describe this comment to others. Learn more.
Copilot review overview
🟡 Changes recommended
The hook checks working-tree content instead of staged content, lint exceptions are overly broad, and Claude can invoke release scripts without approval.
Rename the parse test's local __dirname to fixturesDir so no-underscore-dangle needs no repo-wide exception, and limit the no-await-in-loop override to scripts/release.mjs, the only file with a polling loop.
The hook passed staged paths to oxfmt and oxlint, which read the working tree. A file formatted on disk but never re-staged could slip through, and unstaged edits could block a clean commit. It now exports the index to a temporary directory and checks every tracked file there, so it sees exactly what the commit will contain.
Extend Vitest ESLint override to scripts test directory
.oxlintrc.json:29
This override misses scripts/__tests__/derive-increment.test.mjs, which also imports Vitest, so Vitest-specific correctness rules are not applied to that test suite. Include the scripts test directory in the override so all repository tests receive the intended plugin checks.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Brings simple-xml onto the oxc toolchain already used by sf-formula-parser, soql-parser-js and simple-excel.
Changes
.prettierrcbecomes.oxfmtrc.jsonwith the settings the other libraries share.correctness,suspiciousandperfas errors, withstyleandpedanticoff. The only overrides are__dirnamein the parse tests and the polling loop in the shared release script. It is locked at 1.85.0 to match the other three repos.format,format:check,lint,lint:fix, and apreparescript that setscore.hooksPathto.githooksonnpm install..githooks/pre-commitis the copy shared with the other libraries. It runs the format check and oxlint on staged files and blocks the commit if either fails.format:checkandlint, since the hook can be bypassed with--no-verify.src/parse.ts), with no behaviour change:addChildmoves to module scope, so it isn't recreated on everyparse()call.parseAttributesdrops acoerceparameter, unused since 1.1.0..reverse()keeps an inline disable. The suggestedtoReversed()is ES2023, and esbuild doesn't polyfill it for the ES2022 target.### Changed, so the next release is a patch.Verification
format:check,lint,typecheck,buildand all 117 tests pass.After merging, run
npm installonce in an existing checkout to turn the hook on.