Bug 1881701 - Change new .eslintrc.mjs files to modules (toolkit/), and export as flat config. r=frontend-codestyle-reviewers,extension-reviewers,credential-management-reviewers,Gijs,mossop,dimi,robwu
Differential Revision: https://phabricator.services.mozilla.com/D249950
This commit is contained in:
committed by
mbanner@mozilla.com
parent
4529a8e15d
commit
876c545813
@@ -2,12 +2,12 @@
|
|||||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||||
|
|
||||||
"use strict";
|
export default [
|
||||||
|
{
|
||||||
module.exports = {
|
|
||||||
rules: {
|
rules: {
|
||||||
// XXX Bug 1326071 - This should be reduced down - probably to 20 or to
|
// XXX Bug 1326071 - This should be reduced down - probably to 20 or to
|
||||||
// be removed & synced with the mozilla/recommended value.
|
// be removed & synced with the mozilla/recommended value.
|
||||||
complexity: ["error", 45],
|
complexity: ["error", 45],
|
||||||
},
|
},
|
||||||
};
|
},
|
||||||
|
];
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
"use strict";
|
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||||
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||||
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||||
|
|
||||||
module.exports = {
|
import globals from "globals";
|
||||||
env: {
|
|
||||||
webextensions: true,
|
export default [{ languageOptions: { globals: globals.webextensions } }];
|
||||||
},
|
|
||||||
};
|
|
||||||
|
|||||||
@@ -2,9 +2,8 @@
|
|||||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||||
|
|
||||||
"use strict";
|
export default [
|
||||||
|
{
|
||||||
module.exports = {
|
|
||||||
rules: {
|
rules: {
|
||||||
// Rules from the mozilla plugin
|
// Rules from the mozilla plugin
|
||||||
"mozilla/balanced-listeners": "error",
|
"mozilla/balanced-listeners": "error",
|
||||||
@@ -194,8 +193,7 @@ module.exports = {
|
|||||||
// Disallow labels that share a name with a variable
|
// Disallow labels that share a name with a variable
|
||||||
"no-label-var": "error",
|
"no-label-var": "error",
|
||||||
},
|
},
|
||||||
|
},
|
||||||
overrides: [
|
|
||||||
{
|
{
|
||||||
files: "test/xpcshell/head*.js",
|
files: "test/xpcshell/head*.js",
|
||||||
rules: {
|
rules: {
|
||||||
@@ -208,5 +206,4 @@ module.exports = {
|
|||||||
],
|
],
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
],
|
];
|
||||||
};
|
|
||||||
|
|||||||
@@ -2,9 +2,9 @@
|
|||||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||||
|
|
||||||
"use strict";
|
export default [
|
||||||
|
{
|
||||||
module.exports = {
|
languageOptions: {
|
||||||
globals: {
|
globals: {
|
||||||
// These are defined in the WebExtension script scopes by
|
// These are defined in the WebExtension script scopes by
|
||||||
// ExtensionCommon.sys.mjs in the _createExtGlobal method.
|
// ExtensionCommon.sys.mjs in the _createExtGlobal method.
|
||||||
@@ -37,4 +37,6 @@ module.exports = {
|
|||||||
// This is defined in toolkit/components/extensions/child/ext-toolkit.js
|
// This is defined in toolkit/components/extensions/child/ext-toolkit.js
|
||||||
EventManager: true,
|
EventManager: true,
|
||||||
},
|
},
|
||||||
};
|
},
|
||||||
|
},
|
||||||
|
];
|
||||||
|
|||||||
@@ -2,9 +2,9 @@
|
|||||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||||
|
|
||||||
"use strict";
|
export default [
|
||||||
|
{
|
||||||
module.exports = {
|
languageOptions: {
|
||||||
globals: {
|
globals: {
|
||||||
// These are defined in the WebExtension script scopes by
|
// These are defined in the WebExtension script scopes by
|
||||||
// ExtensionCommon.sys.mjs in the _createExtGlobal method.
|
// ExtensionCommon.sys.mjs in the _createExtGlobal method.
|
||||||
@@ -58,4 +58,6 @@ module.exports = {
|
|||||||
isPrivateCookieStoreId: true,
|
isPrivateCookieStoreId: true,
|
||||||
isValidCookieStoreId: true,
|
isValidCookieStoreId: true,
|
||||||
},
|
},
|
||||||
};
|
},
|
||||||
|
},
|
||||||
|
];
|
||||||
|
|||||||
@@ -1,7 +1,13 @@
|
|||||||
"use strict";
|
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||||
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||||
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||||
|
|
||||||
module.exports = {
|
import globals from "globals";
|
||||||
env: {
|
|
||||||
webextensions: true,
|
export default [
|
||||||
|
{
|
||||||
|
languageOptions: {
|
||||||
|
globals: globals.webextensions,
|
||||||
},
|
},
|
||||||
};
|
},
|
||||||
|
];
|
||||||
|
|||||||
@@ -1,8 +1,13 @@
|
|||||||
"use strict";
|
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||||
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||||
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||||
|
|
||||||
module.exports = {
|
import globals from "globals";
|
||||||
env: {
|
|
||||||
browser: true,
|
export default [
|
||||||
webextensions: true,
|
{
|
||||||
|
languageOptions: {
|
||||||
|
globals: globals.webextensions,
|
||||||
},
|
},
|
||||||
};
|
},
|
||||||
|
];
|
||||||
|
|||||||
@@ -1,13 +1,21 @@
|
|||||||
"use strict";
|
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||||
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||||
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||||
|
|
||||||
module.exports = {
|
import globals from "globals";
|
||||||
env: {
|
|
||||||
|
export default [
|
||||||
|
{
|
||||||
|
languageOptions: {
|
||||||
|
globals: {
|
||||||
// The tests in this folder are testing based on WebExtensions, so lets
|
// The tests in this folder are testing based on WebExtensions, so lets
|
||||||
// just define the webextensions environment here.
|
// just define the webextensions environment here.
|
||||||
webextensions: true,
|
...globals.webextensions,
|
||||||
// Many parts of WebExtensions test definitions (e.g. content scripts) also
|
// Many parts of WebExtensions test definitions (e.g. content scripts) also
|
||||||
// interact with the browser environment, so define that here as we don't
|
// interact with the browser environment, so define that here as we don't
|
||||||
// have an easy way to handle per-function/scope usage yet.
|
// have an easy way to handle per-function/scope usage yet.
|
||||||
browser: true,
|
...globals.browser,
|
||||||
},
|
},
|
||||||
};
|
},
|
||||||
|
},
|
||||||
|
];
|
||||||
|
|||||||
@@ -1,9 +1,15 @@
|
|||||||
"use strict";
|
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||||
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||||
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||||
|
|
||||||
module.exports = {
|
import globals from "globals";
|
||||||
env: {
|
|
||||||
|
export default [
|
||||||
|
{
|
||||||
|
languageOptions: {
|
||||||
// The tests in this folder are testing based on WebExtensions, so lets
|
// The tests in this folder are testing based on WebExtensions, so lets
|
||||||
// just define the webextensions environment here.
|
// just define the webextensions environment here.
|
||||||
webextensions: true,
|
globals: globals.webextensions,
|
||||||
},
|
},
|
||||||
};
|
},
|
||||||
|
];
|
||||||
|
|||||||
@@ -2,9 +2,8 @@
|
|||||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||||
|
|
||||||
"use strict";
|
export default [
|
||||||
|
{
|
||||||
module.exports = {
|
|
||||||
rules: {
|
rules: {
|
||||||
"mozilla/no-aArgs": "error",
|
"mozilla/no-aArgs": "error",
|
||||||
"mozilla/reject-importGlobalProperties": ["error", "everything"],
|
"mozilla/reject-importGlobalProperties": ["error", "everything"],
|
||||||
@@ -21,4 +20,5 @@ module.exports = {
|
|||||||
strict: ["error", "global"],
|
strict: ["error", "global"],
|
||||||
yoda: "error",
|
yoda: "error",
|
||||||
},
|
},
|
||||||
};
|
},
|
||||||
|
];
|
||||||
|
|||||||
@@ -1,7 +1,11 @@
|
|||||||
"use strict";
|
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||||
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||||
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||||
|
|
||||||
module.exports = {
|
export default [
|
||||||
|
{
|
||||||
rules: {
|
rules: {
|
||||||
"require-yield": 0,
|
"require-yield": 0,
|
||||||
},
|
},
|
||||||
};
|
},
|
||||||
|
];
|
||||||
|
|||||||
@@ -1,7 +1,11 @@
|
|||||||
"use strict";
|
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||||
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||||
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||||
|
|
||||||
module.exports = {
|
export default [
|
||||||
|
{
|
||||||
rules: {
|
rules: {
|
||||||
"no-var": "off",
|
"no-var": "off",
|
||||||
},
|
},
|
||||||
};
|
},
|
||||||
|
];
|
||||||
|
|||||||
@@ -1,6 +1,10 @@
|
|||||||
"use strict";
|
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||||
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||||
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||||
|
|
||||||
module.exports = {
|
export default [
|
||||||
|
{
|
||||||
|
languageOptions: {
|
||||||
globals: {
|
globals: {
|
||||||
promptDone: true,
|
promptDone: true,
|
||||||
startTest: true,
|
startTest: true,
|
||||||
@@ -11,7 +15,9 @@ module.exports = {
|
|||||||
sendAsyncMessage: true,
|
sendAsyncMessage: true,
|
||||||
Assert: true,
|
Assert: true,
|
||||||
},
|
},
|
||||||
|
},
|
||||||
rules: {
|
rules: {
|
||||||
"no-var": "off",
|
"no-var": "off",
|
||||||
},
|
},
|
||||||
};
|
},
|
||||||
|
];
|
||||||
|
|||||||
@@ -1,8 +1,12 @@
|
|||||||
"use strict";
|
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||||
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||||
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||||
|
|
||||||
module.exports = {
|
export default [
|
||||||
|
{
|
||||||
rules: {
|
rules: {
|
||||||
// ownerGlobal doesn't exist in content privileged windows.
|
// ownerGlobal doesn't exist in content privileged windows.
|
||||||
"mozilla/use-ownerGlobal": "off",
|
"mozilla/use-ownerGlobal": "off",
|
||||||
},
|
},
|
||||||
};
|
},
|
||||||
|
];
|
||||||
|
|||||||
@@ -2,11 +2,11 @@
|
|||||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||||
|
|
||||||
"use strict";
|
export default [
|
||||||
|
{
|
||||||
module.exports = {
|
|
||||||
rules: {
|
rules: {
|
||||||
"no-inner-declarations": "error",
|
"no-inner-declarations": "error",
|
||||||
"no-unused-vars": ["error", { vars: "all", argsIgnorePattern: "^_" }],
|
"no-unused-vars": ["error", { vars: "all", argsIgnorePattern: "^_" }],
|
||||||
},
|
},
|
||||||
};
|
},
|
||||||
|
];
|
||||||
|
|||||||
@@ -2,23 +2,21 @@
|
|||||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||||
|
|
||||||
"use strict";
|
import mozilla from "eslint-plugin-mozilla";
|
||||||
|
|
||||||
module.exports = {
|
export default [
|
||||||
overrides: [
|
|
||||||
{
|
{
|
||||||
files: "./**/*.?(m)js",
|
|
||||||
excludedFiles: "aboutwebrtc/**",
|
|
||||||
env: {
|
|
||||||
"mozilla/browser-window": true,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
],
|
|
||||||
plugins: ["mozilla"],
|
|
||||||
|
|
||||||
rules: {
|
rules: {
|
||||||
// XXX Bug 1358949 - This should be reduced down - probably to 20 or to
|
// XXX Bug 1358949 - This should be reduced down - probably to 20 or to
|
||||||
// be removed & synced with the mozilla/recommended value.
|
// be removed & synced with the mozilla/recommended value.
|
||||||
complexity: ["error", 48],
|
complexity: ["error", 48],
|
||||||
},
|
},
|
||||||
};
|
},
|
||||||
|
{
|
||||||
|
files: ["**/*.?(m)js"],
|
||||||
|
ignores: ["aboutwebrtc/**"],
|
||||||
|
languageOptions: {
|
||||||
|
globals: mozilla.environments["browser-window"].globals,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
];
|
||||||
|
|||||||
@@ -2,8 +2,6 @@
|
|||||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||||
|
|
||||||
"use strict";
|
import extensionsConfig from "../../components/extensions/.eslintrc.mjs";
|
||||||
|
|
||||||
module.exports = {
|
export default [...extensionsConfig];
|
||||||
extends: "../../components/extensions/.eslintrc.js",
|
|
||||||
};
|
|
||||||
|
|||||||
@@ -2,9 +2,8 @@
|
|||||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||||
|
|
||||||
"use strict";
|
export default [
|
||||||
|
{
|
||||||
module.exports = {
|
|
||||||
rules: {
|
rules: {
|
||||||
// Warn about cyclomatic complexity in functions.
|
// Warn about cyclomatic complexity in functions.
|
||||||
// XXX Bug 1326071 - This should be reduced down - probably to 20 or to
|
// XXX Bug 1326071 - This should be reduced down - probably to 20 or to
|
||||||
@@ -19,7 +18,7 @@ module.exports = {
|
|||||||
},
|
},
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
overrides: [
|
},
|
||||||
{
|
{
|
||||||
files: "test/xpcshell/head*.js",
|
files: "test/xpcshell/head*.js",
|
||||||
rules: {
|
rules: {
|
||||||
@@ -32,5 +31,4 @@ module.exports = {
|
|||||||
],
|
],
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
],
|
];
|
||||||
};
|
|
||||||
|
|||||||
@@ -1,9 +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 = {
|
import globals from "globals";
|
||||||
env: {
|
|
||||||
webextensions: true,
|
export default [
|
||||||
},
|
{
|
||||||
|
languageOptions: { globals: globals.webextensions },
|
||||||
|
|
||||||
rules: {
|
rules: {
|
||||||
"no-unused-vars": [
|
"no-unused-vars": [
|
||||||
@@ -11,4 +14,5 @@ module.exports = {
|
|||||||
{ argsIgnorePattern: "^_", varsIgnorePattern: "^end_test$" },
|
{ argsIgnorePattern: "^_", varsIgnorePattern: "^end_test$" },
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
};
|
},
|
||||||
|
];
|
||||||
|
|||||||
@@ -1,15 +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 = {
|
export default [
|
||||||
|
{
|
||||||
rules: {
|
rules: {
|
||||||
"no-unused-vars": [
|
"no-unused-vars": [
|
||||||
"error",
|
"error",
|
||||||
{ argsIgnorePattern: "^_", varsIgnorePattern: "^end_test$" },
|
{ argsIgnorePattern: "^_", varsIgnorePattern: "^end_test$" },
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
overrides: [
|
},
|
||||||
{
|
{
|
||||||
files: "head*.js",
|
files: "**/head*.js",
|
||||||
rules: {
|
rules: {
|
||||||
"no-unused-vars": [
|
"no-unused-vars": [
|
||||||
"error",
|
"error",
|
||||||
@@ -20,5 +23,4 @@ module.exports = {
|
|||||||
],
|
],
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
],
|
];
|
||||||
};
|
|
||||||
|
|||||||
Reference in New Issue
Block a user