Skip to content

Commit

Permalink
Format /mozilla using Prettier (#24050)
Browse files Browse the repository at this point in the history
  • Loading branch information
queengooborg authored Jul 14, 2023
1 parent 41dd6b8 commit 03d9b93
Show file tree
Hide file tree
Showing 47 changed files with 92 additions and 96 deletions.
4 changes: 0 additions & 4 deletions .prettierignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,6 @@ build/
/files/en-us/_githistory.json
/tests/front-matter_test_files

# A full pass on all Markdown files is being performed.
# The following folders still need a full pass:
/files/en-us/mozilla/add-ons/webextensions/api/**/*.md

# XXX Ignored until https://github.com/prettier/prettier/issues/15032 is fixed
/files/en-us/web/javascript/reference/operators/exponentiation/index.md
/files/en-us/web/javascript/reference/operators/exponentiation_assignment/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,8 @@ let settingIcon = browser.action.setIcon(
let settingIcon = browser.action.setIcon({
imageData: {
16: image16,
32: image32
}
32: image32,
},
});
```

Expand All @@ -60,8 +60,8 @@ let settingIcon = browser.action.setIcon(
let settingIcon = browser.action.setIcon({
path: {
16: "path/to/image16.jpg",
32: "path/to/image32.jpg"
}
32: "path/to/image32.jpg",
},
});
```
Expand Down Expand Up @@ -100,7 +100,7 @@ function startListening() {
browser.webRequest.onHeadersReceived.addListener(
logResponseHeaders,
{ urls: ["<all_urls>"] },
["responseHeaders"]
["responseHeaders"],
);
browser.action.setIcon({ path: "icons/listening-on.svg" });
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ browser.contextMenus.create(
contexts: ["all"],
checked: true,
},
onCreated
onCreated,
);

browser.contextMenus.create(
Expand All @@ -80,7 +80,7 @@ browser.contextMenus.create(
contexts: ["all"],
checked: false,
},
onCreated
onCreated,
);

browser.contextMenus.onClicked.addListener((info, tab) => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,8 @@ let settingIcon = browser.browserAction.setIcon(
let settingIcon = browser.action.setIcon({
imageData: {
16: image16,
32: image32
}
32: image32,
},
});
```

Expand All @@ -58,8 +58,8 @@ let settingIcon = browser.browserAction.setIcon(
let settingIcon = browser.action.setIcon({
path: {
16: "path/to/image16.jpg",
32: "path/to/image32.jpg"
}
32: "path/to/image32.jpg",
},
});
```
Expand Down Expand Up @@ -102,7 +102,7 @@ function startListening() {
browser.webRequest.onHeadersReceived.addListener(
logResponseHeaders,
{ urls: ["<all_urls>"] },
["responseHeaders"]
["responseHeaders"],
);
browser.browserAction.setIcon({ path: "icons/listening-on.svg" });
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ browser.contextMenus.create(
contexts: ["all"],
checked: true,
},
onCreated
onCreated,
);

browser.contextMenus.create(
Expand All @@ -82,7 +82,7 @@ browser.contextMenus.create(
contexts: ["all"],
checked: false,
},
onCreated
onCreated,
);

browser.contextMenus.onClicked.addListener((info, tab) => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ The following code snippet gets all cookie stores and then logs the total number
browser.cookies.getAllCookieStores().then((stores) => {
const incognitoStores = stores.map((store) => store.incognito);
console.log(
`Of ${stores.length} cookie stores, ${incognitoStores.length} are incognito.`
`Of ${stores.length} cookie stores, ${incognitoStores.length} are incognito.`,
);
});
```
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ browser.cookies.onChanged.addListener((changeInfo) => {
`Cookie changed: \n` +
` * Cookie: ${JSON.stringify(changeInfo.cookie)}\n` +
` * Cause: ${changeInfo.cause}\n` +
` * Removed: ${changeInfo.removed}`
` * Removed: ${changeInfo.removed}`,
);
});
```
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ browser.cookies.onChanged.addListener((changeInfo) => {
`Cookie changed: \n` +
` * Cookie: ${JSON.stringify(changeInfo.cookie)}\n` +
` * Cause: ${changeInfo.cause}\n` +
` * Removed: ${changeInfo.removed}`
` * Removed: ${changeInfo.removed}`,
);
});
```
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ browser.devtools.panels
.create(
"My Panel", // title
"/icons/star.png", // icon
"/devtools/panel/panel.html" // content
"/devtools/panel/panel.html", // content
)
.then((newPanel) => {
newPanel.onShown.addListener(handleShown);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ function handleSelectedElement() {
}

browser.devtools.panels.elements.onSelectionChanged.addListener(
handleSelectedElement
handleSelectedElement,
);
```

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ browser.devtools.panels
.create(
"My Panel", // title
"icons/star.png", // icon
"devtools/panel/panel.html" // content
"devtools/panel/panel.html", // content
)
.then((newPanel) => {
newPanel.onShown.addListener(handleShown);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,7 @@ function getNodes() {
document,
window.NodeFilter.SHOW_TEXT,
null,
false
false,
);
const nodes = [];
while ((node = walker.nextNode())) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ browser.history
text: "https://example.org/",
startTime: 0,
maxResults: 1,
})
}),
)
.then(onGot);
```
Expand Down Expand Up @@ -91,7 +91,7 @@ browser.history
.then(() =>
browser.history.getVisits({
url: "https://example.org/",
})
}),
)
.then(onGot);
```
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ browser.menus.create(
contexts: ["all"],
checked: false,
},
onCreated
onCreated,
);
browser.menus.create(
Expand All @@ -165,7 +165,7 @@ browser.menus.create(
contexts: ["all"],
checked: false,
},
onCreated
onCreated,
);
let makeItBlue = 'document.body.style.border = "5px solid blue"';
Expand Down
12 changes: 6 additions & 6 deletions files/en-us/mozilla/add-ons/webextensions/api/menus/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ browser.menus.create(
title: browser.i18n.getMessage("menuItemRemoveMe"),
contexts: ["all"],
},
onCreated
onCreated,
);

browser.menus.create(
Expand All @@ -68,7 +68,7 @@ browser.menus.create(
type: "separator",
contexts: ["all"],
},
onCreated
onCreated,
);

browser.menus.create(
Expand All @@ -83,7 +83,7 @@ browser.menus.create(
32: "icons/paint-green-32.png",
},
},
onCreated
onCreated,
);

browser.menus.create(
Expand All @@ -98,7 +98,7 @@ browser.menus.create(
32: "icons/paint-blue-32.png",
},
},
onCreated
onCreated,
);

browser.menus.create(
Expand All @@ -107,7 +107,7 @@ browser.menus.create(
type: "separator",
contexts: ["all"],
},
onCreated
onCreated,
);

let checkedState = true;
Expand All @@ -120,7 +120,7 @@ browser.menus.create(
contexts: ["all"],
checked: checkedState,
},
onCreated
onCreated,
);
```

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ document.addEventListener(
});
}
},
{ capture: true }
{ capture: true },
);
```

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,8 @@ let settingIcon = browser.pageAction.setIcon(
let settingIcon = browser.action.setIcon({
imageData: {
16: image16,
32: image32
}
32: image32,
},
});
```

Expand All @@ -56,8 +56,8 @@ let settingIcon = browser.pageAction.setIcon(
let settingIcon = browser.action.setIcon({
path: {
16: "path/to/image16.jpg",
32: "path/to/image32.jpg"
}
32: "path/to/image32.jpg",
},
});
```
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,30 +42,30 @@ A [`Promise`](/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise) that

let testPermissions1 = {
origins: ["*://mozilla.org/"],
permissions: ["tabs"]
permissions: ["tabs"],
};

const testResult1 = await browser.permissions.contains(testPermissions1);
console.log(testResult1); // true

let testPermissions2 = {
origins: ["*://mozilla.org/"],
permissions: ["tabs", "alarms"]
permissions: ["tabs", "alarms"],
};

const testResult2 = await browser.permissions.contains(testPermissions2);
console.log(testResult2); // false, "alarms" doesn't match

let testPermissions3 = {
origins: ["https://developer.mozilla.org/"],
permissions: ["tabs", "webRequest"]
permissions: ["tabs", "webRequest"],
};

const testResult3 = await browser.permissions.contains(testPermissions3);
console.log(testResult3); // true: "https://developer.mozilla.org/", matches: "*://*.mozilla.org/*"

let testPermissions4 = {
origins: ["https://example.org/"]
origins: ["https://example.org/"],
};

const testResult4 = await browser.permissions.contains(testPermissions4);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ function handleBrowserUpdateAvailable() {
}

browser.runtime.onBrowserUpdateAvailable.addListener(
handleBrowserUpdateAvailable
handleBrowserUpdateAvailable,
);
```

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ function forgetMostRecent(sessionInfos) {
if (sessionInfo.tab) {
browser.sessions.forgetClosedTab(
sessionInfo.tab.windowId,
sessionInfo.tab.sessionId
sessionInfo.tab.sessionId,
);
} else {
browser.sessions.forgetClosedWindow(sessionInfo.window.sessionId);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ function forgetMostRecent(sessionInfos) {
if (sessionInfo.tab) {
browser.sessions.forgetClosedTab(
sessionInfo.tab.windowId,
sessionInfo.tab.sessionId
sessionInfo.tab.sessionId,
);
} else {
browser.sessions.forgetClosedWindow(sessionInfo.window.sessionId);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,8 @@ let settingIcon = browser.sidebarAction.setIcon(
let settingIcon = browser.action.setIcon({
imageData: {
16: image16,
32: image32
}
32: image32,
},
});
```

Expand All @@ -68,8 +68,8 @@ let settingIcon = browser.sidebarAction.setIcon(
let settingIcon = browser.action.setIcon({
path: {
16: "path/to/image16.jpg",
32: "path/to/image32.jpg"
}
32: "path/to/image32.jpg",
},
});
```
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ Or using a Promise

```js
let gettingItem = new Promise((resolve) =>
chrome.storage.local.get("kitten", resolve)
chrome.storage.local.get("kitten", resolve),
);
gettingItem.then(onGot); // -> Object { kitten: Object }
```
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ Listen for and log move events:
```js
function handleMoved(tabId, moveInfo) {
console.log(
`Tab ${tabId} moved from ${moveInfo.fromIndex} to ${moveInfo.toIndex}`
`Tab ${tabId} moved from ${moveInfo.fromIndex} to ${moveInfo.toIndex}`,
);
}

Expand Down
Loading

0 comments on commit 03d9b93

Please sign in to comment.