Skip to content

Commit

Permalink
Breaking: Add new rules to eslint:recommended (fixes #12911) (#12920)
Browse files Browse the repository at this point in the history
  • Loading branch information
mdjermanovic committed Feb 25, 2020
1 parent 8d5c434 commit 78182e4
Show file tree
Hide file tree
Showing 5 changed files with 6 additions and 19 deletions.
3 changes: 3 additions & 0 deletions conf/eslint-recommended.js
Expand Up @@ -26,6 +26,7 @@ module.exports = {
"no-delete-var": "error",
"no-dupe-args": "error",
"no-dupe-class-members": "error",
"no-dupe-else-if": "error",
"no-dupe-keys": "error",
"no-duplicate-case": "error",
"no-empty": "error",
Expand All @@ -37,6 +38,7 @@ module.exports = {
"no-fallthrough": "error",
"no-func-assign": "error",
"no-global-assign": "error",
"no-import-assign": "error",
"no-inner-declarations": "error",
"no-invalid-regexp": "error",
"no-irregular-whitespace": "error",
Expand All @@ -49,6 +51,7 @@ module.exports = {
"no-redeclare": "error",
"no-regex-spaces": "error",
"no-self-assign": "error",
"no-setter-return": "error",
"no-shadow-restricted-names": "error",
"no-sparse-arrays": "error",
"no-this-before-super": "error",
Expand Down
16 changes: 0 additions & 16 deletions lib/rules/indent-legacy.js
Expand Up @@ -696,20 +696,6 @@ module.exports = {
return startLine === endLine;
}

/**
* Check to see if the first element inside an array is an object and on the same line as the node
* If the node is not an array then it will return false.
* @param {ASTNode} node node to check
* @returns {boolean} success/failure
*/
function isFirstArrayElementOnSameLine(node) {
if (node.type === "ArrayExpression" && node.elements[0]) {
return node.elements[0].loc.start.line === node.loc.start.line && node.elements[0].type === "ObjectExpression";
}
return false;

}

/**
* Check indent for array block content or object block content
* @param {ASTNode} node node to examine
Expand Down Expand Up @@ -776,8 +762,6 @@ module.exports = {
nodeIndent += indentSize;
}
}
} else if (!parentVarNode && !isFirstArrayElementOnSameLine(parent) && parent.type !== "MemberExpression" && parent.type !== "ExpressionStatement" && parent.type !== "AssignmentExpression" && parent.type !== "Property") {
nodeIndent += indentSize;
}

checkFirstNodeLineIndent(node, nodeIndent);
Expand Down
2 changes: 1 addition & 1 deletion lib/rules/no-dupe-else-if.js
Expand Up @@ -53,7 +53,7 @@ module.exports = {
docs: {
description: "disallow duplicate conditions in if-else-if chains",
category: "Possible Errors",
recommended: false,
recommended: true,
url: "https://eslint.org/docs/rules/no-dupe-else-if"
},

Expand Down
2 changes: 1 addition & 1 deletion lib/rules/no-import-assign.js
Expand Up @@ -180,7 +180,7 @@ module.exports = {
docs: {
description: "disallow assigning to imported bindings",
category: "Possible Errors",
recommended: false,
recommended: true,
url: "https://eslint.org/docs/rules/no-import-assign"
},

Expand Down
2 changes: 1 addition & 1 deletion lib/rules/no-setter-return.js
Expand Up @@ -145,7 +145,7 @@ module.exports = {
docs: {
description: "disallow returning values from setters",
category: "Possible Errors",
recommended: false,
recommended: true,
url: "https://eslint.org/docs/rules/no-setter-return"
},

Expand Down

0 comments on commit 78182e4

Please sign in to comment.