Skip to content
Permalink
Browse files

Chore: enable additional rules on ESLint codebase (#9013)

This enables a bunch of rules on the ESLint codebase for dogfooding and style consistency. Almost all of the rules were already being followed everywhere.
  • Loading branch information...
not-an-aardvark committed Jul 26, 2017
1 parent 9b6c552 commit b3b95b8033172a206c79dd7daadee205e395e9b6
Showing with 23 additions and 11 deletions.
  1. +2 −2 lib/rules/indent-legacy.js
  2. +20 −8 packages/eslint-config-eslint/default.yml
  3. +1 −1 tests/lib/ignored-paths.js
@@ -729,7 +729,7 @@ module.exports = {
if (!parentVarNode || parentVarNode.loc.start.line !== node.loc.start.line) {
if (parent.type !== "VariableDeclarator" || parentVarNode === parentVarNode.parent.declarations[0]) {
if (parent.type === "VariableDeclarator" && parentVarNode.loc.start.line === parent.loc.start.line) {
nodeIndent = nodeIndent + (indentSize * options.VariableDeclarator[parentVarNode.parent.kind]);
nodeIndent += (indentSize * options.VariableDeclarator[parentVarNode.parent.kind]);
} else if (parent.type === "ObjectExpression" || parent.type === "ArrayExpression") {
const parentElements = node.parent.type === "ObjectExpression" ? node.parent.properties : node.parent.elements;

@@ -765,7 +765,7 @@ module.exports = {
}
}
} else if (!parentVarNode && !isFirstArrayElementOnSameLine(parent) && parent.type !== "MemberExpression" && parent.type !== "ExpressionStatement" && parent.type !== "AssignmentExpression" && parent.type !== "Property") {
nodeIndent = nodeIndent + indentSize;
nodeIndent += indentSize;
}

checkFirstNodeLineIndent(node, nodeIndent);
@@ -10,7 +10,7 @@ rules:
indent: ["error", 4, {SwitchCase: 1}]
block-spacing: "error"
brace-style: ["error", "1tbs"]
camelcase: ["error", { properties: "never" }]
camelcase: "error"
callback-return: ["error", ["cb", "callback", "next"]]
class-methods-use-this: "error"
comma-dangle: "error"
@@ -20,14 +20,17 @@ rules:
consistent-return: "error"
curly: ["error", "all"]
default-case: "error"
dot-location: ["error", "property"]
dot-notation: ["error", { allowKeywords: true }]
eol-last: "error"
eqeqeq: "error"
for-direction: "error"
func-call-spacing: "error"
func-style: ["error", "declaration"]
generator-star-spacing: "error"
getter-return: "error"
guard-for-in: "error"
handle-callback-err: ["error", "err"]
key-spacing: ["error", { beforeColon: false, afterColon: true }]
keyword-spacing: "error"
lines-around-comment: ["error", {
@@ -41,7 +44,9 @@ rules:
new-parens: "error"
no-alert: "error"
no-array-constructor: "error"
no-buffer-constructor: "error"
no-caller: "error"
no-catch-shadow: "error"
no-confusing-arrow: "error"
no-console: "error"
no-delete-var: "error"
@@ -59,6 +64,7 @@ rules:
no-labels: "error"
no-lone-blocks: "error"
no-loop-func: "error"
no-mixed-requires: "error"
no-mixed-spaces-and-tabs: ["error", false]
no-multi-spaces: "error"
no-multi-str: "error"
@@ -67,9 +73,11 @@ rules:
no-new: "error"
no-new-func: "error"
no-new-object: "error"
no-new-require: "error"
no-new-wrappers: "error"
no-octal: "error"
no-octal-escape: "error"
no-path-concat: "error"
no-process-exit: "error"
no-proto: "error"
no-redeclare: "error"
@@ -81,10 +89,12 @@ rules:
no-return-assign: "error"
no-script-url: "error"
no-self-assign: "error"
no-self-compare: "error"
no-sequences: "error"
no-shadow: "error"
no-shadow-restricted-names: "error"
no-tabs: "error"
no-throw-literal: "error"
no-trailing-spaces: "error"
no-undef: ["error", {typeof: true}]
no-undef-init: "error"
@@ -95,16 +105,20 @@ rules:
no-unused-expressions: "error"
no-unused-vars: ["error", {vars: "all", args: "after-used"}]
no-use-before-define: "error"
no-useless-call: "error"
no-useless-computed-key: "error"
no-useless-concat: "error"
no-useless-constructor: "error"
no-useless-escape: "error"
no-useless-rename: "error"
no-useless-return: "error"
no-whitespace-before-property: "error"
no-with: "error"
no-var: "error"
object-curly-spacing: ["error", "always"]
object-shorthand: "error"
one-var-declaration-per-line: "error"
operator-assignment: "error"
operator-linebreak: "error"
padding-line-between-statements: [
"error",
@@ -121,6 +135,7 @@ rules:
]
prefer-arrow-callback: "error"
prefer-const: "error"
prefer-numeric-literals: "error"
prefer-promise-reject-errors: "error"
prefer-template: "error"
quotes: ["error", "double"]
@@ -129,15 +144,19 @@ rules:
require-jsdoc: "error"
semi: "error"
semi-spacing: ["error", {before: false, after: true}]
semi-style: "error"
space-before-blocks: "error"
space-before-function-paren: ["error", "never"]
space-in-parens: "error"
space-infix-ops: "error"
space-unary-ops: ["error", {words: true, nonwords: false}]
spaced-comment: ["error", "always", { exceptions: ["-"]}]
strict: ["error", "global"]
switch-colon-spacing: "error"
symbol-description: "error"
template-curly-spacing: ["error", "never"]
template-tag-spacing: "error"
unicode-bom: "error"
valid-jsdoc: ["error", {
prefer: { "return": "returns"},
preferType: {
@@ -151,10 +170,3 @@ rules:
wrap-iife: "error"
yield-star-spacing: "error"
yoda: ["error", "never"]

# Previously on by default in node environment
no-catch-shadow: "off"
no-mixed-requires: "error"
no-new-require: "error"
no-path-concat: "error"
handle-callback-err: ["error", "err"]
@@ -85,7 +85,7 @@ function countDefaultPatterns(ignoredPaths) {
let count = ignoredPaths.defaultPatterns.length;

if (!ignoredPaths.options || (ignoredPaths.options.dotfiles !== true)) {
count = count + 2; // Two patterns for ignoring dotfiles
count += 2; // Two patterns for ignoring dotfiles
}
return count;
}

0 comments on commit b3b95b8

Please sign in to comment.
You can’t perform that action at this time.