Skip to content

docs: update examples for ReScript v13 - #1473

Open
aspeddro wants to merge 6 commits into
migrate-compiler-v13from
migrate-content-v13
Open

aspeddro wants to merge 6 commits into
migrate-compiler-v13from
migrate-content-v13

Conversation

@aspeddro

@aspeddro aspeddro commented Nov 1, 2026 •

Copy link
Copy Markdown
Collaborator

Context

The compiler upgrade exposed outdated MDX examples and stale JavaScript output tabs, causing yarn test to fail. This updates the manual, React documentation, and syntax lookup for ReScript 13.0.0-alpha.6.

Changes

  • Replace %external with optional globalThis bindings, @taggedTemplate with the built-in taggedTemplate type, and %re with regular expression literals.
  • Use TaggedTemplate.make for ReScript tag functions, modern standard-library APIs instead of Belt and removed helpers, and a valid loop-control variable instead of the reserved break identifier.
  • Update React component types and record-props examples, and add the component conversion binding required by the generic JSX transform.
  • Replace the removed @deriving(abstract) example with supported records and accessors, updating the accompanying explanations and links.
  • Regenerate JS/JSX output tabs to match the v13 compiler, including .mjs runtime imports and updated template-literal output.

Validation

  • CI=1 yarn test: 190 pages checked with zero compilation errors, stale outputs, or malformed blocks.
  • Link and redirect checks: zero issues.
  • Changed MDX files formatted with Oxfmt; git diff --cached --check passes.

Replace removed syntax and legacy APIs in manual, React, and syntax
lookup examples so they compile with the v13 alpha. Explain the current
tagged template, global binding, record, and React component APIs.

Regenerate JS and JSX output tabs with the installed compiler to keep
the displayed examples consistent and restore content validation.
@aspeddro
aspeddro added this pull request to stack #1474 November 1, 2026 01:05
@cloudflare-workers-and-pages

cloudflare-workers-and-pages Bot commented Nov 1, 2026 •

Copy link
Copy Markdown

Deploying with  Cloudflare Workers  Cloudflare Workers

The latest updates on your project. Learn more about integrating Git with Workers.

Status Name Latest Commit Preview URL Updated (UTC)
✅ Deployment successful!
View logs
guide ab22189 Commit Preview URL

Branch Preview URL
Nov 01 2026, 05:02 PM

@github-actions

github-actions Bot commented Nov 1, 2026 •

Copy link
Copy Markdown
Contributor

Lighthouse baseline

Compared with target branch migrate-compiler-v13 at commit 40d8658. Scores are the median of 3 runs against the deployed Cloudflare preview.

Category Target Current Change
Performance 86 85 -1
Accessibility 80 80 0
Best practices 100 100 0
SEO 66 66 0

Download the full Lighthouse reports and baseline

Commit eaac734 · Cloudflare preview

@aspeddro

aspeddro commented Nov 1, 2026 •

Copy link
Copy Markdown
Collaborator Author

Reanalyze report wrong dead code. Disable for now in 32bb0cc

Run yarn check:dead-code
Cleaned 0/699
Parsed 0 source files
Compiled 0 modules
file:///home/runner/work/rescript-lang.org/rescript-lang.org/scripts/check-dead-code.mjs:59
    throw new Error(
          ^

Error: apps/docs/app/routes/BlogArticle.res:103: make is never used
apps/docs/app/routes/Packages.res:315: make is never used
    at checkDeadCode (file:///home/runner/work/rescript-lang.org/rescript-lang.org/scripts/check-dead-code.mjs:59:11)
    at async file:///home/runner/work/rescript-lang.org/rescript-lang.org/scripts/check-dead-code.mjs:72:3

Node.js v26.3.0
Error: Process completed with exit code 1.

BlogArticle and Packages components are used.

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 1, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-01T17:03:27.970285Z ab22189 New commits
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@aspeddro
aspeddro requested a review from jderochervlk November 1, 2026 02:34
run: yarn test
- name: Check unused ReScript values and exports
run: yarn check:dead-code
# Disable for now. Reanalyze report wrong dead code.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

This is fine for the v13 branch for now.

while !shouldStop.contents {
if Math.random() > 0.3 {
break := true
shouldStop := true

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

We can use the new break keyword here now I guess.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

while !shouldStop.contents {
if Math.random() > 0.3 {
break := true
shouldStop := true

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Can also use the break keyword here

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

@fhammerschmidt

Copy link
Copy Markdown
Member

I wonder if we even need deriving(accessors) or should we encourage unboxed more?
https://forum.rescript-lang.org/t/what-is-the-recommended-replacement-for-deriving-jsconverter

@aspeddro

aspeddro commented Nov 1, 2026

Copy link
Copy Markdown
Collaborator Author

I added more four commits:

  • ab22189 - update syntax lookup while
  • 15a23ae - Add record-rest patterns and explain that they collect fields not explicitly destructured
  • 5c65729 - Add dictionary-spread examples, including how later entries override earlier keys
  • 1a6d9ee - Add docs for break, continue, for of and for await of

I’ll leave it at these for now. I’ll move on to other changes in a future PR.

@github-actions

github-actions Bot commented Nov 1, 2026

Copy link
Copy Markdown
Contributor

Docs preview

This branch was successfully deployed

2 active deployments
preview — ab22189b Deployed Nov 1, 2026 by github-actions[bot]
guide-preview — ab22189b Deployed Nov 1, 2026 by github-actions[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.

2 participants