Skip to content

Commit

Permalink
fix valid code sample
Browse files Browse the repository at this point in the history
  • Loading branch information
Che Fisher committed Nov 24, 2018
1 parent 4d871cd commit 65d126c
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
8 changes: 6 additions & 2 deletions lib/rules/space-in-parens.js
Expand Up @@ -157,6 +157,11 @@ module.exports = {
if (ALWAYS) {
return !isCloserException(left);
}

if (astUtils.isClosingParenToken(left)) {
return false;
}

return isCloserException(left);

}
Expand All @@ -177,6 +182,7 @@ module.exports = {
}

if (!sourceCode.isSpaceBetweenTokens(left, right)) {
//console.log(left.range)
return false;
}

Expand Down Expand Up @@ -249,8 +255,6 @@ module.exports = {
}
});
} else if (token.value === ")" && shouldCloserHaveSpace(prevToken, token)) {

// context.report(node, token.loc.start, MISSING_SPACE_MESSAGE);
context.report({
node,
loc: token.loc.start,
Expand Down
2 changes: 1 addition & 1 deletion tests/lib/rules/space-in-parens.js
Expand Up @@ -363,7 +363,7 @@ ruleTester.run("space-in-parens", rule, {
errors: [{ message: REJECTED_SPACE_ERROR, line: 1, column: 1 }]
},
{
code: "( (1 + 2))",
code: "((1 + 2) )",
output: "((1 + 2))",
options: ["never", { exceptions: ["()"] }],
errors: [REJECTED_SPACE_ERROR]
Expand Down

0 comments on commit 65d126c

Please sign in to comment.