Permalink
Browse files

Chore: Enable comma-dangle on ESLint codebase (fixes #7725) (#7906)

  • Loading branch information...
1 parent 075ec25 commit d6150e300e86e2e55a6a3d048dfb6072ac2b6489 @not-an-aardvark not-an-aardvark committed with kaicataldo Jan 12, 2017
Showing with 259 additions and 258 deletions.
  1. +1 −1 lib/ast-utils.js
  2. +1 −1 lib/config/config-initializer.js
  3. +1 −1 lib/formatters/codeframe.js
  4. +1 −1 lib/internal-rules/internal-consistent-docs-description.js
  5. +6 −6 lib/rules/comma-dangle.js
  6. +1 −1 lib/rules/comma-style.js
  7. +1 −1 lib/rules/lines-around-directive.js
  8. +1 −1 lib/rules/max-lines.js
  9. +1 −1 lib/rules/max-statements-per-line.js
  10. +5 −5 lib/rules/no-await-in-loop.js
  11. +1 −1 lib/rules/no-dupe-keys.js
  12. +2 −2 lib/rules/no-return-await.js
  13. +4 −4 lib/rules/no-useless-return.js
  14. +1 −1 lib/rules/quotes.js
  15. +1 −1 lib/rules/require-await.js
  16. +2 −2 lib/rules/sort-keys.js
  17. +1 −1 lib/rules/space-before-function-paren.js
  18. +3 −3 lib/testers/rule-tester.js
  19. +1 −1 lib/util/glob-util.js
  20. +1 −0 packages/eslint-config-eslint/default.yml
  21. +4 −4 tests/lib/ast-utils.js
  22. +1 −1 tests/lib/formatters/codeframe.js
  23. +12 −12 tests/lib/rules/array-bracket-spacing.js
  24. +1 −1 tests/lib/rules/arrow-body-style.js
  25. +1 −1 tests/lib/rules/arrow-parens.js
  26. +5 −5 tests/lib/rules/arrow-spacing.js
  27. +6 −6 tests/lib/rules/capitalized-comments.js
  28. +1 −1 tests/lib/rules/class-methods-use-this.js
  29. +38 −38 tests/lib/rules/comma-dangle.js
  30. +2 −2 tests/lib/rules/comma-style.js
  31. +1 −1 tests/lib/rules/consistent-return.js
  32. +1 −1 tests/lib/rules/generator-star-spacing.js
  33. +1 −1 tests/lib/rules/indent.js
  34. +2 −2 tests/lib/rules/key-spacing.js
  35. +1 −1 tests/lib/rules/new-parens.js
  36. +3 −3 tests/lib/rules/no-await-in-loop.js
  37. +2 −2 tests/lib/rules/no-console.js
  38. +2 −2 tests/lib/rules/no-dupe-keys.js
  39. +3 −3 tests/lib/rules/no-extra-parens.js
  40. +1 −1 tests/lib/rules/no-invalid-this.js
  41. +1 −1 tests/lib/rules/no-new-symbol.js
  42. +1 −1 tests/lib/rules/no-restricted-properties.js
  43. +25 −25 tests/lib/rules/no-return-await.js
  44. +2 −2 tests/lib/rules/no-self-assign.js
  45. +1 −1 tests/lib/rules/no-tabs.js
  46. +2 −2 tests/lib/rules/no-unsafe-negation.js
  47. +5 −5 tests/lib/rules/no-unused-vars.js
  48. +1 −1 tests/lib/rules/no-use-before-define.js
  49. +5 −5 tests/lib/rules/no-useless-escape.js
  50. +2 −2 tests/lib/rules/no-useless-return.js
  51. +1 −1 tests/lib/rules/no-var.js
  52. +1 −1 tests/lib/rules/prefer-arrow-callback.js
  53. +2 −2 tests/lib/rules/prefer-const.js
  54. +2 −2 tests/lib/rules/prefer-rest-params.js
  55. +1 −1 tests/lib/rules/quote-props.js
  56. +6 −6 tests/lib/rules/quotes.js
  57. +11 −11 tests/lib/rules/require-await.js
  58. +1 −1 tests/lib/rules/require-jsdoc.js
  59. +58 −58 tests/lib/rules/sort-keys.js
  60. +2 −2 tests/lib/rules/space-before-function-paren.js
  61. +1 −1 tests/lib/rules/space-infix-ops.js
  62. +2 −2 tests/lib/rules/symbol-description.js
  63. +2 −2 tests/lib/rules/valid-typeof.js
View
@@ -1037,7 +1037,7 @@ module.exports = {
return {
start: Object.assign({}, start),
- end: Object.assign({}, end),
+ end: Object.assign({}, end)
};
},
@@ -317,7 +317,7 @@ function promptUser(callback) {
default: false,
when(answers) {
return answers.styleguide === "airbnb";
- },
+ }
},
{
type: "input",
@@ -56,7 +56,7 @@ function formatMessage(message, parentResult) {
`${type}:`,
`${msg}`,
ruleId ? `${ruleId}` : "",
- sourceCode ? `at ${filePath}:` : `at ${filePath}`,
+ sourceCode ? `at ${filePath}:` : `at ${filePath}`
].filter(String).join(" ");
const result = [firstLine];
@@ -71,7 +71,7 @@ function checkMetaDocsDescription(context, exportsNode) {
if (description === "") {
context.report({
node: metaDocsDescription.value,
- message: "`meta.docs.description` should not be empty.",
+ message: "`meta.docs.description` should not be empty."
});
return;
}
@@ -20,7 +20,7 @@ const DEFAULT_OPTIONS = Object.freeze({
objects: "never",
imports: "never",
exports: "never",
- functions: "ignore",
+ functions: "ignore"
});
/**
@@ -53,7 +53,7 @@ function normalizeOptions(optionValue) {
exports: optionValue,
// For backward compatibility, always ignore functions.
- functions: "ignore",
+ functions: "ignore"
};
}
if (typeof optionValue === "object" && optionValue !== null) {
@@ -62,7 +62,7 @@ function normalizeOptions(optionValue) {
objects: optionValue.objects || DEFAULT_OPTIONS.objects,
imports: optionValue.imports || DEFAULT_OPTIONS.imports,
exports: optionValue.exports || DEFAULT_OPTIONS.exports,
- functions: optionValue.functions || DEFAULT_OPTIONS.functions,
+ functions: optionValue.functions || DEFAULT_OPTIONS.functions
};
}
@@ -121,7 +121,7 @@ module.exports = {
additionalProperties: false
}
]
- },
+ }
]
},
@@ -312,7 +312,7 @@ module.exports = {
"always-multiline": forceTrailingCommaIfMultiline,
"only-multiline": allowTrailingCommaIfMultiline,
never: forbidTrailingComma,
- ignore: lodash.noop,
+ ignore: lodash.noop
};
return {
@@ -330,7 +330,7 @@ module.exports = {
FunctionExpression: predicate[options.functions],
ArrowFunctionExpression: predicate[options.functions],
CallExpression: predicate[options.functions],
- NewExpression: predicate[options.functions],
+ NewExpression: predicate[options.functions]
};
}
};
@@ -48,7 +48,7 @@ module.exports = {
FunctionDeclaration: true,
FunctionExpression: true,
ImportDeclaration: true,
- ObjectPattern: true,
+ ObjectPattern: true
};
if (context.options.length === 2 && context.options[1].hasOwnProperty("exceptions")) {
@@ -31,7 +31,7 @@ module.exports = {
},
after: {
enum: ["always", "never"]
- },
+ }
},
additionalProperties: false,
minProperties: 2
@@ -134,7 +134,7 @@ module.exports = {
message: "File must be at most {{max}} lines long. It's {{actual}} lines long.",
data: {
max,
- actual: lines.length,
+ actual: lines.length
}
});
}
@@ -60,7 +60,7 @@ module.exports = {
data: {
numberOfStatementsOnThisLine,
maxStatementsPerLine,
- statements: numberOfStatementsOnThisLine === 1 ? "statement" : "statements",
+ statements: numberOfStatementsOnThisLine === 1 ? "statement" : "statements"
}
});
}
@@ -10,25 +10,25 @@ const loopTypes = new Set([
"ForOfStatement",
"ForInStatement",
"WhileStatement",
- "DoWhileStatement",
+ "DoWhileStatement"
]);
// Node types at which we should stop looking for loops. For example, it is fine to declare an async
// function within a loop, and use await inside of that.
const boundaryTypes = new Set([
"FunctionDeclaration",
"FunctionExpression",
- "ArrowFunctionExpression",
+ "ArrowFunctionExpression"
]);
module.exports = {
meta: {
docs: {
description: "disallow `await` inside of loops",
category: "Possible Errors",
- recommended: false,
+ recommended: false
},
- schema: [],
+ schema: []
},
create(context) {
return {
@@ -69,7 +69,7 @@ module.exports = {
}
}
}
- },
+ }
};
}
};
@@ -123,7 +123,7 @@ module.exports = {
node: info.node,
loc: node.key.loc,
message: "Duplicate key '{{name}}'.",
- data: { name },
+ data: { name }
});
}
@@ -35,7 +35,7 @@ module.exports = {
context.report({
node: context.getSourceCode().getFirstToken(node),
loc: node.loc,
- message,
+ message
});
}
@@ -88,7 +88,7 @@ module.exports = {
if (isInTailCallPosition(node) && !hasErrorHandler(node)) {
reportUnnecessaryAwait(node);
}
- },
+ }
};
}
};
@@ -213,7 +213,7 @@ module.exports = {
scopeInfo = {
upper: scopeInfo,
uselessReturns: [],
- codePath,
+ codePath
};
},
@@ -226,7 +226,7 @@ module.exports = {
message: "Unnecessary return statement.",
fix(fixer) {
return isRemovable(node) ? fixer.remove(node) : null;
- },
+ }
});
}
@@ -238,7 +238,7 @@ module.exports = {
onCodePathSegmentStart(segment) {
const info = {
uselessReturns: getUselessReturns([], segment.allPrevSegments),
- returned: false,
+ returned: false
};
// Stores the info.
@@ -287,7 +287,7 @@ module.exports = {
WithStatement: markReturnStatementsOnCurrentSegmentsAsUsed,
ExportNamedDeclaration: markReturnStatementsOnCurrentSegmentsAsUsed,
ExportDefaultDeclaration: markReturnStatementsOnCurrentSegmentsAsUsed,
- ExportAllDeclaration: markReturnStatementsOnCurrentSegmentsAsUsed,
+ ExportAllDeclaration: markReturnStatementsOnCurrentSegmentsAsUsed
};
}
};
View
@@ -269,7 +269,7 @@ module.exports = {
node,
message: "Strings must use {{description}}.",
data: {
- description: settings.description,
+ description: settings.description
},
fix(fixer) {
if (isPartOfDirectivePrologue(node)) {
@@ -51,7 +51,7 @@ module.exports = {
function enterFunction() {
scopeInfo = {
upper: scopeInfo,
- hasAwait: false,
+ hasAwait: false
};
}
@@ -64,7 +64,7 @@ const isValidOrders = {
},
descIN(a, b) {
return isValidOrders.ascIN(b, a);
- },
+ }
};
//------------------------------------------------------------------------------
@@ -147,7 +147,7 @@ module.exports = {
prevName,
order,
insensitive: insensitive ? "insensitive " : "",
- natual: natual ? "natural " : "",
+ natual: natual ? "natural " : ""
}
});
}
@@ -159,7 +159,7 @@ module.exports = {
return {
FunctionDeclaration: validateSpacingBeforeParentheses,
FunctionExpression: validateSpacingBeforeParentheses,
- ArrowFunctionExpression: validateSpacingBeforeParentheses,
+ ArrowFunctionExpression: validateSpacingBeforeParentheses
};
}
};
@@ -213,7 +213,7 @@ Object.defineProperties(RuleTester, {
RuleTester[DESCRIBE] = value;
},
configurable: true,
- enumerable: true,
+ enumerable: true
},
it: {
get() {
@@ -226,8 +226,8 @@ Object.defineProperties(RuleTester, {
RuleTester[IT] = value;
},
configurable: true,
- enumerable: true,
- },
+ enumerable: true
+ }
});
RuleTester.prototype = {
@@ -165,7 +165,7 @@ function listFilesToProcess(globPatterns, options) {
const globOptions = {
nodir: true,
dot: true,
- cwd,
+ cwd
};
new GlobSync(pattern, globOptions, shouldIgnore).found.forEach(globMatch => {
@@ -13,6 +13,7 @@ rules:
camelcase: ["error", { properties: "never" }]
callback-return: ["error", ["cb", "callback", "next"]]
class-methods-use-this: "error"
+ comma-dangle: "error"
comma-spacing: "error"
comma-style: ["error", "last"]
consistent-return: "error"
@@ -759,7 +759,7 @@ describe("ast-utils", () => {
"class A { static *foo() {} }": "static generator method 'foo'",
"class A { static async foo() {} }": "static async method 'foo'",
"class A { static get foo() {} }": "static getter 'foo'",
- "class A { static set foo(a) {} }": "static setter 'foo'",
+ "class A { static set foo(a) {} }": "static setter 'foo'"
};
Object.keys(expectedResults).forEach(key => {
@@ -832,7 +832,7 @@ describe("ast-utils", () => {
"class A { static *foo() {} }": [10, 21],
"class A { static async foo() {} }": [10, 26],
"class A { static get foo() {} }": [10, 24],
- "class A { static set foo(a) {} }": [10, 24],
+ "class A { static set foo(a) {} }": [10, 24]
};
Object.keys(expectedResults).forEach(key => {
@@ -877,7 +877,7 @@ describe("ast-utils", () => {
const expectedResults = {
"{}": true,
"{ a }": false,
- a: false,
+ a: false
};
Object.keys(expectedResults).forEach(key => {
@@ -895,7 +895,7 @@ describe("ast-utils", () => {
"(function foo() { a })": false,
"(a) => {}": true,
"(a) => { a }": false,
- "(a) => a": false,
+ "(a) => a": false
};
Object.keys(expectedResults).forEach(key => {
@@ -146,7 +146,7 @@ describe("formatter:codeframe", () => {
line: 1,
column: 7,
ruleId: "no-unused-vars"
- }],
+ }]
}];
it("should return a string with multiple entries", () => {
Oops, something went wrong.

0 comments on commit d6150e3

Please sign in to comment.