Bug 1620542 - Automatically fix ESLint errors in .eslintrc.js files. r=mossop

# ignore-this-changeset

Differential Revision: https://phabricator.services.mozilla.com/D65703

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Mark Banner 2020-03-07 10:09:44 +00:00
parent f102f74183
commit 15cfe23b88
354 changed files with 2402 additions and 2630 deletions

File diff suppressed because it is too large Load Diff

View File

@ -1,28 +1,28 @@
"use strict"; "use strict";
module.exports = { module.exports = {
"rules": { rules: {
"mozilla/no-aArgs": "error", "mozilla/no-aArgs": "error",
"mozilla/reject-importGlobalProperties": ["error", "everything"], "mozilla/reject-importGlobalProperties": ["error", "everything"],
"mozilla/var-only-at-top-level": "error", "mozilla/var-only-at-top-level": "error",
"block-scoped-var": "error", "block-scoped-var": "error",
"camelcase": ["error", { "properties": "never" }], camelcase: ["error", { properties: "never" }],
"complexity": ["error", 20], complexity: ["error", 20],
"handle-callback-err": ["error", "er"], "handle-callback-err": ["error", "er"],
"max-nested-callbacks": ["error", 4], "max-nested-callbacks": ["error", 4],
"new-cap": ["error", {"capIsNew": false}], "new-cap": ["error", { capIsNew: false }],
"no-fallthrough": "error", "no-fallthrough": "error",
"no-multi-str": "error", "no-multi-str": "error",
"no-proto": "error", "no-proto": "error",
"no-return-assign": "error", "no-return-assign": "error",
"no-shadow": "error", "no-shadow": "error",
"no-unused-vars": ["error", {"vars": "all", "args": "none"}], "no-unused-vars": ["error", { vars: "all", args: "none" }],
"one-var": ["error", "never"], "one-var": ["error", "never"],
"radix": "error", radix: "error",
"strict": ["error", "global"], strict: ["error", "global"],
"yoda": "error", yoda: "error",
"no-undef-init": "error", "no-undef-init": "error",
} },
}; };

View File

@ -1,22 +1,24 @@
"use strict"; "use strict";
module.exports = { module.exports = {
"rules": { rules: {
// XXX These are rules that are enabled in the recommended configuration, but // XXX These are rules that are enabled in the recommended configuration, but
// disabled here due to failures when initially implemented. They should be // disabled here due to failures when initially implemented. They should be
// removed (and hence enabled) at some stage. // removed (and hence enabled) at some stage.
"no-nested-ternary": "off", "no-nested-ternary": "off",
}, },
"overrides": [{ overrides: [
"files": [ {
// Bug 1602061 TODO: These tests access DOM elements via files: [
// id-as-variable-name, which eslint doesn't have support for yet. // Bug 1602061 TODO: These tests access DOM elements via
"attributes/test_listbox.html", // id-as-variable-name, which eslint doesn't have support for yet.
"treeupdate/test_ariaowns.html", "attributes/test_listbox.html",
], "treeupdate/test_ariaowns.html",
"rules": { ],
"no-undef": "off", rules: {
} "no-undef": "off",
}] },
},
],
}; };

View File

@ -1,10 +1,10 @@
"use strict"; "use strict";
module.exports = { 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", {"max": 44}], complexity: ["error", { max: 44 }],
// Disallow empty statements. This will report an error for: // Disallow empty statements. This will report an error for:
// try { something(); } catch (e) {} // try { something(); } catch (e) {}
@ -22,5 +22,5 @@ module.exports = {
"no-shadow": "error", "no-shadow": "error",
"mozilla/no-task": "error", "mozilla/no-task": "error",
} },
}; };

View File

@ -1,7 +1,5 @@
"use strict"; "use strict";
module.exports = { module.exports = {
"extends": [ extends: ["plugin:mozilla/browser-test"],
"plugin:mozilla/browser-test"
]
}; };

View File

@ -1,7 +1,5 @@
"use strict"; "use strict";
module.exports = { module.exports = {
"extends": [ extends: ["plugin:mozilla/browser-test"],
"plugin:mozilla/browser-test"
]
}; };

View File

@ -1,8 +1,5 @@
"use strict"; "use strict";
module.exports = { module.exports = {
"extends": [ extends: ["plugin:mozilla/browser-test"],
"plugin:mozilla/browser-test"
]
}; };

View File

@ -1,7 +1,5 @@
"use strict"; "use strict";
module.exports = { module.exports = {
"extends": [ extends: ["plugin:mozilla/browser-test"],
"plugin:mozilla/browser-test"
]
}; };

View File

@ -1,7 +1,5 @@
"use strict"; "use strict";
module.exports = { module.exports = {
"extends": [ extends: ["plugin:mozilla/browser-test"],
"plugin:mozilla/browser-test"
]
}; };

View File

@ -1,8 +1,5 @@
"use strict"; "use strict";
module.exports = { module.exports = {
"extends": [ extends: ["plugin:mozilla/browser-test", "plugin:mozilla/mochitest-test"],
"plugin:mozilla/browser-test",
"plugin:mozilla/mochitest-test",
]
}; };

View File

@ -1,7 +1,5 @@
"use strict"; "use strict";
module.exports = { module.exports = {
"extends": [ extends: ["plugin:mozilla/browser-test"],
"plugin:mozilla/browser-test"
]
}; };

View File

@ -1,7 +1,5 @@
"use strict"; "use strict";
module.exports = { module.exports = {
"extends": [ extends: ["plugin:mozilla/browser-test"],
"plugin:mozilla/browser-test"
]
}; };

View File

@ -1,8 +1,5 @@
"use strict"; "use strict";
module.exports = { module.exports = {
"extends": [ extends: ["plugin:mozilla/browser-test", "plugin:mozilla/mochitest-test"],
"plugin:mozilla/browser-test",
"plugin:mozilla/mochitest-test",
]
}; };

View File

@ -1,7 +1,5 @@
"use strict"; "use strict";
module.exports = { module.exports = {
"extends": [ extends: ["plugin:mozilla/browser-test"],
"plugin:mozilla/browser-test",
]
}; };

View File

@ -1,7 +1,5 @@
"use strict"; "use strict";
module.exports = { module.exports = {
"extends": [ extends: ["plugin:mozilla/browser-test"],
"plugin:mozilla/browser-test"
]
}; };

View File

@ -1,7 +1,5 @@
"use strict"; "use strict";
module.exports = { module.exports = {
"extends": [ extends: ["plugin:mozilla/browser-test"],
"plugin:mozilla/browser-test"
]
}; };

View File

@ -1,7 +1,5 @@
"use strict"; "use strict";
module.exports = { module.exports = {
"extends": [ extends: ["plugin:mozilla/browser-test"],
"plugin:mozilla/browser-test",
]
}; };

View File

@ -1,7 +1,5 @@
"use strict"; "use strict";
module.exports = { module.exports = {
"extends": [ extends: ["plugin:mozilla/browser-test"],
"plugin:mozilla/browser-test"
]
}; };

View File

@ -1,7 +1,5 @@
"use strict"; "use strict";
module.exports = { module.exports = {
"extends": [ extends: ["plugin:mozilla/browser-test"],
"plugin:mozilla/browser-test",
]
}; };

View File

@ -1,7 +1,5 @@
"use strict"; "use strict";
module.exports = { module.exports = {
"extends": [ extends: ["plugin:mozilla/browser-test"],
"plugin:mozilla/browser-test"
]
}; };

View File

@ -1,7 +1,5 @@
"use strict"; "use strict";
module.exports = { module.exports = {
"extends": [ extends: ["plugin:mozilla/browser-test"],
"plugin:mozilla/browser-test"
]
}; };

View File

@ -1,7 +1,5 @@
"use strict"; "use strict";
module.exports = { module.exports = {
"extends": [ extends: ["plugin:mozilla/browser-test"],
"plugin:mozilla/browser-test"
]
}; };

View File

@ -1,7 +1,5 @@
"use strict"; "use strict";
module.exports = { module.exports = {
"extends": [ extends: ["plugin:mozilla/browser-test"],
"plugin:mozilla/browser-test"
]
}; };

View File

@ -1,7 +1,5 @@
"use strict"; "use strict";
module.exports = { module.exports = {
"extends": [ extends: ["plugin:mozilla/browser-test"],
"plugin:mozilla/browser-test"
]
}; };

View File

@ -1,7 +1,5 @@
"use strict"; "use strict";
module.exports = { module.exports = {
"extends": [ extends: ["plugin:mozilla/browser-test"],
"plugin:mozilla/browser-test"
]
}; };

View File

@ -1,7 +1,5 @@
"use strict"; "use strict";
module.exports = { module.exports = {
"extends": [ extends: ["plugin:mozilla/browser-test"],
"plugin:mozilla/browser-test"
]
}; };

View File

@ -1,7 +1,5 @@
"use strict"; "use strict";
module.exports = { module.exports = {
"extends": [ extends: ["plugin:mozilla/browser-test"],
"plugin:mozilla/browser-test"
]
}; };

View File

@ -1,7 +1,5 @@
"use strict"; "use strict";
module.exports = { module.exports = {
"extends": [ extends: ["plugin:mozilla/browser-test"],
"plugin:mozilla/browser-test"
]
}; };

View File

@ -1,7 +1,5 @@
"use strict"; "use strict";
module.exports = { module.exports = {
"extends": [ extends: ["plugin:mozilla/browser-test"],
"plugin:mozilla/browser-test"
]
}; };

View File

@ -1,7 +1,5 @@
"use strict"; "use strict";
module.exports = { module.exports = {
"extends": [ extends: ["plugin:mozilla/browser-test"],
"plugin:mozilla/browser-test"
]
}; };

View File

@ -1,7 +1,5 @@
"use strict"; "use strict";
module.exports = { module.exports = {
"extends": [ extends: ["plugin:mozilla/browser-test"],
"plugin:mozilla/browser-test"
]
}; };

View File

@ -1,7 +1,5 @@
"use strict"; "use strict";
module.exports = { module.exports = {
"extends": [ extends: ["plugin:mozilla/browser-test"],
"plugin:mozilla/browser-test"
]
}; };

View File

@ -1,7 +1,5 @@
"use strict"; "use strict";
module.exports = { module.exports = {
"extends": [ extends: ["plugin:mozilla/browser-test"],
"plugin:mozilla/browser-test"
]
}; };

View File

@ -1,7 +1,5 @@
"use strict"; "use strict";
module.exports = { module.exports = {
"extends": [ extends: ["plugin:mozilla/browser-test"],
"plugin:mozilla/browser-test"
]
}; };

View File

@ -1,7 +1,5 @@
"use strict"; "use strict";
module.exports = { module.exports = {
"extends": [ extends: ["plugin:mozilla/browser-test"],
"plugin:mozilla/browser-test"
]
}; };

View File

@ -1,7 +1,5 @@
"use strict"; "use strict";
module.exports = { module.exports = {
"extends": [ extends: ["plugin:mozilla/browser-test"],
"plugin:mozilla/browser-test"
]
}; };

View File

@ -1,7 +1,5 @@
"use strict"; "use strict";
module.exports = { module.exports = {
"extends": [ extends: ["plugin:mozilla/browser-test"],
"plugin:mozilla/browser-test"
]
}; };

View File

@ -1,7 +1,5 @@
"use strict"; "use strict";
module.exports = { module.exports = {
"extends": [ extends: ["plugin:mozilla/browser-test"],
"plugin:mozilla/browser-test"
]
}; };

View File

@ -1,11 +1,9 @@
"use strict"; "use strict";
module.exports = { module.exports = {
"extends": [ extends: ["plugin:mozilla/browser-test"],
"plugin:mozilla/browser-test"
],
"env": { env: {
"webextensions": true, webextensions: true,
}, },
}; };

View File

@ -1,7 +1,5 @@
"use strict"; "use strict";
module.exports = { module.exports = {
"extends": [ extends: ["plugin:mozilla/browser-test"],
"plugin:mozilla/browser-test"
]
}; };

View File

@ -1,7 +1,5 @@
"use strict"; "use strict";
module.exports = { module.exports = {
"extends": [ extends: ["plugin:mozilla/browser-test"],
"plugin:mozilla/browser-test"
]
}; };

View File

@ -4,6 +4,6 @@ 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", 61], complexity: ["error", 61],
} },
}; };

View File

@ -1,11 +1,9 @@
"use strict"; "use strict";
module.exports = { module.exports = {
"env": { env: {
"mozilla/browser-window": true, "mozilla/browser-window": true,
}, },
"plugins": [ plugins: ["mozilla"],
"mozilla",
]
}; };

View File

@ -1,7 +1,5 @@
"use strict"; "use strict";
module.exports = { module.exports = {
"extends": [ extends: ["plugin:mozilla/browser-test"],
"plugin:mozilla/browser-test"
]
}; };

View File

@ -1,5 +1,5 @@
"use strict"; "use strict";
module.exports = { module.exports = {
"extends": "../../../toolkit/components/extensions/.eslintrc.js", extends: "../../../toolkit/components/extensions/.eslintrc.js",
}; };

View File

@ -1,6 +1,5 @@
"use strict"; "use strict";
module.exports = { module.exports = {
"extends": "../../../../toolkit/components/extensions/child/.eslintrc.js", extends: "../../../../toolkit/components/extensions/child/.eslintrc.js",
}; };

View File

@ -1,32 +1,32 @@
"use strict"; "use strict";
module.exports = { module.exports = {
"extends": "../../../../toolkit/components/extensions/parent/.eslintrc.js", extends: "../../../../toolkit/components/extensions/parent/.eslintrc.js",
"globals": { globals: {
"Tab": true, Tab: true,
"TabContext": true, TabContext: true,
"Window": true, Window: true,
"actionContextMenu": true, actionContextMenu: true,
"browserActionFor": true, browserActionFor: true,
"clickModifiersFromEvent": true, clickModifiersFromEvent: true,
"getContainerForCookieStoreId": true, getContainerForCookieStoreId: true,
"getDevToolsTargetForContext": true, getDevToolsTargetForContext: true,
"getInspectedWindowFront": true, getInspectedWindowFront: true,
"getTargetTabIdForToolbox": true, getTargetTabIdForToolbox: true,
"getToolboxEvalOptions": true, getToolboxEvalOptions: true,
"isContainerCookieStoreId": true, isContainerCookieStoreId: true,
"isPrivateCookieStoreId": true, isPrivateCookieStoreId: true,
"isValidCookieStoreId": true, isValidCookieStoreId: true,
"makeWidgetId": true, makeWidgetId: true,
"openOptionsPage": true, openOptionsPage: true,
"pageActionFor": true, pageActionFor: true,
"replaceUrlInTab": true, replaceUrlInTab: true,
"searchInitialized": true, searchInitialized: true,
"sidebarActionFor": true, sidebarActionFor: true,
"tabGetSender": true, tabGetSender: true,
"tabTracker": true, tabTracker: true,
"waitForTabLoaded": true, waitForTabLoaded: true,
"windowTracker": true, windowTracker: true,
}, },
}; };

View File

@ -1,11 +1,11 @@
"use strict"; "use strict";
module.exports = { module.exports = {
"env": { env: {
"webextensions": true, webextensions: true,
}, },
"rules": { rules: {
"no-shadow": 0, "no-shadow": 0,
}, },
}; };

View File

@ -1,8 +1,8 @@
"use strict"; "use strict";
module.exports = { module.exports = {
"env": { env: {
"browser": true, browser: true,
"webextensions": true, webextensions: true,
}, },
}; };

View File

@ -1,9 +1,9 @@
"use strict"; "use strict";
module.exports = { module.exports = {
"env": { env: {
// 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 webextensions: true,
} },
}; };

View File

@ -1,27 +1,38 @@
"use strict"; "use strict";
module.exports = { module.exports = {
"rules": { rules: {
"block-scoped-var": "error", "block-scoped-var": "error",
"complexity": ["error", {"max": 22}], complexity: ["error", { max: 22 }],
"max-nested-callbacks": ["error", 3], "max-nested-callbacks": ["error", 3],
"no-extend-native": "error", "no-extend-native": "error",
"no-fallthrough": ["error", { "commentPattern": ".*[Ii]ntentional(?:ly)?\\s+fall(?:ing)?[\\s-]*through.*" }], "no-fallthrough": [
"error",
{
commentPattern:
".*[Ii]ntentional(?:ly)?\\s+fall(?:ing)?[\\s-]*through.*",
},
],
"no-multi-str": "error", "no-multi-str": "error",
"no-return-assign": "error", "no-return-assign": "error",
"no-shadow": "error", "no-shadow": "error",
"no-unused-vars": ["error", { "args": "after-used", "vars": "all" }], "no-unused-vars": ["error", { args: "after-used", vars: "all" }],
"strict": ["error", "global"], strict: ["error", "global"],
"yoda": "error" yoda: "error",
}, },
"overrides": [{ overrides: [
"files": "tests/unit/head*.js", {
"rules": { files: "tests/unit/head*.js",
"no-unused-vars": ["error", { rules: {
"args": "none", "no-unused-vars": [
"vars": "local", "error",
}], {
args: "none",
vars: "local",
},
],
},
}, },
}], ],
}; };

View File

@ -1,27 +1,27 @@
module.exports = { module.exports = {
// When adding items to this file please check for effects on sub-directories. // When adding items to this file please check for effects on sub-directories.
"parser": "babel-eslint", parser: "babel-eslint",
"parserOptions": { parserOptions: {
"ecmaVersion": 2018, ecmaVersion: 2018,
"ecmaFeatures": { ecmaFeatures: {
"jsx": true jsx: true,
}, },
"sourceType": "module" sourceType: "module",
}, },
"env": { env: {
"node": true node: true,
}, },
"plugins": [ plugins: [
"import", // require("eslint-plugin-import") "import", // require("eslint-plugin-import")
"react", // require("eslint-plugin-react") "react", // require("eslint-plugin-react")
"jsx-a11y", // require("eslint-plugin-jsx-a11y") "jsx-a11y", // require("eslint-plugin-jsx-a11y")
], ],
"settings": { settings: {
"react": { react: {
"version": "16.2.0" version: "16.2.0",
} },
}, },
"extends": [ extends: [
"eslint:recommended", "eslint:recommended",
"plugin:jsx-a11y/recommended", // require("eslint-plugin-jsx-a11y") "plugin:jsx-a11y/recommended", // require("eslint-plugin-jsx-a11y")
"plugin:mozilla/recommended", // require("eslint-plugin-mozilla") require("eslint-plugin-fetch-options") require("eslint-plugin-html") require("eslint-plugin-no-unsanitized") "plugin:mozilla/recommended", // require("eslint-plugin-mozilla") require("eslint-plugin-fetch-options") require("eslint-plugin-html") require("eslint-plugin-no-unsanitized")
@ -31,10 +31,10 @@ module.exports = {
"plugin:prettier/recommended", // require("eslint-plugin-prettier") "plugin:prettier/recommended", // require("eslint-plugin-prettier")
"prettier/react", // require("eslint-config-prettier") "prettier/react", // require("eslint-config-prettier")
], ],
"overrides": [ overrides: [
{ {
// These files use fluent-dom to insert content // These files use fluent-dom to insert content
"files": [ files: [
"content-src/aboutwelcome/components/HeroText.jsx", "content-src/aboutwelcome/components/HeroText.jsx",
"content-src/asrouter/templates/OnboardingMessage/**", "content-src/asrouter/templates/OnboardingMessage/**",
"content-src/asrouter/templates/FirstRun/**", "content-src/asrouter/templates/FirstRun/**",
@ -45,28 +45,28 @@ module.exports = {
"content-src/components/MoreRecommendations/MoreRecommendations.jsx", "content-src/components/MoreRecommendations/MoreRecommendations.jsx",
"content-src/components/CollapsibleSection/CollapsibleSection.jsx", "content-src/components/CollapsibleSection/CollapsibleSection.jsx",
"content-src/components/DiscoveryStreamComponents/DSEmptyState/DSEmptyState.jsx", "content-src/components/DiscoveryStreamComponents/DSEmptyState/DSEmptyState.jsx",
"content-src/components/DiscoveryStreamComponents/DSPrivacyModal/DSPrivacyModal.jsx" "content-src/components/DiscoveryStreamComponents/DSPrivacyModal/DSPrivacyModal.jsx",
], ],
"rules": { rules: {
"jsx-a11y/anchor-has-content": 0, "jsx-a11y/anchor-has-content": 0,
"jsx-a11y/heading-has-content": 0, "jsx-a11y/heading-has-content": 0,
} },
}, },
{ {
// Use a configuration that's more appropriate for JSMs // Use a configuration that's more appropriate for JSMs
"files": "**/*.jsm", files: "**/*.jsm",
"parserOptions": { parserOptions: {
"sourceType": "script" sourceType: "script",
}, },
"env": { env: {
"node": false node: false,
}, },
"rules": { rules: {
"no-implicit-globals": 0 "no-implicit-globals": 0,
} },
} },
], ],
"rules": { rules: {
"fetch-options/no-fetch-credentials": 2, "fetch-options/no-fetch-credentials": 2,
"react/jsx-boolean-value": [2, "always"], "react/jsx-boolean-value": [2, "always"],
@ -89,16 +89,16 @@ module.exports = {
"react/no-unknown-property": 2, "react/no-unknown-property": 2,
"react/require-render-return": 2, "react/require-render-return": 2,
"accessor-pairs": [2, {"setWithoutGet": true, "getWithoutSet": false}], "accessor-pairs": [2, { setWithoutGet: true, getWithoutSet: false }],
"array-callback-return": 2, "array-callback-return": 2,
"block-scoped-var": 2, "block-scoped-var": 2,
"callback-return": 0, "callback-return": 0,
"camelcase": 0, camelcase: 0,
"capitalized-comments": 0, "capitalized-comments": 0,
"class-methods-use-this": 0, "class-methods-use-this": 0,
"consistent-this": [2, "use-bind"], "consistent-this": [2, "use-bind"],
"default-case": 0, "default-case": 0,
"eqeqeq": 2, eqeqeq: 2,
"for-direction": 2, "for-direction": 2,
"func-name-matching": 2, "func-name-matching": 2,
"func-names": 0, "func-names": 0,
@ -118,9 +118,9 @@ module.exports = {
"max-nested-callbacks": [2, 4], "max-nested-callbacks": [2, 4],
"max-params": [2, 6], "max-params": [2, 6],
"max-statements": [2, 50], "max-statements": [2, 50],
"max-statements-per-line": [2, {"max": 2}], "max-statements-per-line": [2, { max: 2 }],
"multiline-comment-style": 0, "multiline-comment-style": 0,
"new-cap": [2, {"newIsCap": true, "capIsNew": false}], "new-cap": [2, { newIsCap: true, capIsNew: false }],
"newline-after-var": 0, "newline-after-var": 0,
"newline-before-return": 0, "newline-before-return": 0,
"no-alert": 2, "no-alert": 2,
@ -136,7 +136,7 @@ module.exports = {
"no-eq-null": 2, "no-eq-null": 2,
"no-extend-native": 2, "no-extend-native": 2,
"no-extra-label": 2, "no-extra-label": 2,
"no-implicit-coercion": [2, {"allow": ["!!"]}], "no-implicit-coercion": [2, { allow: ["!!"] }],
"no-implicit-globals": 2, "no-implicit-globals": 2,
"no-inline-comments": 0, "no-inline-comments": 0,
"no-invalid-this": 0, "no-invalid-this": 0,
@ -186,22 +186,35 @@ module.exports = {
"operator-assignment": [2, "always"], "operator-assignment": [2, "always"],
"padding-line-between-statements": 0, "padding-line-between-statements": 0,
"prefer-const": 0, // TODO: Change to `1`? "prefer-const": 0, // TODO: Change to `1`?
"prefer-destructuring": [2, {"AssignmentExpression": {"array": true}, "VariableDeclarator": {"array": true, "object": true}}], "prefer-destructuring": [
2,
{
AssignmentExpression: { array: true },
VariableDeclarator: { array: true, object: true },
},
],
"prefer-numeric-literals": 2, "prefer-numeric-literals": 2,
"prefer-promise-reject-errors": 2, "prefer-promise-reject-errors": 2,
"prefer-reflect": 0, "prefer-reflect": 0,
"prefer-rest-params": 2, "prefer-rest-params": 2,
"prefer-spread": 2, "prefer-spread": 2,
"prefer-template": 2, "prefer-template": 2,
"radix": [2, "always"], radix: [2, "always"],
"require-await": 2, "require-await": 2,
"require-jsdoc": 0, "require-jsdoc": 0,
"sort-keys": 0, "sort-keys": 0,
"sort-vars": 2, "sort-vars": 2,
"strict": 0, strict: 0,
"symbol-description": 2, "symbol-description": 2,
"valid-jsdoc": [0, {"requireReturn": false, "requireParamDescription": false, "requireReturnDescription": false}], "valid-jsdoc": [
0,
{
requireReturn: false,
requireParamDescription: false,
requireReturnDescription: false,
},
],
"vars-on-top": 2, "vars-on-top": 2,
"yoda": [2, "never"] yoda: [2, "never"],
} },
}; };

View File

@ -1,5 +1,5 @@
module.exports = { module.exports = {
rules: { rules: {
"import/no-commonjs": 2 "import/no-commonjs": 2,
} },
} };

View File

@ -1,17 +1,17 @@
module.exports = { module.exports = {
"env": { env: {
"mocha": true mocha: true,
}, },
"globals": { globals: {
"assert": true, assert: true,
"chai": true, chai: true,
"sinon": true sinon: true,
}, },
"rules": { rules: {
"func-name-matching": 0, "func-name-matching": 0,
"import/no-commonjs": 2, "import/no-commonjs": 2,
"lines-between-class-members": 0, "lines-between-class-members": 0,
"react/jsx-no-bind": 0, "react/jsx-no-bind": 0,
"require-await": 0 "require-await": 0,
} },
}; };

View File

@ -16,12 +16,15 @@ module.exports = {
}, },
}, },
{ {
"files": "test/unit/head.js", files: "test/unit/head.js",
"rules": { rules: {
"no-unused-vars": ["error", { "no-unused-vars": [
"args": "none", "error",
"vars": "local", {
}], args: "none",
vars: "local",
},
],
}, },
}, },
], ],
@ -29,37 +32,49 @@ module.exports = {
"mozilla/var-only-at-top-level": "error", "mozilla/var-only-at-top-level": "error",
"block-scoped-var": "error", "block-scoped-var": "error",
complexity: ["error", { complexity: [
max: 20, "error",
}], {
max: 20,
},
],
"max-nested-callbacks": ["error", 4], "max-nested-callbacks": ["error", 4],
"no-console": ["error", { allow: ["error"] }], "no-console": ["error", { allow: ["error"] }],
"no-fallthrough": "error", "no-fallthrough": "error",
"no-multi-str": "error", "no-multi-str": "error",
"no-proto": "error", "no-proto": "error",
"no-unused-expressions": "error", "no-unused-expressions": "error",
"no-unused-vars": ["error", { "no-unused-vars": [
args: "none", "error",
vars: "all" {
}], args: "none",
"no-use-before-define": ["error", { vars: "all",
functions: false, },
}], ],
"no-use-before-define": [
"error",
{
functions: false,
},
],
radix: "error", radix: "error",
"valid-jsdoc": ["error", { "valid-jsdoc": [
prefer: { "error",
return: "returns", {
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,
}],
yoda: "error", yoda: "error",
}, },
}; };

View File

@ -1,7 +1,5 @@
"use strict"; "use strict";
module.exports = { module.exports = {
"extends": [ extends: ["plugin:mozilla/browser-test"],
"plugin:mozilla/browser-test"
]
}; };

View File

@ -1,7 +1,5 @@
"use strict"; "use strict";
module.exports = { module.exports = {
"extends": [ extends: ["plugin:mozilla/browser-test"],
"plugin:mozilla/browser-test"
]
}; };

View File

@ -1,7 +1,5 @@
"use strict"; "use strict";
module.exports = { module.exports = {
"extends": [ extends: ["plugin:mozilla/mochitest-test"],
"plugin:mozilla/mochitest-test"
]
}; };

View File

@ -1,7 +1,7 @@
"use strict"; "use strict";
module.exports = { module.exports = {
"rules": { rules: {
"no-eval": "off" "no-eval": "off",
}, },
}; };

View File

@ -1,7 +1,5 @@
"use strict"; "use strict";
module.exports = { module.exports = {
"extends": [ extends: ["plugin:mozilla/browser-test"],
"plugin:mozilla/browser-test"
]
}; };

View File

@ -3,29 +3,35 @@
module.exports = { module.exports = {
rules: { rules: {
"mozilla/var-only-at-top-level": "error", "mozilla/var-only-at-top-level": "error",
"require-jsdoc": ["error", { "require-jsdoc": [
"require": { "error",
"FunctionDeclaration": false, {
"MethodDefinition": false, require: {
"ClassDeclaration": true, FunctionDeclaration: false,
"ArrowFunctionExpression": false, MethodDefinition: false,
"FunctionExpression": false ClassDeclaration: true,
} ArrowFunctionExpression: false,
}], FunctionExpression: false,
"valid-jsdoc": ["error", { },
prefer: {
return: "returns",
}, },
preferType: { ],
Boolean: "boolean", "valid-jsdoc": [
Number: "number", "error",
String: "string", {
Object: "object", prefer: {
bool: "boolean", return: "returns",
},
preferType: {
Boolean: "boolean",
Number: "number",
String: "string",
Object: "object",
bool: "boolean",
},
requireParamDescription: false,
requireReturn: false,
requireReturnDescription: false,
}, },
requireParamDescription: false, ],
requireReturn: false, },
requireReturnDescription: false,
}],
}
}; };

View File

@ -1,7 +1,5 @@
"use strict"; "use strict";
module.exports = { module.exports = {
"extends": [ extends: ["plugin:mozilla/browser-test"],
"plugin:mozilla/browser-test"
]
}; };

View File

@ -1,7 +1,5 @@
"use strict"; "use strict";
module.exports = { module.exports = {
"extends": [ extends: ["plugin:mozilla/browser-test"],
"plugin:mozilla/browser-test"
]
}; };

View File

@ -5,7 +5,5 @@
"use strict"; "use strict";
module.exports = { module.exports = {
"extends": [ extends: ["plugin:mozilla/browser-test"],
"plugin:mozilla/browser-test" };
]
}

View File

@ -1,11 +1,9 @@
"use strict"; "use strict";
module.exports = { module.exports = {
"env": { env: {
"mozilla/browser-window": true, "mozilla/browser-window": true,
}, },
"plugins": [ plugins: ["mozilla"],
"mozilla",
]
}; };

View File

@ -1,7 +1,5 @@
"use strict"; "use strict";
module.exports = { module.exports = {
"extends": [ extends: ["plugin:mozilla/browser-test"],
"plugin:mozilla/browser-test"
]
}; };

View File

@ -1,7 +1,5 @@
"use strict"; "use strict";
module.exports = { module.exports = {
"extends": [ extends: ["plugin:mozilla/browser-test"],
"plugin:mozilla/browser-test"
]
}; };

View File

@ -3,30 +3,36 @@
module.exports = { module.exports = {
rules: { rules: {
"mozilla/var-only-at-top-level": "error", "mozilla/var-only-at-top-level": "error",
"require-jsdoc": ["error", { "require-jsdoc": [
"require": { "error",
"FunctionDeclaration": false, {
"MethodDefinition": false, require: {
"ClassDeclaration": true, FunctionDeclaration: false,
"ArrowFunctionExpression": false, MethodDefinition: false,
"FunctionExpression": false ClassDeclaration: true,
} ArrowFunctionExpression: false,
}], FunctionExpression: false,
"valid-jsdoc": ["error", { },
prefer: {
return: "returns",
}, },
preferType: { ],
Boolean: "boolean", "valid-jsdoc": [
Number: "number", "error",
String: "string", {
Object: "object", prefer: {
bool: "boolean", return: "returns",
},
preferType: {
Boolean: "boolean",
Number: "number",
String: "string",
Object: "object",
bool: "boolean",
},
requireParamDescription: false,
requireReturn: false,
requireReturnDescription: false,
}, },
requireParamDescription: false, ],
requireReturn: false,
requireReturnDescription: false,
}],
"no-unused-expressions": "error", "no-unused-expressions": "error",
} },
}; };

View File

@ -1,7 +1,7 @@
"use strict"; "use strict";
module.exports = { module.exports = {
"env": { env: {
"webextensions": true, webextensions: true,
}, },
}; };

View File

@ -1,7 +1,7 @@
"use strict"; "use strict";
module.exports = { module.exports = {
"env": { env: {
"webextensions": true, webextensions: true,
}, },
}; };

View File

@ -1,34 +1,41 @@
"use strict"; "use strict";
module.exports = { module.exports = {
"rules": { rules: {
// Rules from the mozilla plugin // Rules from the mozilla plugin
"mozilla/balanced-listeners": "error", "mozilla/balanced-listeners": "error",
"mozilla/no-aArgs": "error", "mozilla/no-aArgs": "error",
"mozilla/var-only-at-top-level": "error", "mozilla/var-only-at-top-level": "error",
"valid-jsdoc": ["error", { "valid-jsdoc": [
"prefer": { "error",
"return": "returns", {
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 expressions where a statement is expected
"no-unused-expressions": "error", "no-unused-expressions": "error",
// No declaring variables that are never used // No declaring variables that are never used
"no-unused-vars": ["error", { "no-unused-vars": [
"args": "none", "vars": "all" "error",
}], {
args: "none",
vars: "all",
},
],
// No using variables before defined // No using variables before defined
"no-use-before-define": "error", "no-use-before-define": "error",
@ -38,7 +45,7 @@ module.exports = {
"block-scoped-var": "error", "block-scoped-var": "error",
// Warn about cyclomatic complexity in functions. // Warn about cyclomatic complexity in functions.
"complexity": ["error", {"max": 26}], complexity: ["error", { max: 26 }],
// Maximum depth callbacks can be nested. // Maximum depth callbacks can be nested.
"max-nested-callbacks": ["error", 4], "max-nested-callbacks": ["error", 4],
@ -60,25 +67,30 @@ module.exports = {
"no-return-assign": "error", "no-return-assign": "error",
// Require use of the second argument for parseInt(). // Require use of the second argument for parseInt().
"radix": "error", radix: "error",
// Require "use strict" to be defined globally in the script. // Require "use strict" to be defined globally in the script.
"strict": ["error", "global"], strict: ["error", "global"],
// Disallow Yoda conditions (where literal value comes first). // Disallow Yoda conditions (where literal value comes first).
"yoda": "error", yoda: "error",
// Disallow function or variable declarations in nested blocks // Disallow function or variable declarations in nested blocks
"no-inner-declarations": "error", "no-inner-declarations": "error",
}, },
"overrides": [{ overrides: [
"files": "test/unit/head.js", {
"rules": { files: "test/unit/head.js",
"no-unused-vars": ["error", { rules: {
"args": "none", "no-unused-vars": [
"vars": "local", "error",
}], {
args: "none",
vars: "local",
},
],
},
}, },
}], ],
}; };

View File

@ -1,7 +1,5 @@
"use strict"; "use strict";
module.exports = { module.exports = {
"extends": [ extends: ["plugin:mozilla/browser-test"],
"plugin:mozilla/browser-test"
]
}; };

View File

@ -1,26 +1,29 @@
"use strict"; "use strict";
module.exports = { module.exports = {
"rules": { rules: {
// Rules from the mozilla plugin // Rules from the mozilla plugin
"mozilla/balanced-listeners": "error", "mozilla/balanced-listeners": "error",
"mozilla/no-aArgs": "error", "mozilla/no-aArgs": "error",
"mozilla/var-only-at-top-level": "error", "mozilla/var-only-at-top-level": "error",
"valid-jsdoc": ["error", { "valid-jsdoc": [
"prefer": { "error",
"return": "returns", {
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 expressions where a statement is expected
"no-unused-expressions": "error", "no-unused-expressions": "error",
@ -33,13 +36,13 @@ module.exports = {
"block-scoped-var": "error", "block-scoped-var": "error",
// Warn about cyclomatic complexity in functions. // Warn about cyclomatic complexity in functions.
"complexity": ["error", {"max": 26}], complexity: ["error", { max: 26 }],
// Maximum depth callbacks can be nested. // Maximum depth callbacks can be nested.
"max-nested-callbacks": ["error", 4], "max-nested-callbacks": ["error", 4],
// Allow the console API aside from console.log. // Allow the console API aside from console.log.
"no-console": ["error", {allow: ["error", "info", "trace", "warn"]}], "no-console": ["error", { allow: ["error", "info", "trace", "warn"] }],
// Disallow fallthrough of case statements, except if there is a comment. // Disallow fallthrough of case statements, except if there is a comment.
"no-fallthrough": "error", "no-fallthrough": "error",
@ -55,13 +58,13 @@ module.exports = {
"no-return-assign": "error", "no-return-assign": "error",
// Require use of the second argument for parseInt(). // Require use of the second argument for parseInt().
"radix": "error", radix: "error",
// Require "use strict" to be defined globally in the script. // Require "use strict" to be defined globally in the script.
"strict": ["error", "global"], strict: ["error", "global"],
// Disallow Yoda conditions (where literal value comes first). // Disallow Yoda conditions (where literal value comes first).
"yoda": "error", yoda: "error",
// Disallow function or variable declarations in nested blocks // Disallow function or variable declarations in nested blocks
"no-inner-declarations": "error", "no-inner-declarations": "error",

View File

@ -1,7 +1,5 @@
"use strict"; "use strict";
module.exports = { module.exports = {
"extends": [ extends: ["plugin:mozilla/browser-test"],
"plugin:mozilla/browser-test"
]
}; };

View File

@ -1,14 +1,15 @@
"use strict"; "use strict";
module.exports = { module.exports = {
"extends": [ extends: ["plugin:mozilla/browser-test"],
"plugin:mozilla/browser-test"
],
"rules": { rules: {
"no-unused-vars": ["error", { "no-unused-vars": [
"args": "none", "error",
"vars": "all" {
}] args: "none",
} vars: "all",
},
],
},
}; };

View File

@ -1,8 +1,5 @@
"use strict"; "use strict";
module.exports = { module.exports = {
"extends": [ extends: ["plugin:mozilla/mochitest-test", "plugin:mozilla/browser-test"],
"plugin:mozilla/mochitest-test",
"plugin:mozilla/browser-test"
]
}; };

View File

@ -1,7 +1,5 @@
"use strict"; "use strict";
module.exports = { module.exports = {
"extends": [ extends: ["plugin:mozilla/xpcshell-test"],
"plugin:mozilla/xpcshell-test" };
]
};

View File

@ -1,155 +1,153 @@
"use strict"; "use strict";
module.exports = { module.exports = {
"plugins": [ plugins: ["react"],
"react" globals: {
], exports: true,
"globals": { isWorker: true,
"exports": true, loader: true,
"isWorker": true, module: true,
"loader": true, reportError: true,
"module": true, require: true,
"reportError": true,
"require": true,
}, },
"overrides": [{ overrides: [
"files": [ {
"client/framework/**", files: ["client/framework/**"],
], rules: {
"rules": { "no-return-assign": "off",
"no-return-assign": "off", },
} },
}, { {
"files": [ files: ["client/shared/*.jsm"],
"client/shared/*.jsm", rules: {
], camelcase: "off",
"rules": { },
"camelcase": "off", },
} {
}, { files: [
"files": [ "client/framework/**",
"client/framework/**", "client/shared/*.jsm",
"client/shared/*.jsm", "client/shared/widgets/*.jsm",
"client/shared/widgets/*.jsm", "client/storage/VariablesView.jsm",
"client/storage/VariablesView.jsm", ],
], rules: {
"rules": { "consistent-return": "off",
"consistent-return": "off", },
} },
}, { {
"files": [ files: ["client/framework/**"],
"client/framework/**", rules: {
], "max-nested-callbacks": "off",
"rules": { },
"max-nested-callbacks": "off", },
} {
}, { files: [
"files": [ "client/framework/**",
"client/framework/**", "client/shared/*.jsm",
"client/shared/*.jsm", "client/shared/widgets/*.jsm",
"client/shared/widgets/*.jsm", "client/storage/VariablesView.jsm",
"client/storage/VariablesView.jsm", "shared/webconsole/test/chrome/*.html",
"shared/webconsole/test/chrome/*.html", ],
], rules: {
"rules": { "mozilla/no-aArgs": "off",
"mozilla/no-aArgs": "off", },
} },
}, { {
"files": [ files: ["client/framework/test/**"],
"client/framework/test/**", rules: {
], "mozilla/var-only-at-top-level": "off",
"rules": { },
"mozilla/var-only-at-top-level": "off", },
} {
}, { files: [
"files": [ "client/framework/**",
"client/framework/**", "client/shared/widgets/*.jsm",
"client/shared/widgets/*.jsm", "client/storage/VariablesView.jsm",
"client/storage/VariablesView.jsm", ],
], rules: {
"rules": { "no-shadow": "off",
"no-shadow": "off", },
} },
}, { {
"files": [ files: ["client/framework/**"],
"client/framework/**", rules: {
], strict: "off",
"rules": { },
"strict": "off", },
} {
}, { // For all head*.js files, turn off no-unused-vars at a global level
// For all head*.js files, turn off no-unused-vars at a global level files: ["**/head*.js"],
"files": [ rules: {
"**/head*.js", "no-unused-vars": ["error", { args: "none", vars: "local" }],
], },
"rules": { },
"no-unused-vars": ["error", {"args": "none", "vars": "local"}], {
} // For all server files, prevent requiring devtools/client modules.
}, { files: [
// For all server files, prevent requiring devtools/client modules. "server/**",
"files": [ // The rule also applies to all `shared` files, with the exception of
"server/**", // shared/fronts.
// The rule also applies to all `shared` files, with the exception of // This first pattern matches files in a shared subfolder other than "fronts".
// shared/fronts. "shared/!(fronts)/**",
// This first pattern matches files in a shared subfolder other than "fronts". // This second pattern matches files directly under shared.
"shared/!(fronts)/**", "shared/*.**",
// This second pattern matches files directly under shared. ],
"shared/*.**", rules: {
], "mozilla/reject-some-requires": [
"rules": { "error",
"mozilla/reject-some-requires": ["error", "^(resource\://)?devtools/client"], "^(resource://)?devtools/client",
} ],
}, { },
// Cu, Cc etc... are not available in most devtools modules loaded by require. },
"files": [ {
"**" // Cu, Cc etc... are not available in most devtools modules loaded by require.
], files: ["**"],
"excludedFiles": [ excludedFiles: [
// Enable the rule on JSM, test head files and some specific files. // Enable the rule on JSM, test head files and some specific files.
"**/*.jsm", "**/*.jsm",
"**/test/**/head.js", "**/test/**/head.js",
"**/test/**/shared-head.js", "**/test/**/shared-head.js",
"client/debugger/test/mochitest/code_frame-script.js", "client/debugger/test/mochitest/code_frame-script.js",
"client/inspector/animation-old/test/doc_frame_script.js", "client/inspector/animation-old/test/doc_frame_script.js",
"client/inspector/animation/test/doc_frame_script.js", "client/inspector/animation/test/doc_frame_script.js",
"client/inspector/rules/test/doc_frame_script.js", "client/inspector/rules/test/doc_frame_script.js",
"client/inspector/shared/test/doc_frame_script.js", "client/inspector/shared/test/doc_frame_script.js",
"client/jsonview/converter-observer.js", "client/jsonview/converter-observer.js",
"client/jsonview/test/doc_frame_script.js", "client/jsonview/test/doc_frame_script.js",
"client/responsive.html/browser/content.js", "client/responsive.html/browser/content.js",
"client/shared/browser-loader.js", "client/shared/browser-loader.js",
"server/actors/webconsole/content-process-forward.js", "server/actors/webconsole/content-process-forward.js",
"server/actors/worker/service-worker-process.js", "server/actors/worker/service-worker-process.js",
"server/startup/content-process.js", "server/startup/content-process.js",
"server/startup/frame.js", "server/startup/frame.js",
"shared/base-loader.js", "shared/base-loader.js",
"shared/worker/loader.js", "shared/worker/loader.js",
"startup/aboutdebugging-registration.js", "startup/aboutdebugging-registration.js",
"startup/aboutdevtools/aboutdevtools-registration.js", "startup/aboutdevtools/aboutdevtools-registration.js",
"startup/aboutdevtoolstoolbox-registration.js", "startup/aboutdevtoolstoolbox-registration.js",
"startup/devtools-startup.js", "startup/devtools-startup.js",
], ],
"rules": { rules: {
"mozilla/no-define-cc-etc": "off", "mozilla/no-define-cc-etc": "off",
} },
}, { },
// All DevTools files should avoid relative paths. {
"files": [ // All DevTools files should avoid relative paths.
"**" files: ["**"],
], excludedFiles: [
"excludedFiles": [ // Debugger modules have a custom bundling logic which relies on relative
// Debugger modules have a custom bundling logic which relies on relative // paths.
// paths. "client/debugger/**",
"client/debugger/**", // `client/shared/build` contains node helpers to build the debugger and
// `client/shared/build` contains node helpers to build the debugger and // not devtools modules.
// not devtools modules. "client/shared/build/**",
"client/shared/build/**", ],
], rules: {
"rules": { "mozilla/reject-relative-requires": "error",
"mozilla/reject-relative-requires": "error", },
} },
}], ],
"rules": { rules: {
// These are the rules that have been configured so far to match the // These are the rules that have been configured so far to match the
// devtools coding style. // devtools coding style.
@ -160,9 +158,12 @@ module.exports = {
// devtools/shared/platform is special; see the README.md in that // devtools/shared/platform is special; see the README.md in that
// directory for details. We reject requires using explicit // directory for details. We reject requires using explicit
// subdirectories of this directory. // subdirectories of this directory.
"mozilla/reject-some-requires": ["error", "^devtools/shared/platform/(chome|content)/"], "mozilla/reject-some-requires": [
"error",
"^devtools/shared/platform/(chome|content)/",
],
"mozilla/var-only-at-top-level": "error", "mozilla/var-only-at-top-level": "error",
"mozilla/use-chromeutils-import": ["error", {allowCu: true}], "mozilla/use-chromeutils-import": ["error", { allowCu: true }],
// Rules from the React plugin // Rules from the React plugin
"react/display-name": "error", "react/display-name": "error",
@ -173,49 +174,47 @@ module.exports = {
"react/no-unknown-property": "error", "react/no-unknown-property": "error",
"react/prefer-es6-class": ["off", "always"], "react/prefer-es6-class": ["off", "always"],
"react/prop-types": "error", "react/prop-types": "error",
"react/sort-comp": ["error", { "react/sort-comp": [
order: [ "error",
"static-methods", {
"lifecycle", order: ["static-methods", "lifecycle", "everything-else", "render"],
"everything-else", groups: {
"render" lifecycle: [
], "displayName",
groups: { "propTypes",
lifecycle: [ "contextTypes",
"displayName", "childContextTypes",
"propTypes", "mixins",
"contextTypes", "statics",
"childContextTypes", "defaultProps",
"mixins", "constructor",
"statics", "getDefaultProps",
"defaultProps", "getInitialState",
"constructor", "state",
"getDefaultProps", "getChildContext",
"getInitialState", "componentWillMount",
"state", "componentDidMount",
"getChildContext", "componentWillReceiveProps",
"componentWillMount", "shouldComponentUpdate",
"componentDidMount", "componentWillUpdate",
"componentWillReceiveProps", "componentDidUpdate",
"shouldComponentUpdate", "componentWillUnmount",
"componentWillUpdate", ],
"componentDidUpdate", },
"componentWillUnmount" },
] ],
}
}],
// Disallow using variables outside the blocks they are defined (especially // Disallow using variables outside the blocks they are defined (especially
// since only let and const are used, see "no-var"). // since only let and const are used, see "no-var").
"block-scoped-var": "error", "block-scoped-var": "error",
// Require camel case names // Require camel case names
"camelcase": ["error", { "properties": "never" }], camelcase: ["error", { properties: "never" }],
// Warn about cyclomatic complexity in functions. // Warn about cyclomatic complexity in functions.
// 20 is ESLint's default, and we want to keep it this way to prevent new highly // 20 is ESLint's default, and we want to keep it this way to prevent new highly
// complex functions from being introduced. However, because Mozilla's eslintrc has // complex functions from being introduced. However, because Mozilla's eslintrc has
// some other value defined, we need to override it here. See bug 1553449 for more // some other value defined, we need to override it here. See bug 1553449 for more
// information on complex DevTools functions that are currently excluded. // information on complex DevTools functions that are currently excluded.
"complexity": ["error", 20], complexity: ["error", 20],
// Don't warn for inconsistent naming when capturing this (not so important // Don't warn for inconsistent naming when capturing this (not so important
// with auto-binding fat arrow functions). // with auto-binding fat arrow functions).
"consistent-this": "off", "consistent-this": "off",
@ -224,7 +223,7 @@ module.exports = {
"default-case": "off", "default-case": "off",
// Allow using == instead of ===, in the interest of landing something since // Allow using == instead of ===, in the interest of landing something since
// the devtools codebase is split on convention here. // the devtools codebase is split on convention here.
"eqeqeq": "off", eqeqeq: "off",
// Don't require function expressions to have a name. // Don't require function expressions to have a name.
// This makes the code more verbose and hard to read. Our engine already // 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 // does a fantastic job assigning a name to the function, which includes
@ -245,7 +244,7 @@ module.exports = {
// Require a capital letter for constructors, only check if all new // Require a capital letter for constructors, only check if all new
// operators are followed by a capital letter. Don't warn when capitalized // operators are followed by a capital letter. Don't warn when capitalized
// functions are used without the new operator. // functions are used without the new operator.
"new-cap": ["error", {"capIsNew": false}], "new-cap": ["error", { capIsNew: false }],
// Allow use of bitwise operators. // Allow use of bitwise operators.
"no-bitwise": "off", "no-bitwise": "off",
// Allow using the console API. // Allow using the console API.
@ -291,10 +290,13 @@ module.exports = {
// Don't restrict usage of specified node modules (not a node environment). // Don't restrict usage of specified node modules (not a node environment).
"no-restricted-modules": "off", "no-restricted-modules": "off",
// Prevent using some properties // Prevent using some properties
"no-restricted-properties": ["error", { "no-restricted-properties": [
"property": "setupInParent", "error",
"message": "avoid child/parent communication with setupInParent" {
}], property: "setupInParent",
message: "avoid child/parent communication with setupInParent",
},
],
// Disallow use of assignment in return statement. It is preferable for a // Disallow use of assignment in return statement. It is preferable for a
// single line of code to have only one easily predictable effect. // single line of code to have only one easily predictable effect.
"no-return-assign": "error", "no-return-assign": "error",
@ -316,7 +318,7 @@ module.exports = {
"no-undefined": "off", "no-undefined": "off",
// Disallow global and local variables that aren't used, but allow unused // Disallow global and local variables that aren't used, but allow unused
// function arguments. // function arguments.
"no-unused-vars": ["error", {"args": "none", "vars": "all"}], "no-unused-vars": ["error", { args: "none", vars: "all" }],
// Allow using variables before they are defined. // Allow using variables before they are defined.
"no-use-before-define": "off", "no-use-before-define": "off",
// We use var-only-at-top-level instead of no-var as we allow top level // We use var-only-at-top-level instead of no-var as we allow top level
@ -331,14 +333,14 @@ module.exports = {
// Allow more than one variable declaration per function. // Allow more than one variable declaration per function.
"one-var": "off", "one-var": "off",
// Enforce using `let` only when variables are reassigned. // Enforce using `let` only when variables are reassigned.
"prefer-const": ["error", { "destructuring": "all" }], "prefer-const": ["error", { destructuring: "all" }],
// Require use of the second argument for parseInt(). // Require use of the second argument for parseInt().
"radix": "error", radix: "error",
// Don't require to sort variables within the same declaration block. // Don't require to sort variables within the same declaration block.
// Anyway, one-var is disabled. // Anyway, one-var is disabled.
"sort-vars": "off", "sort-vars": "off",
// Require "use strict" to be defined globally in the script. // Require "use strict" to be defined globally in the script.
"strict": ["error", "global"], strict: ["error", "global"],
// Warn about invalid JSDoc comments. // Warn about invalid JSDoc comments.
// Disabled for now because of https://github.com/eslint/eslint/issues/2270 // Disabled for now because of https://github.com/eslint/eslint/issues/2270
// The rule fails on some jsdoc comments like in: // The rule fails on some jsdoc comments like in:
@ -347,7 +349,7 @@ module.exports = {
// Allow vars to be declared anywhere in the scope. // Allow vars to be declared anywhere in the scope.
"vars-on-top": "off", "vars-on-top": "off",
// Disallow Yoda conditions (where literal value comes first). // Disallow Yoda conditions (where literal value comes first).
"yoda": "error", yoda: "error",
// And these are the rules that haven't been discussed so far, and that are // And these are the rules that haven't been discussed so far, and that are
// disabled for now until we introduce them, one at a time. // disabled for now until we introduce them, one at a time.
@ -398,5 +400,5 @@ module.exports = {
// require assignment operator shorthand where possible or prohibit it // require assignment operator shorthand where possible or prohibit it
// entirely // entirely
"operator-assignment": "off", "operator-assignment": "off",
} },
}; };

View File

@ -1,13 +1,13 @@
"use strict"; "use strict";
module.exports = { module.exports = {
"env": { "browser": true }, env: { browser: true },
"globals": { globals: {
"define": true, define: true,
}, },
"rules": { rules: {
// See bug 1288147, the devtools front-end wants to be able to run in // See bug 1288147, the devtools front-end wants to be able to run in
// content privileged windows, where ownerGlobal doesn't exist. // content privileged windows, where ownerGlobal doesn't exist.
"mozilla/use-ownerGlobal": "off", "mozilla/use-ownerGlobal": "off",
} },
}; };

View File

@ -6,5 +6,5 @@
module.exports = { module.exports = {
// Extend from the shared list of defined globals for mochitests. // Extend from the shared list of defined globals for mochitests.
"extends": "../../../../.eslintrc.mochitests.js" extends: "../../../../.eslintrc.mochitests.js",
}; };

View File

@ -4,7 +4,7 @@
"use strict"; "use strict";
module.exports = { module.exports = {
"env": { env: {
"jest": true, jest: true,
}, },
}; };

View File

@ -2,5 +2,5 @@
module.exports = { module.exports = {
// Extend from the common devtools xpcshell eslintrc config. // Extend from the common devtools xpcshell eslintrc config.
"extends": "../../../../.eslintrc.xpcshell.js" extends: "../../../../.eslintrc.xpcshell.js",
}; };

View File

@ -2,5 +2,5 @@
module.exports = { module.exports = {
// Extend from the shared list of defined globals for mochitests. // Extend from the shared list of defined globals for mochitests.
"extends": "../../../../.eslintrc.mochitests.js" extends: "../../../../.eslintrc.mochitests.js",
}; };

View File

@ -2,5 +2,5 @@
module.exports = { module.exports = {
// Extend from the shared list of defined globals for mochitests. // Extend from the shared list of defined globals for mochitests.
"extends": "../../../../.eslintrc.mochitests.js" extends: "../../../../.eslintrc.mochitests.js",
}; };

View File

@ -5,7 +5,7 @@
"use strict"; "use strict";
module.exports = { module.exports = {
"env": { env: {
"jest": true, jest: true,
}, },
}; };

View File

@ -6,5 +6,5 @@
module.exports = { module.exports = {
// Extend from the shared list of defined globals for mochitests. // Extend from the shared list of defined globals for mochitests.
"extends": "../../../../.eslintrc.mochitests.js" extends: "../../../../.eslintrc.mochitests.js",
}; };

View File

@ -4,7 +4,7 @@
"use strict"; "use strict";
module.exports = { module.exports = {
"env": { env: {
"jest": true, jest: true,
}, },
}; };

View File

@ -2,5 +2,5 @@
module.exports = { module.exports = {
// Extend from the common devtools xpcshell eslintrc config. // Extend from the common devtools xpcshell eslintrc config.
"extends": "../../../../.eslintrc.xpcshell.js" extends: "../../../../.eslintrc.xpcshell.js",
}; };

View File

@ -1,64 +1,68 @@
/* 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 = { module.exports = {
"parser": "babel-eslint", parser: "babel-eslint",
"plugins": [ plugins: [
"react", "react",
"mozilla", "mozilla",
"flowtype", "flowtype",
"babel", "babel",
"prettier", "prettier",
"import", "import",
"file-header" "file-header",
], ],
"globals": { globals: {
"atob": true, atob: true,
"btoa": true, btoa: true,
"Cc": true, Cc: true,
"Ci": true, Ci: true,
"Components": true, Components: true,
"console": true, console: true,
"Cr": true, Cr: true,
"Cu": true, Cu: true,
"devtools": true, devtools: true,
"dump": true, dump: true,
"EventEmitter": true, EventEmitter: true,
"isWorker": true, isWorker: true,
"loader": true, loader: true,
"reportError": true, reportError: true,
"Services": true, Services: true,
"Task": true, Task: true,
"XPCNativeWrapper": true, XPCNativeWrapper: true,
"XPCOMUtils": true, XPCOMUtils: true,
"_Iterator": true, _Iterator: true,
"__dirname": true, __dirname: true,
"process": true, process: true,
"global": true, global: true,
"L10N": true L10N: true,
}, },
"extends": [ extends: [
"prettier", "prettier",
"prettier/flowtype", "prettier/flowtype",
"prettier/react", "prettier/react",
"plugin:jest/recommended" "plugin:jest/recommended",
], ],
"parserOptions": { parserOptions: {
"ecmaVersion": 2016, ecmaVersion: 2016,
"sourceType": "module", sourceType: "module",
"ecmaFeatures": { "jsx": true }, ecmaFeatures: { jsx: true },
// When the linter runs from the MC root, it won't pick up this project's // When the linter runs from the MC root, it won't pick up this project's
// babel.config.js, so we explicitly set Babel's root location so that // babel.config.js, so we explicitly set Babel's root location so that
// it knows where to look. // it knows where to look.
"babelOptions": { babelOptions: {
"root": __dirname, root: __dirname,
}, },
}, },
"env": { env: {
"es6": true, es6: true,
"browser": true, browser: true,
"commonjs": true, commonjs: true,
"jest": true jest: true,
}, },
"rules": { rules: {
// These are the rules that have been configured so far to match the // These are the rules that have been configured so far to match the
// devtools coding style. // devtools coding style.
@ -81,8 +85,8 @@ module.exports = {
"react/sort-comp": [ "react/sort-comp": [
1, 1,
{ {
order: ["propTypes", "everything-else", "render"] order: ["propTypes", "everything-else", "render"],
} },
], ],
// Check for import errors. // Check for import errors.
@ -100,9 +104,9 @@ module.exports = {
// since only let and const are used, see "no-var"). // since only let and const are used, see "no-var").
"block-scoped-var": 2, "block-scoped-var": 2,
// Require camel case names // Require camel case names
"camelcase": ["error", { "properties": "never" }], camelcase: ["error", { properties: "never" }],
// Warn about cyclomatic complexity in functions. // Warn about cyclomatic complexity in functions.
"complexity": ["error", { "max": 22 }], complexity: ["error", { max: 22 }],
// Don't warn for inconsistent naming when capturing this (not so important // Don't warn for inconsistent naming when capturing this (not so important
// with auto-binding fat arrow functions). // with auto-binding fat arrow functions).
"consistent-this": 0, "consistent-this": 0,
@ -113,7 +117,7 @@ module.exports = {
"dot-notation": 2, "dot-notation": 2,
// Allow using == instead of ===, in the interest of landing something since // Allow using == instead of ===, in the interest of landing something since
// the devtools codebase is split on convention here. // the devtools codebase is split on convention here.
"eqeqeq": 0, eqeqeq: 0,
// Don't require function expressions to have a name. // Don't require function expressions to have a name.
// This makes the code more verbose and hard to read. Our engine already // 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 // does a fantastic job assigning a name to the function, which includes
@ -139,7 +143,7 @@ module.exports = {
// Require a capital letter for constructors, only check if all new // Require a capital letter for constructors, only check if all new
// operators are followed by a capital letter. Don't warn when capitalized // operators are followed by a capital letter. Don't warn when capitalized
// functions are used without the new operator. // functions are used without the new operator.
"new-cap": [2, { "capIsNew": false }], "new-cap": [2, { capIsNew: false }],
// Disallow use of the Array constructor. // Disallow use of the Array constructor.
"no-array-constructor": 2, "no-array-constructor": 2,
// Allow use of bitwise operators. // Allow use of bitwise operators.
@ -211,9 +215,9 @@ module.exports = {
"prefer-const": [ "prefer-const": [
"error", "error",
{ {
"destructuring": "all", destructuring: "all",
"ignoreReadBeforeAssign": false ignoreReadBeforeAssign: false,
} },
], ],
// Disallow reassignments of native objects. // Disallow reassignments of native objects.
"no-native-reassign": 2, "no-native-reassign": 2,
@ -283,7 +287,7 @@ module.exports = {
// statement. // statement.
"no-unreachable": 2, "no-unreachable": 2,
// Disallow global and local variables that arent used, but allow unused function arguments. // Disallow global and local variables that arent used, but allow unused function arguments.
"no-unused-vars": [2, { "vars": "all", "args": "none" }], "no-unused-vars": [2, { vars: "all", args: "none" }],
// Allow using variables before they are defined. // Allow using variables before they are defined.
"no-use-before-define": 0, "no-use-before-define": 0,
// We use var-only-at-top-level instead of no-var as we allow top level // We use var-only-at-top-level instead of no-var as we allow top level
@ -300,12 +304,12 @@ module.exports = {
// Allow more than one variable declaration per function. // Allow more than one variable declaration per function.
"one-var": 0, "one-var": 0,
// Require use of the second argument for parseInt(). // Require use of the second argument for parseInt().
"radix": 2, radix: 2,
// Dont require to sort variables within the same declaration block. // Dont require to sort variables within the same declaration block.
// Anyway, one-var is disabled. // Anyway, one-var is disabled.
"sort-vars": 0, "sort-vars": 0,
// Require "use strict" to be defined globally in the script. // Require "use strict" to be defined globally in the script.
"strict": [2, "global"], strict: [2, "global"],
// Disallow comparisons with the value NaN. // Disallow comparisons with the value NaN.
"use-isnan": 2, "use-isnan": 2,
// Warn about invalid JSDoc comments. // Warn about invalid JSDoc comments.
@ -318,7 +322,7 @@ module.exports = {
// Allow vars to be declared anywhere in the scope. // Allow vars to be declared anywhere in the scope.
"vars-on-top": 0, "vars-on-top": 0,
// Disallow Yoda conditions (where literal value comes first). // Disallow Yoda conditions (where literal value comes first).
"yoda": 2, yoda: 2,
// And these are the rules that haven't been discussed so far, and that are // And these are the rules that haven't been discussed so far, and that are
// disabled for now until we introduce them, one at a time. // disabled for now until we introduce them, one at a time.
@ -382,12 +386,11 @@ module.exports = {
[ [
"This Source Code Form is subject to the terms of the Mozilla Public", "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", "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/>.",
], ],
"block", "block",
["-\\*-(.*)-\\*-", "eslint(.*)", "vim(.*)"] ["-\\*-(.*)-\\*-", "eslint(.*)", "vim(.*)"],
], ],
"consistent-return": "off", "consistent-return": "off",
},
} };
}

View File

@ -1,13 +1,13 @@
"use strict"; "use strict";
module.exports = { module.exports = {
"globals": { globals: {
"XMLHttpRequest": true, XMLHttpRequest: true,
"window": true, window: true,
"define": true, define: true,
"addEventListener": true, addEventListener: true,
"document": true, document: true,
"dispatchEvent": true, dispatchEvent: true,
"MessageEvent": true MessageEvent: true,
} },
}; };

View File

@ -2,5 +2,5 @@
module.exports = { module.exports = {
// Extend from the shared list of defined globals for mochitests. // Extend from the shared list of defined globals for mochitests.
"extends": "../../../.eslintrc.mochitests.js", extends: "../../../.eslintrc.mochitests.js",
}; };

View File

@ -2,5 +2,5 @@
module.exports = { module.exports = {
// Extend from the shared list of defined globals for mochitests. // Extend from the shared list of defined globals for mochitests.
"extends": "../../../../.eslintrc.mochitests.js" extends: "../../../../.eslintrc.mochitests.js",
}; };

View File

@ -2,5 +2,5 @@
module.exports = { module.exports = {
// Extend from the shared list of defined globals for mochitests. // Extend from the shared list of defined globals for mochitests.
"extends": "../../../.eslintrc.mochitests.js" extends: "../../../.eslintrc.mochitests.js",
}; };

View File

@ -4,7 +4,7 @@
"use strict"; "use strict";
module.exports = { module.exports = {
"env": { env: {
"jest": true, jest: true,
}, },
}; };

View File

@ -2,5 +2,5 @@
module.exports = { module.exports = {
// Extend from the shared list of defined globals for mochitests. // Extend from the shared list of defined globals for mochitests.
"extends": "../../../../.eslintrc.xpcshell.js" extends: "../../../../.eslintrc.xpcshell.js",
}; };

View File

@ -2,14 +2,16 @@
module.exports = { module.exports = {
// Extend from the devtools eslintrc. // Extend from the devtools eslintrc.
"extends": "../../.eslintrc.js", extends: "../../.eslintrc.js",
"rules": { rules: {
// The inspector is being migrated to HTML and cleaned of // The inspector is being migrated to HTML and cleaned of
// chrome-privileged code, so this rule disallows requiring chrome // chrome-privileged code, so this rule disallows requiring chrome
// code. Some files in the inspector disable this rule still. The // code. Some files in the inspector disable this rule still. The
// goal is to enable the rule globally on all files. // goal is to enable the rule globally on all files.
"mozilla/reject-some-requires": ["error", "mozilla/reject-some-requires": [
"^(chrome|chrome:.*|resource:.*|devtools/server/.*|.*\\.jsm|devtools/shared/platform/(chome|content)/.*)$"], "error",
"^(chrome|chrome:.*|resource:.*|devtools/server/.*|.*\\.jsm|devtools/shared/platform/(chome|content)/.*)$",
],
}, },
}; };

View File

@ -2,5 +2,5 @@
module.exports = { module.exports = {
// Extend from the shared list of defined globals for mochitests. // Extend from the shared list of defined globals for mochitests.
"extends": "../../../../.eslintrc.mochitests.js" extends: "../../../../.eslintrc.mochitests.js",
}; };

View File

@ -2,5 +2,5 @@
module.exports = { module.exports = {
// Extend from the shared list of defined globals for mochitests. // Extend from the shared list of defined globals for mochitests.
"extends": "../../../../.eslintrc.mochitests.js" extends: "../../../../.eslintrc.mochitests.js",
}; };

View File

@ -2,5 +2,5 @@
module.exports = { module.exports = {
// Extend from the shared list of defined globals for mochitests. // Extend from the shared list of defined globals for mochitests.
"extends": "../../../../.eslintrc.mochitests.js", extends: "../../../../.eslintrc.mochitests.js",
}; };

View File

@ -2,5 +2,5 @@
module.exports = { module.exports = {
// Extend from the common devtools xpcshell eslintrc config. // Extend from the common devtools xpcshell eslintrc config.
"extends": "../../../../../.eslintrc.xpcshell.js" extends: "../../../../../.eslintrc.xpcshell.js",
}; };

Some files were not shown because too many files have changed in this diff Show More