Skip to content

Commit 8547f39

Browse files
committed
formatting
1 parent d48b592 commit 8547f39

File tree

10 files changed

+32
-27
lines changed

10 files changed

+32
-27
lines changed

docs/manual/build-configuration-schema.mdx

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,5 +7,4 @@ section: "Build System"
77
order: 3
88
---
99

10-
11-
<Docson tag="master" />
10+
<Docson tag="master" />

docs/manual/generalized-algebraic-data-types.mdx

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ type timezone =
3434
Using this variant type, we will end up having functions like this:
3535

3636
{/* TODO: fix this example, it has an error because it doesn't have access to the previous snippet */}
37+
3738
```res
3839
let convertToDaylight = tz => {
3940
switch tz {
@@ -49,6 +50,7 @@ This function is only valid for a subset of our variant type's constructors but
4950
Let's see if we can find a way for the compiler to help us with normal variants. We could define another variant type to distinguish the two kinds of timezone.
5051

5152
{/* TODO: fix this example, it has an error because it doesn't have access to the previous snippet */}
53+
5254
```res
5355
type daylightOrStandard =
5456
| Daylight(timezone)
@@ -58,6 +60,7 @@ type daylightOrStandard =
5860
This has a lot of problems. For one, it's cumbersome and redundant. We would now have to pattern-match twice whenever we deal with a timezone that's wrapped up here. The compiler will force us to check whether we are dealing with daylight or standard time, but notice that there's nothing stopping us from providing invalid timezones to these constructors:
5961

6062
{/* TODO: fix this example, it has an error because it doesn't have access to the previous snippet */}
63+
6164
```res
6265
let invalidTz1 = Daylight(EST)
6366
let invalidTz2 = Standard(EDT)
@@ -82,6 +85,7 @@ We define our type with a type parameter. We manually annotate each constructor,
8285
but we've added another level of specificity using a type parameter. Constructors are now understood to be `standard` or `daylight` at the _type_ level. Now we can fix our function like this:
8386

8487
{/* TODO: fix this example, it has an error because it doesn't have access to the previous snippet */}
88+
8589
```res
8690
let convertToDaylight = tz => {
8791
switch tz {
@@ -97,6 +101,7 @@ we try to return a standard timezone from this function. Actually, this seems li
97101
we still want to be able to match on all cases of the variant sometimes, and a naive attempt at this will not pass the type checker. A naive example will fail:
98102

99103
{/* TODO: fix this example, it has an error because it doesn't have access to the previous snippet */}
104+
100105
```res
101106
let convertToDaylight = tz =>
102107
switch tz {
@@ -110,6 +115,7 @@ let convertToDaylight = tz =>
110115
This will complain that `daylight` and `standard` are incompatible. To fix this, we need to explicitly annotate to tell the compiler to accept both:
111116

112117
{/* TODO: fix this example, it has an error because it doesn't have access to the previous snippet */}
118+
113119
```res
114120
let convertToDaylight : type a. timezone<a> => timezone<daylight> = // ...
115121
```
@@ -124,6 +130,7 @@ Sometimes, a function should have a different return type based on what you give
124130
[^1]: In ReScript v12, the built-in operators are already generic, but we use them in this example for simplicity.
125131

126132
{/* this example purposefully has an error so it is not marked as an example */}
133+
127134
```res
128135
type rec number<_> = Int(int): number<int> | Float(float): number<float>
129136
@@ -212,6 +219,7 @@ depending on which event we are binding to. A naive implementation might look si
212219
separate method for each stream event to wrap the unsafe version of `on`.
213220

214221
{/* TODO: fix this example, it has an error */}
222+
215223
```res
216224
module Stream = {
217225
type t
@@ -242,6 +250,7 @@ follow how the type variables are getting filled in, write it out on paper what
242250
to if you need and it will soon become clear.
243251

244252
{/* TODO: fix this example, it has an error */}
253+
245254
```res
246255
247256
module Stream = {

docs/manual/module-functions.mdx

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -36,15 +36,15 @@ module Next = {
3636
}
3737
3838
module Component: {
39-
@react.component
40-
let make: unit => Jsx.element
39+
@react.component
40+
let make: unit => Jsx.element
4141
} = {
4242
// Create a module that matches the module type expected by Next.MakeParams
4343
module P = {
44-
type t = {
45-
tag: string,
46-
item: string,
47-
}
44+
type t = {
45+
tag: string,
46+
item: string,
47+
}
4848
}
4949
5050
// Create a new module using the Params module we created and the Next.MakeParams module function

docs/react/hooks-custom.mdx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ Let's go back to a previous example from our [React.useEffect section](./hooks-e
2323
<CodeTab labels={["ReScript", "JS Output"]}>
2424

2525
{/* TODO: fix this example */}
26+
2627
```res {16-31}
2728
// FriendStatus.res
2829

docs/react/hooks-effect.mdx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -185,6 +185,7 @@ type state = Offline | Loading | Online
185185
<CodeTab labels={["ReScript", "JS Output"]}>
186186

187187
{/* TODO: fix this example */}
188+
188189
```res
189190
// FriendStatus.res
190191
@react.component
@@ -283,6 +284,7 @@ When we render with count updated to 6, React will compare the items in the `[5]
283284
This also works for effects that have a cleanup phase:
284285

285286
{/* TODO fix this example */}
287+
286288
```res
287289
@react.component
288290
let make = (~friendId: string) => {

docs/react/refs-and-the-dom.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -270,7 +270,7 @@ module CustomTextInput = {
270270
@react.component
271271
let make = () => {
272272
let textInput = React.useRef(Nullable.null)
273-
let setInputRef = element => {
273+
let setInputRef = element => {
274274
textInput.current = element
275275
None
276276
}

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,4 +75,4 @@
7575
"vite": "^7.0.6",
7676
"vite-plugin-env-compatible": "^2.0.1"
7777
}
78-
}
78+
}

public/_redirects

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,12 @@
55
/docs/manual/next/* /docs/manual/:splat 308
66
/docs/react/latest/* /docs/react/:spat 308
77

8-
98
/llms/manual/latest/* /llms/manual/:splat 307
109
/llms/manual/next/* /llms/manual/:splat 307
1110

12-
1311
/docs/manual/v11.0.0/* https://v11.rescript-lang.org/docs/manual/v11.0.0/:splat 308
1412
/docs/manual/v10.0.0/* https://v11.rescript-lang.org/docs/manual/v10.0.0/:splat 308
1513
/docs/manual/v9.0.0/* https://v11.rescript-lang.org/docs/manual/v9.0.0/:splat 308
16-
/docs/manual/v8.0.0/* https://v11.rescript-lang.org/docs/manual/v8.0.0/:splat 308
14+
/docs/manual/v8.0.0/* https://v11.rescript-lang.org/docs/manual/v8.0.0/:splat 308
15+
/docs/react/v0.11.0/* https://v11.rescript-lang.org/docs/react/v0.11.0/:splat 308
16+
/docs/react/v0.10.0/* https://v11.rescript-lang.org/docs/react/v0.10.0/:splat 308

scripts/test-examples.mjs

Lines changed: 5 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@ const __dirname =
1111
let tempFileName = path.join(__dirname, "../temp/src/", "_tempFile.res");
1212
let tempFileNameRegex = /_tempFile\.res/g;
1313

14-
1514
let parseFile = (content) => {
1615
if (!/```res (example|prelude|sig)/.test(content)) {
1716
return;
@@ -47,7 +46,6 @@ let parseFile = (content) => {
4746
.join("\n");
4847
};
4948

50-
5149
// TODO post RR7: revisit this
5250
// let postprocessOutput = (file, error) => {
5351
// return error.stderr
@@ -74,7 +72,6 @@ let parseFile = (content) => {
7472

7573
console.log("Running tests...");
7674

77-
7875
let rescriptJson = `{
7976
"name": "temp",
8077
"namespace": false,
@@ -92,7 +89,7 @@ let rescriptJson = `{
9289
"dir": "src"
9390
}
9491
]
95-
}`
92+
}`;
9693

9794
fs.mkdirSync(path.join(__dirname, "../temp/src/"), { recursive: true });
9895
fs.writeFileSync(path.join(__dirname, "../temp/rescript.json"), rescriptJson);
@@ -106,13 +103,12 @@ glob.sync(__dirname + "/../docs/{manual,react}/**/*.mdx").forEach((file) => {
106103
if (parsedResult != null) {
107104
fs.writeFileSync(tempFileName, parsedResult);
108105
try {
109-
console.log("testing examples in", file)
106+
console.log("testing examples in", file);
110107
// -109 for suppressing `Toplevel expression is expected to have unit type.`
111108
// Most doc snippets do e.g. `Belt.Array.length(["test"])`, which triggers this
112-
child_process.execSync(
113-
"npm exec rescript build ./temp -- --quiet",
114-
{ stdio: "inherit" },
115-
);
109+
child_process.execSync("npm exec rescript build ./temp -- --quiet", {
110+
stdio: "inherit",
111+
});
116112
} catch (e) {
117113
// process.stdout.write(postprocessOutput(file, e));
118114
success = false;
@@ -122,5 +118,3 @@ glob.sync(__dirname + "/../docs/{manual,react}/**/*.mdx").forEach((file) => {
122118

123119
fs.unlinkSync(tempFileName);
124120
process.exit(success ? 0 : 1);
125-
126-

src/components/CodeMirrorSetup.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
// CodeMirror setup and mode imports
22
import CodeMirror from "codemirror";
33

4-
import "codemirror/lib/codemirror.css"
4+
import "codemirror/lib/codemirror.css";
55

66
// Import required modes and addons
77
import "codemirror/mode/javascript/javascript";
@@ -13,7 +13,7 @@ import "codemirror/keymap/vim";
1313

1414
// Make sure CodeMirror is available globally
1515
if (typeof window !== "undefined") {
16-
window.CodeMirror = CodeMirror;
16+
window.CodeMirror = CodeMirror;
1717
}
1818

19-
export default CodeMirror;
19+
export default CodeMirror;

0 commit comments

Comments
 (0)