Skip to content
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

fix: format docs with prettier 3.1 #30270

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from 1 commit
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
Original file line number Diff line number Diff line change
Expand Up @@ -77,8 +77,9 @@ function generatePrimes(quota) {
document.querySelector("#generate").addEventListener("click", () => {
const quota = document.querySelector("#quota").value;
const primes = generatePrimes(quota);
document.querySelector("#output").textContent =
`Finished generating ${quota} primes!`;
document.querySelector(
"#output",
).textContent = `Finished generating ${quota} primes!`;
OnkarRuikar marked this conversation as resolved.
Show resolved Hide resolved
});

document.querySelector("#reload").addEventListener("click", () => {
Expand Down Expand Up @@ -160,8 +161,9 @@ document.querySelector("#generate").addEventListener("click", () => {
// update the output box with a message for the user, including the number of
// primes that were generated, taken from the message data.
worker.addEventListener("message", (message) => {
document.querySelector("#output").textContent =
`Finished generating ${message.data} primes!`;
document.querySelector(
"#output",
).textContent = `Finished generating ${message.data} primes!`;
OnkarRuikar marked this conversation as resolved.
Show resolved Hide resolved
});

document.querySelector("#reload").addEventListener("click", () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -445,8 +445,8 @@ We will also use the `Filter` enum in the `Todos.svelte` component.
filter === Filter.ACTIVE
? todos.filter((t) => !t.completed)
: filter === Filter.COMPLETED
? todos.filter((t) => t.completed)
: todos;
? todos.filter((t) => t.completed)
: todos;
OnkarRuikar marked this conversation as resolved.
Show resolved Hide resolved

$: {
if (filter === Filter.ALL) {
Expand Down Expand Up @@ -519,8 +519,8 @@ We will also use the `Filter` enum in the `Todos.svelte` component.
filter === Filter.ACTIVE
? todos.filter((t) => !t.completed)
: filter === Filter.COMPLETED
? todos.filter((t) => t.completed)
: todos;
? todos.filter((t) => t.completed)
: todos;
OnkarRuikar marked this conversation as resolved.
Show resolved Hide resolved

$: {
if (filter === Filter.ALL) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -392,8 +392,8 @@ Finally for this article, let's implement the ability to filter our to-dos by st
filter === "active"
? todos.filter((t) => !t.completed)
: filter === "completed"
? todos.filter((t) => t.completed)
: todos;
? todos.filter((t) => t.completed)
: todos;
OnkarRuikar marked this conversation as resolved.
Show resolved Hide resolved
```

We use the `filter` variable to control the active filter: _all_, _active_, or _completed_. Just assigning one of these values to the filter variable will activate the filter and update the list of to-dos. Let's see how to achieve this.
Expand Down
5 changes: 3 additions & 2 deletions files/en-us/web/api/batterymanager/chargingtime/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,9 @@ A number.
navigator.getBattery().then((battery) => {
const time = battery.chargingTime;

document.querySelector("#chargingTime").textContent =
`Time to fully charge the battery: ${time}s`;
document.querySelector(
"#chargingTime",
).textContent = `Time to fully charge the battery: ${time}s`;
OnkarRuikar marked this conversation as resolved.
Show resolved Hide resolved
});
```

Expand Down
5 changes: 3 additions & 2 deletions files/en-us/web/api/batterymanager/dischargingtime/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,9 @@ A number.
navigator.getBattery().then((battery) => {
const time = battery.dischargingTime;

document.querySelector("#dischargingTime").textContent =
`Remaining time to fully discharge the battery: ${time}`;
document.querySelector(
"#dischargingTime",
).textContent = `Remaining time to fully discharge the battery: ${time}`;
OnkarRuikar marked this conversation as resolved.
Show resolved Hide resolved
});
```

Expand Down
5 changes: 3 additions & 2 deletions files/en-us/web/api/batterymanager/levelchange_event/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,9 @@ navigator.getBattery().then((battery) => {
battery.chargingTime / 60
}`;
} else {
document.querySelector("#stateBattery").textContent =
`Discharging time: ${battery.dischargingTime / 60}`;
document.querySelector(
"#stateBattery",
).textContent = `Discharging time: ${battery.dischargingTime / 60}`;
OnkarRuikar marked this conversation as resolved.
Show resolved Hide resolved
}
};
});
Expand Down
4 changes: 2 additions & 2 deletions files/en-us/web/api/document/createtreewalker/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -158,8 +158,8 @@ const treeWalker = document.createTreeWalker(
node.classList.contains("no-escape")
? NodeFilter.FILTER_REJECT
: node.closest(".escape")
? NodeFilter.FILTER_ACCEPT
: NodeFilter.FILTER_SKIP,
? NodeFilter.FILTER_ACCEPT
: NodeFilter.FILTER_SKIP,
OnkarRuikar marked this conversation as resolved.
Show resolved Hide resolved
);

while (treeWalker.nextNode()) {
Expand Down
5 changes: 3 additions & 2 deletions files/en-us/web/api/ink_api/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -91,8 +91,9 @@ canvas.addEventListener("pointermove", async (evt) => {

style = { color: `rgba(${r}, ${g}, ${b}, 1)`, diameter: 10 };
move_cnt = 0;
document.getElementById("div").style.backgroundColor =
`rgba(${r}, ${g}, ${b}, 0.6)`;
document.getElementById(
"div",
).style.backgroundColor = `rgba(${r}, ${g}, ${b}, 0.6)`;
OnkarRuikar marked this conversation as resolved.
Show resolved Hide resolved
}
move_cnt += 1;
await presenter.updateInkTrailStartPoint(evt, style);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -97,8 +97,9 @@ canvas.addEventListener("pointermove", async (evt) => {

style = { color: `rgba(${r}, ${g}, ${b}, 1)`, diameter: 10 };
move_cnt = 0;
document.getElementById("div").style.backgroundColor =
`rgba(${r}, ${g}, ${b}, 0.6)`;
document.getElementById(
"div",
).style.backgroundColor = `rgba(${r}, ${g}, ${b}, 0.6)`;
OnkarRuikar marked this conversation as resolved.
Show resolved Hide resolved
}
move_cnt += 1;
await presenter.updateInkTrailStartPoint(evt, style);
Expand Down
5 changes: 3 additions & 2 deletions files/en-us/web/api/keyboardevent/metakey/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,9 @@ A boolean value.

```js
function ismetaKey(e) {
document.querySelector("#output").textContent =
`metaKey pressed? ${e.metaKey}`;
document.querySelector(
"#output",
).textContent = `metaKey pressed? ${e.metaKey}`;
OnkarRuikar marked this conversation as resolved.
Show resolved Hide resolved
}
```

Expand Down
5 changes: 3 additions & 2 deletions files/en-us/web/api/response/json/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,9 @@ fetch(myRequest)
listItem.appendChild(document.createElement("strong")).textContent =
product.Name;
listItem.append(` can be found in ${product.Location}. Cost: `);
listItem.appendChild(document.createElement("strong")).textContent =
`£${product.Price}`;
listItem.appendChild(
document.createElement("strong"),
).textContent = `£${product.Price}`;
OnkarRuikar marked this conversation as resolved.
Show resolved Hide resolved
myList.appendChild(listItem);
}
})
Expand Down
5 changes: 3 additions & 2 deletions files/en-us/web/api/rtcdatachannel/label/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,9 @@ const dc = pc.createDataChannel("my channel");

// …

document.getElementById("channel-name").innerHTML =
`<span class='channelName'>${dc.label}</span>`;
document.getElementById(
"channel-name",
).innerHTML = `<span class='channelName'>${dc.label}</span>`;
OnkarRuikar marked this conversation as resolved.
Show resolved Hide resolved
```

## Specifications
Expand Down
5 changes: 3 additions & 2 deletions files/en-us/web/api/webgl_api/by_example/hello_glsl/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -97,8 +97,9 @@ function setupWebGL(evt) {
if (!gl.getProgramParameter(program, gl.LINK_STATUS)) {
const linkErrLog = gl.getProgramInfoLog(program);
cleanup();
document.querySelector("p").textContent =
`Shader program did not link successfully. Error log: ${linkErrLog}`;
document.querySelector(
"p",
).textContent = `Shader program did not link successfully. Error log: ${linkErrLog}`;
OnkarRuikar marked this conversation as resolved.
Show resolved Hide resolved
return;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -102,8 +102,9 @@ function setupWebGL(evt) {
if (!gl.getProgramParameter(program, gl.LINK_STATUS)) {
const linkErrLog = gl.getProgramInfoLog(program);
cleanup();
document.querySelector("p").textContent =
`Shader program did not link successfully. Error log: ${linkErrLog}`;
document.querySelector(
"p",
).textContent = `Shader program did not link successfully. Error log: ${linkErrLog}`;
OnkarRuikar marked this conversation as resolved.
Show resolved Hide resolved
return;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -108,8 +108,9 @@ function setupWebGL(evt) {
if (!gl.getProgramParameter(program, gl.LINK_STATUS)) {
const linkErrLog = gl.getProgramInfoLog(program);
cleanup();
document.querySelector("p").textContent =
`Shader program did not link successfully. Error log: ${linkErrLog}`;
document.querySelector(
"p",
).textContent = `Shader program did not link successfully. Error log: ${linkErrLog}`;
OnkarRuikar marked this conversation as resolved.
Show resolved Hide resolved
return;
}
initializeAttributes();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -163,8 +163,8 @@ Here, we load 10 modules, `/modules/module-0.js`, `/modules/module-1.js`, etc.,

```js
Promise.all(
Array.from({ length: 10 }).map(
(_, index) => import(`/modules/module-${index}.js`),
Array.from({ length: 10 }).map((_, index) =>
import(`/modules/module-${index}.js`),
OnkarRuikar marked this conversation as resolved.
Show resolved Hide resolved
),
).then((modules) => modules.forEach((module) => module.load()));
```
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -112,8 +112,8 @@ let classes = "header";
classes += isLargeScreen()
? ""
: item.isCollapsed
? " icon-expander"
: " icon-collapser";
? " icon-expander"
: " icon-collapser";
OnkarRuikar marked this conversation as resolved.
Show resolved Hide resolved
```

With a template literal but without nesting, you could do this:
Expand Down
Loading