Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Chore: Fix lgtm alerts. (#8611)
  • Loading branch information
xiemaisi authored and not-an-aardvark committed May 17, 2017
1 parent 3418479 commit 729bbcd
Show file tree
Hide file tree
Showing 10 changed files with 18 additions and 19 deletions.
2 changes: 1 addition & 1 deletion lib/code-path-analysis/code-path-state.js
Expand Up @@ -988,7 +988,7 @@ class CodePathState {
switch (context.type) {
case "WhileStatement":
case "ForStatement":
choiceContext = this.popChoiceContext();
this.popChoiceContext();
makeLooped(
this,
forkContext.head,
Expand Down
4 changes: 2 additions & 2 deletions lib/rules/complexity.js
Expand Up @@ -122,7 +122,7 @@ module.exports = {

// Avoiding `default`
if (node.test) {
increaseComplexity(node);
increaseComplexity();
}
}

Expand All @@ -136,7 +136,7 @@ module.exports = {

// Avoiding &&
if (node.operator === "||") {
increaseComplexity(node);
increaseComplexity();
}
}

Expand Down
3 changes: 1 addition & 2 deletions lib/rules/indent-legacy.js
Expand Up @@ -322,7 +322,6 @@ module.exports = {
* Get the actual indent of node
* @param {ASTNode|Token} node Node to examine
* @param {boolean} [byLastLine=false] get indent of node's last line
* @param {boolean} [excludeCommas=false] skip comma on start of line
* @returns {Object} The node's indent. Contains keys `space` and `tab`, representing the indent of each character. Also
contains keys `goodChar` and `badChar`, where `goodChar` is the amount of the user's desired indentation character, and
`badChar` is the amount of the other indentation character.
Expand Down Expand Up @@ -623,7 +622,7 @@ module.exports = {
calleeNode.parent.type === "ArrayExpression")) {

// If function is part of array or object, comma can be put at left
indent = getNodeIndent(calleeNode, false, false).goodChar;
indent = getNodeIndent(calleeNode, false).goodChar;
} else {

// If function is standalone, simple calculate indent
Expand Down
6 changes: 3 additions & 3 deletions lib/rules/max-len.js
Expand Up @@ -268,13 +268,13 @@ module.exports = {
// we iterate over comments in parallel with the lines
let commentsIndex = 0;

const strings = getAllStrings(sourceCode);
const strings = getAllStrings();
const stringsByLine = strings.reduce(groupByLineNumber, {});

const templateLiterals = getAllTemplateLiterals(sourceCode);
const templateLiterals = getAllTemplateLiterals();
const templateLiteralsByLine = templateLiterals.reduce(groupByLineNumber, {});

const regExpLiterals = getAllRegExpLiterals(sourceCode);
const regExpLiterals = getAllRegExpLiterals();
const regExpLiteralsByLine = regExpLiterals.reduce(groupByLineNumber, {});

lines.forEach((line, i) => {
Expand Down
2 changes: 1 addition & 1 deletion lib/rules/no-inner-declarations.js
Expand Up @@ -58,7 +58,7 @@ module.exports = {
* @returns {void}
*/
function check(node) {
const body = nearestBody(node),
const body = nearestBody(),
valid = ((body.type === "Program" && body.distance === 1) ||
body.distance === 2);

Expand Down
4 changes: 2 additions & 2 deletions lib/rules/no-irregular-whitespace.js
Expand Up @@ -16,8 +16,8 @@ const astUtils = require("../ast-utils");
// Constants
//------------------------------------------------------------------------------

const ALL_IRREGULARS = /[\f\v\u0085\u00A0\ufeff\u00a0\u1680\u180e\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u200b\u202f\u205f\u3000\u2028\u2029]/;
const IRREGULAR_WHITESPACE = /[\f\v\u0085\u00A0\ufeff\u00a0\u1680\u180e\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u200b\u202f\u205f\u3000]+/mg;
const ALL_IRREGULARS = /[\f\v\u0085\ufeff\u00a0\u1680\u180e\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u200b\u202f\u205f\u3000\u2028\u2029]/;
const IRREGULAR_WHITESPACE = /[\f\v\u0085\ufeff\u00a0\u1680\u180e\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u200b\u202f\u205f\u3000]+/mg;
const IRREGULAR_LINE_TERMINATORS = /[\u2028\u2029]/mg;
const LINE_BREAK = astUtils.createGlobalLinebreakMatcher();

Expand Down
6 changes: 3 additions & 3 deletions lib/rules/no-lone-blocks.js
Expand Up @@ -94,13 +94,13 @@ module.exports = {

ruleDef.VariableDeclaration = function(node) {
if (node.kind === "let" || node.kind === "const") {
markLoneBlock(node);
markLoneBlock();
}
};

ruleDef.FunctionDeclaration = function(node) {
ruleDef.FunctionDeclaration = function() {
if (context.getScope().isStrict) {
markLoneBlock(node);
markLoneBlock();
}
};

Expand Down
6 changes: 3 additions & 3 deletions lib/rules/no-this-before-super.js
Expand Up @@ -89,7 +89,7 @@ module.exports = {
*/
function isBeforeCallOfSuper() {
return (
isInConstructorOfDerivedClass(funcInfo) &&
isInConstructorOfDerivedClass() &&
!funcInfo.codePath.currentSegments.every(isCalled)
);
}
Expand Down Expand Up @@ -206,7 +206,7 @@ module.exports = {
* @returns {void}
*/
onCodePathSegmentStart(segment) {
if (!isInConstructorOfDerivedClass(funcInfo)) {
if (!isInConstructorOfDerivedClass()) {
return;
}

Expand All @@ -230,7 +230,7 @@ module.exports = {
* @returns {void}
*/
onCodePathSegmentLoop(fromSegment, toSegment) {
if (!isInConstructorOfDerivedClass(funcInfo)) {
if (!isInConstructorOfDerivedClass()) {
return;
}

Expand Down
2 changes: 1 addition & 1 deletion lib/rules/no-use-before-define.js
Expand Up @@ -250,7 +250,7 @@ module.exports = {

ruleDefinition["ArrowFunctionExpression:exit"] = function(node) {
if (node.body.type !== "BlockStatement") {
findVariables(node);
findVariables();
}
};
} else {
Expand Down
2 changes: 1 addition & 1 deletion lib/rules/switch-colon-spacing.js
Expand Up @@ -105,7 +105,7 @@ module.exports = {

return {
SwitchCase(node) {
const colonToken = getColonToken(node, sourceCode);
const colonToken = getColonToken(node);
const beforeToken = sourceCode.getTokenBefore(colonToken);
const afterToken = sourceCode.getTokenAfter(colonToken);

Expand Down

0 comments on commit 729bbcd

Please sign in to comment.