Skip to content

Remove underscores #130

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 1 commit into from
Jul 27, 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
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions docs/content/docs/contributing/code-generation.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ external fetch2: (window, ~input: string, ~init: requestInit=?)
While not that bad and usable, it can be improved:

- Rename `fetch2` to `fetch` because it is the more common usage of the function.
- Rename `fetch` to `fetch_with_request` for clarity that this is the "overload" with a `Request` object.
- Rename `fetch` to `fetchWithRequest` for clarity that this is the "overload" with a `Request` object.
- Consider removing the named `~input` and `~init` arguments and use positional arguments instead.
Motivation: If the function does not have any parameters with the same type, it is more ergonomic to use positional arguments.
This heuristic is not set in stone and can be adjusted based on the specific function.
Expand All @@ -43,7 +43,7 @@ external fetch: (window, string, ~init: requestInit=?)

/** TODO: add better docs */
@send
external fetch_withRequest: (window, request, ~init: requestInit=?)
external fetchWithRequest: (window, request, ~init: requestInit=?)
=> promise<response> = "fetch"
```

Expand Down
4 changes: 2 additions & 2 deletions src/DOMAPI/Element.res
Original file line number Diff line number Diff line change
Expand Up @@ -419,13 +419,13 @@ element->Element.scrollIntoView_alignToTop()
Scrolls the element's ancestor containers such that the element on which scrollIntoView() is called is visible to the user.

```res
element->Element.scrollIntoView_withOptions({ behavior: DOMAPI.Smooth })
element->Element.scrollIntoViewWithOptions({ behavior: DOMAPI.Smooth })
```

[Read more on MDN](https://developer.mozilla.org/docs/Web/API/Element/scrollIntoView)
*/
@send
external scrollIntoView_withOptions: (T.t, scrollIntoViewOptions) => unit = "scrollIntoView"
external scrollIntoViewWithOptions: (T.t, scrollIntoViewOptions) => unit = "scrollIntoView"

/**
[Read more on MDN](https://developer.mozilla.org/docs/Web/API/Element/scrollTo)
Expand Down
4 changes: 2 additions & 2 deletions src/DOMAPI/Window.res
Original file line number Diff line number Diff line change
Expand Up @@ -303,7 +303,7 @@ let response = await window->Window.fetch("https://rescript-lang.org")
external fetch: (window, string, ~init: requestInit=?) => promise<response> = "fetch"

/**
`fetch_withRequest(window, request, init)`
`fetchWithRequest(window, request, init)`

Starts the process of fetching a resource from the network,
returning a promise that is fulfilled once the response is available.
Expand All @@ -314,7 +314,7 @@ let response = await window->Window.fetch(myRequest)
[Read more on MDN](https://developer.mozilla.org/docs/Web/API/Window/fetch)
*/
@send
external fetch_withRequest: (window, request, ~init: requestInit=?) => promise<response> = "fetch"
external fetchWithRequest: (window, request, ~init: requestInit=?) => promise<response> = "fetch"

/**
[Read more on MDN](https://developer.mozilla.org/docs/Web/API/DedicatedWorkerGlobalScope/requestAnimationFrame)
Expand Down
4 changes: 2 additions & 2 deletions src/Global.res
Original file line number Diff line number Diff line change
Expand Up @@ -493,7 +493,7 @@ let response = await fetch("https://rescript-lang.org")
external fetch: (string, ~init: requestInit=?) => promise<response> = "fetch"

/**
`fetch_withRequest(request, init)`
`fetchWithRequest(request, init)`

Starts the process of fetching a resource from the network,
returning a promise that is fulfilled once the response is available.
Expand All @@ -504,7 +504,7 @@ let response = await fetch(myRequest)

[Read more on MDN](https://developer.mozilla.org/docs/Web/API/Window/fetch)
*/
external fetch_withRequest: (request, ~init: requestInit=?) => promise<response> = "fetch"
external fetchWithRequest: (request, ~init: requestInit=?) => promise<response> = "fetch"

/**
[Read more on MDN](https://developer.mozilla.org/docs/Web/API/DedicatedWorkerGlobalScope/requestAnimationFrame)
Expand Down
4 changes: 2 additions & 2 deletions src/WebWorkersAPI/WorkerGlobalScope.res
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ let response = await self->WorkerGlobalScope.fetch("https://rescript-lang.org")
external fetch: (T.t, string, ~init: requestInit=?) => promise<response> = "fetch"

/**
`fetch_withRequest(workerGlobalScope, request, init)`
`fetchWithRequest(workerGlobalScope, request, init)`

The fetch() method of the WorkerGlobalScope interface starts the process of fetching a resource from the network,
returning a promise that is fulfilled once the response is available.
Expand All @@ -35,7 +35,7 @@ let response = await self->WorkerGlobalScope.fetch(myRequest)

[Read more on MDN](https://developer.mozilla.org/en-US/docs/Web/API/WorkerGlobalScope/fetch)
*/
external fetch_withRequest: (T.t, request, ~init: requestInit=?) => promise<response> = "fetch"
external fetchWithRequest: (T.t, request, ~init: requestInit=?) => promise<response> = "fetch"
}

include Impl({type t = workerGlobalScope})
2 changes: 1 addition & 1 deletion tests/DOMAPI/HTMLElement__test.res
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,5 @@ document
->Document.querySelector("form")
->Null.toOption
->Option.forEach(form => {
form->Element.scrollIntoView_withOptions({behavior: DOMAPI.Smooth})
form->Element.scrollIntoViewWithOptions({behavior: DOMAPI.Smooth})
})
2 changes: 1 addition & 1 deletion tests/Global__test.res
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ let response2 = await fetch(
},
)

let response3 = await fetch_withRequest(
let response3 = await fetchWithRequest(
Request.fromURL("https://rescript-lang.org/"),
~init={
method: "POST",
Expand Down