Bug 1881701 - Change new .eslintrc.mjs files to modules (toolkit/), and export as flat config. r=frontend-codestyle-reviewers,extension-reviewers,credential-management-reviewers,Gijs,mossop,dimi,robwu
Differential Revision: https://phabricator.services.mozilla.com/D249950
This commit is contained in:
committed by
mbanner@mozilla.com
parent
4529a8e15d
commit
876c545813
@@ -2,12 +2,12 @@
|
|||||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
* 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/. */
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||||
|
|
||||||
"use strict";
|
export default [
|
||||||
|
{
|
||||||
module.exports = {
|
rules: {
|
||||||
rules: {
|
// XXX Bug 1326071 - This should be reduced down - probably to 20 or to
|
||||||
// XXX Bug 1326071 - This should be reduced down - probably to 20 or to
|
// be removed & synced with the mozilla/recommended value.
|
||||||
// be removed & synced with the mozilla/recommended value.
|
complexity: ["error", 45],
|
||||||
complexity: ["error", 45],
|
},
|
||||||
},
|
},
|
||||||
};
|
];
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
"use strict";
|
/* 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/. */
|
||||||
|
|
||||||
module.exports = {
|
import globals from "globals";
|
||||||
env: {
|
|
||||||
webextensions: true,
|
export default [{ languageOptions: { globals: globals.webextensions } }];
|
||||||
},
|
|
||||||
};
|
|
||||||
|
|||||||
@@ -2,211 +2,208 @@
|
|||||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
* 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/. */
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||||
|
|
||||||
"use strict";
|
export default [
|
||||||
|
{
|
||||||
|
rules: {
|
||||||
|
// Rules from the mozilla plugin
|
||||||
|
"mozilla/balanced-listeners": "error",
|
||||||
|
"mozilla/no-aArgs": "error",
|
||||||
|
"mozilla/var-only-at-top-level": "error",
|
||||||
|
// Disable reject-importGlobalProperties because we don't want to include
|
||||||
|
// these in the sandbox directly as that would potentially mean the
|
||||||
|
// imported properties would be instatiated up-front rather than lazily.
|
||||||
|
"mozilla/reject-importGlobalProperties": "off",
|
||||||
|
|
||||||
module.exports = {
|
// Functions are not required to consistently return something or nothing
|
||||||
rules: {
|
"consistent-return": "off",
|
||||||
// Rules from the mozilla plugin
|
|
||||||
"mozilla/balanced-listeners": "error",
|
|
||||||
"mozilla/no-aArgs": "error",
|
|
||||||
"mozilla/var-only-at-top-level": "error",
|
|
||||||
// Disable reject-importGlobalProperties because we don't want to include
|
|
||||||
// these in the sandbox directly as that would potentially mean the
|
|
||||||
// imported properties would be instatiated up-front rather than lazily.
|
|
||||||
"mozilla/reject-importGlobalProperties": "off",
|
|
||||||
|
|
||||||
// Functions are not required to consistently return something or nothing
|
// Disallow empty statements. This will report an error for:
|
||||||
"consistent-return": "off",
|
// try { something(); } catch (e) {}
|
||||||
|
// but will not report it for:
|
||||||
|
// try { something(); } catch (e) { /* Silencing the error because ...*/ }
|
||||||
|
// which is a valid use case.
|
||||||
|
"no-empty": "error",
|
||||||
|
|
||||||
// Disallow empty statements. This will report an error for:
|
// No expressions where a statement is expected
|
||||||
// try { something(); } catch (e) {}
|
"no-unused-expressions": "error",
|
||||||
// but will not report it for:
|
|
||||||
// try { something(); } catch (e) { /* Silencing the error because ...*/ }
|
|
||||||
// which is a valid use case.
|
|
||||||
"no-empty": "error",
|
|
||||||
|
|
||||||
// No expressions where a statement is expected
|
// No declaring variables that are never used
|
||||||
"no-unused-expressions": "error",
|
"no-unused-vars": [
|
||||||
|
"error",
|
||||||
|
{
|
||||||
|
argsIgnorePattern: "^_",
|
||||||
|
vars: "all",
|
||||||
|
varsIgnorePattern: "^console$",
|
||||||
|
},
|
||||||
|
],
|
||||||
|
|
||||||
// No declaring variables that are never used
|
// No using things before they're defined.
|
||||||
"no-unused-vars": [
|
"no-use-before-define": [
|
||||||
"error",
|
"error",
|
||||||
{
|
{
|
||||||
argsIgnorePattern: "^_",
|
allowNamedExports: true,
|
||||||
vars: "all",
|
classes: true,
|
||||||
varsIgnorePattern: "^console$",
|
// The next two being false allows idiomatic patterns which are more
|
||||||
},
|
// type-inference friendly. Functions are hoisted, so this is safe.
|
||||||
],
|
functions: false,
|
||||||
|
// This flag is only meaningful for `var` declarations.
|
||||||
|
// When false, it still disallows use-before-define in the same scope.
|
||||||
|
// Since we only allow `var` at the global scope, this is no worse than
|
||||||
|
// how we currently declare an uninitialized `let` at the top of file.
|
||||||
|
variables: false,
|
||||||
|
},
|
||||||
|
],
|
||||||
|
|
||||||
// No using things before they're defined.
|
// Disallow using variables outside the blocks they are defined (especially
|
||||||
"no-use-before-define": [
|
// since only let and const are used, see "no-var").
|
||||||
"error",
|
"block-scoped-var": "error",
|
||||||
{
|
|
||||||
allowNamedExports: true,
|
|
||||||
classes: true,
|
|
||||||
// The next two being false allows idiomatic patterns which are more
|
|
||||||
// type-inference friendly. Functions are hoisted, so this is safe.
|
|
||||||
functions: false,
|
|
||||||
// This flag is only meaningful for `var` declarations.
|
|
||||||
// When false, it still disallows use-before-define in the same scope.
|
|
||||||
// Since we only allow `var` at the global scope, this is no worse than
|
|
||||||
// how we currently declare an uninitialized `let` at the top of file.
|
|
||||||
variables: false,
|
|
||||||
},
|
|
||||||
],
|
|
||||||
|
|
||||||
// Disallow using variables outside the blocks they are defined (especially
|
// Warn about cyclomatic complexity in functions.
|
||||||
// since only let and const are used, see "no-var").
|
complexity: "error",
|
||||||
"block-scoped-var": "error",
|
|
||||||
|
|
||||||
// Warn about cyclomatic complexity in functions.
|
// Don't warn for inconsistent naming when capturing this (not so important
|
||||||
complexity: "error",
|
// with auto-binding fat arrow functions).
|
||||||
|
// "consistent-this": ["error", "self"],
|
||||||
|
|
||||||
// Don't warn for inconsistent naming when capturing this (not so important
|
// Don't require a default case in switch statements. Avoid being forced to
|
||||||
// with auto-binding fat arrow functions).
|
// add a bogus default when you know all possible cases are handled.
|
||||||
// "consistent-this": ["error", "self"],
|
"default-case": "off",
|
||||||
|
|
||||||
// Don't require a default case in switch statements. Avoid being forced to
|
// Allow using == instead of ===, in the interest of landing something since
|
||||||
// add a bogus default when you know all possible cases are handled.
|
// the devtools codebase is split on convention here.
|
||||||
"default-case": "off",
|
eqeqeq: "off",
|
||||||
|
|
||||||
// Allow using == instead of ===, in the interest of landing something since
|
// Don't require function expressions to have a name.
|
||||||
// the devtools codebase is split on convention here.
|
// This makes the code more verbose and hard to read. Our engine already
|
||||||
eqeqeq: "off",
|
// does a fantastic job assigning a name to the function, which includes
|
||||||
|
// the enclosing function name, and worst case you have a line number that
|
||||||
|
// you can just look up.
|
||||||
|
"func-names": "off",
|
||||||
|
|
||||||
// Don't require function expressions to have a name.
|
// Allow use of function declarations and expressions.
|
||||||
// This makes the code more verbose and hard to read. Our engine already
|
"func-style": "off",
|
||||||
// does a fantastic job assigning a name to the function, which includes
|
|
||||||
// the enclosing function name, and worst case you have a line number that
|
|
||||||
// you can just look up.
|
|
||||||
"func-names": "off",
|
|
||||||
|
|
||||||
// Allow use of function declarations and expressions.
|
// Maximum depth callbacks can be nested.
|
||||||
"func-style": "off",
|
"max-nested-callbacks": ["error", 4],
|
||||||
|
|
||||||
// Maximum depth callbacks can be nested.
|
// Don't limit the number of parameters that can be used in a function.
|
||||||
"max-nested-callbacks": ["error", 4],
|
"max-params": "off",
|
||||||
|
|
||||||
// Don't limit the number of parameters that can be used in a function.
|
// Don't limit the maximum number of statement allowed in a function. We
|
||||||
"max-params": "off",
|
// already have the complexity rule that's a better measurement.
|
||||||
|
"max-statements": "off",
|
||||||
|
|
||||||
// Don't limit the maximum number of statement allowed in a function. We
|
// Don't require a capital letter for constructors, only check if all new
|
||||||
// already have the complexity rule that's a better measurement.
|
// operators are followed by a capital letter. Don't warn when capitalized
|
||||||
"max-statements": "off",
|
// functions are used without the new operator.
|
||||||
|
"new-cap": ["off", { capIsNew: false }],
|
||||||
|
|
||||||
// Don't require a capital letter for constructors, only check if all new
|
// Allow use of bitwise operators.
|
||||||
// operators are followed by a capital letter. Don't warn when capitalized
|
"no-bitwise": "off",
|
||||||
// functions are used without the new operator.
|
|
||||||
"new-cap": ["off", { capIsNew: false }],
|
|
||||||
|
|
||||||
// Allow use of bitwise operators.
|
// Allow use of the continue statement.
|
||||||
"no-bitwise": "off",
|
"no-continue": "off",
|
||||||
|
|
||||||
// Allow use of the continue statement.
|
// Allow division operators explicitly at beginning of regular expression.
|
||||||
"no-continue": "off",
|
"no-div-regex": "off",
|
||||||
|
|
||||||
// Allow division operators explicitly at beginning of regular expression.
|
// Disallow adding to native types
|
||||||
"no-div-regex": "off",
|
"no-extend-native": "error",
|
||||||
|
|
||||||
// Disallow adding to native types
|
// Allow comments inline after code.
|
||||||
"no-extend-native": "error",
|
"no-inline-comments": "off",
|
||||||
|
|
||||||
// Allow comments inline after code.
|
// Disallow use of labels for anything other then loops and switches.
|
||||||
"no-inline-comments": "off",
|
"no-labels": ["error", { allowLoop: true }],
|
||||||
|
|
||||||
// Disallow use of labels for anything other then loops and switches.
|
// Disallow use of multiline strings (use template strings instead).
|
||||||
"no-labels": ["error", { allowLoop: true }],
|
"no-multi-str": "error",
|
||||||
|
|
||||||
// Disallow use of multiline strings (use template strings instead).
|
// Allow reassignment of function parameters.
|
||||||
"no-multi-str": "error",
|
"no-param-reassign": "off",
|
||||||
|
|
||||||
// Allow reassignment of function parameters.
|
// Allow string concatenation with __dirname and __filename (not a node env).
|
||||||
"no-param-reassign": "off",
|
"no-path-concat": "off",
|
||||||
|
|
||||||
// Allow string concatenation with __dirname and __filename (not a node env).
|
// Allow use of unary operators, ++ and --.
|
||||||
"no-path-concat": "off",
|
"no-plusplus": "off",
|
||||||
|
|
||||||
// Allow use of unary operators, ++ and --.
|
// Allow using process.env (not a node environment).
|
||||||
"no-plusplus": "off",
|
"no-process-env": "off",
|
||||||
|
|
||||||
// Allow using process.env (not a node environment).
|
// Allow using process.exit (not a node environment).
|
||||||
"no-process-env": "off",
|
"no-process-exit": "off",
|
||||||
|
|
||||||
// Allow using process.exit (not a node environment).
|
// Disallow usage of __proto__ property.
|
||||||
"no-process-exit": "off",
|
"no-proto": "error",
|
||||||
|
|
||||||
// Disallow usage of __proto__ property.
|
// Don't restrict usage of specified node modules (not a node environment).
|
||||||
"no-proto": "error",
|
"no-restricted-modules": "off",
|
||||||
|
|
||||||
// Don't restrict usage of specified node modules (not a node environment).
|
// Disallow use of assignment in return statement. It is preferable for a
|
||||||
"no-restricted-modules": "off",
|
// single line of code to have only one easily predictable effect.
|
||||||
|
"no-return-assign": "error",
|
||||||
|
|
||||||
// Disallow use of assignment in return statement. It is preferable for a
|
// Allow use of synchronous methods (not a node environment).
|
||||||
// single line of code to have only one easily predictable effect.
|
"no-sync": "off",
|
||||||
"no-return-assign": "error",
|
|
||||||
|
|
||||||
// Allow use of synchronous methods (not a node environment).
|
// Allow the use of ternary operators.
|
||||||
"no-sync": "off",
|
"no-ternary": "off",
|
||||||
|
|
||||||
// Allow the use of ternary operators.
|
// Allow dangling underscores in identifiers (for privates).
|
||||||
"no-ternary": "off",
|
"no-underscore-dangle": "off",
|
||||||
|
|
||||||
// Allow dangling underscores in identifiers (for privates).
|
// Allow use of undefined variable.
|
||||||
"no-underscore-dangle": "off",
|
"no-undefined": "off",
|
||||||
|
|
||||||
// Allow use of undefined variable.
|
// We use var-only-at-top-level instead of no-var as we allow top level
|
||||||
"no-undefined": "off",
|
// vars.
|
||||||
|
"no-var": "off",
|
||||||
|
|
||||||
// We use var-only-at-top-level instead of no-var as we allow top level
|
// Allow using TODO/FIXME comments.
|
||||||
// vars.
|
"no-warning-comments": "off",
|
||||||
"no-var": "off",
|
|
||||||
|
|
||||||
// Allow using TODO/FIXME comments.
|
// Don't require method and property shorthand syntax for object literals.
|
||||||
"no-warning-comments": "off",
|
// We use this in the code a lot, but not consistently, and this seems more
|
||||||
|
// like something to check at code review time.
|
||||||
|
"object-shorthand": "off",
|
||||||
|
|
||||||
// Don't require method and property shorthand syntax for object literals.
|
// Allow more than one variable declaration per function.
|
||||||
// We use this in the code a lot, but not consistently, and this seems more
|
"one-var": "off",
|
||||||
// like something to check at code review time.
|
|
||||||
"object-shorthand": "off",
|
|
||||||
|
|
||||||
// Allow more than one variable declaration per function.
|
// Require use of the second argument for parseInt().
|
||||||
"one-var": "off",
|
radix: "error",
|
||||||
|
|
||||||
// Require use of the second argument for parseInt().
|
// Don't require to sort variables within the same declaration block.
|
||||||
radix: "error",
|
// Anyway, one-var is disabled.
|
||||||
|
"sort-vars": "off",
|
||||||
|
|
||||||
// Don't require to sort variables within the same declaration block.
|
// Require "use strict" to be defined globally in the script.
|
||||||
// Anyway, one-var is disabled.
|
strict: ["error", "global"],
|
||||||
"sort-vars": "off",
|
|
||||||
|
|
||||||
// Require "use strict" to be defined globally in the script.
|
// Allow vars to be declared anywhere in the scope.
|
||||||
strict: ["error", "global"],
|
"vars-on-top": "off",
|
||||||
|
|
||||||
// Allow vars to be declared anywhere in the scope.
|
// Disallow Yoda conditions (where literal value comes first).
|
||||||
"vars-on-top": "off",
|
yoda: "error",
|
||||||
|
|
||||||
// Disallow Yoda conditions (where literal value comes first).
|
// Disallow function or variable declarations in nested blocks
|
||||||
yoda: "error",
|
"no-inner-declarations": "error",
|
||||||
|
|
||||||
// Disallow function or variable declarations in nested blocks
|
// Disallow labels that share a name with a variable
|
||||||
"no-inner-declarations": "error",
|
"no-label-var": "error",
|
||||||
|
|
||||||
// Disallow labels that share a name with a variable
|
|
||||||
"no-label-var": "error",
|
|
||||||
},
|
|
||||||
|
|
||||||
overrides: [
|
|
||||||
{
|
|
||||||
files: "test/xpcshell/head*.js",
|
|
||||||
rules: {
|
|
||||||
"no-unused-vars": [
|
|
||||||
"error",
|
|
||||||
{
|
|
||||||
argsIgnorePattern: "^_",
|
|
||||||
vars: "local",
|
|
||||||
},
|
|
||||||
],
|
|
||||||
},
|
|
||||||
},
|
},
|
||||||
],
|
},
|
||||||
};
|
{
|
||||||
|
files: "test/xpcshell/head*.js",
|
||||||
|
rules: {
|
||||||
|
"no-unused-vars": [
|
||||||
|
"error",
|
||||||
|
{
|
||||||
|
argsIgnorePattern: "^_",
|
||||||
|
vars: "local",
|
||||||
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
|
},
|
||||||
|
];
|
||||||
|
|||||||
@@ -2,39 +2,41 @@
|
|||||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
* 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/. */
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||||
|
|
||||||
"use strict";
|
export default [
|
||||||
|
{
|
||||||
|
languageOptions: {
|
||||||
|
globals: {
|
||||||
|
// These are defined in the WebExtension script scopes by
|
||||||
|
// ExtensionCommon.sys.mjs in the _createExtGlobal method.
|
||||||
|
AppConstants: true,
|
||||||
|
Cc: true,
|
||||||
|
ChromeWorker: true,
|
||||||
|
Ci: true,
|
||||||
|
Cr: true,
|
||||||
|
Cu: true,
|
||||||
|
ExtensionAPI: true,
|
||||||
|
ExtensionAPIPersistent: true,
|
||||||
|
ExtensionCommon: true,
|
||||||
|
FileReader: true,
|
||||||
|
Glean: true,
|
||||||
|
GleanPings: true,
|
||||||
|
IOUtils: true,
|
||||||
|
MatchGlob: true,
|
||||||
|
MatchPattern: true,
|
||||||
|
MatchPatternSet: true,
|
||||||
|
OffscreenCanvas: true,
|
||||||
|
PathUtils: true,
|
||||||
|
Services: true,
|
||||||
|
StructuredCloneHolder: true,
|
||||||
|
WebExtensionPolicy: true,
|
||||||
|
XPCOMUtils: true,
|
||||||
|
extensions: true,
|
||||||
|
global: true,
|
||||||
|
ExtensionUtils: true,
|
||||||
|
|
||||||
module.exports = {
|
// This is defined in toolkit/components/extensions/child/ext-toolkit.js
|
||||||
globals: {
|
EventManager: true,
|
||||||
// These are defined in the WebExtension script scopes by
|
},
|
||||||
// ExtensionCommon.sys.mjs in the _createExtGlobal method.
|
},
|
||||||
AppConstants: true,
|
|
||||||
Cc: true,
|
|
||||||
ChromeWorker: true,
|
|
||||||
Ci: true,
|
|
||||||
Cr: true,
|
|
||||||
Cu: true,
|
|
||||||
ExtensionAPI: true,
|
|
||||||
ExtensionAPIPersistent: true,
|
|
||||||
ExtensionCommon: true,
|
|
||||||
FileReader: true,
|
|
||||||
Glean: true,
|
|
||||||
GleanPings: true,
|
|
||||||
IOUtils: true,
|
|
||||||
MatchGlob: true,
|
|
||||||
MatchPattern: true,
|
|
||||||
MatchPatternSet: true,
|
|
||||||
OffscreenCanvas: true,
|
|
||||||
PathUtils: true,
|
|
||||||
Services: true,
|
|
||||||
StructuredCloneHolder: true,
|
|
||||||
WebExtensionPolicy: true,
|
|
||||||
XPCOMUtils: true,
|
|
||||||
extensions: true,
|
|
||||||
global: true,
|
|
||||||
ExtensionUtils: true,
|
|
||||||
|
|
||||||
// This is defined in toolkit/components/extensions/child/ext-toolkit.js
|
|
||||||
EventManager: true,
|
|
||||||
},
|
},
|
||||||
};
|
];
|
||||||
|
|||||||
@@ -2,60 +2,62 @@
|
|||||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
* 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/. */
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||||
|
|
||||||
"use strict";
|
export default [
|
||||||
|
{
|
||||||
|
languageOptions: {
|
||||||
|
globals: {
|
||||||
|
// These are defined in the WebExtension script scopes by
|
||||||
|
// ExtensionCommon.sys.mjs in the _createExtGlobal method.
|
||||||
|
AppConstants: true,
|
||||||
|
Cc: true,
|
||||||
|
ChromeWorker: true,
|
||||||
|
Ci: true,
|
||||||
|
Cr: true,
|
||||||
|
Cu: true,
|
||||||
|
ExtensionAPI: true,
|
||||||
|
ExtensionAPIPersistent: true,
|
||||||
|
ExtensionCommon: true,
|
||||||
|
FileReader: true,
|
||||||
|
Glean: true,
|
||||||
|
GleanPings: true,
|
||||||
|
IOUtils: true,
|
||||||
|
MatchGlob: true,
|
||||||
|
MatchPattern: true,
|
||||||
|
MatchPatternSet: true,
|
||||||
|
OffscreenCanvas: true,
|
||||||
|
PathUtils: true,
|
||||||
|
Services: true,
|
||||||
|
StructuredCloneHolder: true,
|
||||||
|
WebExtensionPolicy: true,
|
||||||
|
XPCOMUtils: true,
|
||||||
|
extensions: true,
|
||||||
|
global: true,
|
||||||
|
ExtensionUtils: true,
|
||||||
|
|
||||||
module.exports = {
|
// These are defined in toolkit/components/extensions/parent/ext-tabs-base.js
|
||||||
globals: {
|
TabBase: true,
|
||||||
// These are defined in the WebExtension script scopes by
|
TabManagerBase: true,
|
||||||
// ExtensionCommon.sys.mjs in the _createExtGlobal method.
|
TabTrackerBase: true,
|
||||||
AppConstants: true,
|
WindowBase: true,
|
||||||
Cc: true,
|
WindowManagerBase: true,
|
||||||
ChromeWorker: true,
|
WindowTrackerBase: true,
|
||||||
Ci: true,
|
getUserContextIdForCookieStoreId: true,
|
||||||
Cr: true,
|
// There are defined in toolkit/components/extensions/parent/ext-toolkit.js
|
||||||
Cu: true,
|
CONTAINER_STORE: true,
|
||||||
ExtensionAPI: true,
|
DEFAULT_STORE: true,
|
||||||
ExtensionAPIPersistent: true,
|
EventEmitter: true,
|
||||||
ExtensionCommon: true,
|
EventManager: true,
|
||||||
FileReader: true,
|
PRIVATE_STORE: true,
|
||||||
Glean: true,
|
getContainerForCookieStoreId: true,
|
||||||
GleanPings: true,
|
getCookieStoreIdForContainer: true,
|
||||||
IOUtils: true,
|
getCookieStoreIdForOriginAttributes: true,
|
||||||
MatchGlob: true,
|
getCookieStoreIdForTab: true,
|
||||||
MatchPattern: true,
|
getOriginAttributesPatternForCookieStoreId: true,
|
||||||
MatchPatternSet: true,
|
isContainerCookieStoreId: true,
|
||||||
OffscreenCanvas: true,
|
isDefaultCookieStoreId: true,
|
||||||
PathUtils: true,
|
isPrivateCookieStoreId: true,
|
||||||
Services: true,
|
isValidCookieStoreId: true,
|
||||||
StructuredCloneHolder: true,
|
},
|
||||||
WebExtensionPolicy: true,
|
},
|
||||||
XPCOMUtils: true,
|
|
||||||
extensions: true,
|
|
||||||
global: true,
|
|
||||||
ExtensionUtils: true,
|
|
||||||
|
|
||||||
// These are defined in toolkit/components/extensions/parent/ext-tabs-base.js
|
|
||||||
TabBase: true,
|
|
||||||
TabManagerBase: true,
|
|
||||||
TabTrackerBase: true,
|
|
||||||
WindowBase: true,
|
|
||||||
WindowManagerBase: true,
|
|
||||||
WindowTrackerBase: true,
|
|
||||||
getUserContextIdForCookieStoreId: true,
|
|
||||||
// There are defined in toolkit/components/extensions/parent/ext-toolkit.js
|
|
||||||
CONTAINER_STORE: true,
|
|
||||||
DEFAULT_STORE: true,
|
|
||||||
EventEmitter: true,
|
|
||||||
EventManager: true,
|
|
||||||
PRIVATE_STORE: true,
|
|
||||||
getContainerForCookieStoreId: true,
|
|
||||||
getCookieStoreIdForContainer: true,
|
|
||||||
getCookieStoreIdForOriginAttributes: true,
|
|
||||||
getCookieStoreIdForTab: true,
|
|
||||||
getOriginAttributesPatternForCookieStoreId: true,
|
|
||||||
isContainerCookieStoreId: true,
|
|
||||||
isDefaultCookieStoreId: true,
|
|
||||||
isPrivateCookieStoreId: true,
|
|
||||||
isValidCookieStoreId: true,
|
|
||||||
},
|
},
|
||||||
};
|
];
|
||||||
|
|||||||
@@ -1,7 +1,13 @@
|
|||||||
"use strict";
|
/* 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/. */
|
||||||
|
|
||||||
module.exports = {
|
import globals from "globals";
|
||||||
env: {
|
|
||||||
webextensions: true,
|
export default [
|
||||||
|
{
|
||||||
|
languageOptions: {
|
||||||
|
globals: globals.webextensions,
|
||||||
|
},
|
||||||
},
|
},
|
||||||
};
|
];
|
||||||
|
|||||||
@@ -1,8 +1,13 @@
|
|||||||
"use strict";
|
/* 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/. */
|
||||||
|
|
||||||
module.exports = {
|
import globals from "globals";
|
||||||
env: {
|
|
||||||
browser: true,
|
export default [
|
||||||
webextensions: true,
|
{
|
||||||
|
languageOptions: {
|
||||||
|
globals: globals.webextensions,
|
||||||
|
},
|
||||||
},
|
},
|
||||||
};
|
];
|
||||||
|
|||||||
@@ -1,13 +1,21 @@
|
|||||||
"use strict";
|
/* 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/. */
|
||||||
|
|
||||||
module.exports = {
|
import globals from "globals";
|
||||||
env: {
|
|
||||||
// The tests in this folder are testing based on WebExtensions, so lets
|
export default [
|
||||||
// just define the webextensions environment here.
|
{
|
||||||
webextensions: true,
|
languageOptions: {
|
||||||
// Many parts of WebExtensions test definitions (e.g. content scripts) also
|
globals: {
|
||||||
// interact with the browser environment, so define that here as we don't
|
// The tests in this folder are testing based on WebExtensions, so lets
|
||||||
// have an easy way to handle per-function/scope usage yet.
|
// just define the webextensions environment here.
|
||||||
browser: true,
|
...globals.webextensions,
|
||||||
|
// Many parts of WebExtensions test definitions (e.g. content scripts) also
|
||||||
|
// interact with the browser environment, so define that here as we don't
|
||||||
|
// have an easy way to handle per-function/scope usage yet.
|
||||||
|
...globals.browser,
|
||||||
|
},
|
||||||
|
},
|
||||||
},
|
},
|
||||||
};
|
];
|
||||||
|
|||||||
@@ -1,9 +1,15 @@
|
|||||||
"use strict";
|
/* 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/. */
|
||||||
|
|
||||||
module.exports = {
|
import globals from "globals";
|
||||||
env: {
|
|
||||||
// The tests in this folder are testing based on WebExtensions, so lets
|
export default [
|
||||||
// just define the webextensions environment here.
|
{
|
||||||
webextensions: true,
|
languageOptions: {
|
||||||
|
// The tests in this folder are testing based on WebExtensions, so lets
|
||||||
|
// just define the webextensions environment here.
|
||||||
|
globals: globals.webextensions,
|
||||||
|
},
|
||||||
},
|
},
|
||||||
};
|
];
|
||||||
|
|||||||
@@ -2,23 +2,23 @@
|
|||||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
* 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/. */
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||||
|
|
||||||
"use strict";
|
export default [
|
||||||
|
{
|
||||||
module.exports = {
|
rules: {
|
||||||
rules: {
|
"mozilla/no-aArgs": "error",
|
||||||
"mozilla/no-aArgs": "error",
|
"mozilla/reject-importGlobalProperties": ["error", "everything"],
|
||||||
"mozilla/reject-importGlobalProperties": ["error", "everything"],
|
"mozilla/var-only-at-top-level": "error",
|
||||||
"mozilla/var-only-at-top-level": "error",
|
"block-scoped-var": "error",
|
||||||
"block-scoped-var": "error",
|
camelcase: ["error", { properties: "never" }],
|
||||||
camelcase: ["error", { properties: "never" }],
|
complexity: ["error", { max: 20 }],
|
||||||
complexity: ["error", { max: 20 }],
|
"max-nested-callbacks": ["error", 3],
|
||||||
"max-nested-callbacks": ["error", 3],
|
"new-cap": ["error", { capIsNew: false }],
|
||||||
"new-cap": ["error", { capIsNew: false }],
|
"no-extend-native": "error",
|
||||||
"no-extend-native": "error",
|
"no-inline-comments": "error",
|
||||||
"no-inline-comments": "error",
|
"no-multi-str": "error",
|
||||||
"no-multi-str": "error",
|
"no-return-assign": "error",
|
||||||
"no-return-assign": "error",
|
strict: ["error", "global"],
|
||||||
strict: ["error", "global"],
|
yoda: "error",
|
||||||
yoda: "error",
|
},
|
||||||
},
|
},
|
||||||
};
|
];
|
||||||
|
|||||||
@@ -1,7 +1,11 @@
|
|||||||
"use strict";
|
/* 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/. */
|
||||||
|
|
||||||
module.exports = {
|
export default [
|
||||||
rules: {
|
{
|
||||||
"require-yield": 0,
|
rules: {
|
||||||
|
"require-yield": 0,
|
||||||
|
},
|
||||||
},
|
},
|
||||||
};
|
];
|
||||||
|
|||||||
@@ -1,7 +1,11 @@
|
|||||||
"use strict";
|
/* 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/. */
|
||||||
|
|
||||||
module.exports = {
|
export default [
|
||||||
rules: {
|
{
|
||||||
"no-var": "off",
|
rules: {
|
||||||
|
"no-var": "off",
|
||||||
|
},
|
||||||
},
|
},
|
||||||
};
|
];
|
||||||
|
|||||||
@@ -1,17 +1,23 @@
|
|||||||
"use strict";
|
/* 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/. */
|
||||||
|
|
||||||
module.exports = {
|
export default [
|
||||||
globals: {
|
{
|
||||||
promptDone: true,
|
languageOptions: {
|
||||||
startTest: true,
|
globals: {
|
||||||
// Make no-undef happy with our runInParent mixed environments since you
|
promptDone: true,
|
||||||
// can't indicate a single function is a new env.
|
startTest: true,
|
||||||
assert: true,
|
// Make no-undef happy with our runInParent mixed environments since you
|
||||||
addMessageListener: true,
|
// can't indicate a single function is a new env.
|
||||||
sendAsyncMessage: true,
|
assert: true,
|
||||||
Assert: true,
|
addMessageListener: true,
|
||||||
|
sendAsyncMessage: true,
|
||||||
|
Assert: true,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
rules: {
|
||||||
|
"no-var": "off",
|
||||||
|
},
|
||||||
},
|
},
|
||||||
rules: {
|
];
|
||||||
"no-var": "off",
|
|
||||||
},
|
|
||||||
};
|
|
||||||
|
|||||||
@@ -1,8 +1,12 @@
|
|||||||
"use strict";
|
/* 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/. */
|
||||||
|
|
||||||
module.exports = {
|
export default [
|
||||||
rules: {
|
{
|
||||||
// ownerGlobal doesn't exist in content privileged windows.
|
rules: {
|
||||||
"mozilla/use-ownerGlobal": "off",
|
// ownerGlobal doesn't exist in content privileged windows.
|
||||||
|
"mozilla/use-ownerGlobal": "off",
|
||||||
|
},
|
||||||
},
|
},
|
||||||
};
|
];
|
||||||
|
|||||||
@@ -2,11 +2,11 @@
|
|||||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
* 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/. */
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||||
|
|
||||||
"use strict";
|
export default [
|
||||||
|
{
|
||||||
module.exports = {
|
rules: {
|
||||||
rules: {
|
"no-inner-declarations": "error",
|
||||||
"no-inner-declarations": "error",
|
"no-unused-vars": ["error", { vars: "all", argsIgnorePattern: "^_" }],
|
||||||
"no-unused-vars": ["error", { vars: "all", argsIgnorePattern: "^_" }],
|
},
|
||||||
},
|
},
|
||||||
};
|
];
|
||||||
|
|||||||
@@ -2,23 +2,21 @@
|
|||||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
* 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/. */
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||||
|
|
||||||
"use strict";
|
import mozilla from "eslint-plugin-mozilla";
|
||||||
|
|
||||||
module.exports = {
|
export default [
|
||||||
overrides: [
|
{
|
||||||
{
|
rules: {
|
||||||
files: "./**/*.?(m)js",
|
// XXX Bug 1358949 - This should be reduced down - probably to 20 or to
|
||||||
excludedFiles: "aboutwebrtc/**",
|
// be removed & synced with the mozilla/recommended value.
|
||||||
env: {
|
complexity: ["error", 48],
|
||||||
"mozilla/browser-window": true,
|
|
||||||
},
|
|
||||||
},
|
},
|
||||||
],
|
|
||||||
plugins: ["mozilla"],
|
|
||||||
|
|
||||||
rules: {
|
|
||||||
// XXX Bug 1358949 - This should be reduced down - probably to 20 or to
|
|
||||||
// be removed & synced with the mozilla/recommended value.
|
|
||||||
complexity: ["error", 48],
|
|
||||||
},
|
},
|
||||||
};
|
{
|
||||||
|
files: ["**/*.?(m)js"],
|
||||||
|
ignores: ["aboutwebrtc/**"],
|
||||||
|
languageOptions: {
|
||||||
|
globals: mozilla.environments["browser-window"].globals,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
];
|
||||||
|
|||||||
@@ -2,8 +2,6 @@
|
|||||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
* 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/. */
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||||
|
|
||||||
"use strict";
|
import extensionsConfig from "../../components/extensions/.eslintrc.mjs";
|
||||||
|
|
||||||
module.exports = {
|
export default [...extensionsConfig];
|
||||||
extends: "../../components/extensions/.eslintrc.js",
|
|
||||||
};
|
|
||||||
|
|||||||
@@ -2,35 +2,33 @@
|
|||||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
* 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/. */
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||||
|
|
||||||
"use strict";
|
export default [
|
||||||
|
{
|
||||||
|
rules: {
|
||||||
|
// Warn about cyclomatic complexity in functions.
|
||||||
|
// XXX Bug 1326071 - This should be reduced down - probably to 20 or to
|
||||||
|
// be removed & synced with the mozilla/recommended value.
|
||||||
|
complexity: ["error", { max: 68 }],
|
||||||
|
|
||||||
module.exports = {
|
"no-unused-vars": [
|
||||||
rules: {
|
"error",
|
||||||
// Warn about cyclomatic complexity in functions.
|
{
|
||||||
// XXX Bug 1326071 - This should be reduced down - probably to 20 or to
|
argsIgnorePattern: "^_",
|
||||||
// be removed & synced with the mozilla/recommended value.
|
vars: "all",
|
||||||
complexity: ["error", { max: 68 }],
|
},
|
||||||
|
],
|
||||||
"no-unused-vars": [
|
|
||||||
"error",
|
|
||||||
{
|
|
||||||
argsIgnorePattern: "^_",
|
|
||||||
vars: "all",
|
|
||||||
},
|
|
||||||
],
|
|
||||||
},
|
|
||||||
overrides: [
|
|
||||||
{
|
|
||||||
files: "test/xpcshell/head*.js",
|
|
||||||
rules: {
|
|
||||||
"no-unused-vars": [
|
|
||||||
"error",
|
|
||||||
{
|
|
||||||
argsIgnorePattern: "^_",
|
|
||||||
vars: "local",
|
|
||||||
},
|
|
||||||
],
|
|
||||||
},
|
|
||||||
},
|
},
|
||||||
],
|
},
|
||||||
};
|
{
|
||||||
|
files: "test/xpcshell/head*.js",
|
||||||
|
rules: {
|
||||||
|
"no-unused-vars": [
|
||||||
|
"error",
|
||||||
|
{
|
||||||
|
argsIgnorePattern: "^_",
|
||||||
|
vars: "local",
|
||||||
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
|
},
|
||||||
|
];
|
||||||
|
|||||||
@@ -1,14 +1,18 @@
|
|||||||
"use strict";
|
/* 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/. */
|
||||||
|
|
||||||
module.exports = {
|
import globals from "globals";
|
||||||
env: {
|
|
||||||
webextensions: true,
|
|
||||||
},
|
|
||||||
|
|
||||||
rules: {
|
export default [
|
||||||
"no-unused-vars": [
|
{
|
||||||
"error",
|
languageOptions: { globals: globals.webextensions },
|
||||||
{ argsIgnorePattern: "^_", varsIgnorePattern: "^end_test$" },
|
|
||||||
],
|
rules: {
|
||||||
|
"no-unused-vars": [
|
||||||
|
"error",
|
||||||
|
{ argsIgnorePattern: "^_", varsIgnorePattern: "^end_test$" },
|
||||||
|
],
|
||||||
|
},
|
||||||
},
|
},
|
||||||
};
|
];
|
||||||
|
|||||||
@@ -1,24 +1,26 @@
|
|||||||
"use strict";
|
/* 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/. */
|
||||||
|
|
||||||
module.exports = {
|
export default [
|
||||||
rules: {
|
{
|
||||||
"no-unused-vars": [
|
rules: {
|
||||||
"error",
|
"no-unused-vars": [
|
||||||
{ argsIgnorePattern: "^_", varsIgnorePattern: "^end_test$" },
|
"error",
|
||||||
],
|
{ argsIgnorePattern: "^_", varsIgnorePattern: "^end_test$" },
|
||||||
},
|
],
|
||||||
overrides: [
|
|
||||||
{
|
|
||||||
files: "head*.js",
|
|
||||||
rules: {
|
|
||||||
"no-unused-vars": [
|
|
||||||
"error",
|
|
||||||
{
|
|
||||||
argsIgnorePattern: "^_",
|
|
||||||
vars: "local",
|
|
||||||
},
|
|
||||||
],
|
|
||||||
},
|
|
||||||
},
|
},
|
||||||
],
|
},
|
||||||
};
|
{
|
||||||
|
files: "**/head*.js",
|
||||||
|
rules: {
|
||||||
|
"no-unused-vars": [
|
||||||
|
"error",
|
||||||
|
{
|
||||||
|
argsIgnorePattern: "^_",
|
||||||
|
vars: "local",
|
||||||
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
|
},
|
||||||
|
];
|
||||||
|
|||||||
Reference in New Issue
Block a user