Skip to content

Commit

Permalink
Fix: manual fix eslint core files
Browse files Browse the repository at this point in the history
  • Loading branch information
graingert committed Sep 29, 2017
1 parent 6dac782 commit da474ec
Show file tree
Hide file tree
Showing 12 changed files with 38 additions and 19 deletions.
3 changes: 2 additions & 1 deletion lib/ast-utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -1041,7 +1041,8 @@ module.exports = {
} else if (parent.type === "Property" || parent.type === "MethodDefinition") {
if (parent.kind === "constructor") {
return "constructor";
} if (parent.kind === "get") {
}
if (parent.kind === "get") {
tokens.push("getter");
} else if (parent.kind === "set") {
tokens.push("setter");
Expand Down
3 changes: 2 additions & 1 deletion lib/cli.js
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,8 @@ const cli = {
if (files.length) {
log.error("The --print-config option must be used with exactly one file name.");
return 1;
} if (text) {
}
if (text) {
log.error("The --print-config option is not available for piped-in code.");
return 1;
}
Expand Down
3 changes: 2 additions & 1 deletion lib/formatters/html.js
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,8 @@ function renderSummary(totalErrors, totalWarnings) {
function renderColor(totalErrors, totalWarnings) {
if (totalErrors !== 0) {
return 2;
} if (totalWarnings !== 0) {
}
if (totalWarnings !== 0) {
return 1;
}
return 0;
Expand Down
3 changes: 2 additions & 1 deletion lib/rules/callback-return.js
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,8 @@ module.exports = {
if (node.type === "MemberExpression") {
if (node.object.type === "Identifier") {
return true;
} if (node.object.type === "MemberExpression") {
}
if (node.object.type === "MemberExpression") {
return containsOnlyIdentifiers(node.object);
}
}
Expand Down
3 changes: 2 additions & 1 deletion lib/rules/capitalized-comments.js
Original file line number Diff line number Diff line change
Expand Up @@ -247,7 +247,8 @@ module.exports = {

if (capitalize === "always" && isLowercase) {
return false;
} if (capitalize === "never" && isUppercase) {
}
if (capitalize === "never" && isUppercase) {
return false;
}

Expand Down
3 changes: 2 additions & 1 deletion lib/rules/new-cap.js
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,8 @@ module.exports = {

// char has no uppercase variant, so it's non-alphabetic
return "non-alpha";
} if (firstChar === firstCharLower) {
}
if (firstChar === firstCharLower) {
return "lower";
}
return "upper";
Expand Down
6 changes: 4 additions & 2 deletions lib/rules/newline-before-return.js
Original file line number Diff line number Diff line change
Expand Up @@ -59,9 +59,11 @@ module.exports = {

if (parentType === "IfStatement") {
return isPrecededByTokens(node, ["else", ")"]);
} if (parentType === "DoWhileStatement") {
}
if (parentType === "DoWhileStatement") {
return isPrecededByTokens(node, ["do"]);
} if (parentType === "SwitchCase") {
}
if (parentType === "SwitchCase") {
return isPrecededByTokens(node, [":"]);
}
return isPrecededByTokens(node, [")"]);
Expand Down
3 changes: 2 additions & 1 deletion lib/rules/no-control-regex.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,8 @@ module.exports = {
function getRegExp(node) {
if (node.value instanceof RegExp) {
return node.value;
} if (typeof node.value === "string") {
}
if (typeof node.value === "string") {

const parent = context.getAncestors().pop();

Expand Down
9 changes: 6 additions & 3 deletions lib/rules/no-extra-parens.js
Original file line number Diff line number Diff line change
Expand Up @@ -195,10 +195,12 @@ module.exports = {
function containsAssignment(node) {
if (node.type === "AssignmentExpression") {
return true;
} if (node.type === "ConditionalExpression" &&
}
if (node.type === "ConditionalExpression" &&
(node.consequent.type === "AssignmentExpression" || node.alternate.type === "AssignmentExpression")) {
return true;
} if ((node.left && node.left.type === "AssignmentExpression") ||
}
if ((node.left && node.left.type === "AssignmentExpression") ||
(node.right && node.right.type === "AssignmentExpression")) {
return true;
}
Expand All @@ -219,7 +221,8 @@ module.exports = {

if (node.type === "ReturnStatement") {
return node.argument && containsAssignment(node.argument);
} if (node.type === "ArrowFunctionExpression" && node.body.type !== "BlockStatement") {
}
if (node.type === "ArrowFunctionExpression" && node.body.type !== "BlockStatement") {
return containsAssignment(node.body);
}
return containsAssignment(node);
Expand Down
12 changes: 8 additions & 4 deletions lib/rules/no-mixed-requires.js
Original file line number Diff line number Diff line change
Expand Up @@ -104,14 +104,16 @@ module.exports = {

// "var x = require('util');"
return DECL_REQUIRE;
} if (allowCall &&
}
if (allowCall &&
initExpression.type === "CallExpression" &&
initExpression.callee.type === "CallExpression"
) {

// "var x = require('diagnose')('sub-module');"
return getDeclarationType(initExpression.callee);
} if (initExpression.type === "MemberExpression") {
}
if (initExpression.type === "MemberExpression") {

// "var x = require('glob').Glob;"
return getDeclarationType(initExpression.object);
Expand All @@ -131,7 +133,8 @@ module.exports = {

// "var x = require('glob').Glob;"
return inferModuleType(initExpression.object);
} if (initExpression.arguments.length === 0) {
}
if (initExpression.arguments.length === 0) {

// "var x = require();"
return REQ_COMPUTED;
Expand All @@ -149,7 +152,8 @@ module.exports = {

// "var fs = require('fs');"
return REQ_CORE;
} if (/^\.{0,2}\//.test(arg.value)) {
}
if (/^\.{0,2}\//.test(arg.value)) {

// "var utils = require('./utils');"
return REQ_FILE;
Expand Down
6 changes: 4 additions & 2 deletions lib/rules/sort-imports.js
Original file line number Diff line number Diff line change
Expand Up @@ -67,9 +67,11 @@ module.exports = {
function usedMemberSyntax(node) {
if (node.specifiers.length === 0) {
return "none";
} if (node.specifiers[0].type === "ImportNamespaceSpecifier") {
}
if (node.specifiers[0].type === "ImportNamespaceSpecifier") {
return "all";
} if (node.specifiers.length === 1) {
}
if (node.specifiers.length === 1) {
return "single";
}
return "multiple";
Expand Down
3 changes: 2 additions & 1 deletion lib/util/source-code.js
Original file line number Diff line number Diff line change
Expand Up @@ -332,7 +332,8 @@ class SourceCode extends TokenStore {
}

return parent && parent.type !== "FunctionDeclaration" && parent.type !== "Program" ? findJSDocComment(parentLeadingComments, parent.loc.start.line) : null;
} if (leadingComments.length) {
}
if (leadingComments.length) {
return findJSDocComment(leadingComments, node.loc.start.line);
}

Expand Down

0 comments on commit da474ec

Please sign in to comment.