Backed out 8 changesets (bug 1917532, bug 1575506, bug 1917530) for causing node newtab failures CLOSED TREE

Backed out changeset 8d6f7bc74d08 (bug 1917532)
Backed out changeset 7c963e72cf06 (bug 1575506)
Backed out changeset d5e110187781 (bug 1917530)
Backed out changeset 1d2325ffded6 (bug 1917530)
Backed out changeset 8a361e37e32c (bug 1917530)
Backed out changeset c4011d92c7f7 (bug 1917530)
Backed out changeset 1a45047dfb3c (bug 1917530)
Backed out changeset ed6b35444c45 (bug 1917530)
This commit is contained in:
Sandor Molnar 2024-09-12 20:45:28 +03:00
Родитель c39b99b6f6
Коммит 6a28b1e440
88 изменённых файлов: 375 добавлений и 366 удалений

Просмотреть файл

@ -1988,96 +1988,6 @@ const rollouts = [
"mozilla/no-browser-refs-in-toolkit": "warn",
},
},
{
// TODO: Bug TBD - Finish enabling no-shadow with builtinGlobals: true
// for system modules.
files: [
"browser/components/extensions/Extension*.sys.mjs",
"docshell/base/URIFixup.sys.mjs",
"dom/base/ContentAreaDropListener.sys.mjs",
"dom/manifest/ImageObjectProcessor.sys.mjs",
"dom/media/PeerConnection.sys.mjs",
"dom/push/Push*.sys.mjs",
"dom/system/NetworkGeolocationProvider.sys.mjs",
"dom/xslt/xslt/txEXSLTRegExFunctions.sys.mjs",
"layout/tools/reftest/reftest.sys.mjs",
"mobile/shared/**/*.sys.mjs",
"netwerk/test/browser/cookie_filtering_helper.sys.mjs",
"netwerk/test/httpserver/httpd.sys.mjs",
"remote/cdp/**/*.sys.mjs",
"remote/marionette/**/*.sys.mjs",
"remote/server/WebSocketHandshake.sys.mjs",
"remote/shared/**/*.sys.mjs",
"remote/webdriver-bidi/**/*.sys.mjs",
"security/manager/ssl/RemoteSecuritySettings.sys.mjs",
"services/common/**/*.sys.mjs",
"services/crypto/**/*.sys.mjs",
"services/fxaccounts/**/*.sys.mjs",
"services/settings/**/*.sys.mjs",
"services/sync/**/*.sys.mjs",
"testing/mochitest/BrowserTestUtils/BrowserTestUtils.sys.mjs",
"testing/modules/**/*.sys.mjs",
"testing/specialpowers/content/SpecialPowersChild.sys.mjs",
"testing/talos/talos/**/*.sys.mjs",
"toolkit/actors/**/*.sys.mjs",
"toolkit/components/**/*.sys.mjs",
"toolkit/crashreporter/CrashSubmit.sys.mjs",
"toolkit/modules/**/*.sys.mjs",
"toolkit/mozapps/**/*.sys.mjs",
],
rules: {
"no-shadow": ["warn", { allow: ["event"], builtinGlobals: true }],
},
},
{
// TODO: Bug TBD - Finish enabling no-shadow for all files.
files: [
"browser/components/extensions/**",
"docshell/test/**",
"devtools/client/framework/**",
"dom/fetch/tests/**",
"dom/indexedDB/test/**",
"dom/media/**",
"dom/notification/test/browser/browser_permission_dismiss.js",
"dom/security/**",
"dom/tests/browser/**",
"dom/xslt/tests/browser/file_bug1309630.html",
"extensions/spellcheck/tests/chrome/test_add_remove_dictionaries.xhtml",
"gfx/layers/layerviewer/layerTreeView.js",
"image/test/browser/browser_animated_css_image.js",
"js/src/builtin/Promise.js",
"js/xpconnect/tests/**",
"layout/tools/reftest/reftest-content.js",
"mobile/android/geckoview/**",
"mobile/shared/components/extensions/**",
"netwerk/**",
"remote/cdp/**",
"remote/shared/**",
"remote/webdriver-bidi/**",
"security/manager/**",
"security/sandbox/**",
"taskcluster/docker/periodic-updates/scripts/genHPKPStaticPins.js",
"testing/condprofile/condprof/scenarii/bookmark.js",
"testing/**",
"toolkit/components/**",
"toolkit/content/**",
"toolkit/crashreporter/**",
"toolkit/modules/subprocess/subprocess_shared.js",
"toolkit/modules/tests/**",
"toolkit/mozapps/**",
"toolkit/themes/shared/design-system/tests/try-runner.js",
"tools/profiler/tests/**",
"tools/tryselect/selectors/chooser/static/filter.js",
],
excludedFiles: [
"**/*.sys.mjs",
"toolkit/components/narrate/**",
"toolkit/components/reader/**",
],
rules: {
"no-shadow": "off",
},
},
];
module.exports = { rollouts };

Просмотреть файл

@ -45,7 +45,6 @@ const xpcshellTestPaths = [
// of the file.
const extraXpcshellTestPaths = [
"devtools/client/shared/remote-debugging/adb/xpcshell/",
"devtools/platform/tests/xpcshell/",
"dom/file/tests/",
"dom/ipc/tests/",

Просмотреть файл

@ -14,9 +14,24 @@ const { rollouts } = require("./.eslintrc-rollouts.js");
const fs = require("fs");
const path = require("path");
function readFile(filePath) {
/**
* Some configurations have overrides, which can't be specified within overrides,
* so we need to remove them.
*
* @param {object} config
* The configuration to remove overrides from.
* @returns {object}
* The new configuration.
*/
function removeOverrides(config) {
config = { ...config };
delete config.overrides;
return config;
}
function readFile(path) {
return fs
.readFileSync(filePath, { encoding: "utf-8" })
.readFileSync(path, { encoding: "utf-8" })
.split("\n")
.filter(p => p && !p.startsWith("#"));
}
@ -138,8 +153,8 @@ module.exports = {
extends: ["plugin:mozilla/general-test"],
},
{
...xpcshellTestConfig,
files: testPaths.xpcshell.map(filePath => `${filePath}**`),
...removeOverrides(xpcshellTestConfig),
files: testPaths.xpcshell.map(path => `${path}**`),
excludedFiles: ["**/*.jsm", "**/*.mjs", "**/*.sjs"],
},
{
@ -147,7 +162,7 @@ module.exports = {
// would require searching the other test files to know if they are used or not.
// This would be expensive and slow, and it isn't worth it for head files.
// We could get developers to declare as exported, but that doesn't seem worth it.
files: testPaths.xpcshell.map(filePath => `${filePath}head*.js`),
files: testPaths.xpcshell.map(path => `${path}head*.js`),
rules: {
"no-unused-vars": [
"error",
@ -164,7 +179,7 @@ module.exports = {
// This is not done in the xpcshell-test configuration as we cannot pull
// in overrides from there. We should at some stage, aim to enable this
// for all files in xpcshell-tests.
files: testPaths.xpcshell.map(filePath => `${filePath}test*.js`),
files: testPaths.xpcshell.map(path => `${path}test*.js`),
rules: {
// No declaring variables that are never used
"no-unused-vars": [
@ -177,13 +192,13 @@ module.exports = {
},
},
{
...browserTestConfig,
files: testPaths.browser.map(filePath => `${filePath}**`),
...removeOverrides(browserTestConfig),
files: testPaths.browser.map(path => `${path}**`),
excludedFiles: ["**/*.jsm", "**/*.mjs", "**/*.sjs"],
},
{
...mochitestTestConfig,
files: testPaths.mochitest.map(filePath => `${filePath}**`),
...removeOverrides(mochitestTestConfig),
files: testPaths.mochitest.map(path => `${path}**`),
excludedFiles: [
"**/*.jsm",
"**/*.mjs",
@ -191,8 +206,8 @@ module.exports = {
],
},
{
...chromeTestConfig,
files: testPaths.chrome.map(filePath => `${filePath}**`),
...removeOverrides(chromeTestConfig),
files: testPaths.chrome.map(path => `${path}**`),
excludedFiles: ["**/*.jsm", "**/*.mjs", "**/*.sjs"],
},
{
@ -203,8 +218,8 @@ module.exports = {
"mozilla/simpletest": true,
},
files: [
...testPaths.mochitest.map(filePath => `${filePath}/**/*.js`),
...testPaths.chrome.map(filePath => `${filePath}/**/*.js`),
...testPaths.mochitest.map(path => `${path}/**/*.js`),
...testPaths.chrome.map(path => `${path}/**/*.js`),
],
excludedFiles: ["**/*.jsm", "**/*.mjs", "**/*.sjs"],
},
@ -213,7 +228,7 @@ module.exports = {
// don't work well for HTML-based mochitests, so disable those.
files: testPaths.xpcshell
.concat(testPaths.browser)
.map(filePath => [`${filePath}/**/*.html`, `${filePath}/**/*.xhtml`])
.map(path => [`${path}/**/*.html`, `${path}/**/*.xhtml`])
.flat(),
rules: {
// plain/chrome mochitests don't automatically include Assert, so
@ -254,7 +269,7 @@ module.exports = {
},
{
// Exempt files with these paths since they have to use http for full coverage
files: httpTestingPaths.map(filePath => `${filePath}**`),
files: httpTestingPaths.map(path => `${path}**`),
rules: {
"@microsoft/sdl/no-insecure-url": "off",
},
@ -282,6 +297,9 @@ module.exports = {
"mozilla/reject-importGlobalProperties": ["error", "everything"],
"mozilla/reject-mixing-eager-and-lazy": "error",
"mozilla/reject-top-level-await": "error",
// TODO: Bug 1575506 turn `builtinGlobals` on here.
// We can enable builtinGlobals for jsms due to their scopes.
"no-redeclare": ["error", { builtinGlobals: false }],
// Modules and workers are far easier to check for no-unused-vars on a
// global scope, than our content files. Hence we turn that on here.
"no-unused-vars": [

Просмотреть файл

@ -9,9 +9,9 @@
const fs = require("fs");
const path = require("path");
function readFile(filePath) {
function readFile(path) {
return fs
.readFileSync(filePath, { encoding: "utf-8" })
.readFileSync(path, { encoding: "utf-8" })
.split("\n")
.filter(p => p && !p.startsWith("#"));
}

Просмотреть файл

@ -17,6 +17,7 @@ module.exports = {
"no-multi-str": "error",
"no-proto": "error",
"no-return-assign": "error",
"no-shadow": "error",
"no-unused-vars": ["error", { vars: "all", argsIgnorePattern: "^_" }],
"one-var": ["error", "never"],
radix: "error",

Просмотреть файл

@ -22,5 +22,7 @@ module.exports = {
// Disallow adding to native types
"no-extend-native": "error",
"no-shadow": "error",
},
};

Просмотреть файл

@ -943,6 +943,7 @@ export class ContextMenuChild extends JSWindowActorChild {
? undefined
: context.target.title || context.target.alt,
};
const { SVGAnimatedLength } = context.target.ownerGlobal;
if (SVGAnimatedLength.isInstance(context.imageInfo.height)) {
context.imageInfo.height = context.imageInfo.height.animVal.value;
}

Просмотреть файл

@ -151,6 +151,7 @@ module.exports = {
"no-prototype-builtins": "error",
"no-return-assign": ["error", "except-parens"],
"no-script-url": "error",
"no-shadow": "error",
"no-template-curly-in-string": "error",
"no-undef-init": "error",
"no-unmodified-loop-condition": "error",

Просмотреть файл

@ -97,7 +97,7 @@ export const AddonsPicker = props => {
(
{
id,
name: addonName,
name,
type,
description,
icon,
@ -106,7 +106,7 @@ export const AddonsPicker = props => {
},
index
) =>
addonName ? (
name ? (
<div key={id} className="addon-container">
<div className="rtamo-icon">
<img
@ -119,7 +119,7 @@ export const AddonsPicker = props => {
/>
</div>
<div className="addon-details">
<Localized text={addonName}>
<Localized text={name}>
<div className="addon-title" />
</Localized>
<Localized text={description}>

Просмотреть файл

@ -20,22 +20,20 @@ export function useLanguageSwitcher(
const languageMismatchScreenIndex = screens.findIndex(
({ id }) => id === "AW_LANGUAGE_MISMATCH"
);
const mismatchScreen = screens[languageMismatchScreenIndex];
const screen = screens[languageMismatchScreenIndex];
// Ensure fluent messages have the negotiatedLanguage args set, as they are rendered
// before the negotiatedLanguage is known. If the arg isn't present then Firefox will
// crash in development mode.
useEffect(() => {
if (mismatchScreen?.content?.languageSwitcher) {
for (const text of Object.values(
mismatchScreen.content.languageSwitcher
)) {
if (screen?.content?.languageSwitcher) {
for (const text of Object.values(screen.content.languageSwitcher)) {
if (text?.args && text.args.negotiatedLanguage === undefined) {
text.args.negotiatedLanguage = "";
}
}
}
}, [mismatchScreen]);
}, [screen]);
// If there is a mismatch, then Firefox can negotiate a better langpack to offer
// the user.
@ -99,11 +97,11 @@ export function useLanguageSwitcher(
}
setLangPackInstallPhase("installing");
window
.AWEnsureLangPackInstalled(negotiatedLanguage, mismatchScreen?.content)
.AWEnsureLangPackInstalled(negotiatedLanguage, screen?.content)
.then(
content => {
// Update screen content with strings that might have changed.
mismatchScreen.content = content;
screen.content = content;
setLangPackInstallPhase("installed");
},
error => {
@ -112,7 +110,7 @@ export function useLanguageSwitcher(
}
);
},
[negotiatedLanguage, mismatchScreen]
[negotiatedLanguage, screen]
);
const [languageFilteredScreens, setLanguageFilteredScreens] =
@ -122,7 +120,7 @@ export function useLanguageSwitcher(
// Remove the language screen if it exists (already removed for no live
// reload) and we either don't-need-to or can't switch.
if (
mismatchScreen &&
screen &&
(appAndSystemLocaleInfo?.matchType !== "language-mismatch" ||
negotiatedLanguage?.langPack === null)
) {
@ -142,7 +140,7 @@ export function useLanguageSwitcher(
appAndSystemLocaleInfo?.matchType,
languageMismatchScreenIndex,
negotiatedLanguage,
mismatchScreen,
screen,
screens,
setScreenIndex,
]

Просмотреть файл

@ -63,7 +63,6 @@ export const MultiStageAboutWelcome = props => {
.map(({ id }) => id?.split("_")[1]?.[0])
.join("");
// Send impression ping when respective screen first renders
// eslint-disable-next-line no-shadow
filteredScreens.forEach((screen, order) => {
if (index === order) {
const messageId = `${props.message_id}_${order}_${screen.id}_${screenInitials}`;
@ -220,60 +219,58 @@ export const MultiStageAboutWelcome = props => {
className={`outer-wrapper onboardingContainer proton transition-${transition}`}
style={props.backdrop ? { background: props.backdrop } : {}}
>
{screens.map((currentScreen, order) => {
const isFirstScreen = currentScreen === screens[0];
const isLastScreen = currentScreen === screens[screens.length - 1];
{screens.map((screen, order) => {
const isFirstScreen = screen === screens[0];
const isLastScreen = screen === screens[screens.length - 1];
const totalNumberOfScreens = screens.length;
const isSingleScreen = totalNumberOfScreens === 1;
const setActiveMultiSelect = valueOrFn =>
setActiveMultiSelects(prevState => ({
...prevState,
[currentScreen.id]:
[screen.id]:
typeof valueOrFn === "function"
? valueOrFn(prevState[currentScreen.id])
? valueOrFn(prevState[screen.id])
: valueOrFn,
}));
const setScreenMultiSelects = valueOrFn =>
setMultiSelects(prevState => ({
...prevState,
[currentScreen.id]:
[screen.id]:
typeof valueOrFn === "function"
? valueOrFn(prevState[currentScreen.id])
? valueOrFn(prevState[screen.id])
: valueOrFn,
}));
return index === order ? (
<WelcomeScreen
key={currentScreen.id + order}
id={currentScreen.id}
key={screen.id + order}
id={screen.id}
totalNumberOfScreens={totalNumberOfScreens}
isFirstScreen={isFirstScreen}
isLastScreen={isLastScreen}
isSingleScreen={isSingleScreen}
order={order}
previousOrder={previousOrder}
content={currentScreen.content}
content={screen.content}
navigate={handleTransition}
messageId={`${props.message_id}_${order}_${currentScreen.id}`}
messageId={`${props.message_id}_${order}_${screen.id}`}
UTMTerm={props.utm_term}
flowParams={flowParams}
activeTheme={activeTheme}
initialTheme={initialTheme}
setActiveTheme={setActiveTheme}
setInitialTheme={setInitialTheme}
screenMultiSelects={multiSelects[currentScreen.id]}
screenMultiSelects={multiSelects[screen.id]}
setScreenMultiSelects={setScreenMultiSelects}
activeMultiSelect={activeMultiSelects[currentScreen.id]}
activeMultiSelect={activeMultiSelects[screen.id]}
setActiveMultiSelect={setActiveMultiSelect}
autoAdvance={currentScreen.auto_advance}
autoAdvance={screen.auto_advance}
negotiatedLanguage={negotiatedLanguage}
langPackInstallPhase={langPackInstallPhase}
forceHideStepsIndicator={currentScreen.force_hide_steps_indicator}
forceHideStepsIndicator={screen.force_hide_steps_indicator}
ariaRole={props.ariaRole}
aboveButtonStepsIndicator={
currentScreen.above_button_steps_indicator
}
aboveButtonStepsIndicator={screen.above_button_steps_indicator}
installedAddons={installedAddons}
setInstalledAddons={setInstalledAddons}
/>

Просмотреть файл

@ -219,7 +219,6 @@ const MultiStageAboutWelcome = props => {
id
}) => id?.split("_")[1]?.[0]).join("");
// Send impression ping when respective screen first renders
// eslint-disable-next-line no-shadow
filteredScreens.forEach((screen, order) => {
if (index === order) {
const messageId = `${props.message_id}_${order}_${screen.id}_${screenInitials}`;
@ -363,47 +362,47 @@ const MultiStageAboutWelcome = props => {
style: props.backdrop ? {
background: props.backdrop
} : {}
}, screens.map((currentScreen, order) => {
const isFirstScreen = currentScreen === screens[0];
const isLastScreen = currentScreen === screens[screens.length - 1];
}, screens.map((screen, order) => {
const isFirstScreen = screen === screens[0];
const isLastScreen = screen === screens[screens.length - 1];
const totalNumberOfScreens = screens.length;
const isSingleScreen = totalNumberOfScreens === 1;
const setActiveMultiSelect = valueOrFn => setActiveMultiSelects(prevState => ({
...prevState,
[currentScreen.id]: typeof valueOrFn === "function" ? valueOrFn(prevState[currentScreen.id]) : valueOrFn
[screen.id]: typeof valueOrFn === "function" ? valueOrFn(prevState[screen.id]) : valueOrFn
}));
const setScreenMultiSelects = valueOrFn => setMultiSelects(prevState => ({
...prevState,
[currentScreen.id]: typeof valueOrFn === "function" ? valueOrFn(prevState[currentScreen.id]) : valueOrFn
[screen.id]: typeof valueOrFn === "function" ? valueOrFn(prevState[screen.id]) : valueOrFn
}));
return index === order ? /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement(WelcomeScreen, {
key: currentScreen.id + order,
id: currentScreen.id,
key: screen.id + order,
id: screen.id,
totalNumberOfScreens: totalNumberOfScreens,
isFirstScreen: isFirstScreen,
isLastScreen: isLastScreen,
isSingleScreen: isSingleScreen,
order: order,
previousOrder: previousOrder,
content: currentScreen.content,
content: screen.content,
navigate: handleTransition,
messageId: `${props.message_id}_${order}_${currentScreen.id}`,
messageId: `${props.message_id}_${order}_${screen.id}`,
UTMTerm: props.utm_term,
flowParams: flowParams,
activeTheme: activeTheme,
initialTheme: initialTheme,
setActiveTheme: setActiveTheme,
setInitialTheme: setInitialTheme,
screenMultiSelects: multiSelects[currentScreen.id],
screenMultiSelects: multiSelects[screen.id],
setScreenMultiSelects: setScreenMultiSelects,
activeMultiSelect: activeMultiSelects[currentScreen.id],
activeMultiSelect: activeMultiSelects[screen.id],
setActiveMultiSelect: setActiveMultiSelect,
autoAdvance: currentScreen.auto_advance,
autoAdvance: screen.auto_advance,
negotiatedLanguage: negotiatedLanguage,
langPackInstallPhase: langPackInstallPhase,
forceHideStepsIndicator: currentScreen.force_hide_steps_indicator,
forceHideStepsIndicator: screen.force_hide_steps_indicator,
ariaRole: props.ariaRole,
aboveButtonStepsIndicator: currentScreen.above_button_steps_indicator,
aboveButtonStepsIndicator: screen.above_button_steps_indicator,
installedAddons: installedAddons,
setInstalledAddons: setInstalledAddons
}) : null;
@ -1559,20 +1558,20 @@ function useLanguageSwitcher(appAndSystemLocaleInfo, screens, screenIndex, setSc
const languageMismatchScreenIndex = screens.findIndex(({
id
}) => id === "AW_LANGUAGE_MISMATCH");
const mismatchScreen = screens[languageMismatchScreenIndex];
const screen = screens[languageMismatchScreenIndex];
// Ensure fluent messages have the negotiatedLanguage args set, as they are rendered
// before the negotiatedLanguage is known. If the arg isn't present then Firefox will
// crash in development mode.
(0,react__WEBPACK_IMPORTED_MODULE_0__.useEffect)(() => {
if (mismatchScreen?.content?.languageSwitcher) {
for (const text of Object.values(mismatchScreen.content.languageSwitcher)) {
if (screen?.content?.languageSwitcher) {
for (const text of Object.values(screen.content.languageSwitcher)) {
if (text?.args && text.args.negotiatedLanguage === undefined) {
text.args.negotiatedLanguage = "";
}
}
}
}, [mismatchScreen]);
}, [screen]);
// If there is a mismatch, then Firefox can negotiate a better langpack to offer
// the user.
@ -1625,20 +1624,20 @@ function useLanguageSwitcher(appAndSystemLocaleInfo, screens, screenIndex, setSc
return;
}
setLangPackInstallPhase("installing");
window.AWEnsureLangPackInstalled(negotiatedLanguage, mismatchScreen?.content).then(content => {
window.AWEnsureLangPackInstalled(negotiatedLanguage, screen?.content).then(content => {
// Update screen content with strings that might have changed.
mismatchScreen.content = content;
screen.content = content;
setLangPackInstallPhase("installed");
}, error => {
console.error(error);
setLangPackInstallPhase("installation-error");
});
}, [negotiatedLanguage, mismatchScreen]);
}, [negotiatedLanguage, screen]);
const [languageFilteredScreens, setLanguageFilteredScreens] = (0,react__WEBPACK_IMPORTED_MODULE_0__.useState)(screens);
(0,react__WEBPACK_IMPORTED_MODULE_0__.useEffect)(function filterScreen() {
// Remove the language screen if it exists (already removed for no live
// reload) and we either don't-need-to or can't switch.
if (mismatchScreen && (appAndSystemLocaleInfo?.matchType !== "language-mismatch" || negotiatedLanguage?.langPack === null)) {
if (screen && (appAndSystemLocaleInfo?.matchType !== "language-mismatch" || negotiatedLanguage?.langPack === null)) {
if (screenIndex > languageMismatchScreenIndex) {
setScreenIndex(screenIndex - 1);
}
@ -1649,7 +1648,7 @@ function useLanguageSwitcher(appAndSystemLocaleInfo, screens, screenIndex, setSc
},
// Removing screenIndex as a dependency as it's causing infinite re-renders (1873019)
// eslint-disable-next-line react-hooks/exhaustive-deps
[appAndSystemLocaleInfo?.matchType, languageMismatchScreenIndex, negotiatedLanguage, mismatchScreen, screens, setScreenIndex]);
[appAndSystemLocaleInfo?.matchType, languageMismatchScreenIndex, negotiatedLanguage, screen, screens, setScreenIndex]);
return {
negotiatedLanguage,
langPackInstallPhase,
@ -2290,13 +2289,13 @@ const AddonsPicker = props => {
className: "addons-picker-container"
}, content.tiles.data.map(({
id,
name: addonName,
name,
type,
description,
icon,
install_label,
install_complete_label
}, index) => addonName ? /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement("div", {
}, index) => name ? /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement("div", {
key: id,
className: "addon-container"
}, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement("div", {
@ -2309,7 +2308,7 @@ const AddonsPicker = props => {
})), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement("div", {
className: "addon-details"
}, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement(_MSLocalized__WEBPACK_IMPORTED_MODULE_2__.Localized, {
text: addonName
text: name
}, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement("div", {
className: "addon-title"
})), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement(_MSLocalized__WEBPACK_IMPORTED_MODULE_2__.Localized, {

Просмотреть файл

@ -277,7 +277,7 @@ describe("Multistage AboutWelcome module", () => {
});
describe("random colorways", () => {
let checkSelection;
let test;
beforeEach(() => {
COLORWAY_SCREEN_PROPS.handleAction = sandbox.stub();
sandbox.stub(window, "matchMedia");
@ -287,7 +287,7 @@ describe("Multistage AboutWelcome module", () => {
fn();
}
});
checkSelection = () => {
test = () => {
shallow(<Colorways {...COLORWAY_SCREEN_PROPS} />);
return COLORWAY_SCREEN_PROPS.handleAction.firstCall.firstArg
.currentTarget;
@ -295,7 +295,7 @@ describe("Multistage AboutWelcome module", () => {
});
it("should select a random colorway", () => {
const { value } = checkSelection();
const { value } = test();
assert.strictEqual(value, "abstract-soft");
assert.calledThrice(React.useEffect);
@ -306,7 +306,7 @@ describe("Multistage AboutWelcome module", () => {
window.matchMedia.returns({ matches: false });
COLORWAY_SCREEN_PROPS.content.tiles.darkVariation = 1;
const { value } = checkSelection();
const { value } = test();
assert.strictEqual(value, "abstract-soft");
assert.calledThrice(React.useEffect);
@ -317,7 +317,7 @@ describe("Multistage AboutWelcome module", () => {
window.matchMedia.returns({ matches: true });
COLORWAY_SCREEN_PROPS.content.tiles.darkVariation = 1;
const { value } = checkSelection();
const { value } = test();
assert.strictEqual(value, "abstract-bold");
assert.calledThrice(React.useEffect);

Просмотреть файл

@ -480,7 +480,6 @@ describe("MultiStageAboutWelcomeProton module", () => {
let data = await getData();
if (evalFalseScreenIds?.length) {
// eslint-disable-next-line no-shadow
data.screens.forEach(async screen => {
if (evalFalseScreenIds.includes(screen.id)) {
screen.targeting = false;

Просмотреть файл

@ -217,16 +217,16 @@ describe("MultiStageAboutWelcome module", () => {
describe("WelcomeScreen component", () => {
describe("easy setup screen", () => {
const easySetupScreen = AboutWelcomeDefaults.getDefaults().screens.find(
const screen = AboutWelcomeDefaults.getDefaults().screens.find(
s => s.id === "AW_EASY_SETUP_NEEDS_DEFAULT_AND_PIN"
);
let EASY_SETUP_SCREEN_PROPS;
beforeEach(() => {
EASY_SETUP_SCREEN_PROPS = {
id: easySetupScreen.id,
content: easySetupScreen.content,
messageId: `${DEFAULT_PROPS.message_id}_${easySetupScreen.id}`,
id: screen.id,
content: screen.content,
messageId: `${DEFAULT_PROPS.message_id}_${screen.id}`,
UTMTerm: DEFAULT_PROPS.utm_term,
flowParams: null,
totalNumberOfScreens: 1,

Просмотреть файл

@ -117,6 +117,7 @@ module.exports = {
"no-prototype-builtins": "error",
"no-return-assign": ["error", "except-parens"],
"no-script-url": "error",
"no-shadow": "error",
"no-template-curly-in-string": "error",
"no-undef-init": "error",
"no-unmodified-loop-condition": "error",

Просмотреть файл

@ -238,7 +238,7 @@ export class ASRouterAdminInner extends React.PureComponent {
}
onChangeTargetingParameters(event) {
const { name: eventName } = event.target;
const { name } = event.target;
const { value } = event.target;
let targetingParametersError = null;
@ -246,14 +246,14 @@ export class ASRouterAdminInner extends React.PureComponent {
JSON.parse(value);
event.target.classList.remove("errorState");
} catch (e) {
console.error(`Error parsing value of parameter ${eventName}`);
console.error(`Error parsing value of parameter ${name}`);
event.target.classList.add("errorState");
targetingParametersError = { id: eventName };
targetingParametersError = { id: name };
}
this.setState(({ stringTargetingParameters }) => {
const updatedParameters = { ...stringTargetingParameters };
updatedParameters[eventName] = value;
updatedParameters[name] = value;
return {
copiedToClipboard: false,
@ -692,7 +692,6 @@ export class ASRouterAdminInner extends React.PureComponent {
{this.state.messages
.map(message => message.template)
.filter(
// eslint-disable-next-line no-shadow
(value, index, self) => self.indexOf(value) === index
)
.map(template => (
@ -1225,11 +1224,11 @@ export class ASRouterAdminInner extends React.PureComponent {
}
onChangeAttributionParameters(event) {
const { eventName, value } = event.target;
const { name, value } = event.target;
this.setState(({ attributionParameters }) => {
const updatedParameters = { ...attributionParameters };
updatedParameters[eventName] = value;
updatedParameters[name] = value;
return { attributionParameters: updatedParameters };
});

Просмотреть файл

@ -4,4 +4,8 @@ module.exports = {
env: {
webextensions: true,
},
rules: {
"no-shadow": 0,
},
};

Просмотреть файл

@ -12,6 +12,7 @@ module.exports = {
"no-extend-native": "error",
"no-multi-str": "error",
"no-return-assign": "error",
"no-shadow": "error",
"no-unused-vars": ["error", { argsIgnorePattern: "^_", vars: "all" }],
strict: ["error", "global"],
yoda: "error",

Просмотреть файл

@ -420,20 +420,18 @@ export class ChromeProfileMigrator extends MigratorBase {
return;
}
let loginCrypto;
let crypto;
try {
if (AppConstants.platform == "win") {
let { ChromeWindowsLoginCrypto } = ChromeUtils.importESModule(
"resource:///modules/ChromeWindowsLoginCrypto.sys.mjs"
);
loginCrypto = new ChromeWindowsLoginCrypto(
_chromeUserDataPathSuffix
);
crypto = new ChromeWindowsLoginCrypto(_chromeUserDataPathSuffix);
} else if (AppConstants.platform == "macosx") {
let { ChromeMacOSLoginCrypto } = ChromeUtils.importESModule(
"resource:///modules/ChromeMacOSLoginCrypto.sys.mjs"
);
loginCrypto = new ChromeMacOSLoginCrypto(
crypto = new ChromeMacOSLoginCrypto(
_keychainServiceName,
_keychainAccountName,
_keychainMockPassphrase
@ -464,7 +462,7 @@ export class ChromeProfileMigrator extends MigratorBase {
}
let loginInfo = {
username: row.getResultByName("username_value"),
password: await loginCrypto.decryptData(
password: await crypto.decryptData(
row.getResultByName("password_value"),
null
),
@ -580,20 +578,18 @@ export class ChromeProfileMigrator extends MigratorBase {
type: MigrationUtils.resourceTypes.PAYMENT_METHODS,
async migrate(aCallback) {
let loginCrypto;
let crypto;
try {
if (AppConstants.platform == "win") {
let { ChromeWindowsLoginCrypto } = ChromeUtils.importESModule(
"resource:///modules/ChromeWindowsLoginCrypto.sys.mjs"
);
loginCrypto = new ChromeWindowsLoginCrypto(
_chromeUserDataPathSuffix
);
crypto = new ChromeWindowsLoginCrypto(_chromeUserDataPathSuffix);
} else if (AppConstants.platform == "macosx") {
let { ChromeMacOSLoginCrypto } = ChromeUtils.importESModule(
"resource:///modules/ChromeMacOSLoginCrypto.sys.mjs"
);
loginCrypto = new ChromeMacOSLoginCrypto(
crypto = new ChromeMacOSLoginCrypto(
_keychainServiceName,
_keychainAccountName,
_keychainMockPassphrase
@ -613,7 +609,7 @@ export class ChromeProfileMigrator extends MigratorBase {
for (let row of rows) {
cards.push({
"cc-name": row.getResultByName("name_on_card"),
"cc-number": await loginCrypto.decryptData(
"cc-number": await crypto.decryptData(
row.getResultByName("card_number_encrypted"),
null
),

Просмотреть файл

@ -10,7 +10,6 @@ import { PlacesUtils } from "resource://gre/modules/PlacesUtils.sys.mjs";
// Resources
// eslint-disable-next-line no-shadow
function History() {}
History.prototype = {

Просмотреть файл

@ -141,6 +141,7 @@ module.exports = {
"no-prototype-builtins": "error",
"no-return-assign": ["error", "except-parens"],
"no-script-url": "error",
"no-shadow": "error",
"no-template-curly-in-string": "error",
"no-undef-init": "error",
"no-unmodified-loop-condition": "error",

Просмотреть файл

@ -243,22 +243,22 @@ export class BaseContent extends React.PureComponent {
return null;
}
const { name: authorDetails, webpage } = selected.attribution;
if (activeWallpaper && wallpaperList && authorDetails.url) {
const { name, webpage } = selected.attribution;
if (activeWallpaper && wallpaperList && name.url) {
return (
<p
className={`wallpaper-attribution`}
key={authorDetails.string}
key={name.string}
data-l10n-id="newtab-wallpaper-attribution"
data-l10n-args={JSON.stringify({
author_string: authorDetails.string,
author_url: authorDetails.url,
author_string: name.string,
author_url: name.url,
webpage_string: webpage.string,
webpage_url: webpage.url,
})}
>
<a data-l10n-name="name-link" href={authorDetails.url}>
{authorDetails.string}
<a data-l10n-name="name-link" href={name.url}>
{name.string}
</a>
<a data-l10n-name="webpage-link" href={webpage.url}>
{webpage.string}

Просмотреть файл

@ -95,16 +95,16 @@ export class _ContextMenuItem extends React.PureComponent {
// This selects the correct node based on the key pressed
focusSibling(target, key) {
const { parentNode } = target;
const parent = target.parentNode;
const closestSiblingSelector =
key === "ArrowUp" ? "previousSibling" : "nextSibling";
if (!parentNode[closestSiblingSelector]) {
if (!parent[closestSiblingSelector]) {
return;
}
if (parentNode[closestSiblingSelector].firstElementChild) {
parentNode[closestSiblingSelector].firstElementChild.focus();
if (parent[closestSiblingSelector].firstElementChild) {
parent[closestSiblingSelector].firstElementChild.focus();
} else {
parentNode[closestSiblingSelector][
parent[closestSiblingSelector][
closestSiblingSelector
].firstElementChild.focus();
}

Просмотреть файл

@ -18,12 +18,12 @@ export class ContentSection extends React.PureComponent {
this.pocketDrawerRef = React.createRef();
}
inputUserEvent(eventSource, eventValue) {
inputUserEvent(eventSource, status) {
this.props.dispatch(
ac.UserEvent({
event: "PREF_CHANGED",
source: eventSource,
value: { status: eventValue, menu_source: "CUSTOMIZE_MENU" },
value: { status, menu_source: "CUSTOMIZE_MENU" },
})
);
}

Просмотреть файл

@ -5,7 +5,6 @@
import { ContentSection } from "content-src/components/CustomizeMenu/ContentSection/ContentSection";
import { connect } from "react-redux";
import React from "react";
// eslint-disable-next-line no-shadow
import { CSSTransition } from "react-transition-group";
export class _CustomizeMenu extends React.PureComponent {

Просмотреть файл

@ -137,11 +137,11 @@ export class DiscoveryStreamAdminUI extends React.PureComponent {
};
}
setConfigValue(configName, configValue) {
setConfigValue(name, value) {
this.props.dispatch(
ac.OnlyToMain({
type: at.DISCOVERY_STREAM_CONFIG_SET_VALUE,
data: { name: configName, value: configValue },
data: { name, value },
})
);
}

Просмотреть файл

@ -149,7 +149,6 @@ export function OnboardingExperience({ dispatch, windowObj = globalThis }) {
);
}
// eslint-disable-next-line no-shadow
export function IntersectionObserver({
children,
windowObj = window,

Просмотреть файл

@ -4,7 +4,6 @@
import { cardContextTypes } from "../../Card/types.mjs";
import { SponsoredContentHighlight } from "../FeatureHighlight/SponsoredContentHighlight";
// eslint-disable-next-line no-shadow
import { CSSTransition, TransitionGroup } from "react-transition-group";
import { FluentOrText } from "../../FluentOrText/FluentOrText.jsx";
import React from "react";

Просмотреть файл

@ -30,14 +30,14 @@ export class Topic extends React.PureComponent {
}
render() {
const { url, name: topicName } = this.props;
const { url, name } = this.props;
return (
<SafeAnchor
onLinkClick={this.onLinkClick}
className={this.props.className}
url={url}
>
{topicName}
{name}
</SafeAnchor>
);
}

Просмотреть файл

@ -5,7 +5,6 @@
import React, { useEffect, useCallback, useRef } from "react";
function ModalOverlayWrapper({
// eslint-disable-next-line no-shadow
document = globalThis.document,
unstyled,
innerClassName,

Просмотреть файл

@ -68,10 +68,10 @@ export class SearchShortcutsForm extends React.PureComponent {
handleChange(event) {
const { target } = event;
const { name: targetName, checked } = target;
const { name, checked } = target;
this.setState(prevState => {
const shortcuts = prevState.shortcuts.slice();
let shortcut = shortcuts.find(({ keyword }) => keyword === targetName);
let shortcut = shortcuts.find(({ keyword }) => keyword === name);
shortcut.isSelected = checked;
return { shortcuts };
});

Просмотреть файл

@ -6,11 +6,11 @@ import React from "react";
export class Topic extends React.PureComponent {
render() {
const { url, name: topicName } = this.props;
const { url, name } = this.props;
return (
<li>
<a key={topicName} href={url}>
{topicName}
<a key={name} href={url}>
{name}
</a>
</li>
);

Просмотреть файл

@ -5,7 +5,6 @@
import React from "react";
import { connect } from "react-redux";
import { actionCreators as ac, actionTypes as at } from "common/Actions.mjs";
// eslint-disable-next-line no-shadow
import { CSSTransition } from "react-transition-group";
export class _WallpaperCategories extends React.PureComponent {

Просмотреть файл

@ -108,10 +108,10 @@ function LocationSearch({ outerClassName }) {
/>
<button className="close-icon" onClick={handleCloseSearch} />
<datalist id="merino-location-list">
{(suggestedLocations || []).map(merinoLcation => (
<option value={merinoLcation.key} key={merinoLcation.key}>
{merinoLcation.localized_name},{" "}
{merinoLcation.administrative_area.localized_name}
{(suggestedLocations || []).map(location => (
<option value={location.key} key={location.key}>
{location.localized_name},{" "}
{location.administrative_area.localized_name}
</option>
))}
</datalist>

Просмотреть файл

@ -694,12 +694,12 @@ class DiscoveryStreamAdminUI extends (external_React_default()).PureComponent {
weatherQuery: ""
};
}
setConfigValue(configName, configValue) {
setConfigValue(name, value) {
this.props.dispatch(actionCreators.OnlyToMain({
type: actionTypes.DISCOVERY_STREAM_CONFIG_SET_VALUE,
data: {
name: configName,
value: configValue
name,
value
}
}));
}
@ -1401,17 +1401,15 @@ class _ContextMenuItem extends (external_React_default()).PureComponent {
// This selects the correct node based on the key pressed
focusSibling(target, key) {
const {
parentNode
} = target;
const parent = target.parentNode;
const closestSiblingSelector = key === "ArrowUp" ? "previousSibling" : "nextSibling";
if (!parentNode[closestSiblingSelector]) {
if (!parent[closestSiblingSelector]) {
return;
}
if (parentNode[closestSiblingSelector].firstElementChild) {
parentNode[closestSiblingSelector].firstElementChild.focus();
if (parent[closestSiblingSelector].firstElementChild) {
parent[closestSiblingSelector].firstElementChild.focus();
} else {
parentNode[closestSiblingSelector][closestSiblingSelector].firstElementChild.focus();
parent[closestSiblingSelector][closestSiblingSelector].firstElementChild.focus();
}
}
onKeyDown(event) {
@ -2595,7 +2593,6 @@ class FluentOrText extends (external_React_default()).PureComponent {
// eslint-disable-next-line no-shadow
@ -3766,8 +3763,6 @@ function OnboardingExperience({
className: "ds-onboarding-graphic"
})))));
}
// eslint-disable-next-line no-shadow
function CardGrid_IntersectionObserver({
children,
windowObj = window,
@ -4527,7 +4522,6 @@ class DSMessage extends (external_React_default()).PureComponent {
function ModalOverlayWrapper({
// eslint-disable-next-line no-shadow
document = globalThis.document,
unstyled,
innerClassName,
@ -5609,12 +5603,12 @@ class Topic extends (external_React_default()).PureComponent {
render() {
const {
url,
name: topicName
name
} = this.props;
return /*#__PURE__*/external_React_default().createElement("li", null, /*#__PURE__*/external_React_default().createElement("a", {
key: topicName,
key: name,
href: url
}, topicName));
}, name));
}
}
class Topics extends (external_React_default()).PureComponent {
@ -5705,14 +5699,14 @@ class SearchShortcutsForm extends (external_React_default()).PureComponent {
target
} = event;
const {
name: targetName,
name,
checked
} = target;
this.setState(prevState => {
const shortcuts = prevState.shortcuts.slice();
let shortcut = shortcuts.find(({
keyword
}) => keyword === targetName);
}) => keyword === name);
shortcut.isSelected = checked;
return {
shortcuts
@ -8664,13 +8658,13 @@ class Navigation_Topic extends (external_React_default()).PureComponent {
render() {
const {
url,
name: topicName
name
} = this.props;
return /*#__PURE__*/external_React_default().createElement(SafeAnchor, {
onLinkClick: this.onLinkClick,
className: this.props.className,
url: url
}, topicName);
}, name);
}
}
class Navigation extends (external_React_default()).PureComponent {
@ -9482,7 +9476,6 @@ const WallpapersSection = (0,external_ReactRedux_namespaceObject.connect)(state
// eslint-disable-next-line no-shadow
class _WallpaperCategories extends (external_React_default()).PureComponent {
constructor(props) {
@ -9686,12 +9679,12 @@ class ContentSection extends (external_React_default()).PureComponent {
this.topSitesDrawerRef = /*#__PURE__*/external_React_default().createRef();
this.pocketDrawerRef = /*#__PURE__*/external_React_default().createRef();
}
inputUserEvent(eventSource, eventValue) {
inputUserEvent(eventSource, status) {
this.props.dispatch(actionCreators.UserEvent({
event: "PREF_CHANGED",
source: eventSource,
value: {
status: eventValue,
status,
menu_source: "CUSTOMIZE_MENU"
}
}));
@ -9944,7 +9937,6 @@ class ContentSection extends (external_React_default()).PureComponent {
// eslint-disable-next-line no-shadow
class _CustomizeMenu extends (external_React_default()).PureComponent {
constructor(props) {
@ -10325,10 +10317,10 @@ function LocationSearch({
onClick: handleCloseSearch
}), /*#__PURE__*/external_React_default().createElement("datalist", {
id: "merino-location-list"
}, (suggestedLocations || []).map(merinoLcation => /*#__PURE__*/external_React_default().createElement("option", {
value: merinoLcation.key,
key: merinoLcation.key
}, merinoLcation.localized_name, ",", " ", merinoLcation.administrative_area.localized_name)))));
}, (suggestedLocations || []).map(location => /*#__PURE__*/external_React_default().createElement("option", {
value: location.key,
key: location.key
}, location.localized_name, ",", " ", location.administrative_area.localized_name)))));
}
;// CONCATENATED MODULE: ./content-src/components/Weather/Weather.jsx
@ -11277,24 +11269,24 @@ class BaseContent extends (external_React_default()).PureComponent {
return null;
}
const {
name: authorDetails,
name,
webpage
} = selected.attribution;
if (activeWallpaper && wallpaperList && authorDetails.url) {
if (activeWallpaper && wallpaperList && name.url) {
return /*#__PURE__*/external_React_default().createElement("p", {
className: `wallpaper-attribution`,
key: authorDetails.string,
key: name.string,
"data-l10n-id": "newtab-wallpaper-attribution",
"data-l10n-args": JSON.stringify({
author_string: authorDetails.string,
author_url: authorDetails.url,
author_string: name.string,
author_url: name.url,
webpage_string: webpage.string,
webpage_url: webpage.url
})
}, /*#__PURE__*/external_React_default().createElement("a", {
"data-l10n-name": "name-link",
href: authorDetails.url
}, authorDetails.string), /*#__PURE__*/external_React_default().createElement("a", {
href: name.url
}, name.string), /*#__PURE__*/external_React_default().createElement("a", {
"data-l10n-name": "webpage-link",
href: webpage.url
}, webpage.string));

Просмотреть файл

@ -85,13 +85,13 @@ let Agent = {
this._templates = {};
for (let [templateName, path] of templateResources) {
for (let [name, path] of templateResources) {
const xhr = new XMLHttpRequest();
// Using a synchronous XHR in a worker is fine.
xhr.open("GET", path, false);
xhr.responseType = "text";
xhr.send(null);
this._templates[templateName] = xhr.responseText;
this._templates[name] = xhr.responseText;
}
return this._templates;

Просмотреть файл

@ -94,7 +94,6 @@ describe("<Card>", () => {
wrapper
.find(".context-menu-button")
.simulate("click", { preventDefault: () => {} });
// eslint-disable-next-line no-shadow
const { dispatch, source, onUpdate, site, options, index } = wrapper
.find(LinkMenu)
.props();
@ -113,17 +112,16 @@ describe("<Card>", () => {
wrapper
.find(".context-menu-button")
.simulate("click", { preventDefault: () => {} });
// eslint-disable-next-line no-shadow
const { options } = wrapper.find(LinkMenu).props();
assert.equal(options, link.contextMenuOptions);
});
it("should have a context based on type", () => {
wrapper = shallow(<Card {...DEFAULT_PROPS} />);
const cardContext = wrapper.find(".card-context");
const context = wrapper.find(".card-context");
const { icon, fluentID } = cardContextTypes[DEFAULT_PROPS.link.type];
assert.isTrue(cardContext.childAt(0).hasClass(`icon-${icon}`));
assert.isTrue(cardContext.childAt(1).hasClass("card-context-label"));
assert.equal(cardContext.childAt(1).prop("data-l10n-id"), fluentID);
assert.isTrue(context.childAt(0).hasClass(`icon-${icon}`));
assert.isTrue(context.childAt(1).hasClass("card-context-label"));
assert.equal(context.childAt(1).prop("data-l10n-id"), fluentID);
});
it("should support setting custom context", () => {
const linkWithCustomContext = {
@ -137,16 +135,16 @@ describe("<Card>", () => {
{...Object.assign({}, DEFAULT_PROPS, { link: linkWithCustomContext })}
/>
);
const cardContext = wrapper.find(".card-context");
const context = wrapper.find(".card-context");
const { icon } = cardContextTypes[DEFAULT_PROPS.link.type];
assert.isFalse(cardContext.childAt(0).hasClass(`icon-${icon}`));
assert.isFalse(context.childAt(0).hasClass(`icon-${icon}`));
assert.equal(
cardContext.childAt(0).props().style.backgroundImage,
context.childAt(0).props().style.backgroundImage,
"url('icon-url')"
);
assert.isTrue(cardContext.childAt(1).hasClass("card-context-label"));
assert.equal(cardContext.childAt(1).text(), linkWithCustomContext.context);
assert.isTrue(context.childAt(1).hasClass("card-context-label"));
assert.equal(context.childAt(1).text(), linkWithCustomContext.context);
});
it("should parse args for fluent correctly", () => {
const title = '"fluent"';

Просмотреть файл

@ -22,14 +22,14 @@ const DEFAULT_PROPS = {
describe("CollapsibleSection", () => {
let wrapper;
function testSetup(props = {}) {
function setup(props = {}) {
const customProps = Object.assign({}, DEFAULT_PROPS, props);
wrapper = mount(
<CollapsibleSection {...customProps}>foo</CollapsibleSection>
);
}
beforeEach(() => testSetup());
beforeEach(() => setup());
it("should render the component", () => {
assert.ok(wrapper.exists());
@ -46,7 +46,7 @@ describe("CollapsibleSection", () => {
let dispatch;
beforeEach(() => {
dispatch = sinon.stub();
testSetup({ collapsed: undefined, dispatch });
setup({ collapsed: undefined, dispatch });
});
it("should render the section uncollapsed", () => {
assert.isFalse(

Просмотреть файл

@ -28,7 +28,6 @@ const FakeMenu = props => {
};
describe("<ContextMenuButton>", () => {
// eslint-disable-next-line no-shadow
function mountWithProps(options) {
const store = createStore(combineReducers(reducers), INITIAL_STATE);
return mount(
@ -90,7 +89,6 @@ describe("<ContextMenuButton>", () => {
assert.equal(wrapper.find(ContextMenu).prop("keyboardAccess"), true);
});
it("should call focusFirst when keyboardAccess is true", () => {
// eslint-disable-next-line no-shadow
const options = [{ label: "item1", first: true }];
const wrapper = mountWithProps(options);
const focusFirst = sandbox.spy(_ContextMenuItem.prototype, "focusFirst");
@ -112,7 +110,6 @@ describe("<ContextMenu>", () => {
}
it("should render all the options provided", () => {
// eslint-disable-next-line no-shadow
const options = [
{ label: "item1" },
{ type: "separator" },
@ -124,7 +121,6 @@ describe("<ContextMenu>", () => {
assert.lengthOf(wrapper.find(".context-menu-list").children(), 3);
});
it("should not add a link for a separator", () => {
// eslint-disable-next-line no-shadow
const options = [{ label: "item1" }, { type: "separator" }];
const wrapper = shallow(
<ContextMenu {...DEFAULT_PROPS} options={options} />
@ -132,7 +128,6 @@ describe("<ContextMenu>", () => {
assert.lengthOf(wrapper.find(".separator"), 1);
});
it("should add a link for all types that are not separators", () => {
// eslint-disable-next-line no-shadow
const options = [{ label: "item1" }, { type: "separator" }];
const wrapper = shallow(
<ContextMenu {...DEFAULT_PROPS} options={options} />
@ -176,7 +171,6 @@ describe("<ContextMenu>", () => {
assert.lengthOf(wrapper.find(".context-menu-item a.disabled"), 0);
});
it("should add disabled className to any disabled options", () => {
// eslint-disable-next-line no-shadow
const options = [
{ label: "item1", icon: "icon1", disabled: true },
{ type: "separator" },
@ -186,7 +180,6 @@ describe("<ContextMenu>", () => {
assert.lengthOf(wrapper.find(".context-menu-item button.disabled"), 1);
});
it("should have the context-menu-item class", () => {
// eslint-disable-next-line no-shadow
const options = [{ label: "item1", icon: "icon1" }];
const props = Object.assign({}, DEFAULT_PROPS, { options });
const wrapper = mountWithProps(props);

Просмотреть файл

@ -163,14 +163,14 @@ describe("DiscoveryStreamAdmin", () => {
);
});
it("should fire setConfigValue with DISCOVERY_STREAM_CONFIG_SET_VALUE", () => {
const configName = "name";
const configValue = "value";
wrapper.instance().setConfigValue(configName, configValue);
const name = "name";
const value = "value";
wrapper.instance().setConfigValue(name, value);
assert.calledWith(
dispatch,
ac.OnlyToMain({
type: at.DISCOVERY_STREAM_CONFIG_SET_VALUE,
data: { name: configName, value: configValue },
data: { name, value },
})
);
});

Просмотреть файл

@ -1,6 +1,5 @@
import {
_CardGrid as CardGrid,
// eslint-disable-next-line no-shadow
IntersectionObserver,
RecentSavesContainer,
OnboardingExperience,

Просмотреть файл

@ -125,7 +125,6 @@ describe("<DSCard>", () => {
});
it("should render Sponsored Context for a spoc element", () => {
// eslint-disable-next-line no-shadow
const context = "Sponsored by Foo";
wrapper = mount(
<DSCard context_type="bookmark" context={context} {...DEFAULT_PROPS} />

Просмотреть файл

@ -13,7 +13,6 @@ describe("<DSContextFooter>", () => {
let sandbox;
const bookmarkBadge = "bookmark";
const removeBookmarkBadge = "removedBookmark";
// eslint-disable-next-line no-shadow
const context = "Sponsored by Babel";
const sponsored_by_override = "Sponsored override";
const engagement = "Popular";

Просмотреть файл

@ -310,7 +310,6 @@ describe("<ImpressionStats>", () => {
);
});
it("should unobserve the intersection observer when the wrapper is removed", () => {
// eslint-disable-next-line no-shadow
const IntersectionObserver =
buildIntersectionObserver(ZeroIntersectEntries);
const spy = sinon.spy(IntersectionObserver.prototype, "unobserve");

Просмотреть файл

@ -1,4 +1,3 @@
/* eslint-disable no-shadow */
import { ContextMenu } from "content-src/components/ContextMenu/ContextMenu";
import { _LinkMenu as LinkMenu } from "content-src/components/LinkMenu/LinkMenu";
import React from "react";

Просмотреть файл

@ -559,7 +559,6 @@ describe("<TopSiteLink>", () => {
});
it("should prevent dragging with sponsored_position from dragstart", () => {
const preventDefault = sinon.stub();
// eslint-disable-next-line no-shadow
const blur = sinon.stub();
wrapper.setProps({ link: { sponsored_position: 1 } });
wrapper.instance().onDragEvent({
@ -573,7 +572,6 @@ describe("<TopSiteLink>", () => {
});
it("should prevent dragging with link.shim from dragstart", () => {
const preventDefault = sinon.stub();
// eslint-disable-next-line no-shadow
const blur = sinon.stub();
wrapper.setProps({ link: { type: "SPOC" } });
wrapper.instance().onDragEvent({
@ -956,7 +954,7 @@ describe("<TopSiteForm>", () => {
let wrapper;
let sandbox;
function testSetup(props = {}) {
function setup(props = {}) {
sandbox = sinon.createSandbox();
const customProps = Object.assign(
{},
@ -967,7 +965,7 @@ describe("<TopSiteForm>", () => {
}
describe("validateForm", () => {
beforeEach(() => testSetup({ site: { url: "http://foo" } }));
beforeEach(() => setup({ site: { url: "http://foo" } }));
it("should return true for a correct URL", () => {
wrapper.setState({ url: "foo" });
@ -1009,7 +1007,7 @@ describe("<TopSiteForm>", () => {
describe("#previewButton", () => {
beforeEach(() =>
testSetup({
setup({
site: { customScreenshotURL: "http://foo.com" },
previewResponse: null,
})
@ -1037,7 +1035,7 @@ describe("<TopSiteForm>", () => {
describe("preview request", () => {
beforeEach(() => {
testSetup({
setup({
site: { customScreenshotURL: "http://foo.com", url: "http://foo.com" },
previewResponse: null,
});
@ -1075,7 +1073,7 @@ describe("<TopSiteForm>", () => {
describe("#TopSiteLink", () => {
beforeEach(() => {
testSetup();
setup();
});
it("should display a TopSiteLink preview", () => {
@ -1115,7 +1113,7 @@ describe("<TopSiteForm>", () => {
});
describe("#addMode", () => {
beforeEach(() => testSetup());
beforeEach(() => setup());
it("should render the component", () => {
assert.ok(wrapper.find(TopSiteForm).exists());
@ -1206,7 +1204,7 @@ describe("<TopSiteForm>", () => {
describe("edit existing Topsite", () => {
beforeEach(() =>
testSetup({
setup({
site: {
url: "https://foo.bar",
label: "baz",
@ -1352,7 +1350,7 @@ describe("<TopSiteForm>", () => {
});
describe("#previewMode", () => {
beforeEach(() => testSetup({ previewResponse: null }));
beforeEach(() => setup({ previewResponse: null }));
it("should transition from save to preview", () => {
wrapper.setProps({
@ -1404,7 +1402,7 @@ describe("<TopSiteForm>", () => {
describe("#validateUrl", () => {
it("should properly validate URLs", () => {
testSetup();
setup();
assert.ok(wrapper.instance().validateUrl("mozilla.org"));
assert.ok(wrapper.instance().validateUrl("https://mozilla.org"));
assert.ok(wrapper.instance().validateUrl("http://mozilla.org"));
@ -1424,7 +1422,7 @@ describe("<TopSiteForm>", () => {
describe("#cleanUrl", () => {
it("should properly prepend http:// to URLs when required", () => {
testSetup();
setup();
assert.equal(
"http://mozilla.org",
wrapper.instance().cleanUrl("mozilla.org")

Просмотреть файл

@ -135,7 +135,6 @@ describe("<TopSiteImpressionWrapper>", () => {
);
});
it("should unobserve the intersection observer when the wrapper is removed", () => {
// eslint-disable-next-line no-shadow
const IntersectionObserver =
buildIntersectionObserver(ZeroIntersectEntries);
const spy = sinon.spy(IntersectionObserver.prototype, "unobserve");

Просмотреть файл

@ -20,7 +20,6 @@ function Home(props) {
utmContent,
} = props;
// eslint-disable-next-line no-shadow
const [{ articles, status }, setArticlesState] = useState({
articles: [],
// Can be success, loading, or error.

Просмотреть файл

@ -3,6 +3,7 @@
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this file,
* You can obtain one at http://mozilla.org/MPL/2.0/. */
/* eslint-env mozilla/browser-window */
/**
* ResetPBMPanel contains the logic for the restart private browsing action.

Просмотреть файл

@ -2,6 +2,8 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
/* eslint-env mozilla/browser-window */
const DEFAULT_NEW_REPORT_ENDPOINT = "https://webcompat.com/issues/new";
import { XPCOMUtils } from "resource://gre/modules/XPCOMUtils.sys.mjs";

Просмотреть файл

@ -136,7 +136,6 @@ const UPDATE_CHECK_PERIOD_MS = 12 * 60 * 60 * 1000; // 12 hours
/**
* A node in the QueryScorer's phrase tree.
*/
// eslint-disable-next-line no-shadow
class Node {
constructor(word) {
this.word = word;

Просмотреть файл

@ -777,13 +777,13 @@ export let BrowserUsageTelemetry = {
return "keyboard";
}
const { URL: url } = node.ownerDocument;
if (url == AppConstants.BROWSER_CHROME_URL) {
const { URL } = node.ownerDocument;
if (URL == AppConstants.BROWSER_CHROME_URL) {
return this._getBrowserWidgetContainer(node);
}
if (
url.startsWith("about:preferences") ||
url.startsWith("about:settings")
URL.startsWith("about:preferences") ||
URL.startsWith("about:settings")
) {
// Find the element's category.
let container = node.closest("[data-category]");

Просмотреть файл

@ -602,7 +602,6 @@ export var TabCrashHandler = {
return;
}
// eslint-disable-next-line no-shadow
let { includeURL, comments, URL } = message.data;
let extraExtraKeyVals = {

Просмотреть файл

@ -490,7 +490,6 @@ export var TestRunner = {
},
async _cropImage(window, srcPath, bounds, rects, targetPath) {
// eslint-disable-next-line no-shadow
const { document, Image } = window;
const promise = new Promise((resolve, reject) => {
const img = new Image();

Просмотреть файл

@ -2,7 +2,6 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this file,
* You can obtain one at http://mozilla.org/MPL/2.0/. */
// eslint-disable-next-line no-shadow
import { AddonManager } from "resource://gre/modules/AddonManager.sys.mjs";
export var LightweightThemes = {

Просмотреть файл

@ -7,7 +7,7 @@
import { BrowserTestUtils } from "resource://testing-common/BrowserTestUtils.sys.mjs";
const TEST_URL =
const URL =
"https://test1.example.com/browser/browser/tools/mozscreenshots/mozscreenshots/extension/mozscreenshots/browser/resources/lib/permissionPrompts.html";
let lastTab = null;
@ -146,7 +146,7 @@ async function clickOn(selector, beforeContentFn) {
// Save the tab so we can close it later.
lastTab = await BrowserTestUtils.openNewForegroundTab(
browserWindow.gBrowser,
TEST_URL
URL
);
let { SpecialPowers } = lastTab.ownerGlobal;

Просмотреть файл

@ -9,18 +9,12 @@ module.exports = {
globals: {
exports: true,
isWorker: true,
loader: true,
module: true,
require: true,
DebuggerNotificationObserver: true,
},
overrides: [
{
files: ["**/*.*"],
excludedFiles: ["**/*.sys.mjs", "**/*.worker.js"],
globals: {
loader: true,
module: true,
require: true,
},
},
{
files: ["client/framework/**"],
rules: {
@ -54,6 +48,12 @@ module.exports = {
"mozilla/var-only-at-top-level": "off",
},
},
{
files: ["client/framework/**"],
rules: {
"no-shadow": "off",
},
},
{
files: ["client/framework/**"],
rules: {
@ -227,6 +227,12 @@ module.exports = {
// Disallow use of assignment in return statement. It is preferable for a
// single line of code to have only one easily predictable effect.
"no-return-assign": "error",
// Warn about declaration of variables already declared in the outer scope.
// This isn't an error because it sometimes is useful to use the same name
// in a small helper function rather than having to come up with another
// random name.
// Still, making this a warning can help people avoid being confused.
"no-shadow": "error",
// Disallow global and local variables that aren't used. Allow unused
// function arguments prefixed with `_`.
"no-unused-vars": ["error", { argsIgnorePattern: "^_", vars: "all" }],

Просмотреть файл

@ -6,6 +6,7 @@
// Parent config file for all devtools xpcshell files.
module.exports = {
extends: ["plugin:mozilla/xpcshell-test"],
rules: {
// Allow non-camelcase so that run_test doesn't produce a warning.
camelcase: "off",

Просмотреть файл

@ -5,6 +5,7 @@
"use strict";
module.exports = {
env: { browser: true },
globals: {
define: true,
},

Просмотреть файл

@ -6,7 +6,6 @@
"use strict";
// Send a message to all controlled windows.
/* eslint-disable-next-line no-redeclare */
function postMessage(message) {
return clients.matchAll().then(function (clientlist) {
clientlist.forEach(function (client) {

Просмотреть файл

@ -206,6 +206,8 @@ module.exports = {
"no-process-exit": 0,
// Disallow usage of __proto__ property.
"no-proto": 2,
// Disallow declaring the same variable more than once (we use let anyway).
"no-redeclare": 2,
// Disallow multiple spaces in a regular expression literal.
"no-regex-spaces": 2,
// Don't restrict usage of specified node modules (not a node environment).
@ -219,6 +221,12 @@ module.exports = {
"no-self-compare": 2,
// Disallow use of comma operator.
"no-sequences": 2,
// Warn about declaration of variables already declared in the outer scope.
// This isn't an error because it sometimes is useful to use the same name
// in a small helper function rather than having to come up with another
// random name.
// Still, making this a warning can help people avoid being confused.
"no-shadow": 2,
// Disallow sparse arrays, eg. let arr = [,,2].
// Array destructuring is fine though:
// for (let [, breakpointPromise] of aPromises)

Просмотреть файл

@ -34,7 +34,6 @@ const { getCompactSymbolTable, queryAPI } = wasm_bindgen;
// message properties.
function createPlainErrorObject(e) {
// Regular errors: just rewrap the object.
// eslint-disable-next-line no-shadow
const { name, message, fileName, lineNumber } = e;
return { name, message, fileName, lineNumber };
}
@ -66,7 +65,6 @@ class FileAndPathHelper {
);
}
// eslint-disable-next-line no-shadow
const { name, path, debugPath, arch } = lib;
const candidatePaths = [];
@ -154,7 +152,6 @@ class FileAndPathHelper {
);
}
// eslint-disable-next-line no-shadow
const { name, path, arch } = lib;
const candidatePaths = [];

Просмотреть файл

@ -419,7 +419,6 @@ export function getAllBrowsingContextsForContext(
}
if (typeof module == "object") {
// eslint-disable-next-line no-undef
module.exports = {
isBrowsingContextPartOfContext,
isWindowGlobalPartOfContext,

Просмотреть файл

@ -46,7 +46,6 @@ const listeners = new Set();
// Detecting worker is different if this file is loaded via Common JS loader (isWorker global)
// or as a JSM (constructor name)
// eslint-disable-next-line no-shadow
const isWorker =
globalThis.isWorker ||
globalThis.constructor.name == "WorkerDebuggerGlobalScope";
@ -71,8 +70,6 @@ const customLazy = {
// this module no longer has WorkerDebuggerGlobalScope as global,
// but has to use require() to pull Debugger.
if (isWorker) {
// require is defined for workers.
// eslint-disable-next-line no-undef
return require("Debugger");
}
const { addDebuggerToGlobal } = ChromeUtils.importESModule(

Просмотреть файл

@ -2,6 +2,8 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
/* global DebuggerNotificationObserver */
// This module does import many attributes from the global object
/* eslint-disable mozilla/reject-global-this */

Просмотреть файл

@ -2,6 +2,8 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
/* global ChromeWorker */
let MESSAGE_COUNTER = 0;
function dumpn(_msg) {
@ -127,7 +129,6 @@ export function workerify(fn) {
"used in production."
);
// Fetch modules here as we don't want to include it normally.
// eslint-disable-next-line no-shadow
const { URL, Blob } = Services.wm.getMostRecentWindow("navigator:browser");
const stringifiedFn = createWorkerString(fn);
const blob = new Blob([stringifiedFn]);

Просмотреть файл

@ -515,7 +515,7 @@ DevToolsStartup.prototype = {
};
}
const jsConsole = cmdLine.handleFlag("jsconsole", false);
const console = cmdLine.handleFlag("jsconsole", false);
const devtools = cmdLine.handleFlag("devtools", false);
let devToolsServer;
@ -539,12 +539,7 @@ DevToolsStartup.prototype = {
debuggerFlag = cmdLine.handleFlag("jsdebugger", false);
}
return {
console: jsConsole,
debugger: debuggerFlag,
devtools,
devToolsServer,
};
return { console, debugger: debuggerFlag, devtools, devToolsServer };
},
/**

Просмотреть файл

@ -0,0 +1,7 @@
"use strict";
module.exports = {
rules: {
"no-shadow": "off",
},
};

2
package-lock.json сгенерированный
Просмотреть файл

@ -6168,7 +6168,7 @@
"license": "MPL-2.0"
},
"tools/lint/eslint/eslint-plugin-mozilla": {
"version": "3.7.6",
"version": "3.7.5",
"dev": true,
"license": "MPL-2.0",
"dependencies": {

Просмотреть файл

@ -11,6 +11,8 @@ import { CommonUtils } from "resource://services-common/utils.sys.mjs";
import { Utils } from "resource://services-sync/util.sys.mjs";
import { setTimeout, clearTimeout } from "resource://gre/modules/Timer.sys.mjs";
/* global AbortController */
/*
* Resource represents a remote network resource, identified by a URI.
* Create an instance like so:

Просмотреть файл

@ -6,7 +6,7 @@ importScripts("mp4box.all.min.js");
importScripts("demuxer_mp4.js");
importScripts("shared.js");
self.onmessage = event => {
self.onmessage = e => {
const resolve = result => {
self.postMessage(result);
};
@ -16,15 +16,15 @@ self.onmessage = event => {
try {
runTestInternal(
event.data.testName,
event.data.canvasType,
event.data.offscreenCanvas,
e.data.testName,
e.data.canvasType,
e.data.offscreenCanvas,
/* isWorker */ true,
event.data.videoUri,
e.data.videoUri,
resolve,
reject
);
} catch (ex) {
reject(ex);
} catch (e) {
reject(e);
}
};

Просмотреть файл

@ -163,6 +163,9 @@ module.exports = {
// single line of code to have only one easily predictable effect.
"no-return-assign": "error",
// Don't warn about declaration of variables already declared in the outer scope.
"no-shadow": "off",
// Allow use of synchronous methods (not a node environment).
"no-sync": "off",

Просмотреть файл

@ -4,4 +4,8 @@ module.exports = {
env: {
webextensions: true,
},
rules: {
"no-shadow": "off",
},
};

Просмотреть файл

@ -5,4 +5,8 @@ module.exports = {
browser: true,
webextensions: true,
},
rules: {
"no-shadow": 0,
},
};

Просмотреть файл

@ -18,6 +18,7 @@ module.exports = {
"no-inline-comments": "error",
"no-multi-str": "error",
"no-return-assign": "error",
"no-shadow": "error",
strict: ["error", "global"],
yoda: "error",
},

Просмотреть файл

@ -251,7 +251,8 @@ AbstractWorker.prototype = {
"id is",
id
);
this.postMessage({ fail: exn.toMsg(), id, durationMs });
let msg = exn.toMsg();
this.postMessage({ fail: msg, id, durationMs });
} else {
// If we encounter an exception for which we have no
// serialization mechanism in place, we have no choice but to

Просмотреть файл

@ -7,6 +7,7 @@
module.exports = {
rules: {
"no-inner-declarations": "error",
"no-shadow": "error",
"no-unused-vars": ["error", { vars: "all", argsIgnorePattern: "^_" }],
},
};

Просмотреть файл

@ -245,8 +245,11 @@ class Engine {
this.bergamot = bergamot;
/** @type {Bergamot["TranslationModel"][]} */
this.languageTranslationModels = languageTranslationModelFiles.map(
modelFiles =>
BergamotUtils.constructSingleTranslationModel(bergamot, modelFiles)
languageTranslationModelFiles =>
BergamotUtils.constructSingleTranslationModel(
bergamot,
languageTranslationModelFiles
)
);
/** @type {Bergamot["BlockingService"]} */

Просмотреть файл

@ -10,6 +10,8 @@
* eagerly loaded at startup.
*/
/* globals WebExtensionPolicy */
import { XPCOMUtils } from "resource://gre/modules/XPCOMUtils.sys.mjs";
const lazy = {};

Просмотреть файл

@ -23,6 +23,7 @@ module.exports = {
rules: {
camelcase: ["error", { properties: "never" }],
"handle-callback-err": ["error", "er"],
"no-shadow": "error",
"no-undef-init": "error",
"one-var": ["error", "never"],
strict: ["error", "global"],

Просмотреть файл

@ -6,6 +6,7 @@ module.exports = {
browser: true,
"mozilla/browser-window": true,
"mozilla/simpletest": true,
// "node": true
},
// All globals made available in the test environment.
@ -56,6 +57,19 @@ module.exports = {
waitForFocus: false,
},
overrides: [
{
// Some directories have multiple kinds of tests, and some rules
// don't work well for plain mochitests, so disable those.
files: ["*.html", "*.xhtml"],
// plain/chrome mochitests don't automatically include Assert, so
// autofixing `ok()` to Assert.something is bad.
rules: {
"mozilla/no-comparison-or-assignment-inside-ok": "off",
},
},
],
plugins: ["mozilla"],
rules: {

Просмотреть файл

@ -18,6 +18,18 @@ module.exports = {
getRootDirectory: false,
},
overrides: [
{
env: {
// Ideally we wouldn't be using the simpletest env here, but our uses of
// js files mean we pick up everything from the global scope, which could
// be any one of a number of html files. So we just allow the basics...
"mozilla/simpletest": true,
},
files: ["*.js"],
},
],
plugins: ["mozilla"],
rules: {

Просмотреть файл

@ -12,6 +12,17 @@ module.exports = {
SpecialPowers: false,
},
overrides: [
{
env: {
// Ideally we wouldn't be using the simpletest env here, but our uses of
// js files mean we pick up everything from the global scope, which could
// be any one of a number of html files. So we just allow the basics...
"mozilla/simpletest": true,
},
files: ["*.js"],
},
],
plugins: ["mozilla"],
rules: {
@ -24,5 +35,6 @@ module.exports = {
// Turn off use-chromeutils-generateqi as these tests don't have ChromeUtils
// available.
"mozilla/use-chromeutils-generateqi": "off",
"no-shadow": "error",
},
};

Просмотреть файл

@ -63,15 +63,14 @@ module.exports = {
"mozilla/reject-importGlobalProperties": ["error", "everything"],
"mozilla/reject-mixing-eager-and-lazy": "error",
"mozilla/reject-top-level-await": "error",
// TODO: Bug 1575506 turn `builtinGlobals` on here.
// We can enable builtinGlobals for mjs files due to their scopes.
"no-redeclare": ["error", { builtinGlobals: false }],
},
},
{
files: ["**/*.mjs", "**/*.jsx", "**/?(*.)worker.?(m)js"],
rules: {
// We enable builtinGlobals for modules and workers due to their
// contained scopes.
"no-redeclare": ["error", { builtinGlobals: true }],
"no-shadow": ["error", { allow: ["event"], builtinGlobals: true }],
// Modules and workers are far easier to check for no-unused-vars on a
// global scope, than our content files. Hence we turn that on here.
"no-unused-vars": [
@ -89,6 +88,7 @@ module.exports = {
rules: {
"mozilla/reject-import-system-module-from-non-system": "error",
"mozilla/reject-lazy-imports-into-globals": "error",
"no-shadow": ["error", { allow: ["event"], builtinGlobals: true }],
},
},
{
@ -285,7 +285,7 @@ module.exports = {
"no-sequences": "error",
// No declaring variables from an outer scope
"no-shadow": "error",
// "no-shadow": "error",
// Disallow throwing literals (eg. throw "error" instead of
// throw new Error("error")).

Просмотреть файл

@ -8,6 +8,47 @@ module.exports = {
"mozilla/xpcshell": true,
},
overrides: [
{
// Some directories have multiple kinds of tests, and some rules
// don't work well for plain mochitests, so disable those.
files: ["*.html", "*.xhtml"],
// plain/chrome mochitests don't automatically include Assert, so
// autofixing `ok()` to Assert.something is bad.
rules: {
"mozilla/no-comparison-or-assignment-inside-ok": "off",
},
},
{
// If it is a head file, we turn off global unused variable checks, as it
// would require searching the other test files to know if they are used or not.
// This would be expensive and slow, and it isn't worth it for head files.
// We could get developers to declare as exported, but that doesn't seem worth it.
files: "head*.js",
rules: {
"no-unused-vars": [
"error",
{
argsIgnorePattern: "^_",
vars: "local",
},
],
},
},
{
// No declaring variables that are never used
files: "test*.js",
rules: {
"no-unused-vars": [
"error",
{
argsIgnorePattern: "^_",
vars: "all",
},
],
},
},
],
plugins: ["mozilla", "@microsoft/sdl"],
rules: {
@ -17,5 +58,6 @@ module.exports = {
"mozilla/no-comparison-or-assignment-inside-ok": "error",
"mozilla/no-useless-run-test": "error",
"no-shadow": "error",
},
};

Просмотреть файл

@ -1,6 +1,6 @@
{
"name": "eslint-plugin-mozilla",
"version": "3.7.6",
"version": "3.7.5",
"lockfileVersion": 3,
"requires": true,
"packages": {

Просмотреть файл

@ -1,6 +1,6 @@
{
"name": "eslint-plugin-mozilla",
"version": "3.7.6",
"version": "3.7.5",
"description": "A collection of rules that help enforce JavaScript coding standard in the Mozilla project.",
"keywords": [
"eslint",