Skip to content

Replace ESLint with oxlint and add oxfmt - #480

Draft
mr-zwets wants to merge 3 commits into
masterfrom
oxlint
Draft

mr-zwets wants to merge 3 commits into
masterfrom
oxlint

Conversation

@mr-zwets

@mr-zwets mr-zwets commented Nov 29, 2026 •

Copy link
Copy Markdown
Member

Replaces ESLint with oxlint for linting and adds oxfmt for formatting, as proposed in #303.

Why

  • Fast. Linting the three packages takes about 0.06s, versus about 5.85s with ESLint (same machine).
  • Current. We were on ESLint 8 with the old config format and the deprecated eslint-config-airbnb-typescript, and typescript-eslint does not support TypeScript 7.
  • Fewer dependencies. Five ESLint packages and their dependency tree are replaced by two pinned tools.

Commits

  1. Tooling switch. Removes ESLint, adds oxlint 1.96.0 and oxfmt 0.81.0, .oxlintrc.json, .oxfmtrc.json, and pnpm format / pnpm format:check.
  2. Mechanical reformat. The output of pnpm format and nothing else (92 files). Best reviewed by re-running the command rather than reading the diff. It also converts TransactionBuilder.ts from CRLF to LF.
  3. CI and blame. Adds a formatting check to CI and a .git-blame-ignore-revs entry for commit 2.

What changes in enforcement

Carried over (13 rules): explicit-function-return-type, import/extensions, no-unused-vars, no-unused-expressions, no-shadow, no-throw-literal, default-param-last, no-array-constructor, no-dupe-class-members, no-empty-function, no-loop-func, no-loss-of-precision, no-useless-constructor.

Replaced by oxfmt: the 13 formatting rules (indent, quotes, semi, comma-dangle, spacing).

No longer enforced:

  • Type-aware rules (only-throw-error, return-await, dot-notation, no-implied-eval). oxlint's type-aware mode rejects our current moduleResolution: "node" and baseUrl, so these can return after ANTLR is blocking the TypeScript upgrade #478.
  • naming-convention and lines-between-class-members. No equivalent in oxlint or oxfmt.
  • max-len as a hard limit. oxfmt wraps code at 125 characters but does not flag long comments or lines it cannot break.
  • Style in fixture files. oxfmt ignores fixtures and the generated grammar; they are still linted. Most are generated, but a few hand-written ones are included (for example packages/cashc/test/ast/fixtures.ts).

Notes for review

  • Formatting scope is packages/* only. examples/ and .github/scripts are not formatted or checked.
  • Merge method matters. .git-blame-ignore-revs points at the hash of commit 2, so this needs a merge commit. After a squash or rebase the hash has to be updated.
  • Formatter is pre-1.0, which is why both tools are pinned to exact versions.

Verification

pnpm lint, pnpm format:check, pnpm build, pnpm spellcheck and pnpm test pass locally (78 + 636 + 230 tests). The reformat commit was checked to be reproducible from pnpm format and to leave the TypeScript AST and all comments unchanged.

Possible follow-ups for what is no longer enforced

Tried on a scratch copy of this branch:

  1. Type-aware rules: can return with a small tsconfig change. With ANTLR is blocking the TypeScript upgrade #478's option 1 (moduleResolution: "bundler", baseUrl dropped), oxlint --type-aware runs through oxlint-tsgolint, and all four rules pass on the current code. import/extensions already covers the .js extension check that bundler gives up.
  2. lines-between-class-members and max-len: possible, but probably not worth it. Both work through oxlint's ESLint plugin support (jsPlugins, still alpha) with @stylistic/eslint-plugin, but that brings eslint back as a peer dependency. With oxfmt wrapping code, max-len would only catch long comments.
  3. naming-convention: accepted. It cannot run through jsPlugins, because typescript-eslint's rule always asks for parser services.
  4. Fixture formatting: narrow the ignore list. Removing the ignores would reformat 125 files, mostly generated ones that would drift again on regeneration. The better option is to keep ignoring generated fixtures and add the hand-written ones back into formatting.

Refs #303

🤖 Generated with Claude Code

@vercel

vercel Bot commented Nov 29, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
cashscript Ready Ready Preview Dec 3, 2026 1:29pm UTC

Request Review

@codecov

codecov Bot commented Nov 29, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 92.62590% with 41 lines in your changes missing coverage. Please review.
✅ Project coverage is 89.23%. Comparing base (f33fb37) to head (3322c11).

Files with missing lines Patch % Lines
packages/cashscript/src/TransactionBuilder.ts 95.34% 10 Missing ⚠️
packages/utils/src/script.ts 22.22% 5 Missing and 2 partials ⚠️
.../cashscript/src/network/ElectrumNetworkProvider.ts 66.66% 5 Missing ⚠️
packages/utils/src/artifact.ts 0.00% 4 Missing and 1 partial ⚠️
packages/utils/src/types.ts 42.85% 4 Missing ⚠️
...cashc/src/semantic/FoldGlobalConstantsTraversal.ts 81.81% 2 Missing ⚠️
packages/cashscript/src/utils.ts 89.47% 2 Missing ⚠️
packages/utils/src/source-map.ts 93.75% 2 Missing ⚠️
packages/cashc/src/cashc-cli.ts 0.00% 1 Missing ⚠️
packages/cashscript/src/Errors.ts 93.33% 1 Missing ⚠️
... and 2 more
Additional details and impacted files
@@            Coverage Diff             @@
##           master     #480      +/-   ##
==========================================
- Coverage   89.25%   89.23%   -0.02%     
==========================================
  Files          61       61              
  Lines        5082     5064      -18     
  Branches      950      944       -6     
==========================================
- Hits         4536     4519      -17     
  Misses        421      421              
+ Partials      125      124       -1     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@mr-zwets mr-zwets mentioned this pull request Nov 29, 2026
18 tasks
@mr-zwets mr-zwets linked an issue Dec 2, 2026 that may be closed by this pull request
rkalis pushed a commit to CashScript/cashscript-playground that referenced this pull request Dec 3, 2026
Same setup as CashScript/cashscript#480. typescript-eslint relies on
TypeScript's JavaScript compiler API, which TypeScript 7 no longer ships,
so it blocked the upgrade.

- remove eslint, typescript-eslint, eslint-plugin-react-hooks,
  eslint-plugin-react-refresh and globals
- add oxlint and oxfmt, pinned to exact versions (oxfmt is pre-1.0)
- .oxlintrc.json keeps the existing rules (rules-of-hooks,
  exhaustive-deps, only-export-components) with the correctness
  category off, like #480
- .oxfmtrc.json uses the same options as the cashscript repo
- add `format` and `format:check` scripts
- TypeScript 6.0 → 7.0

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
rkalis pushed a commit to CashScript/cashscript-playground that referenced this pull request Dec 3, 2026
Same setup as CashScript/cashscript#480. typescript-eslint relies on
TypeScript's JavaScript compiler API, which TypeScript 7 no longer ships,
so it blocked the upgrade.

- remove eslint, typescript-eslint, eslint-plugin-react-hooks,
  eslint-plugin-react-refresh and globals
- add oxlint and oxfmt, pinned to exact versions (oxfmt is pre-1.0)
- .oxlintrc.json keeps the existing rules (rules-of-hooks,
  exhaustive-deps, only-export-components) with the correctness
  category off, like #480
- .oxfmtrc.json uses the same options as the cashscript repo
- add `format` and `format:check` scripts
- TypeScript 6.0 → 7.0

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
rkalis pushed a commit to CashScript/vscode-cashscript that referenced this pull request Dec 3, 2026
Same oxlint/oxfmt setup as CashScript/cashscript#480 and the playground.

- add oxlint and oxfmt, pinned to exact versions (oxfmt is pre-1.0)
- .oxlintrc.json uses oxlint's default rules, with no-unused-vars
  configured like the cashscript repo
- .oxfmtrc.json uses the same options as the cashscript repo
  (printWidth 125 instead of prettier's 120 here)
- `lint` now runs oxlint (it used to run `prettier --write`); add
  `format` and `format:check`
- TypeScript 5.8 → 7.0. TypeScript 6 made `strict` the default, which
  enables strictPropertyInitialization; mark the two CompletionProvider
  fields that are assigned at the start of provideCompletionItems as
  definitely assigned

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
mr-zwets and others added 3 commits December 3, 2026 14:29
ESLint 8, typescript-eslint 7 and the deprecated airbnb-typescript config
are replaced by oxlint for linting and oxfmt for formatting. The lint rules
that have an oxlint equivalent and do not need type information carry over.
The formatting rules are replaced by oxfmt.

No longer enforced:
- Type-aware rules (only-throw-error, return-await, dot-notation,
  no-implied-eval). These can return once the tsconfig no longer uses
  moduleResolution "node" and baseUrl (#478).
- naming-convention and lines-between-class-members, which have no
  equivalent in oxlint or oxfmt.
- max-len as a hard limit. oxfmt wraps code at 125 characters but does
  not flag long comments or other lines it cannot break.
- Style in fixture files, which oxfmt ignores (they are still linted).

Refs #303

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Mechanical change: the output of `pnpm format`, no manual edits. Also
normalises the CRLF line endings in TransactionBuilder.ts to LF.

Refs #303

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Refs #303

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>

This branch was successfully deployed

1 active deployment
Preview — 3322c11a Deployed Dec 3, 2026 by vercel[bot]
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.

Modernize lint setup (migrate to oxlint)

1 participant