Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Fix: Semi-Style only check for comments when tokens exist (fixes #8696)…
… (#8697)
  • Loading branch information
soda0289 authored and gyandeeps committed Jun 9, 2017
1 parent 3cfe9ee commit 3da7b5e
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
2 changes: 1 addition & 1 deletion lib/rules/semi-style.js
Expand Up @@ -79,7 +79,7 @@ module.exports = {
: "the beginning of the next line"
},
fix(fixer) {
if (commentsExistBetween(prevToken, nextToken)) {
if (prevToken && nextToken && commentsExistBetween(prevToken, nextToken)) {
return null;
}

Expand Down
6 changes: 6 additions & 0 deletions tests/lib/rules/semi-style.js
Expand Up @@ -113,6 +113,12 @@ ruleTester.run("semi-style", rule, {
options: ["last"],
errors: ["Expected this semicolon to be at the end of the previous line."]
},
{
code: "foo()\n;",
output: "foo();\n",
options: ["last"],
errors: ["Expected this semicolon to be at the end of the previous line."]
},

{
code: "foo;\nbar",
Expand Down

0 comments on commit 3da7b5e

Please sign in to comment.