mirror of
https://github.com/mozilla/gecko-dev.git
synced 2025-11-01 08:48:25 +02:00
Bug 1881701 - Change new .eslintrc.mjs files to modules (misc), and export as flat config. r=frontend-codestyle-reviewers,webdriver-reviewers,perftest-reviewers,geckoview-reviewers,devtools-reviewers,sync-reviewers,android-reviewers,mossop,spidermonkey-reviewers,Gijs,ohall,whimboo,nchevobbe,arai,sparky,skhamis,webcompat-reviewers,twisniewski
Differential Revision: https://phabricator.services.mozilla.com/D249951
This commit is contained in:
parent
8b3069fa80
commit
f29a0c8d41
40 changed files with 809 additions and 725 deletions
|
|
@ -1,27 +1,31 @@
|
|||
"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: {
|
||||
"mozilla/no-aArgs": "error",
|
||||
"mozilla/reject-importGlobalProperties": ["error", "everything"],
|
||||
"mozilla/var-only-at-top-level": "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", 20],
|
||||
"block-scoped-var": "error",
|
||||
camelcase: ["error", { properties: "never" }],
|
||||
complexity: ["error", 20],
|
||||
|
||||
"handle-callback-err": ["error", "er"],
|
||||
"max-nested-callbacks": ["error", 4],
|
||||
"new-cap": ["error", { capIsNew: false }],
|
||||
"no-fallthrough": "error",
|
||||
"no-multi-str": "error",
|
||||
"no-proto": "error",
|
||||
"no-return-assign": "error",
|
||||
"no-unused-vars": ["error", { vars: "all", argsIgnorePattern: "^_" }],
|
||||
"one-var": ["error", "never"],
|
||||
radix: "error",
|
||||
strict: ["error", "global"],
|
||||
yoda: "error",
|
||||
"no-undef-init": "error",
|
||||
"handle-callback-err": ["error", "er"],
|
||||
"max-nested-callbacks": ["error", 4],
|
||||
"new-cap": ["error", { capIsNew: false }],
|
||||
"no-fallthrough": "error",
|
||||
"no-multi-str": "error",
|
||||
"no-proto": "error",
|
||||
"no-return-assign": "error",
|
||||
"no-unused-vars": ["error", { vars: "all", argsIgnorePattern: "^_" }],
|
||||
"one-var": ["error", "never"],
|
||||
radix: "error",
|
||||
strict: ["error", "global"],
|
||||
yoda: "error",
|
||||
"no-undef-init": "error",
|
||||
},
|
||||
},
|
||||
};
|
||||
];
|
||||
|
|
|
|||
|
|
@ -1,24 +1,25 @@
|
|||
"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: {
|
||||
// XXX These are rules that are enabled in the recommended configuration, but
|
||||
// disabled here due to failures when initially implemented. They should be
|
||||
// removed (and hence enabled) at some stage.
|
||||
"no-nested-ternary": "off",
|
||||
},
|
||||
|
||||
overrides: [
|
||||
{
|
||||
files: [
|
||||
// Bug 1602061 TODO: These tests access DOM elements via
|
||||
// id-as-variable-name, which eslint doesn't have support for yet.
|
||||
"attributes/test_listbox.html",
|
||||
"treeupdate/test_ariaowns.html",
|
||||
],
|
||||
rules: {
|
||||
"no-undef": "off",
|
||||
},
|
||||
export default [
|
||||
{
|
||||
rules: {
|
||||
// XXX These are rules that are enabled in the recommended configuration, but
|
||||
// disabled here due to failures when initially implemented. They should be
|
||||
// removed (and hence enabled) at some stage.
|
||||
"no-nested-ternary": "off",
|
||||
},
|
||||
],
|
||||
};
|
||||
},
|
||||
{
|
||||
files: [
|
||||
// Bug 1602061 TODO: These tests access DOM elements via
|
||||
// id-as-variable-name, which eslint doesn't have support for yet.
|
||||
"attributes/test_listbox.html",
|
||||
"treeupdate/test_ariaowns.html",
|
||||
],
|
||||
rules: {
|
||||
"no-undef": "off",
|
||||
},
|
||||
},
|
||||
];
|
||||
|
|
|
|||
|
|
@ -1,15 +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 = {
|
||||
overrides: [
|
||||
{
|
||||
// eslint-plugin-html doesn't automatically detect module sections in
|
||||
// html files. Enable these as a module here. JavaScript files can use
|
||||
// the mjs extension.
|
||||
files: ["*.html"],
|
||||
parserOptions: {
|
||||
sourceType: "module",
|
||||
},
|
||||
export default [
|
||||
{
|
||||
// eslint-plugin-html doesn't automatically detect module sections in
|
||||
// html files. Enable these as a module here. JavaScript files can use
|
||||
// the mjs extension.
|
||||
files: ["**/*.html"],
|
||||
languageOptions: {
|
||||
sourceType: "module",
|
||||
},
|
||||
],
|
||||
};
|
||||
},
|
||||
];
|
||||
|
|
|
|||
|
|
@ -2,13 +2,15 @@
|
|||
* 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 = {
|
||||
globals: {
|
||||
Assert: true,
|
||||
exported_symbols: true,
|
||||
require_module: true,
|
||||
Utils: true,
|
||||
export default [
|
||||
{
|
||||
languageOptions: {
|
||||
globals: {
|
||||
Assert: true,
|
||||
exported_symbols: true,
|
||||
require_module: true,
|
||||
Utils: true,
|
||||
},
|
||||
},
|
||||
},
|
||||
};
|
||||
];
|
||||
|
|
|
|||
|
|
@ -3,10 +3,12 @@
|
|||
* http://creativecommons.org/publicdomain/zero/1.0/
|
||||
*/
|
||||
|
||||
"use strict";
|
||||
import globals from "globals";
|
||||
|
||||
module.exports = {
|
||||
env: {
|
||||
worker: true,
|
||||
export default [
|
||||
{
|
||||
languageOptions: {
|
||||
globals: globals.worker,
|
||||
},
|
||||
},
|
||||
};
|
||||
];
|
||||
|
|
|
|||
|
|
@ -3,10 +3,12 @@
|
|||
* http://creativecommons.org/publicdomain/zero/1.0/
|
||||
*/
|
||||
|
||||
"use strict";
|
||||
import globals from "globals";
|
||||
|
||||
module.exports = {
|
||||
env: {
|
||||
worker: true,
|
||||
export default [
|
||||
{
|
||||
languageOptions: {
|
||||
globals: globals.worker,
|
||||
},
|
||||
},
|
||||
};
|
||||
];
|
||||
|
|
|
|||
|
|
@ -1,28 +1,34 @@
|
|||
"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 from mediasource.js. We use false to indicate they should not
|
||||
// be overwritten in scripts.
|
||||
globals: {
|
||||
addMSEPrefs: false,
|
||||
fetchAndLoad: false,
|
||||
fetchAndLoadAsync: false,
|
||||
fetchWithXHR: false,
|
||||
logEvents: false,
|
||||
loadSegment: false,
|
||||
must_not_reject: false,
|
||||
must_not_throw: false,
|
||||
must_reject: false,
|
||||
must_throw: false,
|
||||
once: false,
|
||||
range: false,
|
||||
runWithMSE: false,
|
||||
wait: false,
|
||||
waitUntilTime: false,
|
||||
export default [
|
||||
{
|
||||
// Globals from mediasource.js. We use false to indicate they should not
|
||||
// be overwritten in scripts.
|
||||
languageOptions: {
|
||||
globals: {
|
||||
addMSEPrefs: false,
|
||||
fetchAndLoad: false,
|
||||
fetchAndLoadAsync: false,
|
||||
fetchWithXHR: false,
|
||||
logEvents: false,
|
||||
loadSegment: false,
|
||||
must_not_reject: false,
|
||||
must_not_throw: false,
|
||||
must_reject: false,
|
||||
must_throw: false,
|
||||
once: false,
|
||||
range: false,
|
||||
runWithMSE: false,
|
||||
wait: false,
|
||||
waitUntilTime: false,
|
||||
},
|
||||
},
|
||||
// Use const/let instead of var for tighter scoping, avoiding redeclaration
|
||||
rules: {
|
||||
"no-var": "error",
|
||||
"prefer-const": "error",
|
||||
},
|
||||
},
|
||||
// Use const/let instead of var for tighter scoping, avoiding redeclaration
|
||||
rules: {
|
||||
"no-var": "error",
|
||||
"prefer-const": "error",
|
||||
},
|
||||
};
|
||||
];
|
||||
|
|
|
|||
|
|
@ -3,19 +3,12 @@
|
|||
* http://creativecommons.org/publicdomain/zero/1.0/
|
||||
*/
|
||||
|
||||
"use strict";
|
||||
import globals from "globals";
|
||||
|
||||
module.exports = {
|
||||
env: {
|
||||
worker: true,
|
||||
},
|
||||
|
||||
overrides: [
|
||||
{
|
||||
files: ["head.js"],
|
||||
env: {
|
||||
worker: true,
|
||||
},
|
||||
export default [
|
||||
{
|
||||
languageOptions: {
|
||||
globals: globals.worker,
|
||||
},
|
||||
],
|
||||
};
|
||||
},
|
||||
];
|
||||
|
|
|
|||
|
|
@ -2,35 +2,107 @@
|
|||
* 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 spidermonkeyJS from "eslint-plugin-spidermonkey-js";
|
||||
import mozilla from "eslint-plugin-mozilla";
|
||||
import globals from "globals";
|
||||
|
||||
module.exports = {
|
||||
plugins: ["spidermonkey-js"],
|
||||
export default [
|
||||
{
|
||||
plugins: { "spidermonkey-js": spidermonkeyJS },
|
||||
files: ["**/*.js"],
|
||||
processor: "spidermonkey-js/processor",
|
||||
|
||||
overrides: [
|
||||
{
|
||||
files: ["*.js"],
|
||||
excludedFiles: ".eslintrc.js",
|
||||
processor: "spidermonkey-js/processor",
|
||||
env: {
|
||||
// Disable all built-in environments.
|
||||
node: false,
|
||||
browser: false,
|
||||
builtin: false,
|
||||
|
||||
// We need to explicitly disable the default environments added from
|
||||
// "tools/lint/eslint/eslint-plugin-mozilla/lib/configs/recommended.js".
|
||||
es2021: false,
|
||||
"mozilla/privileged": false,
|
||||
"mozilla/specific": false,
|
||||
|
||||
// Enable SpiderMonkey's self-hosted environment.
|
||||
"spidermonkey-js/environment": true,
|
||||
},
|
||||
rules: {
|
||||
// We should fix those at some point, but we use this to detect NaNs.
|
||||
"no-self-compare": "off",
|
||||
"no-lonely-if": "off",
|
||||
// Disabled until we can use let/const to fix those erorrs, and undefined
|
||||
// names cause an exception and abort during runtime initialization.
|
||||
"no-redeclare": "off",
|
||||
// Disallow use of |void 0|. Instead use |undefined|.
|
||||
"no-void": ["error", { allowAsStatement: true }],
|
||||
// Disallow loose equality because of objects with the [[IsHTMLDDA]]
|
||||
// internal slot, aka |document.all|, aka "objects emulating undefined".
|
||||
eqeqeq: "error",
|
||||
// All self-hosted code is implicitly strict mode, so there's no need to
|
||||
// add a strict-mode directive.
|
||||
strict: ["error", "never"],
|
||||
// Disallow syntax not supported in self-hosted code.
|
||||
"no-restricted-syntax": [
|
||||
"error",
|
||||
{
|
||||
selector: "ClassDeclaration",
|
||||
message: "Class declarations are not allowed",
|
||||
},
|
||||
{
|
||||
selector: "ClassExpression",
|
||||
message: "Class expressions are not allowed",
|
||||
},
|
||||
{
|
||||
selector: "Literal[regex]",
|
||||
message: "Regular expression literals are not allowed",
|
||||
},
|
||||
{
|
||||
selector: "CallExpression > MemberExpression.callee",
|
||||
message:
|
||||
"Direct method calls are not allowed, use callFunction() or callContentFunction()",
|
||||
},
|
||||
{
|
||||
selector: "NewExpression > MemberExpression.callee",
|
||||
message:
|
||||
"Direct method calls are not allowed, use constructContentFunction()",
|
||||
},
|
||||
{
|
||||
selector: "YieldExpression[delegate=true]",
|
||||
message:
|
||||
"yield* is not allowed because it can run user-modifiable iteration code",
|
||||
},
|
||||
{
|
||||
selector: "ForOfStatement > :not(CallExpression).right",
|
||||
message:
|
||||
"for-of loops must use allowContentIter(), allowContentIterWith(), or allowContentIterWithNext()",
|
||||
},
|
||||
{
|
||||
selector:
|
||||
"ForOfStatement > CallExpression.right > :not(Identifier[name='allowContentIter'], Identifier[name='allowContentIterWith'], Identifier[name='allowContentIterWithNext']).callee",
|
||||
message:
|
||||
"for-of loops must use allowContentIter(), allowContentIterWith(), or allowContentIterWithNext",
|
||||
},
|
||||
{
|
||||
selector:
|
||||
"CallExpression[callee.name='TO_PROPERTY_KEY'] > :not(Identifier).arguments:first-child",
|
||||
message:
|
||||
"TO_PROPERTY_KEY macro must be called with a simple identifier",
|
||||
},
|
||||
{
|
||||
selector: "Identifier[name='arguments']",
|
||||
message:
|
||||
"'arguments' is disallowed, use ArgumentsLength(), GetArgument(n), or rest-parameters",
|
||||
},
|
||||
{
|
||||
selector: "VariableDeclaration[kind='let']",
|
||||
message:
|
||||
"'let' declarations are disallowed to avoid TDZ checks, use 'var' instead",
|
||||
},
|
||||
{
|
||||
selector: "VariableDeclaration[kind='const']",
|
||||
message:
|
||||
"'const' declarations are disallowed to avoid TDZ checks, use 'var' instead",
|
||||
},
|
||||
],
|
||||
// Method signatures are important in builtins so disable unused argument errors.
|
||||
"no-unused-vars": [
|
||||
"error",
|
||||
{
|
||||
args: "none",
|
||||
vars: "local",
|
||||
},
|
||||
],
|
||||
},
|
||||
|
||||
languageOptions: {
|
||||
parserOptions: {
|
||||
ecmaVersion: "latest",
|
||||
sourceType: "script",
|
||||
|
||||
// Self-hosted code defaults to strict mode.
|
||||
ecmaFeatures: {
|
||||
|
|
@ -45,93 +117,22 @@ module.exports = {
|
|||
},
|
||||
},
|
||||
|
||||
rules: {
|
||||
// We should fix those at some point, but we use this to detect NaNs.
|
||||
"no-self-compare": "off",
|
||||
"no-lonely-if": "off",
|
||||
// Disabled until we can use let/const to fix those erorrs, and undefined
|
||||
// names cause an exception and abort during runtime initialization.
|
||||
"no-redeclare": "off",
|
||||
// Disallow use of |void 0|. Instead use |undefined|.
|
||||
"no-void": ["error", { allowAsStatement: true }],
|
||||
// Disallow loose equality because of objects with the [[IsHTMLDDA]]
|
||||
// internal slot, aka |document.all|, aka "objects emulating undefined".
|
||||
eqeqeq: "error",
|
||||
// All self-hosted code is implicitly strict mode, so there's no need to
|
||||
// add a strict-mode directive.
|
||||
strict: ["error", "never"],
|
||||
// Disallow syntax not supported in self-hosted code.
|
||||
"no-restricted-syntax": [
|
||||
"error",
|
||||
{
|
||||
selector: "ClassDeclaration",
|
||||
message: "Class declarations are not allowed",
|
||||
},
|
||||
{
|
||||
selector: "ClassExpression",
|
||||
message: "Class expressions are not allowed",
|
||||
},
|
||||
{
|
||||
selector: "Literal[regex]",
|
||||
message: "Regular expression literals are not allowed",
|
||||
},
|
||||
{
|
||||
selector: "CallExpression > MemberExpression.callee",
|
||||
message:
|
||||
"Direct method calls are not allowed, use callFunction() or callContentFunction()",
|
||||
},
|
||||
{
|
||||
selector: "NewExpression > MemberExpression.callee",
|
||||
message:
|
||||
"Direct method calls are not allowed, use constructContentFunction()",
|
||||
},
|
||||
{
|
||||
selector: "YieldExpression[delegate=true]",
|
||||
message:
|
||||
"yield* is not allowed because it can run user-modifiable iteration code",
|
||||
},
|
||||
{
|
||||
selector: "ForOfStatement > :not(CallExpression).right",
|
||||
message:
|
||||
"for-of loops must use allowContentIter(), allowContentIterWith(), or allowContentIterWithNext()",
|
||||
},
|
||||
{
|
||||
selector:
|
||||
"ForOfStatement > CallExpression.right > :not(Identifier[name='allowContentIter'], Identifier[name='allowContentIterWith'], Identifier[name='allowContentIterWithNext']).callee",
|
||||
message:
|
||||
"for-of loops must use allowContentIter(), allowContentIterWith(), or allowContentIterWithNext",
|
||||
},
|
||||
{
|
||||
selector:
|
||||
"CallExpression[callee.name='TO_PROPERTY_KEY'] > :not(Identifier).arguments:first-child",
|
||||
message:
|
||||
"TO_PROPERTY_KEY macro must be called with a simple identifier",
|
||||
},
|
||||
{
|
||||
selector: "Identifier[name='arguments']",
|
||||
message:
|
||||
"'arguments' is disallowed, use ArgumentsLength(), GetArgument(n), or rest-parameters",
|
||||
},
|
||||
{
|
||||
selector: "VariableDeclaration[kind='let']",
|
||||
message: "'let' declarations are disallowed to avoid TDZ checks, use 'var' instead",
|
||||
},
|
||||
{
|
||||
selector: "VariableDeclaration[kind='const']",
|
||||
message: "'const' declarations are disallowed to avoid TDZ checks, use 'var' instead",
|
||||
},
|
||||
],
|
||||
// Method signatures are important in builtins so disable unused argument errors.
|
||||
"no-unused-vars": [
|
||||
"error",
|
||||
{
|
||||
args: "none",
|
||||
vars: "local",
|
||||
},
|
||||
],
|
||||
},
|
||||
|
||||
sourceType: "script",
|
||||
globals: {
|
||||
// Disable all built-in environments.
|
||||
...mozilla.turnOff(globals.node),
|
||||
...mozilla.turnOff(globals.browser),
|
||||
...mozilla.turnOff(globals.builtin),
|
||||
|
||||
// We need to explicitly disable the default environments added from
|
||||
// "tools/lint/eslint/eslint-plugin-mozilla/lib/configs/recommended.js".
|
||||
...mozilla.turnOff(globals.es2021),
|
||||
...mozilla.turnOff(mozilla.environments.privileged.globals),
|
||||
...mozilla.turnOff(mozilla.environments.specific.globals),
|
||||
|
||||
// Enable SpiderMonkey's self-hosted environment.
|
||||
...spidermonkeyJS.environments.environment.globals,
|
||||
|
||||
// The bytecode compiler special-cases these identifiers.
|
||||
ArgumentsLength: "readonly",
|
||||
allowContentIter: "readonly",
|
||||
|
|
@ -173,5 +174,5 @@ module.exports = {
|
|||
Tuple: "off",
|
||||
},
|
||||
},
|
||||
],
|
||||
};
|
||||
},
|
||||
];
|
||||
|
|
|
|||
|
|
@ -2,19 +2,15 @@
|
|||
* 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 config from "../../toolkit/components/extensions/parent/.eslintrc.mjs";
|
||||
|
||||
const {
|
||||
globals,
|
||||
} = require("../../toolkit/components/extensions/parent/.eslintrc.js");
|
||||
|
||||
module.exports = {
|
||||
overrides: [
|
||||
{
|
||||
files: ["components/extensions/ext-*.js"],
|
||||
excludedFiles: ["components/extensions/ext-c-*.js"],
|
||||
export default [
|
||||
{
|
||||
files: ["components/extensions/ext-*.js"],
|
||||
ignores: ["components/extensions/ext-c-*.js"],
|
||||
languageOptions: {
|
||||
globals: {
|
||||
...globals,
|
||||
...config[0].globals,
|
||||
// These globals are defined in ext-android.js and can only be used in
|
||||
// the extension files that run in the parent process.
|
||||
EventDispatcher: true,
|
||||
|
|
@ -25,49 +21,49 @@ module.exports = {
|
|||
windowTracker: true,
|
||||
},
|
||||
},
|
||||
{
|
||||
files: [
|
||||
"chrome/geckoview/**",
|
||||
"components/geckoview/**",
|
||||
"modules/geckoview/**",
|
||||
"actors/**",
|
||||
},
|
||||
{
|
||||
files: [
|
||||
"chrome/geckoview/**",
|
||||
"components/geckoview/**",
|
||||
"modules/geckoview/**",
|
||||
"actors/**",
|
||||
],
|
||||
rules: {
|
||||
"no-unused-vars": [
|
||||
"error",
|
||||
{
|
||||
argsIgnorePattern: "^_",
|
||||
vars: "local",
|
||||
varsIgnorePattern: "(debug|warn)",
|
||||
},
|
||||
],
|
||||
rules: {
|
||||
"no-unused-vars": [
|
||||
"error",
|
||||
{
|
||||
argsIgnorePattern: "^_",
|
||||
vars: "local",
|
||||
varsIgnorePattern: "(debug|warn)",
|
||||
},
|
||||
],
|
||||
"no-restricted-syntax": [
|
||||
"error",
|
||||
{
|
||||
selector: `CallExpression > \
|
||||
"no-restricted-syntax": [
|
||||
"error",
|
||||
{
|
||||
selector: `CallExpression > \
|
||||
Identifier.callee[name = /^debug$|^warn$/]`,
|
||||
message:
|
||||
"Use debug and warn with template literals, e.g. debug `foo`;",
|
||||
},
|
||||
{
|
||||
selector: `BinaryExpression[operator = '+'] > \
|
||||
message:
|
||||
"Use debug and warn with template literals, e.g. debug `foo`;",
|
||||
},
|
||||
{
|
||||
selector: `BinaryExpression[operator = '+'] > \
|
||||
TaggedTemplateExpression.left > \
|
||||
Identifier.tag[name = /^debug$|^warn$/]`,
|
||||
message:
|
||||
"Use only one template literal with debug/warn instead of concatenating multiple expressions,\n" +
|
||||
" e.g. (debug `foo ${42} bar`) instead of (debug `foo` + 42 + `bar`)",
|
||||
},
|
||||
{
|
||||
selector: `TaggedTemplateExpression[tag.type = 'Identifier'][tag.name = /^debug$|^warn$/] > \
|
||||
message:
|
||||
"Use only one template literal with debug/warn instead of concatenating multiple expressions,\n" +
|
||||
" e.g. (debug `foo ${42} bar`) instead of (debug `foo` + 42 + `bar`)",
|
||||
},
|
||||
{
|
||||
selector: `TaggedTemplateExpression[tag.type = 'Identifier'][tag.name = /^debug$|^warn$/] > \
|
||||
TemplateLiteral.quasi CallExpression > \
|
||||
MemberExpression.callee[object.type = 'Identifier'][object.name = 'JSON'] > \
|
||||
Identifier.property[name = 'stringify']`,
|
||||
message:
|
||||
"Don't call JSON.stringify within debug/warn literals,\n" +
|
||||
" e.g. (debug `foo=${foo}`) instead of (debug `foo=${JSON.stringify(foo)}`)",
|
||||
},
|
||||
],
|
||||
},
|
||||
message:
|
||||
"Don't call JSON.stringify within debug/warn literals,\n" +
|
||||
" e.g. (debug `foo=${foo}`) instead of (debug `foo=${JSON.stringify(foo)}`)",
|
||||
},
|
||||
],
|
||||
},
|
||||
],
|
||||
};
|
||||
},
|
||||
];
|
||||
|
|
|
|||
|
|
@ -2,75 +2,79 @@
|
|||
* 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 = {
|
||||
rules: {
|
||||
// Rules from the mozilla plugin
|
||||
"mozilla/balanced-listeners": "error",
|
||||
"mozilla/no-aArgs": "error",
|
||||
"mozilla/var-only-at-top-level": "error",
|
||||
export default [
|
||||
{
|
||||
plugins: { mozilla },
|
||||
|
||||
"valid-jsdoc": [
|
||||
"error",
|
||||
{
|
||||
prefer: {
|
||||
return: "returns",
|
||||
rules: {
|
||||
// Rules from the mozilla plugin
|
||||
"mozilla/balanced-listeners": "error",
|
||||
"mozilla/no-aArgs": "error",
|
||||
"mozilla/var-only-at-top-level": "error",
|
||||
|
||||
"valid-jsdoc": [
|
||||
"error",
|
||||
{
|
||||
prefer: {
|
||||
return: "returns",
|
||||
},
|
||||
preferType: {
|
||||
Boolean: "boolean",
|
||||
Number: "number",
|
||||
String: "string",
|
||||
bool: "boolean",
|
||||
},
|
||||
requireParamDescription: false,
|
||||
requireReturn: false,
|
||||
requireReturnDescription: false,
|
||||
},
|
||||
preferType: {
|
||||
Boolean: "boolean",
|
||||
Number: "number",
|
||||
String: "string",
|
||||
bool: "boolean",
|
||||
},
|
||||
requireParamDescription: false,
|
||||
requireReturn: false,
|
||||
requireReturnDescription: false,
|
||||
},
|
||||
],
|
||||
],
|
||||
|
||||
// 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",
|
||||
// No declaring variables that are never used
|
||||
"no-unused-vars": "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",
|
||||
// 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", { max: 26 }],
|
||||
// Warn about cyclomatic complexity in functions.
|
||||
complexity: ["error", { max: 26 }],
|
||||
|
||||
// Maximum depth callbacks can be nested.
|
||||
"max-nested-callbacks": ["error", 4],
|
||||
// Maximum depth callbacks can be nested.
|
||||
"max-nested-callbacks": ["error", 4],
|
||||
|
||||
// Allow the console API aside from console.log.
|
||||
"no-console": ["error", { allow: ["error", "info", "trace", "warn"] }],
|
||||
// Allow the console API aside from console.log.
|
||||
"no-console": ["error", { allow: ["error", "info", "trace", "warn"] }],
|
||||
|
||||
// Disallow fallthrough of case statements, except if there is a comment.
|
||||
"no-fallthrough": "error",
|
||||
// Disallow fallthrough of case statements, except if there is a comment.
|
||||
"no-fallthrough": "error",
|
||||
|
||||
// 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",
|
||||
|
||||
// Disallow usage of __proto__ property.
|
||||
"no-proto": "error",
|
||||
// Disallow usage of __proto__ property.
|
||||
"no-proto": "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",
|
||||
// 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",
|
||||
|
||||
// Require use of the second argument for parseInt().
|
||||
radix: "error",
|
||||
// Require use of the second argument for parseInt().
|
||||
radix: "error",
|
||||
|
||||
// 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"],
|
||||
|
||||
// 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",
|
||||
},
|
||||
},
|
||||
};
|
||||
];
|
||||
|
|
|
|||
|
|
@ -2,10 +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";
|
||||
import globals from "globals";
|
||||
|
||||
module.exports = {
|
||||
env: {
|
||||
webextensions: true,
|
||||
export default [
|
||||
{
|
||||
languageOptions: {
|
||||
globals: globals.webextensions,
|
||||
},
|
||||
},
|
||||
};
|
||||
];
|
||||
|
|
|
|||
|
|
@ -2,10 +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";
|
||||
import globals from "globals";
|
||||
|
||||
module.exports = {
|
||||
env: {
|
||||
webextensions: true,
|
||||
export default [
|
||||
{
|
||||
languageOptions: {
|
||||
globals: globals.webextensions,
|
||||
},
|
||||
},
|
||||
};
|
||||
];
|
||||
|
|
|
|||
|
|
@ -2,14 +2,16 @@
|
|||
* 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 = {
|
||||
globals: {
|
||||
Bookmarks: false,
|
||||
EnableEngines: false,
|
||||
Passwords: false,
|
||||
Phase: false,
|
||||
Sync: false,
|
||||
export default [
|
||||
{
|
||||
languageOptions: {
|
||||
globals: {
|
||||
Bookmarks: false,
|
||||
EnableEngines: false,
|
||||
Passwords: false,
|
||||
Phase: false,
|
||||
Sync: false,
|
||||
},
|
||||
},
|
||||
},
|
||||
};
|
||||
];
|
||||
|
|
|
|||
|
|
@ -1,14 +1,20 @@
|
|||
"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,
|
||||
ExtensionAPI: true,
|
||||
// available to frameScripts
|
||||
addMessageListener: false,
|
||||
content: false,
|
||||
sendAsyncMessage: false,
|
||||
},
|
||||
},
|
||||
},
|
||||
globals: {
|
||||
ExtensionAPI: true,
|
||||
// available to frameScripts
|
||||
addMessageListener: false,
|
||||
content: false,
|
||||
sendAsyncMessage: false,
|
||||
},
|
||||
};
|
||||
];
|
||||
|
|
|
|||
|
|
@ -2,53 +2,49 @@
|
|||
* 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 = {
|
||||
overrides: [
|
||||
{
|
||||
files: [
|
||||
"chrome/geckoview/**",
|
||||
"components/geckoview/**",
|
||||
"modules/geckoview/**",
|
||||
"actors/**",
|
||||
export default [
|
||||
{
|
||||
files: [
|
||||
"chrome/geckoview/**",
|
||||
"components/geckoview/**",
|
||||
"modules/geckoview/**",
|
||||
"actors/**",
|
||||
],
|
||||
rules: {
|
||||
"no-unused-vars": [
|
||||
"error",
|
||||
{
|
||||
args: "none",
|
||||
vars: "local",
|
||||
varsIgnorePattern: "(debug|warn)",
|
||||
},
|
||||
],
|
||||
rules: {
|
||||
"no-unused-vars": [
|
||||
"error",
|
||||
{
|
||||
args: "none",
|
||||
vars: "local",
|
||||
varsIgnorePattern: "(debug|warn)",
|
||||
},
|
||||
],
|
||||
"no-restricted-syntax": [
|
||||
"error",
|
||||
{
|
||||
selector: `CallExpression > \
|
||||
"no-restricted-syntax": [
|
||||
"error",
|
||||
{
|
||||
selector: `CallExpression > \
|
||||
Identifier.callee[name = /^debug$|^warn$/]`,
|
||||
message:
|
||||
"Use debug and warn with template literals, e.g. debug `foo`;",
|
||||
},
|
||||
{
|
||||
selector: `BinaryExpression[operator = '+'] > \
|
||||
message:
|
||||
"Use debug and warn with template literals, e.g. debug `foo`;",
|
||||
},
|
||||
{
|
||||
selector: `BinaryExpression[operator = '+'] > \
|
||||
TaggedTemplateExpression.left > \
|
||||
Identifier.tag[name = /^debug$|^warn$/]`,
|
||||
message:
|
||||
"Use only one template literal with debug/warn instead of concatenating multiple expressions,\n" +
|
||||
" e.g. (debug `foo ${42} bar`) instead of (debug `foo` + 42 + `bar`)",
|
||||
},
|
||||
{
|
||||
selector: `TaggedTemplateExpression[tag.type = 'Identifier'][tag.name = /^debug$|^warn$/] > \
|
||||
message:
|
||||
"Use only one template literal with debug/warn instead of concatenating multiple expressions,\n" +
|
||||
" e.g. (debug `foo ${42} bar`) instead of (debug `foo` + 42 + `bar`)",
|
||||
},
|
||||
{
|
||||
selector: `TaggedTemplateExpression[tag.type = 'Identifier'][tag.name = /^debug$|^warn$/] > \
|
||||
TemplateLiteral.quasi CallExpression > \
|
||||
MemberExpression.callee[object.type = 'Identifier'][object.name = 'JSON'] > \
|
||||
Identifier.property[name = 'stringify']`,
|
||||
message:
|
||||
"Don't call JSON.stringify within debug/warn literals,\n" +
|
||||
" e.g. (debug `foo=${foo}`) instead of (debug `foo=${JSON.stringify(foo)}`)",
|
||||
},
|
||||
],
|
||||
},
|
||||
message:
|
||||
"Don't call JSON.stringify within debug/warn literals,\n" +
|
||||
" e.g. (debug `foo=${foo}`) instead of (debug `foo=${JSON.stringify(foo)}`)",
|
||||
},
|
||||
],
|
||||
},
|
||||
],
|
||||
};
|
||||
},
|
||||
];
|
||||
|
|
|
|||
|
|
@ -2,28 +2,22 @@
|
|||
* 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 toolkitConfig from "../../../../toolkit/components/extensions/.eslintrc.mjs";
|
||||
import parentConfig from "../../../../toolkit/components/extensions/parent/.eslintrc.mjs";
|
||||
import childConfig from "../../../../toolkit/components/extensions/child/.eslintrc.mjs";
|
||||
|
||||
const {
|
||||
globals: globalsParent,
|
||||
} = require("../../../../toolkit/components/extensions/parent/.eslintrc.js");
|
||||
|
||||
const {
|
||||
globals: globalsChild,
|
||||
} = require("../../../../toolkit/components/extensions/child/.eslintrc.js");
|
||||
|
||||
module.exports = {
|
||||
extends: "../../../../toolkit/components/extensions/.eslintrc.js",
|
||||
export default [
|
||||
...toolkitConfig,
|
||||
// Ideally mobile should also follow the convention of
|
||||
// parent/ext-*.js for parent scripts and
|
||||
// child/ext-*.js for child scripts,
|
||||
// but the current file structure predates the parent/ vs child/ separation.
|
||||
overrides: [
|
||||
{
|
||||
files: ["ext-*.js"],
|
||||
excludedFiles: ["ext-c-*.js"],
|
||||
{
|
||||
files: ["ext-*.js"],
|
||||
ignores: ["ext-c-*.js"],
|
||||
languageOptions: {
|
||||
globals: {
|
||||
...globalsParent,
|
||||
...parentConfig[0].languageOptions.globals,
|
||||
// These globals are defined in ext-android.js and can only be used in
|
||||
// the extension files that run in the parent process.
|
||||
EventDispatcher: true,
|
||||
|
|
@ -34,13 +28,11 @@ module.exports = {
|
|||
windowTracker: true,
|
||||
},
|
||||
},
|
||||
{
|
||||
files: ["ext-c-*.js"],
|
||||
globals: {
|
||||
...globalsChild,
|
||||
// If there were ever globals exported in ext-c-android.js for common
|
||||
// use, then they would appear here.
|
||||
},
|
||||
},
|
||||
],
|
||||
};
|
||||
},
|
||||
{
|
||||
files: ["ext-c-*.js"],
|
||||
// If there were ever globals exported in ext-c-android.js for common
|
||||
// use, then they would appear here.
|
||||
...childConfig[0],
|
||||
},
|
||||
];
|
||||
|
|
|
|||
|
|
@ -1,6 +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 = {
|
||||
extends:
|
||||
"../../../../../../toolkit/components/extensions/test/mochitest/.eslintrc.js",
|
||||
};
|
||||
import config from "../../../../../../toolkit/components/extensions/test/mochitest/.eslintrc.mjs";
|
||||
|
||||
export default config;
|
||||
|
|
|
|||
|
|
@ -1,6 +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 = {
|
||||
extends:
|
||||
"../../../../../../toolkit/components/extensions/test/xpcshell/.eslintrc.js",
|
||||
};
|
||||
import config from "../../../../../../toolkit/components/extensions/test/xpcshell/.eslintrc.mjs";
|
||||
|
||||
export default config;
|
||||
|
|
|
|||
|
|
@ -2,11 +2,16 @@
|
|||
* 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 globals from "globals";
|
||||
|
||||
module.exports = {
|
||||
env: {
|
||||
browser: true,
|
||||
node: true,
|
||||
export default [
|
||||
{
|
||||
files: ["**/*.js"],
|
||||
languageOptions: {
|
||||
globals: {
|
||||
...globals.browser,
|
||||
...globals.node,
|
||||
},
|
||||
},
|
||||
},
|
||||
};
|
||||
];
|
||||
|
|
|
|||
|
|
@ -2,13 +2,13 @@
|
|||
* 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";
|
||||
|
||||
// inherits from ../../tools/lint/eslint/eslint-plugin-mozilla/lib/configs/recommended.js
|
||||
|
||||
module.exports = {
|
||||
rules: {
|
||||
camelcase: ["error", { properties: "never" }],
|
||||
"no-var": "error",
|
||||
export default [
|
||||
{
|
||||
rules: {
|
||||
camelcase: ["error", { properties: "never" }],
|
||||
"no-var": "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: {
|
||||
camelcase: "off",
|
||||
export default [
|
||||
{
|
||||
rules: {
|
||||
camelcase: "off",
|
||||
},
|
||||
},
|
||||
};
|
||||
];
|
||||
|
|
|
|||
|
|
@ -2,45 +2,45 @@
|
|||
* 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: {
|
||||
// Enforce return statements in callbacks of array methods.
|
||||
"array-callback-return": "error",
|
||||
|
||||
module.exports = {
|
||||
rules: {
|
||||
// Enforce return statements in callbacks of array methods.
|
||||
"array-callback-return": "error",
|
||||
// Require default case in switch statements.
|
||||
"default-case": "error",
|
||||
|
||||
// Require default case in switch statements.
|
||||
"default-case": "error",
|
||||
// Disallow use of alert(), confirm(), and prompt().
|
||||
"no-alert": "error",
|
||||
|
||||
// Disallow use of alert(), confirm(), and prompt().
|
||||
"no-alert": "error",
|
||||
// Disallow likely erroneous `switch` scoped lexical declarations in
|
||||
// case/default clauses.
|
||||
"no-case-declarations": "error",
|
||||
|
||||
// Disallow likely erroneous `switch` scoped lexical declarations in
|
||||
// case/default clauses.
|
||||
"no-case-declarations": "error",
|
||||
// Disallow constant expressions in conditions (except for loops).
|
||||
"no-constant-condition": ["error", { checkLoops: false }],
|
||||
|
||||
// Disallow constant expressions in conditions (except for loops).
|
||||
"no-constant-condition": ["error", { checkLoops: false }],
|
||||
// Disallow extending of native objects.
|
||||
"no-extend-native": "error",
|
||||
|
||||
// Disallow extending of native objects.
|
||||
"no-extend-native": "error",
|
||||
// Disallow use of assignment in return statement.
|
||||
"no-return-assign": ["error", "always"],
|
||||
|
||||
// Disallow use of assignment in return statement.
|
||||
"no-return-assign": ["error", "always"],
|
||||
// Disallow template literal placeholder syntax in regular strings.
|
||||
"no-template-curly-in-string": "error",
|
||||
|
||||
// Disallow template literal placeholder syntax in regular strings.
|
||||
"no-template-curly-in-string": "error",
|
||||
// Disallow unmodified loop conditions.
|
||||
"no-unmodified-loop-condition": "error",
|
||||
|
||||
// Disallow unmodified loop conditions.
|
||||
"no-unmodified-loop-condition": "error",
|
||||
// No expressions where a statement is expected
|
||||
"no-unused-expressions": "error",
|
||||
|
||||
// No expressions where a statement is expected
|
||||
"no-unused-expressions": "error",
|
||||
// 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"],
|
||||
|
||||
// Disallow Yoda conditions.
|
||||
yoda: ["error", "never"],
|
||||
// Disallow Yoda conditions.
|
||||
yoda: ["error", "never"],
|
||||
},
|
||||
},
|
||||
};
|
||||
];
|
||||
|
|
|
|||
|
|
@ -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: {
|
||||
// Disallow non-top level |var| declarations.
|
||||
"mozilla/var-only-at-top-level": "error",
|
||||
export default [
|
||||
{
|
||||
rules: {
|
||||
// Disallow non-top level |var| declarations.
|
||||
"mozilla/var-only-at-top-level": "error",
|
||||
},
|
||||
},
|
||||
};
|
||||
];
|
||||
|
|
|
|||
|
|
@ -2,12 +2,14 @@
|
|||
* 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 = {
|
||||
globals: {
|
||||
// JS files in this folder are commonly xpcshell scripts where |arguments|
|
||||
// is defined in the global scope.
|
||||
arguments: false,
|
||||
export default [
|
||||
{
|
||||
languageOptions: {
|
||||
globals: {
|
||||
// JS files in this folder are commonly xpcshell scripts where |arguments|
|
||||
// is defined in the global scope.
|
||||
arguments: false,
|
||||
},
|
||||
},
|
||||
},
|
||||
};
|
||||
];
|
||||
|
|
|
|||
|
|
@ -1,28 +1,34 @@
|
|||
"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: {
|
||||
// Injected into tests via tps.sys.mjs
|
||||
Addons: false,
|
||||
Addresses: false,
|
||||
Bookmarks: false,
|
||||
CreditCards: false,
|
||||
EnableEngines: false,
|
||||
EnsureTracking: false,
|
||||
ExtStorage: false,
|
||||
Formdata: false,
|
||||
History: false,
|
||||
Login: false,
|
||||
Passwords: false,
|
||||
Phase: false,
|
||||
Prefs: false,
|
||||
STATE_DISABLED: false,
|
||||
STATE_ENABLED: false,
|
||||
Sync: false,
|
||||
SYNC_WIPE_CLIENT: false,
|
||||
SYNC_WIPE_REMOTE: false,
|
||||
Tabs: false,
|
||||
Windows: false,
|
||||
WipeServer: false,
|
||||
export default [
|
||||
{
|
||||
languageOptions: {
|
||||
globals: {
|
||||
// Injected into tests via tps.sys.mjs
|
||||
Addons: false,
|
||||
Addresses: false,
|
||||
Bookmarks: false,
|
||||
CreditCards: false,
|
||||
EnableEngines: false,
|
||||
EnsureTracking: false,
|
||||
ExtStorage: false,
|
||||
Formdata: false,
|
||||
History: false,
|
||||
Login: false,
|
||||
Passwords: false,
|
||||
Phase: false,
|
||||
Prefs: false,
|
||||
STATE_DISABLED: false,
|
||||
STATE_ENABLED: false,
|
||||
Sync: false,
|
||||
SYNC_WIPE_CLIENT: false,
|
||||
SYNC_WIPE_REMOTE: false,
|
||||
Tabs: false,
|
||||
Windows: false,
|
||||
WipeServer: false,
|
||||
},
|
||||
},
|
||||
},
|
||||
};
|
||||
];
|
||||
|
|
|
|||
|
|
@ -2,10 +2,10 @@
|
|||
* 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 globals from "globals";
|
||||
|
||||
module.exports = {
|
||||
env: {
|
||||
node: true,
|
||||
export default [
|
||||
{
|
||||
languageOptions: { globals: globals.node },
|
||||
},
|
||||
};
|
||||
];
|
||||
|
|
|
|||
|
|
@ -2,50 +2,52 @@
|
|||
* 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: {
|
||||
// JS files in this folder are commonly xpcshell scripts where |arguments|
|
||||
// is defined in the global scope.
|
||||
arguments: false,
|
||||
},
|
||||
},
|
||||
rules: {
|
||||
// Enforce return statements in callbacks of array methods.
|
||||
"array-callback-return": "error",
|
||||
|
||||
module.exports = {
|
||||
globals: {
|
||||
// JS files in this folder are commonly xpcshell scripts where |arguments|
|
||||
// is defined in the global scope.
|
||||
arguments: false,
|
||||
// Require default case in switch statements.
|
||||
"default-case": "error",
|
||||
|
||||
// Disallow use of alert(), confirm(), and prompt().
|
||||
"no-alert": "error",
|
||||
|
||||
// Disallow likely erroneous `switch` scoped lexical declarations in
|
||||
// case/default clauses.
|
||||
"no-case-declarations": "error",
|
||||
|
||||
// Disallow constant expressions in conditions (except for loops).
|
||||
"no-constant-condition": ["error", { checkLoops: false }],
|
||||
|
||||
// Disallow extending of native objects.
|
||||
"no-extend-native": "error",
|
||||
|
||||
// Disallow use of assignment in return statement.
|
||||
"no-return-assign": ["error", "always"],
|
||||
|
||||
// Disallow template literal placeholder syntax in regular strings.
|
||||
"no-template-curly-in-string": "error",
|
||||
|
||||
// Disallow unmodified loop conditions.
|
||||
"no-unmodified-loop-condition": "error",
|
||||
|
||||
// No expressions where a statement is expected
|
||||
"no-unused-expressions": "error",
|
||||
|
||||
// Require "use strict" to be defined globally in the script.
|
||||
strict: ["error", "global"],
|
||||
|
||||
// Disallow Yoda conditions.
|
||||
yoda: ["error", "never"],
|
||||
},
|
||||
},
|
||||
rules: {
|
||||
// Enforce return statements in callbacks of array methods.
|
||||
"array-callback-return": "error",
|
||||
|
||||
// Require default case in switch statements.
|
||||
"default-case": "error",
|
||||
|
||||
// Disallow use of alert(), confirm(), and prompt().
|
||||
"no-alert": "error",
|
||||
|
||||
// Disallow likely erroneous `switch` scoped lexical declarations in
|
||||
// case/default clauses.
|
||||
"no-case-declarations": "error",
|
||||
|
||||
// Disallow constant expressions in conditions (except for loops).
|
||||
"no-constant-condition": ["error", { checkLoops: false }],
|
||||
|
||||
// Disallow extending of native objects.
|
||||
"no-extend-native": "error",
|
||||
|
||||
// Disallow use of assignment in return statement.
|
||||
"no-return-assign": ["error", "always"],
|
||||
|
||||
// Disallow template literal placeholder syntax in regular strings.
|
||||
"no-template-curly-in-string": "error",
|
||||
|
||||
// Disallow unmodified loop conditions.
|
||||
"no-unmodified-loop-condition": "error",
|
||||
|
||||
// No expressions where a statement is expected
|
||||
"no-unused-expressions": "error",
|
||||
|
||||
// Require "use strict" to be defined globally in the script.
|
||||
strict: ["error", "global"],
|
||||
|
||||
// Disallow Yoda conditions.
|
||||
yoda: ["error", "never"],
|
||||
},
|
||||
};
|
||||
];
|
||||
|
|
|
|||
|
|
@ -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 = {
|
||||
globals: {
|
||||
user_pref: true,
|
||||
export default [
|
||||
{
|
||||
languageOptions: {
|
||||
globals: {
|
||||
user_pref: true,
|
||||
},
|
||||
},
|
||||
},
|
||||
};
|
||||
];
|
||||
|
|
|
|||
|
|
@ -2,11 +2,15 @@
|
|||
* 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 globals from "globals";
|
||||
|
||||
module.exports = {
|
||||
env: {
|
||||
browser: true,
|
||||
node: true,
|
||||
export default [
|
||||
{
|
||||
languageOptions: {
|
||||
globals: {
|
||||
...globals.browser,
|
||||
...globals.node,
|
||||
},
|
||||
},
|
||||
},
|
||||
};
|
||||
];
|
||||
|
|
|
|||
|
|
@ -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";
|
||||
import globals from "globals";
|
||||
import mozilla from "eslint-plugin-mozilla";
|
||||
|
||||
module.exports = {
|
||||
env: {
|
||||
webextensions: true,
|
||||
export default [
|
||||
{
|
||||
languageOptions: {
|
||||
globals: {
|
||||
...globals.webextensions,
|
||||
getTestConfig: false,
|
||||
startMark: true,
|
||||
endMark: true,
|
||||
name: true,
|
||||
},
|
||||
},
|
||||
plugins: { mozilla },
|
||||
rules: {
|
||||
"mozilla/avoid-Date-timing": "error",
|
||||
},
|
||||
},
|
||||
|
||||
globals: {
|
||||
getTestConfig: false,
|
||||
startMark: true,
|
||||
endMark: true,
|
||||
name: true,
|
||||
},
|
||||
|
||||
plugins: ["mozilla"],
|
||||
|
||||
rules: {
|
||||
"mozilla/avoid-Date-timing": "error",
|
||||
},
|
||||
};
|
||||
];
|
||||
|
|
|
|||
|
|
@ -2,35 +2,38 @@
|
|||
* 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 = {
|
||||
globals: {
|
||||
Cc: false,
|
||||
Ci: false,
|
||||
Cu: false,
|
||||
content: true,
|
||||
dumpLog: false,
|
||||
netscape: false,
|
||||
addMessageListener: false,
|
||||
goQuitApplication: false,
|
||||
MozillaFileLogger: false,
|
||||
Profiler: true,
|
||||
Services: false,
|
||||
gBrowser: false,
|
||||
removeMessageListener: false,
|
||||
sendAsyncMessage: false,
|
||||
sendSyncMessage: false,
|
||||
TalosPowersContent: true,
|
||||
TalosPowersParent: true,
|
||||
TalosContentProfiler: true,
|
||||
TalosParentProfiler: true,
|
||||
tpRecordTime: true,
|
||||
export default [
|
||||
{
|
||||
languageOptions: {
|
||||
globals: {
|
||||
Cc: false,
|
||||
Ci: false,
|
||||
Cu: false,
|
||||
content: true,
|
||||
dumpLog: false,
|
||||
netscape: false,
|
||||
addMessageListener: false,
|
||||
goQuitApplication: false,
|
||||
MozillaFileLogger: false,
|
||||
Profiler: true,
|
||||
Services: false,
|
||||
gBrowser: false,
|
||||
removeMessageListener: false,
|
||||
sendAsyncMessage: false,
|
||||
sendSyncMessage: false,
|
||||
TalosPowersContent: true,
|
||||
TalosPowersParent: true,
|
||||
TalosContentProfiler: true,
|
||||
TalosParentProfiler: true,
|
||||
tpRecordTime: true,
|
||||
},
|
||||
},
|
||||
plugins: { mozilla },
|
||||
|
||||
rules: {
|
||||
"mozilla/avoid-Date-timing": "error",
|
||||
},
|
||||
},
|
||||
|
||||
plugins: ["mozilla"],
|
||||
|
||||
rules: {
|
||||
"mozilla/avoid-Date-timing": "error",
|
||||
},
|
||||
};
|
||||
];
|
||||
|
|
|
|||
|
|
@ -1,26 +1,34 @@
|
|||
"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 = {
|
||||
plugins: ["react"],
|
||||
globals: {
|
||||
exports: true,
|
||||
isWorker: true,
|
||||
loader: true,
|
||||
module: true,
|
||||
reportError: true,
|
||||
require: true,
|
||||
dampWindow: true,
|
||||
},
|
||||
rules: {
|
||||
"no-unused-vars": ["error", { argsIgnorePattern: "^_", vars: "all" }],
|
||||
// These are the rules that have been configured so far to match the
|
||||
// devtools coding style.
|
||||
import mozilla from "eslint-plugin-mozilla";
|
||||
|
||||
// Rules from the mozilla plugin
|
||||
"mozilla/no-aArgs": "error",
|
||||
"mozilla/no-define-cc-etc": "off",
|
||||
// See bug 1224289.
|
||||
"mozilla/reject-importGlobalProperties": ["error", "everything"],
|
||||
"mozilla/var-only-at-top-level": "error",
|
||||
export default [
|
||||
{
|
||||
plugins: { mozilla },
|
||||
languageOptions: {
|
||||
globals: {
|
||||
exports: true,
|
||||
isWorker: true,
|
||||
loader: true,
|
||||
module: true,
|
||||
reportError: true,
|
||||
require: true,
|
||||
dampWindow: true,
|
||||
},
|
||||
},
|
||||
rules: {
|
||||
"no-unused-vars": ["error", { argsIgnorePattern: "^_", vars: "all" }],
|
||||
// These are the rules that have been configured so far to match the
|
||||
// devtools coding style.
|
||||
|
||||
// Rules from the mozilla plugin
|
||||
"mozilla/no-aArgs": "error",
|
||||
"mozilla/no-define-cc-etc": "off",
|
||||
// See bug 1224289.
|
||||
"mozilla/reject-importGlobalProperties": ["error", "everything"],
|
||||
"mozilla/var-only-at-top-level": "error",
|
||||
},
|
||||
},
|
||||
};
|
||||
];
|
||||
|
|
|
|||
|
|
@ -1,5 +1,11 @@
|
|||
{
|
||||
"rules": {
|
||||
"no-undef": "off"
|
||||
}
|
||||
}
|
||||
/* 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/. */
|
||||
|
||||
export default [
|
||||
{
|
||||
rules: {
|
||||
"no-undef": "off",
|
||||
},
|
||||
},
|
||||
];
|
||||
|
|
|
|||
|
|
@ -1,5 +1,11 @@
|
|||
{
|
||||
"rules": {
|
||||
"no-undef": "off"
|
||||
}
|
||||
}
|
||||
/* 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/. */
|
||||
|
||||
export default [
|
||||
{
|
||||
rules: {
|
||||
"no-undef": "off",
|
||||
},
|
||||
},
|
||||
];
|
||||
|
|
|
|||
|
|
@ -2,29 +2,38 @@
|
|||
* 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 globals from "globals";
|
||||
import eslintPlugin from "eslint-plugin-eslint-plugin";
|
||||
|
||||
module.exports = {
|
||||
plugins: ["eslint-plugin"],
|
||||
extends: ["plugin:eslint-plugin/recommended"],
|
||||
// eslint-plugin-mozilla runs under node, so we need a more restrictive
|
||||
// environment / parser setup here than the rest of mozilla-central.
|
||||
env: {
|
||||
browser: false,
|
||||
node: true,
|
||||
},
|
||||
parser: "espree",
|
||||
parserOptions: {
|
||||
// This should match with the minimum node version that the ESLint CI
|
||||
// process uses (check the linux64-node toolchain).
|
||||
ecmaVersion: 12,
|
||||
},
|
||||
export default [
|
||||
{
|
||||
...eslintPlugin.configs["flat/recommended"],
|
||||
languageOptions: {
|
||||
globals: globals.node,
|
||||
parserOptions: {
|
||||
// This should match with the minimum node version that the ESLint CI
|
||||
// process uses (check the linux64-node toolchain).
|
||||
ecmaVersion: 12,
|
||||
},
|
||||
},
|
||||
|
||||
rules: {
|
||||
camelcase: ["error", { properties: "never" }],
|
||||
"handle-callback-err": ["error", "er"],
|
||||
"no-undef-init": "error",
|
||||
"one-var": ["error", "never"],
|
||||
strict: ["error", "global"],
|
||||
rules: {
|
||||
camelcase: ["error", { properties: "never" }],
|
||||
"handle-callback-err": ["error", "er"],
|
||||
"no-undef-init": "error",
|
||||
"one-var": ["error", "never"],
|
||||
strict: ["error", "global"],
|
||||
},
|
||||
},
|
||||
};
|
||||
{
|
||||
files: ["eslint-plugin-mozilla/scripts/createExports.js"],
|
||||
languageOptions: {
|
||||
sourceType: "script",
|
||||
parserOptions: {
|
||||
ecmaFeatures: {
|
||||
globalReturn: true,
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
];
|
||||
|
|
|
|||
|
|
@ -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: {
|
||||
// Require object keys to be sorted.
|
||||
"sort-keys": "error",
|
||||
export default [
|
||||
{
|
||||
rules: {
|
||||
// Require object keys to be sorted.
|
||||
"sort-keys": "error",
|
||||
},
|
||||
},
|
||||
};
|
||||
];
|
||||
|
|
|
|||
|
|
@ -1,5 +1,3 @@
|
|||
|
||||
// Dot file to verify that it works
|
||||
// without license
|
||||
|
||||
"use strict";
|
||||
|
|
|
|||
|
|
@ -2,15 +2,17 @@
|
|||
* 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 globals from "globals";
|
||||
|
||||
module.exports = {
|
||||
env: {
|
||||
jquery: true,
|
||||
export default [
|
||||
{
|
||||
languageOptions: {
|
||||
globals: {
|
||||
...globals.jquery,
|
||||
apply: true,
|
||||
applyChunks: true,
|
||||
tasks: true,
|
||||
},
|
||||
},
|
||||
},
|
||||
globals: {
|
||||
apply: true,
|
||||
applyChunks: true,
|
||||
tasks: true,
|
||||
},
|
||||
};
|
||||
];
|
||||
|
|
|
|||
|
|
@ -2,17 +2,19 @@
|
|||
* 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 eslintPlugin from "eslint-plugin-eslint-plugin";
|
||||
import globals from "globals";
|
||||
|
||||
module.exports = {
|
||||
plugins: ["eslint-plugin"],
|
||||
extends: ["plugin:eslint-plugin/recommended"],
|
||||
env: {
|
||||
browser: false,
|
||||
node: true,
|
||||
export default [
|
||||
{
|
||||
plugins: { "eslint-plugin": eslintPlugin },
|
||||
...eslintPlugin.configs["flat/recommended"],
|
||||
languageOptions: {
|
||||
globals: { ...globals.browser, ...globals.node },
|
||||
},
|
||||
rules: {
|
||||
"no-console": "off",
|
||||
strict: ["error", "global"],
|
||||
},
|
||||
},
|
||||
rules: {
|
||||
"no-console": "off",
|
||||
strict: ["error", "global"],
|
||||
},
|
||||
};
|
||||
];
|
||||
|
|
|
|||
Loading…
Reference in a new issue