Skip to content

Commit

Permalink
fix: fix errors in no-multiple-empty-lines (#240)
Browse files Browse the repository at this point in the history
  • Loading branch information
yeonjuan authored Dec 1, 2024
1 parent 80a2bec commit edcbf13
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ module.exports = {
check(
lines,
// @ts-ignore
node.quasi.loc.start.line,
node.loc.start.line,
getTemplateTokens(tokens)
);
}
Expand Down
2 changes: 1 addition & 1 deletion packages/eslint-plugin/lib/rules/utils/node.js
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ function isNodeTokensOnSameLine(node) {
* @returns {boolean}
*/
function isRangesOverlap(rangeA, rangeB) {
return rangeA[0] < rangeB[1] && rangeB[0] < rangeB[1];
return rangeA[0] < rangeB[1] && rangeB[0] < rangeA[1];
}

/**
Expand Down
25 changes: 25 additions & 0 deletions packages/eslint-plugin/tests/rules/no-multiple-empty-lines.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,31 @@ html\`<html>
</div>
</body>
</html>\`
`,
errors: [
{
message: "More than 2 blank lines not allowed.",
},
],
},
{
code: `
const html = /* html */\`
<div style=\${"aa"}>
<div></div>
</div>\`
`,
output: `
const html = /* html */\`
<div style=\${"aa"}>
<div></div>
</div>\`
`,
errors: [
{
Expand Down

0 comments on commit edcbf13

Please sign in to comment.