mirror of
https://github.com/mozilla/gecko-dev.git
synced 2025-02-24 19:37:15 +00:00
Bug 1575506 - Enable ESLint rule no-redeclare with builtinGlobals on all module and worker files. r=frontend-codestyle-reviewers,devtools-reviewers,nchevobbe,mossop
Differential Revision: https://phabricator.services.mozilla.com/D221446
This commit is contained in:
parent
0075a7ce1f
commit
533bbce8a6
@ -2030,6 +2030,7 @@ const rollouts = [
|
||||
},
|
||||
},
|
||||
{
|
||||
// TODO: Bug TBD - Finish enabling no-shadow for all files.
|
||||
files: [
|
||||
"browser/components/extensions/**",
|
||||
"docshell/test/**",
|
||||
|
@ -297,9 +297,6 @@ 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": [
|
||||
|
@ -6,6 +6,7 @@
|
||||
"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,8 +206,6 @@ 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).
|
||||
|
@ -2,8 +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/. */
|
||||
|
||||
/* global DebuggerNotificationObserver */
|
||||
|
||||
// This module does import many attributes from the global object
|
||||
/* eslint-disable mozilla/reject-global-this */
|
||||
|
||||
|
@ -2,8 +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/. */
|
||||
|
||||
/* global ChromeWorker */
|
||||
|
||||
let MESSAGE_COUNTER = 0;
|
||||
|
||||
function dumpn(_msg) {
|
||||
|
2
package-lock.json
generated
2
package-lock.json
generated
@ -6168,7 +6168,7 @@
|
||||
"license": "MPL-2.0"
|
||||
},
|
||||
"tools/lint/eslint/eslint-plugin-mozilla": {
|
||||
"version": "3.7.5",
|
||||
"version": "3.7.6",
|
||||
"dev": true,
|
||||
"license": "MPL-2.0",
|
||||
"dependencies": {
|
||||
|
@ -11,8 +11,6 @@ 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:
|
||||
|
@ -10,8 +10,6 @@
|
||||
* eagerly loaded at startup.
|
||||
*/
|
||||
|
||||
/* globals WebExtensionPolicy */
|
||||
|
||||
import { XPCOMUtils } from "resource://gre/modules/XPCOMUtils.sys.mjs";
|
||||
|
||||
const lazy = {};
|
||||
|
@ -63,14 +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.
|
||||
|
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "eslint-plugin-mozilla",
|
||||
"version": "3.7.5",
|
||||
"version": "3.7.6",
|
||||
"lockfileVersion": 3,
|
||||
"requires": true,
|
||||
"packages": {
|
||||
|
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "eslint-plugin-mozilla",
|
||||
"version": "3.7.5",
|
||||
"version": "3.7.6",
|
||||
"description": "A collection of rules that help enforce JavaScript coding standard in the Mozilla project.",
|
||||
"keywords": [
|
||||
"eslint",
|
||||
|
Loading…
x
Reference in New Issue
Block a user