diff --git a/lib/rules/no-multiple-empty-lines.js b/lib/rules/no-multiple-empty-lines.js index c7f697843661..679c4f69c73f 100644 --- a/lib/rules/no-multiple-empty-lines.js +++ b/lib/rules/no-multiple-empty-lines.js @@ -165,7 +165,7 @@ module.exports = { } else { const location = { line: lastLocation + 1, - column: 1 + column: 0 }; if (lastLocation < firstOfEndingBlankLines) { diff --git a/tests/lib/rules/no-multiple-empty-lines.js b/tests/lib/rules/no-multiple-empty-lines.js index 877de2022849..b4c3b3945488 100644 --- a/tests/lib/rules/no-multiple-empty-lines.js +++ b/tests/lib/rules/no-multiple-empty-lines.js @@ -47,7 +47,8 @@ function getExpectedErrorEOF(lines) { return { message: "Too many blank lines at the end of file. Max of " + lines + " allowed.", - type: "Program" + type: "Program", + column: 1, }; } @@ -283,6 +284,17 @@ ruleTester.run("no-multiple-empty-lines", rule, { output: "// invalid 21\n// unix line endings\nvar a = 5;\nvar b = 3;\n\n", errors: [ getExpectedErrorEOF(1) ], options: [ { max: 1 } ] + }, + { + code: "// invalid 1\nvar a = 5;\n\n\nvar b = 3;", + output: "// invalid 1\nvar a = 5;\n\nvar b = 3;", + errors: [ { + message: "More than 1 blank line not allowed.", + type: "Program", + line: 4, + column: 1 + } ], + options: [ { max: 1 } ] } ] });