Skip to content

Add prettier and format everything #1081

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 7 commits into from
Aug 18, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
8 changes: 3 additions & 5 deletions .github/ISSUE_TEMPLATE/documentation_issue.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
---
name: 🚨 Documentation issue
about: Create an issue to help us improve the rescript-lang.org documentation website
title: ''
labels: ''
assignees: ''

title: ""
labels: ""
assignees: ""
---

1 change: 1 addition & 0 deletions .github/workflows/pull-request.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ jobs:
- run: npm ci
- run: npx rescript
- run: npm test
- run: npm run ci:format

- name: Format check
run: npx rescript format -check -all
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ _tempFile.cmt
.bsb.lock
.merlin
lib/
.vscode/

.vercel

Expand Down
2 changes: 2 additions & 0 deletions .prettierrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
plugins:
- "@prettier/plugin-oxc"
3 changes: 3 additions & 0 deletions .vscode/extensions.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"recommendations": ["esbenp.prettier-vscode", "chenglou92.rescript-vscode"]
}
6 changes: 1 addition & 5 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
# Changelog


This changelog documents significant changes that caused a new version in the manual, or other related resources.

We don't create a version fork for every minor release, and try to make docs "append only" as much as possible. Usually when we introduce a new feature we add a `since 9.0` annotation to a specific section, and be done with it.
Expand All @@ -13,8 +12,7 @@ Here are the notes on major changes we did, and how the version corresponds to s

### latest

- 9.1 related
-
- ## 9.1 related

### v9.0 (v8.3 - v9.0)

Expand All @@ -34,5 +32,3 @@ Here are the notes on major changes we did, and how the version corresponds to s
### v8.0.0 (v6 - v8.3)

- Docs with Reason / OCaml syntax before the new syntax


1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
# rescript-lang.org

[![Contributor Covenant](https://img.shields.io/badge/Contributor%20Covenant-v1.4%20adopted-ff69b4.svg)](CODE_OF_CONDUCT.md)

This is the official documentation platform for the [ReScript](https://rescript-lang.org) programming language.
Expand Down
3 changes: 3 additions & 0 deletions _blogposts/2020-08-10-bucklescript-is-rebranding.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,15 @@ We're pleased to announce that BuckleScript is getting a brand new name: **ReScr
## Community Situation

BuckleScript started with the idea that **JavaScript programmers deserved a great typed language with a fast and lean toolchain**. This idea took root and, over the years, we've gradually accomplished feats such as:

- a state of the art compiled JavaScript output that rivals hand-written JS,
- a fast & reliable toolchain much needed in front-end and Node development,
- various JS interop features that spawned an ecosystem of well typed libraries,
- a production-ready standard library,
- [and recently](/blog/bucklescript-8-1-new-syntax), a fresh syntax made by a major contributor of Reason's old syntax.

These developments have attracted many people into our community. But one bigger challenge persisted: newcomers dropped out at the sheer amount of extra incongruent tools and learning overhead from having to understand OCaml concepts, Reason concepts, and BuckleScript's concepts. Take, for example, what's required to make a React app using BuckleScript:

- Knowledge of React.
- Knowledge of JS.
- Knowledge of BuckleScript's specific bindings to React (that we've tried hard to keep to a minimum).
Expand All @@ -43,6 +45,7 @@ The adoption barrier is real, and it's about time we finally solve it.
## The Rebranding

Today, we'll start to truly unify the various BuckleScript-related projects under the ReScript umbrella. This includes:

- The compiler, build system and the new syntax unified under a single installation.
- Doubling down on editor tooling for ReScript usage.
- A single documentation site (this one), which unifies all the docs and greatly trims down on redundant and stale info.
Expand Down
25 changes: 17 additions & 8 deletions _blogposts/2020-08-28-new-rescript-logo.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -15,35 +15,44 @@ ReScript is the evolution and fusion of Reason and BuckleScript. As we're a desi

Here it is!


<Image withShadow={false} src="/static/blog/rescript-launch/ReScript-1.jpg" caption="Comparison between the Reason, BuckleScript and ReScript logos"/>

<Image
withShadow={false}
src="/static/blog/rescript-launch/ReScript-1.jpg"
caption="Comparison between the Reason, BuckleScript and ReScript logos"
/>

The old Reason and BuckleScript logo had many limitations:

- The icons didn't really work well on round Social Media profile images (or round shapes at all).
- There's no guideline on how the logo works inverted, or on colored background.
- The large red rectangle makes it difficult to balance the logo with other elements.
- The buckle and belt were a bit too literal and did not convey much.

The new logo addresses all these and more:

<Image withShadow={false} src="/static/blog/rescript-launch/ReScript-2.jpg" caption="Logo comparison on social media"/>
<Image
withShadow={false}
src="/static/blog/rescript-launch/ReScript-2.jpg"
caption="Logo comparison on social media"
/>

## Creating Meaning Through Simple Shapes

A minimal logo design is achieved by putting aside all distractions while focusing on legibility, meaning and small details like clear lines, interesting perspective and depth.


<Image withShadow={false} src="/static/blog/rescript-launch/ReScript-4.jpg" caption="ReScript logo variations and usage examples"/>

<Image
withShadow={false}
src="/static/blog/rescript-launch/ReScript-4.jpg"
caption="ReScript logo variations and usage examples"
/>

**The letter "r"**, composed of two shapes, is inspired by Albers, a german-born American Bauhaus artist and typographer. An object should be simple, beautiful, functional and accessible for everyone - a statement which applies to ReScript's principles perfectly.

**I/O**: The rectangle and circle represent the input / output, recalling the digital nature of a program.

**The red app-shaped background** references the vibrant, playful applications our developers are empowered to create with ReScript.

**The Logotype** ("rescript") complements the brand mark with its clean look and its embrace of technology while retaining a functional look.
**The Logotype** ("rescript") complements the brand mark with its clean look and its embrace of technology while retaining a functional look.

We'd like to position ReScript to be a community of product-first developers who care about the fit & finish of their work, while keeping an eye on the quality of their engineering. This interplay of design and engineering is a hard-to-achieve but beautifully worthwhile sweet spot that's frequently been missing in the programmer community; our vibrant logo is our renewed symbolic step toward this mission. Come along with us on our journey!

Expand Down
12 changes: 5 additions & 7 deletions _blogposts/2020-09-25-release-8-3-2.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ To get the build output, instead of communicating through IPC, we adopted a simp
This makes the editor integration build-system agnostic, it does not need talk to the build system directly.

It also makes our build tool work with other watchers including Facebook's [watchman](https://facebook.github.io/watchman/).
Watchman is a more scalable watcher tool for some specific platforms and less memory hungry, however, we still need a watchman-client to get the output of triggered job.
Watchman is a more scalable watcher tool for some specific platforms and less memory hungry, however, we still need a watchman-client to get the output of triggered job.
We write the output to `.compiler.log` per each build, allowing clients to read compiler diagnostics when they want.

## A better algorithm for removing stale outputs
Expand All @@ -90,8 +90,8 @@ We scan `lib/bs` directory and check some dangling `cm{i,t,j,ti}` files, if it d
the current build set, it is considered stale artifacts. If it is `cmt` file, it would trigger some hooks of `genType`, notably -cmt-rm.

- Based on previous build logs
We store previous compilation stats. If a file is in the previous compiler output, but no longer in the output of the new build, it is considered stale and can be removed.
it is considered stale output which can be removed.
We store previous compilation stats. If a file is in the previous compiler output, but no longer in the output of the new build, it is considered stale and can be removed.
it is considered stale output which can be removed.

In general, strategy two is more reliable and efficient.

Expand All @@ -100,11 +100,9 @@ In general, strategy two is more reliable and efficient.

However, strategy one is easier for tooling like `genType`. Not every tool has knowledge of the build system.


Sometimes a combination of both strategies is needed.
- When removing .cm* files, we use the first strategy.
- When removing generated javascript, we use strategy two,


- When removing .cm\* files, we use the first strategy.
- When removing generated javascript, we use strategy two,

Happy Hacking!
19 changes: 10 additions & 9 deletions _blogposts/2020-09-25-release-8-3.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -17,28 +17,27 @@ It's focused on type safety, performance and JS interop. It used to be called Bu
npm i [email protected]
```

The changes are listed [here](https://github.com/rescript-lang/rescript/blob/master/Changes.md#83), this is a large release, and we will go through some highlighted changes.


The changes are listed [here](https://github.com/rescript-lang/rescript/blob/master/Changes.md#83), this is a large release, and we will go through some highlighted changes.

## Lightweight FFI attributes without `bs.` prefix

In this release, we make the `bs.` prefix optional, this will make the FFI less verbose.

For example, the old externals for `readFileAsUtf8Sync` used to be written like this


<CodeTab labels={["ReScript", "Reason (Old Syntax)", "ML Syntax"]}>

```res
@bs.val @bs.module("fs")
external readFileAsUtf8Sync: (string, @bs.as("utf8") _) => string = "readFileSync"
```

```reason
[@bs.val] [@bs.module "fs"]
external readFileAsUtf8Sync: (string, [@bs.as "utf8"] _) => string =
"readFileSync";
```

```ocaml
external readFileAsUtf8Sync : string -> (_[@bs.as "utf8"]) -> string = "readFileSync" [@@bs.val] [@@bs.module "fs"]
```
Expand All @@ -52,11 +51,13 @@ It can now be simplified as
```res
@val @module("fs") external readFileAsUtf8Sync: (string, @as("utf8") _) => string = "readFileSync"
```

```reason
[@val] [@module "fs"]
external readFileAsUtf8Sync: (string, [@as "utf8"] _) => string =
"readFileSync";
```

```ocaml
external readFileAsUtf8Sync : string -> (_[@as "utf8"]) -> string = "readFileSync"
[@@val] [@@module "fs"]
Expand All @@ -70,8 +71,7 @@ with the exception of the following two that don't have abbreviations:
- `bs.send.pipe` : this attribute was deprecated in favor of `bs.send`; you can still use the existing one for backward compatibility.

- `bs.splice` : this attribute was deprecated in favor of `bs.variadic`; you can still use the existing one for
backward compatibility.

backward compatibility.

## default import in Es6 support

Expand All @@ -84,11 +84,13 @@ If you use es6 module output, the default bindings will be compiled properly now
let a = input("hello")
```

```reason
[@module "hello"] external input: string => string = "default";
let a = input("hello");
```

```ocaml
external input : string -> string = "default" [@@module "hello"]
Expand All @@ -104,7 +106,6 @@ import Hello from "hello";
var a = Hello("hello");
```


## Customized js file extension support

Now user can pick up their js file extension support per module format:
Expand All @@ -126,8 +127,6 @@ To have better integration with other [JS infrastructures](https://github.com/re
for example, Next.js/React Native, we allow file names like `404.res`,
`Button.Android.res` so that it can just be picked up by those tools



## Better type based inference for pattern `let {a,b,c} = value`

Previously, for code like this:
Expand All @@ -144,6 +143,7 @@ let f = (u: N.t) => {
x + 1
} /* type error */
```

```reason
module N = {
type t = {x: int};
Expand All @@ -154,6 +154,7 @@ let f = (u: N.t) => {
x + 1;
}; /* type error */
```

```ocaml
module N = struct
type t = {
Expand Down
8 changes: 6 additions & 2 deletions _blogposts/2020-11-26-editor-support-release-1-0.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,12 @@ description: |
Type hints, jump to definition, error diagnostics, and more.
---


## Editor Integration Has Finally Landed

Thank you so much for the wait!

**Here are all the features:**

- Highlighting
- Formatting
- Diagnostics
Expand All @@ -32,4 +32,8 @@ We'll keep on iterating on the polish of the plugins, and release better [Sublim

Happy thanksgiving!

<Image withShadow={false} src="/static/blog/editor_support_article.jpg" caption="ReScript now offers autocompletion for VSCode and neovim (Sublime coming soon)"/>
<Image
withShadow={false}
src="/static/blog/editor_support_article.jpg"
caption="ReScript now offers autocompletion for VSCode and neovim (Sublime coming soon)"
/>
8 changes: 2 additions & 6 deletions _blogposts/2021-02-09-release-9-0.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@ Our compiler comes with a set of stdlib modules (such as `Belt`, `Pervasives`, e

In previous versions, users couldn't ship their compiled JS code without defining a `package.json` dependency on `bs-platform`. Whenever a ReScript developer wanted to publish a package just for pure JS consumption / lean container deployment, they were required to use a bundler to bundle up their library / stdlib code, which made things way more complex and harder to understand.


To fix this problem, we introduced an `external-stdlib` configuration that allows specifying a pre-compiled stdlib npm package (`@rescript/std`). More details on how to use that feature can be found in our [External Stdlib](/docs/manual/latest/build-external-stdlib) documentation.

### Less Bundle Bloat when Adding ReScript
Expand Down Expand Up @@ -67,8 +66,8 @@ The snippet above will compile to the following JS output:
<CodeTab labels={["9.0 Output", "8.4 Output" ]}>

```js
function test(x){
return x === 0
function test(x) {
return x === 0;
}
```

Expand All @@ -82,7 +81,6 @@ function test(x) {
}
```


</CodeTab>

As you can see, the 9.0 compiler removes all the unnecessary `typeof` checks!
Expand Down Expand Up @@ -153,7 +151,6 @@ type animation = [ #\"ease-in" | #\"ease-out" ]

We introduced this change to allow easier interop with existing JS string enums. In pure ReScript code, we'd still recommend our users to stick with valid identifier names instead (e.g. `easeIn` instead of `ease-in`).


## Breaking Changes

This release comes with a minor breaking change that shouldn't have much impact on the upgrade of existing codebases.
Expand Down Expand Up @@ -209,5 +206,4 @@ For example, we are tinkering with the idea on using WASM to replace Camlp4, and

We will discuss these topics in a separate development post, but we are already excited about the new possibilities this will bring within the compiler toolchain.


Happy Hacking!
4 changes: 3 additions & 1 deletion _blogposts/2021-05-07-release-9-1.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ The default `rescript` is equivalent to `rescript build` subcommand
```

Here's a table of translation, if you're upgrading your script that is currently using `bsc` and `bsb`:

- `bsc -format myFile.res`: `rescript format myFile.res`
- `bsb`: `rescript build` \*
- `bsb -make-world`: `rescript build -with-deps` \*
Expand All @@ -53,7 +54,8 @@ This means that you can ditch your old `-make-world` (now the explicit `-with-de

### Polymorphic Variants for Numbers and Strings

*Drumrolls*
_Drumrolls_

- Poly variants like `#1`, `#42` compile to JavaScript numbers.
- Poly variants like `#hello`, `#world` compile to JavaScript Strings.

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ description: |
Announcing our roadmap for 2021 / 2022, release cycle plans and new landing page.
---

import Image from "src/components/Image.mjs"
import Image from "src/components/Image.mjs";

## Team Update

Expand Down
Loading