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
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
"use strict";
|
||||
|
||||
module.exports = {
|
||||
rules: {
|
||||
// XXX Bug 1326071 - This should be reduced down - probably to 20 or to
|
||||
// be removed & synced with the mozilla/recommended value.
|
||||
complexity: ["error", 45],
|
||||
export default [
|
||||
{
|
||||
rules: {
|
||||
// XXX Bug 1326071 - This should be reduced down - probably to 20 or to
|
||||
// be removed & synced with the mozilla/recommended value.
|
||||
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 = {
|
||||
env: {
|
||||
webextensions: true,
|
||||
},
|
||||
};
|
||||
import globals from "globals";
|
||||
|
||||
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
|
||||
* 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 = {
|
||||
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",
|
||||
// Functions are not required to consistently return something or nothing
|
||||
"consistent-return": "off",
|
||||
|
||||
// Functions are not required to consistently return something or nothing
|
||||
"consistent-return": "off",
|
||||
// Disallow empty statements. This will report an error for:
|
||||
// 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:
|
||||
// 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",
|
||||
// No expressions where a statement is expected
|
||||
"no-unused-expressions": "error",
|
||||
|
||||
// No expressions where a statement is expected
|
||||
"no-unused-expressions": "error",
|
||||
// No declaring variables that are never used
|
||||
"no-unused-vars": [
|
||||
"error",
|
||||
{
|
||||
argsIgnorePattern: "^_",
|
||||
vars: "all",
|
||||
varsIgnorePattern: "^console$",
|
||||
},
|
||||
],
|
||||
|
||||
// No declaring variables that are never used
|
||||
"no-unused-vars": [
|
||||
"error",
|
||||
{
|
||||
argsIgnorePattern: "^_",
|
||||
vars: "all",
|
||||
varsIgnorePattern: "^console$",
|
||||
},
|
||||
],
|
||||
// No using things before they're defined.
|
||||
"no-use-before-define": [
|
||||
"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,
|
||||
},
|
||||
],
|
||||
|
||||
// No using things before they're defined.
|
||||
"no-use-before-define": [
|
||||
"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
|
||||
// since only let and const are used, see "no-var").
|
||||
"block-scoped-var": "error",
|
||||
|
||||
// Disallow using variables outside the blocks they are defined (especially
|
||||
// since only let and const are used, see "no-var").
|
||||
"block-scoped-var": "error",
|
||||
// Warn about cyclomatic complexity in functions.
|
||||
complexity: "error",
|
||||
|
||||
// Warn about cyclomatic complexity in functions.
|
||||
complexity: "error",
|
||||
// Don't warn for inconsistent naming when capturing this (not so important
|
||||
// with auto-binding fat arrow functions).
|
||||
// "consistent-this": ["error", "self"],
|
||||
|
||||
// Don't warn for inconsistent naming when capturing this (not so important
|
||||
// with auto-binding fat arrow functions).
|
||||
// "consistent-this": ["error", "self"],
|
||||
// Don't require a default case in switch statements. Avoid being forced to
|
||||
// add a bogus default when you know all possible cases are handled.
|
||||
"default-case": "off",
|
||||
|
||||
// Don't require a default case in switch statements. Avoid being forced to
|
||||
// add a bogus default when you know all possible cases are handled.
|
||||
"default-case": "off",
|
||||
// Allow using == instead of ===, in the interest of landing something since
|
||||
// the devtools codebase is split on convention here.
|
||||
eqeqeq: "off",
|
||||
|
||||
// Allow using == instead of ===, in the interest of landing something since
|
||||
// the devtools codebase is split on convention here.
|
||||
eqeqeq: "off",
|
||||
// Don't require function expressions to have a name.
|
||||
// This makes the code more verbose and hard to read. Our engine already
|
||||
// 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.
|
||||
// This makes the code more verbose and hard to read. Our engine already
|
||||
// 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.
|
||||
"func-style": "off",
|
||||
|
||||
// Allow use of function declarations and expressions.
|
||||
"func-style": "off",
|
||||
// Maximum depth callbacks can be nested.
|
||||
"max-nested-callbacks": ["error", 4],
|
||||
|
||||
// Maximum depth callbacks can be nested.
|
||||
"max-nested-callbacks": ["error", 4],
|
||||
// Don't limit the number of parameters that can be used in a function.
|
||||
"max-params": "off",
|
||||
|
||||
// Don't limit the number of parameters that can be used in a function.
|
||||
"max-params": "off",
|
||||
// Don't limit the maximum number of statement allowed in a function. We
|
||||
// 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
|
||||
// already have the complexity rule that's a better measurement.
|
||||
"max-statements": "off",
|
||||
// Don't require a capital letter for constructors, only check if all new
|
||||
// operators are followed by a capital letter. Don't warn when capitalized
|
||||
// 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
|
||||
// operators are followed by a capital letter. Don't warn when capitalized
|
||||
// functions are used without the new operator.
|
||||
"new-cap": ["off", { capIsNew: false }],
|
||||
// Allow use of bitwise operators.
|
||||
"no-bitwise": "off",
|
||||
|
||||
// Allow use of bitwise operators.
|
||||
"no-bitwise": "off",
|
||||
// Allow use of the continue statement.
|
||||
"no-continue": "off",
|
||||
|
||||
// Allow use of the continue statement.
|
||||
"no-continue": "off",
|
||||
// Allow division operators explicitly at beginning of regular expression.
|
||||
"no-div-regex": "off",
|
||||
|
||||
// Allow division operators explicitly at beginning of regular expression.
|
||||
"no-div-regex": "off",
|
||||
// Disallow adding to native types
|
||||
"no-extend-native": "error",
|
||||
|
||||
// Disallow adding to native types
|
||||
"no-extend-native": "error",
|
||||
// Allow comments inline after code.
|
||||
"no-inline-comments": "off",
|
||||
|
||||
// Allow comments inline after code.
|
||||
"no-inline-comments": "off",
|
||||
// Disallow use of labels for anything other then loops and switches.
|
||||
"no-labels": ["error", { allowLoop: true }],
|
||||
|
||||
// Disallow use of labels for anything other then loops and switches.
|
||||
"no-labels": ["error", { allowLoop: true }],
|
||||
// Disallow use of multiline strings (use template strings instead).
|
||||
"no-multi-str": "error",
|
||||
|
||||
// Disallow use of multiline strings (use template strings instead).
|
||||
"no-multi-str": "error",
|
||||
// Allow reassignment of function parameters.
|
||||
"no-param-reassign": "off",
|
||||
|
||||
// Allow reassignment of function parameters.
|
||||
"no-param-reassign": "off",
|
||||
// Allow string concatenation with __dirname and __filename (not a node env).
|
||||
"no-path-concat": "off",
|
||||
|
||||
// Allow string concatenation with __dirname and __filename (not a node env).
|
||||
"no-path-concat": "off",
|
||||
// Allow use of unary operators, ++ and --.
|
||||
"no-plusplus": "off",
|
||||
|
||||
// Allow use of unary operators, ++ and --.
|
||||
"no-plusplus": "off",
|
||||
// Allow using process.env (not a node environment).
|
||||
"no-process-env": "off",
|
||||
|
||||
// Allow using process.env (not a node environment).
|
||||
"no-process-env": "off",
|
||||
// Allow using process.exit (not a node environment).
|
||||
"no-process-exit": "off",
|
||||
|
||||
// Allow using process.exit (not a node environment).
|
||||
"no-process-exit": "off",
|
||||
// Disallow usage of __proto__ property.
|
||||
"no-proto": "error",
|
||||
|
||||
// Disallow usage of __proto__ property.
|
||||
"no-proto": "error",
|
||||
// Don't restrict usage of specified node modules (not a node environment).
|
||||
"no-restricted-modules": "off",
|
||||
|
||||
// Don't restrict usage of specified node modules (not a node environment).
|
||||
"no-restricted-modules": "off",
|
||||
// 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",
|
||||
|
||||
// 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",
|
||||
// Allow use of synchronous methods (not a node environment).
|
||||
"no-sync": "off",
|
||||
|
||||
// Allow use of synchronous methods (not a node environment).
|
||||
"no-sync": "off",
|
||||
// Allow the use of ternary operators.
|
||||
"no-ternary": "off",
|
||||
|
||||
// Allow the use of ternary operators.
|
||||
"no-ternary": "off",
|
||||
// Allow dangling underscores in identifiers (for privates).
|
||||
"no-underscore-dangle": "off",
|
||||
|
||||
// Allow dangling underscores in identifiers (for privates).
|
||||
"no-underscore-dangle": "off",
|
||||
// Allow use of undefined variable.
|
||||
"no-undefined": "off",
|
||||
|
||||
// Allow use of undefined variable.
|
||||
"no-undefined": "off",
|
||||
// We use var-only-at-top-level instead of no-var as we allow top level
|
||||
// vars.
|
||||
"no-var": "off",
|
||||
|
||||
// We use var-only-at-top-level instead of no-var as we allow top level
|
||||
// vars.
|
||||
"no-var": "off",
|
||||
// Allow using TODO/FIXME comments.
|
||||
"no-warning-comments": "off",
|
||||
|
||||
// Allow using TODO/FIXME comments.
|
||||
"no-warning-comments": "off",
|
||||
// Don't require method and property shorthand syntax for object literals.
|
||||
// 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.
|
||||
// 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",
|
||||
// Allow more than one variable declaration per function.
|
||||
"one-var": "off",
|
||||
|
||||
// Allow more than one variable declaration per function.
|
||||
"one-var": "off",
|
||||
// Require use of the second argument for parseInt().
|
||||
radix: "error",
|
||||
|
||||
// Require use of the second argument for parseInt().
|
||||
radix: "error",
|
||||
// Don't require to sort variables within the same declaration block.
|
||||
// Anyway, one-var is disabled.
|
||||
"sort-vars": "off",
|
||||
|
||||
// Don't require to sort variables within the same declaration block.
|
||||
// Anyway, one-var is disabled.
|
||||
"sort-vars": "off",
|
||||
// Require "use strict" to be defined globally in the script.
|
||||
strict: ["error", "global"],
|
||||
|
||||
// Require "use strict" to be defined globally in the script.
|
||||
strict: ["error", "global"],
|
||||
// Allow vars to be declared anywhere in the scope.
|
||||
"vars-on-top": "off",
|
||||
|
||||
// Allow vars to be declared anywhere in the scope.
|
||||
"vars-on-top": "off",
|
||||
// Disallow Yoda conditions (where literal value comes first).
|
||||
yoda: "error",
|
||||
|
||||
// Disallow Yoda conditions (where literal value comes first).
|
||||
yoda: "error",
|
||||
// Disallow function or variable declarations in nested blocks
|
||||
"no-inner-declarations": "error",
|
||||
|
||||
// Disallow function or variable declarations in nested blocks
|
||||
"no-inner-declarations": "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",
|
||||
},
|
||||
],
|
||||
},
|
||||
// Disallow labels that share a name with a variable
|
||||
"no-label-var": "error",
|
||||
},
|
||||
],
|
||||
};
|
||||
},
|
||||
{
|
||||
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
|
||||
* 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 = {
|
||||
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,
|
||||
|
||||
// This is defined in toolkit/components/extensions/child/ext-toolkit.js
|
||||
EventManager: 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
|
||||
* 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 = {
|
||||
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,
|
||||
|
||||
// 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,
|
||||
// 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 = {
|
||||
env: {
|
||||
webextensions: true,
|
||||
import globals from "globals";
|
||||
|
||||
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 = {
|
||||
env: {
|
||||
browser: true,
|
||||
webextensions: true,
|
||||
import globals from "globals";
|
||||
|
||||
export default [
|
||||
{
|
||||
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 = {
|
||||
env: {
|
||||
// The tests in this folder are testing based on WebExtensions, so lets
|
||||
// just define the webextensions environment here.
|
||||
webextensions: true,
|
||||
// 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.
|
||||
browser: true,
|
||||
import globals from "globals";
|
||||
|
||||
export default [
|
||||
{
|
||||
languageOptions: {
|
||||
globals: {
|
||||
// The tests in this folder are testing based on WebExtensions, so lets
|
||||
// just define the webextensions environment here.
|
||||
...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 = {
|
||||
env: {
|
||||
// The tests in this folder are testing based on WebExtensions, so lets
|
||||
// just define the webextensions environment here.
|
||||
webextensions: true,
|
||||
import globals from "globals";
|
||||
|
||||
export default [
|
||||
{
|
||||
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
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
"use strict";
|
||||
|
||||
module.exports = {
|
||||
rules: {
|
||||
"mozilla/no-aArgs": "error",
|
||||
"mozilla/reject-importGlobalProperties": ["error", "everything"],
|
||||
"mozilla/var-only-at-top-level": "error",
|
||||
"block-scoped-var": "error",
|
||||
camelcase: ["error", { properties: "never" }],
|
||||
complexity: ["error", { max: 20 }],
|
||||
"max-nested-callbacks": ["error", 3],
|
||||
"new-cap": ["error", { capIsNew: false }],
|
||||
"no-extend-native": "error",
|
||||
"no-inline-comments": "error",
|
||||
"no-multi-str": "error",
|
||||
"no-return-assign": "error",
|
||||
strict: ["error", "global"],
|
||||
yoda: "error",
|
||||
export default [
|
||||
{
|
||||
rules: {
|
||||
"mozilla/no-aArgs": "error",
|
||||
"mozilla/reject-importGlobalProperties": ["error", "everything"],
|
||||
"mozilla/var-only-at-top-level": "error",
|
||||
"block-scoped-var": "error",
|
||||
camelcase: ["error", { properties: "never" }],
|
||||
complexity: ["error", { max: 20 }],
|
||||
"max-nested-callbacks": ["error", 3],
|
||||
"new-cap": ["error", { capIsNew: false }],
|
||||
"no-extend-native": "error",
|
||||
"no-inline-comments": "error",
|
||||
"no-multi-str": "error",
|
||||
"no-return-assign": "error",
|
||||
strict: ["error", "global"],
|
||||
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 = {
|
||||
rules: {
|
||||
"require-yield": 0,
|
||||
export default [
|
||||
{
|
||||
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 = {
|
||||
rules: {
|
||||
"no-var": "off",
|
||||
export default [
|
||||
{
|
||||
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 = {
|
||||
globals: {
|
||||
promptDone: true,
|
||||
startTest: true,
|
||||
// Make no-undef happy with our runInParent mixed environments since you
|
||||
// can't indicate a single function is a new env.
|
||||
assert: true,
|
||||
addMessageListener: true,
|
||||
sendAsyncMessage: true,
|
||||
Assert: true,
|
||||
export default [
|
||||
{
|
||||
languageOptions: {
|
||||
globals: {
|
||||
promptDone: true,
|
||||
startTest: true,
|
||||
// Make no-undef happy with our runInParent mixed environments since you
|
||||
// can't indicate a single function is a new env.
|
||||
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 = {
|
||||
rules: {
|
||||
// ownerGlobal doesn't exist in content privileged windows.
|
||||
"mozilla/use-ownerGlobal": "off",
|
||||
export default [
|
||||
{
|
||||
rules: {
|
||||
// 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
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
"use strict";
|
||||
|
||||
module.exports = {
|
||||
rules: {
|
||||
"no-inner-declarations": "error",
|
||||
"no-unused-vars": ["error", { vars: "all", argsIgnorePattern: "^_" }],
|
||||
export default [
|
||||
{
|
||||
rules: {
|
||||
"no-inner-declarations": "error",
|
||||
"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
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
"use strict";
|
||||
import mozilla from "eslint-plugin-mozilla";
|
||||
|
||||
module.exports = {
|
||||
overrides: [
|
||||
{
|
||||
files: "./**/*.?(m)js",
|
||||
excludedFiles: "aboutwebrtc/**",
|
||||
env: {
|
||||
"mozilla/browser-window": true,
|
||||
},
|
||||
export default [
|
||||
{
|
||||
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],
|
||||
},
|
||||
],
|
||||
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
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
"use strict";
|
||||
import extensionsConfig from "../../components/extensions/.eslintrc.mjs";
|
||||
|
||||
module.exports = {
|
||||
extends: "../../components/extensions/.eslintrc.js",
|
||||
};
|
||||
export default [...extensionsConfig];
|
||||
|
||||
@@ -2,35 +2,33 @@
|
||||
* 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/. */
|
||||
|
||||
"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 = {
|
||||
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 }],
|
||||
|
||||
"no-unused-vars": [
|
||||
"error",
|
||||
{
|
||||
argsIgnorePattern: "^_",
|
||||
vars: "all",
|
||||
},
|
||||
],
|
||||
},
|
||||
overrides: [
|
||||
{
|
||||
files: "test/xpcshell/head*.js",
|
||||
rules: {
|
||||
"no-unused-vars": [
|
||||
"error",
|
||||
{
|
||||
argsIgnorePattern: "^_",
|
||||
vars: "local",
|
||||
},
|
||||
],
|
||||
},
|
||||
"no-unused-vars": [
|
||||
"error",
|
||||
{
|
||||
argsIgnorePattern: "^_",
|
||||
vars: "all",
|
||||
},
|
||||
],
|
||||
},
|
||||
],
|
||||
};
|
||||
},
|
||||
{
|
||||
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 = {
|
||||
env: {
|
||||
webextensions: true,
|
||||
},
|
||||
import globals from "globals";
|
||||
|
||||
rules: {
|
||||
"no-unused-vars": [
|
||||
"error",
|
||||
{ argsIgnorePattern: "^_", varsIgnorePattern: "^end_test$" },
|
||||
],
|
||||
export default [
|
||||
{
|
||||
languageOptions: { globals: globals.webextensions },
|
||||
|
||||
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 = {
|
||||
rules: {
|
||||
"no-unused-vars": [
|
||||
"error",
|
||||
{ argsIgnorePattern: "^_", varsIgnorePattern: "^end_test$" },
|
||||
],
|
||||
},
|
||||
overrides: [
|
||||
{
|
||||
files: "head*.js",
|
||||
rules: {
|
||||
"no-unused-vars": [
|
||||
"error",
|
||||
{
|
||||
argsIgnorePattern: "^_",
|
||||
vars: "local",
|
||||
},
|
||||
],
|
||||
},
|
||||
export default [
|
||||
{
|
||||
rules: {
|
||||
"no-unused-vars": [
|
||||
"error",
|
||||
{ argsIgnorePattern: "^_", varsIgnorePattern: "^end_test$" },
|
||||
],
|
||||
},
|
||||
],
|
||||
};
|
||||
},
|
||||
{
|
||||
files: "**/head*.js",
|
||||
rules: {
|
||||
"no-unused-vars": [
|
||||
"error",
|
||||
{
|
||||
argsIgnorePattern: "^_",
|
||||
vars: "local",
|
||||
},
|
||||
],
|
||||
},
|
||||
},
|
||||
];
|
||||
|
||||
Reference in New Issue
Block a user