Skip to content

Commit

Permalink
Update: fix false negative of no-extra-parens (fixes #7122) (#7432)
Browse files Browse the repository at this point in the history
  • Loading branch information
mysticatea authored and kaicataldo committed Oct 24, 2016
1 parent 23062e2 commit 3813988
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 1 deletion.
2 changes: 1 addition & 1 deletion lib/rules/no-extra-parens.js
Expand Up @@ -509,7 +509,7 @@ module.exports = {
!(
(node.object.type === "Literal" &&
typeof node.object.value === "number" &&
/^[0-9]+$/.test(sourceCode.getFirstToken(node.object).value))
astUtils.isDecimalInteger(node.object))
||

// RegExp literal is allowed to have parens (#1589)
Expand Down
1 change: 1 addition & 0 deletions tests/lib/rules/no-extra-parens.js
Expand Up @@ -358,6 +358,7 @@ ruleTester.run("no-extra-parens", rule, {
invalid("(0.0).a", "0.0.a", "Literal"),
invalid("(0xBEEF).a", "0xBEEF.a", "Literal"),
invalid("(1e6).a", "1e6.a", "Literal"),
invalid("(0123).a", "0123.a", "Literal"),
invalid("a[(function() {})]", "a[function() {}]", "FunctionExpression"),
invalid("new (function(){})", "new function(){}", "FunctionExpression"),
invalid("new (\nfunction(){}\n)", "new \nfunction(){}\n", "FunctionExpression", 1),
Expand Down

0 comments on commit 3813988

Please sign in to comment.