Bug 1917530 - Enable ESLint rule no-shadow on system modules where no-shadow is enabled already, and warn for remaining failures. r=frontend-codestyle-reviewers,mossop

This moves the ESLint rule to apply to jsx, system modules and workers. It is excluded from most system
modules by the roll out, which we can work on later. However, it will be enabled where no-shadow is
already enabled - previously these were hidden due to the order in which ESLint was applying the rules.

Differential Revision: https://phabricator.services.mozilla.com/D221444
This commit is contained in:
Mark Banner 2024-09-12 21:08:44 +00:00
Родитель 3a3d0b8465
Коммит f63765b6ef
2 изменённых файлов: 41 добавлений и 1 удалений

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

@ -1988,6 +1988,46 @@ const rollouts = [
"mozilla/no-browser-refs-in-toolkit": "warn",
},
},
{
// TODO: Bug TBD - Finish enabling no-shadow with builtinGlobals: true
// for system modules.
files: [
"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 }],
},
},
];
module.exports = { rollouts };

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

@ -71,6 +71,7 @@ module.exports = {
{
files: ["**/*.mjs", "**/*.jsx", "**/?(*.)worker.?(m)js"],
rules: {
"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": [
@ -88,7 +89,6 @@ 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 }],
},
},
{