Bug 1486739 - Enable ESLint rule comma-dangle for browser/, services/, taskcluster/ and toolkit/ directories. r=mossop

Enable globally by default by blacklist directories outside of the ones we're enabling. Remove now unnecessary existing configurations.

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

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Mark Banner 2018-08-31 06:06:08 +00:00
Родитель 691543ee89
Коммит afb520e82a
15 изменённых файлов: 29 добавлений и 33 удалений

Просмотреть файл

@ -39,5 +39,27 @@ module.exports = {
"env": { "env": {
"mozilla/browser-window": true "mozilla/browser-window": true
} }
}, {
// XXX Bug 1486741 - We've not rolled out comma-dangle to these directories
// yet, so turn it off for now.
"files": [
"accessible/**",
"caps/**",
"chrome/**",
"devtools/**",
"dom/**",
"extensions/**",
"intl/**",
"js/**",
"mobile/**",
"security/**",
"storage/**",
"testing/**",
"tools/**",
"xpcom/**",
],
"rules": {
"comma-dangle": "off",
}
}] }]
}; };

Просмотреть файл

@ -28,7 +28,7 @@ add_task(async function testDetailsObjects() {
green: getImageData("green"), green: getImageData("green"),
}; };
/* eslint-disable comma-dangle, indent, indent-legacy */ /* eslint-disable indent, indent-legacy */
let iconDetails = [ let iconDetails = [
// Only paths. // Only paths.
{details: {"path": "a.png"}, {details: {"path": "a.png"},
@ -166,6 +166,7 @@ add_task(async function testDetailsObjects() {
"1": browser.runtime.getURL("data/32.png"), "1": browser.runtime.getURL("data/32.png"),
"2": browser.runtime.getURL("data/32.png")}}, "2": browser.runtime.getURL("data/32.png")}},
]; ];
/* eslint-enable indent, indent-legacy */
// Allow serializing ImageData objects for logging. // Allow serializing ImageData objects for logging.
ImageData.prototype.toJSON = () => "<ImageData>"; ImageData.prototype.toJSON = () => "<ImageData>";

Просмотреть файл

@ -3,7 +3,6 @@
module.exports = { module.exports = {
"rules": { "rules": {
"block-scoped-var": "error", "block-scoped-var": "error",
"comma-dangle": ["error", "always-multiline"],
"complexity": ["error", {"max": 22}], "complexity": ["error", {"max": 22}],
"indent-legacy": ["error", 2, {"SwitchCase": 1, "ArrayExpression": "first", "ObjectExpression": "first"}], "indent-legacy": ["error", 2, {"SwitchCase": 1, "ArrayExpression": "first", "ObjectExpression": "first"}],
"max-nested-callbacks": ["error", 3], "max-nested-callbacks": ["error", 3],

Просмотреть файл

@ -21,7 +21,6 @@ module.exports = {
"array-bracket-spacing": ["error", "never"], "array-bracket-spacing": ["error", "never"],
"block-scoped-var": "error", "block-scoped-var": "error",
"comma-dangle": ["error", "always-multiline"],
complexity: ["error", { complexity: ["error", {
max: 20, max: 20,
}], }],

Просмотреть файл

@ -1,7 +0,0 @@
"use strict";
module.exports = {
"rules": {
"comma-dangle": ["error", "always-multiline"],
}
};

Просмотреть файл

@ -55,10 +55,6 @@ 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": "error", "block-scoped-var": "error",
// Allow trailing commas for easy list extension. Having them does not
// impair readability, but also not required either.
"comma-dangle": ["error", "always-multiline"],
// Warn about cyclomatic complexity in functions. // Warn about cyclomatic complexity in functions.
"complexity": ["error", {"max": 26}], "complexity": ["error", {"max": 26}],

Просмотреть файл

@ -238,9 +238,6 @@ module.exports = {
"brace-style": ["error", "1tbs", {"allowSingleLine": false}], "brace-style": ["error", "1tbs", {"allowSingleLine": false}],
// Require camel case names // Require camel case names
"camelcase": "error", "camelcase": "error",
// Allow trailing commas for easy list extension. Having them does not
// impair readability, but also not required either.
"comma-dangle": "off",
// Warn about cyclomatic complexity in functions. // Warn about cyclomatic complexity in functions.
"complexity": ["error", 53], "complexity": ["error", 53],
// Don't warn for inconsistent naming when capturing this (not so important // Don't warn for inconsistent naming when capturing this (not so important

Просмотреть файл

@ -109,10 +109,6 @@ 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": "error", "block-scoped-var": "error",
// Allow trailing commas for easy list extension. Having them does not
// impair readability, but also not required either.
"comma-dangle": ["error", "always-multiline"],
// Warn about cyclomatic complexity in functions. // Warn about cyclomatic complexity in functions.
"complexity": "error", "complexity": "error",

Просмотреть файл

@ -7,7 +7,6 @@ module.exports = {
"mozilla/var-only-at-top-level": "error", "mozilla/var-only-at-top-level": "error",
"block-scoped-var": "error", "block-scoped-var": "error",
"camelcase": "error", "camelcase": "error",
"comma-dangle": "off",
"complexity": ["error", {"max": 20}], "complexity": ["error", {"max": 20}],
"curly": "error", "curly": "error",
"dot-location": ["error", "property"], "dot-location": ["error", "property"],

Просмотреть файл

@ -1,7 +0,0 @@
"use strict";
module.exports = {
"rules": {
"comma-dangle": ["error", "always-multiline"],
}
};

Просмотреть файл

@ -7,7 +7,6 @@ module.exports = {
"array-bracket-spacing": ["error", "never"], "array-bracket-spacing": ["error", "never"],
"block-scoped-var": "error", "block-scoped-var": "error",
"comma-dangle": ["error", "always-multiline"],
complexity: ["error", { complexity: ["error", {
max: 23, max: 23,
}], }],

Просмотреть файл

@ -16,7 +16,6 @@ module.exports = {
"rules": { "rules": {
"camelcase": "error", "camelcase": "error",
"comma-dangle": ["error", "never"],
"curly": ["error", "multi-line"], "curly": ["error", "multi-line"],
"handle-callback-err": ["error", "er"], "handle-callback-err": ["error", "er"],
"indent-legacy": ["error", 2, {"SwitchCase": 1}], "indent-legacy": ["error", 2, {"SwitchCase": 1}],

Просмотреть файл

@ -116,6 +116,9 @@ module.exports = {
// No newline before open brace for a block // No newline before open brace for a block
"brace-style": ["error", "1tbs", { "allowSingleLine": true }], "brace-style": ["error", "1tbs", { "allowSingleLine": true }],
// Require trailing commas for easy list extension and consistent style.
"comma-dangle": ["error", "always-multiline"],
// No space before always a space after a comma // No space before always a space after a comma
"comma-spacing": ["error", {"after": true, "before": false}], "comma-spacing": ["error", {"after": true, "before": false}],

Просмотреть файл

@ -1,6 +1,6 @@
{ {
"name": "eslint-plugin-mozilla", "name": "eslint-plugin-mozilla",
"version": "0.15.1", "version": "0.15.3",
"lockfileVersion": 1, "lockfileVersion": 1,
"requires": true, "requires": true,
"dependencies": { "dependencies": {

Просмотреть файл

@ -1,6 +1,6 @@
{ {
"name": "eslint-plugin-mozilla", "name": "eslint-plugin-mozilla",
"version": "0.15.1", "version": "0.15.3",
"description": "A collection of rules that help enforce JavaScript coding standard in the Mozilla project.", "description": "A collection of rules that help enforce JavaScript coding standard in the Mozilla project.",
"keywords": [ "keywords": [
"eslint", "eslint",