Skip to content

Commit

Permalink
no-multiple-empty-lines: Adjust reported loc
Browse files Browse the repository at this point in the history
The `+ 1` was from a time where we warned about anything with more than one empty line, but since then the rule has become configurable. We should put the warning on the first line that breaks this rule, instead of on the second empty line.
  • Loading branch information
Turbo87 committed Nov 23, 2019
1 parent c644b54 commit 731672d
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion lib/rules/no-multiple-empty-lines.js
Expand Up @@ -110,7 +110,7 @@ module.exports = {
if (lineNumber - lastLineNumber - 1 > maxAllowed) {
context.report({
node,
loc: { start: { line: lastLineNumber + 1, column: 0 }, end: { line: lineNumber, column: 0 } },
loc: { start: { line: lastLineNumber + maxAllowed, column: 0 }, end: { line: lineNumber, column: 0 } },
message,
data: { max: maxAllowed, pluralizedLines: maxAllowed === 1 ? "line" : "lines" },
fix(fixer) {
Expand Down

0 comments on commit 731672d

Please sign in to comment.