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 = {
|
||||
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,9 +2,8 @@
|
||||
* 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 = {
|
||||
export default [
|
||||
{
|
||||
rules: {
|
||||
// Rules from the mozilla plugin
|
||||
"mozilla/balanced-listeners": "error",
|
||||
@@ -194,8 +193,7 @@ module.exports = {
|
||||
// Disallow labels that share a name with a variable
|
||||
"no-label-var": "error",
|
||||
},
|
||||
|
||||
overrides: [
|
||||
},
|
||||
{
|
||||
files: "test/xpcshell/head*.js",
|
||||
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
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
"use strict";
|
||||
|
||||
module.exports = {
|
||||
export default [
|
||||
{
|
||||
languageOptions: {
|
||||
globals: {
|
||||
// These are defined in the WebExtension script scopes by
|
||||
// ExtensionCommon.sys.mjs in the _createExtGlobal method.
|
||||
@@ -37,4 +37,6 @@ module.exports = {
|
||||
// This is defined in toolkit/components/extensions/child/ext-toolkit.js
|
||||
EventManager: true,
|
||||
},
|
||||
};
|
||||
},
|
||||
},
|
||||
];
|
||||
|
||||
@@ -2,9 +2,9 @@
|
||||
* 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 = {
|
||||
export default [
|
||||
{
|
||||
languageOptions: {
|
||||
globals: {
|
||||
// These are defined in the WebExtension script scopes by
|
||||
// ExtensionCommon.sys.mjs in the _createExtGlobal method.
|
||||
@@ -58,4 +58,6 @@ module.exports = {
|
||||
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: {
|
||||
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.
|
||||
webextensions: true,
|
||||
...globals.webextensions,
|
||||
// Many parts of WebExtensions test definitions (e.g. content scripts) also
|
||||
// interact with the browser environment, so define that here as we don't
|
||||
// have an easy way to handle per-function/scope usage yet.
|
||||
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 = {
|
||||
env: {
|
||||
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.
|
||||
webextensions: true,
|
||||
globals: globals.webextensions,
|
||||
},
|
||||
};
|
||||
},
|
||||
];
|
||||
|
||||
@@ -2,9 +2,8 @@
|
||||
* 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 = {
|
||||
export default [
|
||||
{
|
||||
rules: {
|
||||
"mozilla/no-aArgs": "error",
|
||||
"mozilla/reject-importGlobalProperties": ["error", "everything"],
|
||||
@@ -21,4 +20,5 @@ module.exports = {
|
||||
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 = {
|
||||
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 = {
|
||||
export default [
|
||||
{
|
||||
rules: {
|
||||
"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: {
|
||||
promptDone: true,
|
||||
startTest: true,
|
||||
@@ -11,7 +15,9 @@ module.exports = {
|
||||
sendAsyncMessage: true,
|
||||
Assert: true,
|
||||
},
|
||||
},
|
||||
rules: {
|
||||
"no-var": "off",
|
||||
},
|
||||
};
|
||||
},
|
||||
];
|
||||
|
||||
@@ -1,8 +1,12 @@
|
||||
"use strict";
|
||||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
module.exports = {
|
||||
export default [
|
||||
{
|
||||
rules: {
|
||||
// ownerGlobal doesn't exist in content privileged windows.
|
||||
"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 = {
|
||||
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: [
|
||||
export default [
|
||||
{
|
||||
files: "./**/*.?(m)js",
|
||||
excludedFiles: "aboutwebrtc/**",
|
||||
env: {
|
||||
"mozilla/browser-window": true,
|
||||
},
|
||||
},
|
||||
],
|
||||
plugins: ["mozilla"],
|
||||
|
||||
rules: {
|
||||
// XXX Bug 1358949 - This should be reduced down - probably to 20 or to
|
||||
// be removed & synced with the mozilla/recommended value.
|
||||
complexity: ["error", 48],
|
||||
},
|
||||
};
|
||||
},
|
||||
{
|
||||
files: ["**/*.?(m)js"],
|
||||
ignores: ["aboutwebrtc/**"],
|
||||
languageOptions: {
|
||||
globals: mozilla.environments["browser-window"].globals,
|
||||
},
|
||||
},
|
||||
];
|
||||
|
||||
@@ -2,8 +2,6 @@
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* 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,9 +2,8 @@
|
||||
* 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 = {
|
||||
export default [
|
||||
{
|
||||
rules: {
|
||||
// Warn about cyclomatic complexity in functions.
|
||||
// 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",
|
||||
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 = {
|
||||
env: {
|
||||
webextensions: true,
|
||||
},
|
||||
import globals from "globals";
|
||||
|
||||
export default [
|
||||
{
|
||||
languageOptions: { globals: globals.webextensions },
|
||||
|
||||
rules: {
|
||||
"no-unused-vars": [
|
||||
@@ -11,4 +14,5 @@ module.exports = {
|
||||
{ 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: {
|
||||
"no-unused-vars": [
|
||||
"error",
|
||||
{ argsIgnorePattern: "^_", varsIgnorePattern: "^end_test$" },
|
||||
],
|
||||
},
|
||||
overrides: [
|
||||
},
|
||||
{
|
||||
files: "head*.js",
|
||||
files: "**/head*.js",
|
||||
rules: {
|
||||
"no-unused-vars": [
|
||||
"error",
|
||||
@@ -20,5 +23,4 @@ module.exports = {
|
||||
],
|
||||
},
|
||||
},
|
||||
],
|
||||
};
|
||||
];
|
||||
|
||||
Reference in New Issue
Block a user