Skip to content

Commit

Permalink
Fix: Return correct column number for no-multiple-empty-lines (fixes #…
Browse files Browse the repository at this point in the history
  • Loading branch information
IanVS committed Sep 8, 2016
1 parent d9513b7 commit ac0e931
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 2 deletions.
2 changes: 1 addition & 1 deletion lib/rules/no-multiple-empty-lines.js
Expand Up @@ -165,7 +165,7 @@ module.exports = {
} else {
const location = {
line: lastLocation + 1,
column: 1
column: 0
};

if (lastLocation < firstOfEndingBlankLines) {
Expand Down
14 changes: 13 additions & 1 deletion tests/lib/rules/no-multiple-empty-lines.js
Expand Up @@ -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,
};
}

Expand Down Expand Up @@ -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 } ]
}
]
});

0 comments on commit ac0e931

Please sign in to comment.