Bug 1927798 - Re-enable the curly rule for ESLint. r=frontend-codestyle-reviewers,mossop

This was accidentally disabled in bug 1920531 with the re-organisation of how eslint-plugin-mozilla worked.
The rule needs to be (re)enabled after eslint-config-prettier is applied, as eslint-config-prettier turns it off by default.

Differential Revision: https://phabricator.services.mozilla.com/D227621
This commit is contained in:
Mark Banner 2024-11-01 14:15:01 +00:00
parent 116cb723db
commit cbb55a4a55
7 changed files with 26 additions and 9 deletions

View File

@ -87,6 +87,14 @@ module.exports = {
"mozilla/privileged": true,
"mozilla/specific": true,
},
rules: {
// Require braces around blocks that start a new line. This must be
// configured after eslint-config-prettier is included (via `extends`
// above), as otherwise that configuration disables it. Hence, we do
// not include it in
// `tools/lint/eslint/eslint-plugin-mozilla/lib/configs/recommended.js`.
curly: ["error", "all"],
},
},
{
files: [

View File

@ -267,7 +267,9 @@ export const GenAI = {
*/
init() {
// Allow other callers to init even though we now automatically init
if (this._initialized) return;
if (this._initialized) {
return;
}
this._initialized = true;
// Access getters for side effects of observing pref changes

View File

@ -509,7 +509,9 @@ function showOnboarding(length) {
// Handle single select provider choice
case ACTIONS.CHATBOT_SELECT: {
const { config } = action;
if (!config) break;
if (!config) {
break;
}
request(config.url);
document.querySelector(".primary").disabled = false;

View File

@ -311,7 +311,9 @@ class _MLSuggest {
#sumObjectsByKey(...objs) {
return objs.reduce((a, b) => {
for (let k in b) {
if (b.hasOwnProperty(k)) a[k] = (a[k] || 0) + b[k];
if (b.hasOwnProperty(k)) {
a[k] = (a[k] || 0) + b[k];
}
}
return a;
}, {});

View File

@ -51,7 +51,9 @@ async function testLegacyEnumerateDevices() {
is(jsoned[0].deviceId, devices[0].deviceId, "deviceId survived serializer");
for (const device of devices) {
validateDevice(device);
if (device.kind == "audiooutput") continue;
if (device.kind == "audiooutput") {
continue;
}
is(device.label, "", "Device label is empty");
// Test deviceId constraint
let deviceId = device.deviceId;
@ -107,7 +109,9 @@ async function testLegacyEnumerateDevices() {
window.addEventListener("message", ({ origin, data }) => {
ok(origins.includes(origin), "Got message from expected origin");
map.set(origin, JSON.parse(data));
if (map.size < origins.length) return;
if (map.size < origins.length) {
return;
}
resolve(map);
});
});

View File

@ -227,7 +227,9 @@ function isMultiThreadSupported() {
*
*/
async function checkGPUSupport() {
if (!navigator?.gpu) return false;
if (!navigator?.gpu) {
return false;
}
const adapter = await navigator.gpu.requestAdapter({
powerPreference: "high-performance",

View File

@ -52,9 +52,6 @@ const coreRules = {
// Functions must always return something or nothing
"consistent-return": "error",
// Require braces around blocks that start a new line
curly: ["error", "all"],
// Encourage the use of dot notation whenever possible.
"dot-notation": "error",