Skip to content

Commit

Permalink
Fix: no-multiple-empty-lines errors when no line breaks (fixes eslint…
Browse files Browse the repository at this point in the history
  • Loading branch information
strawbrary committed Jun 17, 2016
1 parent 414206c commit 09a8809
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
2 changes: 1 addition & 1 deletion lib/rules/no-multiple-empty-lines.js
Expand Up @@ -98,7 +98,7 @@ module.exports = {

linesRangeStart.push(0);
lines.forEach(function(str, i) {
var length = i < fullLines.length ? fullLines[i].length : 0,
var length = Array.isArray(fullLines) && i < fullLines.length ? fullLines[i].length : 0,
trimmed = str.trim();

if ((firstNonBlankLine === -1) && (trimmed !== "")) {
Expand Down
4 changes: 4 additions & 0 deletions tests/lib/rules/no-multiple-empty-lines.js
Expand Up @@ -149,6 +149,10 @@ ruleTester.run("no-multiple-empty-lines", rule, {
{
code: "// valid 17\nvar a = 5;\n\n",
options: [ { max: 0, maxEOF: 1 } ]
},
{
code: "var a = 5;",
options: [ { max: 1 } ]
}
],

Expand Down

0 comments on commit 09a8809

Please sign in to comment.