Skip to content

chore: migrate from prettier to oxfmt and add oxlint#22

Merged
nicknisi merged 3 commits intomainfrom
feat/oxfmt-oxlint-migration
Apr 16, 2026
Merged

chore: migrate from prettier to oxfmt and add oxlint#22
nicknisi merged 3 commits intomainfrom
feat/oxfmt-oxlint-migration

Conversation

@nicknisi
Copy link
Copy Markdown
Member

Summary

Replaces Prettier with oxfmt for code formatting and adds oxlint as the project's linter (previously there was no linter configured — the CI lint step was commented out). All formatting options from the original Prettier config are preserved in the new .oxfmtrc.json. Two lint warnings in src/ were fixed (error cause chaining in catch blocks). The entire codebase has been reformatted with oxfmt.

Changes

  • Removed: prettier, prettier.config.js, .prettierignore
  • Added: oxfmt (formatter), oxlint (linter), .oxfmtrc.json, .oxlintrc.json
  • Updated: package.json scripts (format, format:check, lint), CI workflow (format check uses oxfmt, lint step uncommented with oxlint)
  • Fixed: Error cause chaining in src/core/AuthKitCore.ts and src/core/session/TokenManager.ts (oxlint warnings)

What was tested

Automated

  • Full test suite: 135 tests passing
  • Build: successful
  • Typecheck: clean
  • pnpm run format:check (oxfmt): 44 files, all clean
  • pnpm run lint (oxlint): 28 files, 0 warnings, 0 errors

Manual

Library verification via scenario script checking 8 specific conditions:

  1. prettier.config.js and .prettierignore removed ✅
  2. .oxfmtrc.json and .oxlintrc.json exist ✅
  3. AuthKitCore.ts has error cause chaining ✅
  4. TokenManager.ts has error cause chaining ✅
  5. package.json scripts updated (format→oxfmt, format:check→oxfmt --check, lint→oxlint) ✅
  6. devDependencies updated (prettier removed, oxfmt+oxlint added) ✅
  7. CI workflow updated (format:check replaces prettier, lint step uncommented) ✅
  8. oxfmt config preserves original prettier formatting options (trailingComma, semi, arrowParens, singleQuote, tabWidth, useTabs) ✅

Verification

This is a library repo (no UI), so verification was done via automated tests, tool checks, and a scenario script that would fail if any part of the migration were reverted.

Follow-ups

  • Consider switching the tested evidence marker to use vitest --reporter=json for structured output (the current plain-text grep heuristic can produce false positives on strings like "0 failed")
  • package.json field reordering is a formatter artifact from oxfmt — expected behavior, not manual scope creep

Copy link
Copy Markdown
Member Author

@nicknisi nicknisi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review Findings

Warnings

  • [Principle 2 / Convention] tested marker shows fail_indicators: 1 — this is a false positive from the plain-text grep heuristic (matches "0 failed" in vitest output). Verifier manual-tested marker (22 pass indicators) and implementer log (135 passing) confirm all tests actually pass. Consider using vitest --reporter=json for structured evidence. (File: .case/authkit-session-mncbvowg-ideation-oxfmt-oxlint-migratio/tested)

Info

  • [Principle 10 / Convention] package.json field reordering (keywords, license, author, repository, files, dependencies sections moved) is an oxfmt formatter artifact, not manual scope creep. Expected behavior from the formatter migration. (File: package.json)

Automated review by case/reviewer agent

@greptile-apps
Copy link
Copy Markdown

greptile-apps bot commented Mar 29, 2026

Greptile Summary

This PR migrates code formatting from Prettier to oxfmt and introduces oxlint as the project's first active linter, while also restructuring CI so format/lint checks run in a dedicated single-run job rather than redundantly across the Node version matrix. Two catch blocks in AuthKitCore.ts and TokenManager.ts are improved with proper error cause chaining.

Confidence Score: 5/5

Safe to merge — clean tooling swap with no logic changes beyond error cause chaining improvements.

All changed source files are tooling configuration or minor catch-block improvements. The CI restructuring is an improvement over the previous state. No P0 or P1 issues found; previously flagged concerns about CI redundancy have been addressed in this PR.

No files require special attention.

Important Files Changed

Filename Overview
.github/workflows/ci.yml CI restructured into a dedicated single-run lint/format job (Node 22) plus the existing matrix test job — eliminates redundant tool-quality checks across Node versions.
.oxfmtrc.json New oxfmt config faithfully preserves all original Prettier options (trailingComma, semi, arrowParens, useTabs, tabWidth, singleQuote, printWidth), with ignore patterns covering lock files and dist.
.oxlintrc.json Enables correctness (error) and suspicious (warn) lint categories; a reasonable baseline that activates oxlint for the first time in this project.
package.json Scripts updated (format→oxfmt, format:check→oxfmt --check, lint→oxlint), prettier removed from devDependencies, oxfmt and oxlint added; field reordering is an expected formatter artifact.
src/core/AuthKitCore.ts Error cause chaining added to parseTokenClaims catch block — original error is now preserved as cause for improved debuggability.
src/core/session/TokenManager.ts Same error cause chaining fix as AuthKitCore — decodeJwt failures in parseTokenClaims now chain the original cause correctly.
pnpm-lock.yaml Lock file updated to replace prettier with oxfmt and oxlint along with their platform-specific native bindings; no unexpected transitive dependency changes.

Flowchart

%%{init: {'theme': 'neutral'}}%%
flowchart TD
    A[Push / Pull Request] --> L[lint job — Node 22]
    A --> T[test job matrix]

    subgraph lint [Lint & Format — runs once]
        L --> LC[Checkout + pnpm install]
        LC --> LF[format:check — oxfmt --check .]
        LF --> LL[lint — oxlint .]
    end

    subgraph tests [Test — Node 20 / 22 / 24]
        T --> TC[Checkout + pnpm install]
        TC --> B[Build — pnpm run build]
        B --> TS[Test — vitest coverage]
    end
Loading

Reviews (2): Last reviewed commit: "ci: split lint/format into single-run jo..." | Re-trigger Greptile

Comment thread .github/workflows/ci.yml
Comment thread .gitignore Outdated
Comment on lines +1 to +5
# Spec: Migrate from Prettier to oxfmt and add oxlint

## Overview

Replace Prettier with oxfmt for formatting and add oxlint as the linter. Single phase, mechanical changes.
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Internal planning docs committed to public repo

docs/ideation/oxfmt-oxlint-migration/contract.md and docs/ideation/oxfmt-oxlint-migration/spec.md are migration planning/spec documents. Committing them to the main branch of a public library repo means external contributors will see internal tooling process docs that have no ongoing value once the migration is complete.

Consider whether these should live in the PR description/wiki instead, or add docs/ideation/ to .gitignore if this pattern will repeat.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Already removed in a54cea4 before this review was posted — the ideation docs are no longer tracked.

Replace Prettier with oxfmt for formatting and add oxlint as the linter.
This moves to the faster oxc toolchain for both formatting and linting.

- Remove prettier, .prettierignore, prettier.config.js
- Add oxfmt with equivalent formatting config (.oxfmtrc.json)
- Add oxlint with correctness/suspicious rules (.oxlintrc.json)
- Update package.json scripts (format, format:check, lint)
- Update CI workflow to use new format:check and lint steps
- Fix two lint issues: preserve caught errors with cause property
- Reformat all files with oxfmt
@nicknisi nicknisi force-pushed the feat/oxfmt-oxlint-migration branch from e3bd06d to a54cea4 Compare April 16, 2026 18:52
Address greptile PR review feedback:
- Split format:check and lint out of the 3-node matrix into a
  dedicated single-run job; these checks are not Node-version
  sensitive so running them 3x wastes CI minutes.
- Remove internal bootstrap comment from .gitignore entry.
@nicknisi nicknisi requested a review from gjtorikian April 16, 2026 18:55
@nicknisi nicknisi merged commit bba1174 into main Apr 16, 2026
6 checks passed
@gjtorikian gjtorikian deleted the feat/oxfmt-oxlint-migration branch April 16, 2026 21:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

2 participants