Skip to content

[codex] Fix clients-js oxfmt config loading#388

Closed
onspeedhp wants to merge 1 commit into
solana-program:mainfrom
onspeedhp:codex/fix-oxfmt-config
Closed

[codex] Fix clients-js oxfmt config loading#388
onspeedhp wants to merge 1 commit into
solana-program:mainfrom
onspeedhp:codex/fix-oxfmt-config

Conversation

@onspeedhp

Copy link
Copy Markdown
Contributor

Summary

Fix clients/js Oxfmt config loading by switching the config file to an ESM TypeScript module and making the format scripts pass it explicitly with -c.

This keeps the shared @solana-config/oxc/oxfmt settings, including the generated/dist ignore patterns, without relying on the CommonJS .ts config shape that Oxfmt currently fails to link.

Why

Running pnpm format in clients/js fails on main with:

Failed to load configuration file.
.../clients/js/oxfmt.config.ts
Error: module is not linked
Ensure the file has a valid default export of a JSON-serializable configuration object.

This was originally noticed while fixing the Pinocchio JS test fixtures in #387, but was split out per review feedback.

Validation

  • pnpm format in clients/js
  • pnpm lint in clients/js
  • pnpm build in clients/js

Note: pnpm test in clients/js still fails on this branch because main expects target/deploy/spl_memo.so; that fixture is addressed separately in #387.

@onspeedhp onspeedhp marked this pull request as ready for review June 5, 2026 10:50
@joncinque joncinque requested a review from lorisleiva June 5, 2026 12:15
@joncinque

Copy link
Copy Markdown
Contributor

@lorisleiva can you take a look? Since you've been doing the oxfmt transitions, I want to be sure we don't need to fix every repo

@lorisleiva

Copy link
Copy Markdown
Member

I believe this is a local Node version issue rather than a config bug:

"TypeScript config files require Node.js ^20.19.0 || >=22.12.0."

CI runs Node 24 so it passes there and I can only reproduce the error outside of above ranges.

I'd rather not switch to .mts though because it breaks editor autodiscovery. Oxlint/oxfmt (and the VScode extension) only auto-pick-up oxfmt.config.ts / oxlint.config.ts, not .mts. That's why this PR needs the explicit -c and the IDE would stop formatting on save (unless you explicitly configured it that way which I'm trying to avoid).

Btw this PR only fixes oxfmt. oxlint.config.ts is the same shape and should fail the same way on your Node version.

I think the better fix is to explicitly add "engines": { "node": ">=24.0.0" } to the clients/js package.json so you get a clear warning instead of the cryptic error.

I've actually got plans to go around all repos and align their orchestration (the last wave in the multi-phase process) so I've added that step to that last wave. I'll close this PR in favour of that change but thanks for flagging this.

@lorisleiva lorisleiva closed this Jun 5, 2026
@onspeedhp

Copy link
Copy Markdown
Contributor Author

Thanks for the context, makes sense

@onspeedhp onspeedhp deleted the codex/fix-oxfmt-config branch June 5, 2026 12:57
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.

3 participants