Skip to content
Permalink
Browse files

Fix: padding-line-between-statements crash on semicolons after blocks (

…#8748)

(fixes #8839)
  • Loading branch information...
outpunk authored and not-an-aardvark committed Jul 30, 2017
1 parent 3141872 commit cdb82f2de35e1e6e4d7a40e018b257996f1079c4
@@ -93,7 +93,7 @@ function isBlockLikeStatement(sourceCode, node) {

// Checks the last token is a closing brace of blocks.
const lastToken = sourceCode.getLastToken(node, astUtils.isNotSemicolonToken);
const belongingNode = astUtils.isClosingBraceToken(lastToken)
const belongingNode = lastToken && astUtils.isClosingBraceToken(lastToken)
? sourceCode.getNodeByRangeIndex(lastToken.range[0])
: null;

@@ -2359,6 +2359,12 @@ ruleTester.run("padding-line-between-statements", rule, {
options: [
{ blankLine: "always", prev: "*", next: ["if", "for", "return", "switch", "case", "break", "throw", "while", "default"] }
]
},
{
code: "function test() {};",
options: [
{ blankLine: "always", prev: "block-like", next: "block-like" }
]
}
],
invalid: [

0 comments on commit cdb82f2

Please sign in to comment.
You can’t perform that action at this time.