Skip to content

Commit

Permalink
Fix column calculation for inline config nodes
Browse files Browse the repository at this point in the history
  • Loading branch information
nzakas committed Sep 27, 2024
1 parent c3fe8e5 commit faa17b4
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion src/language/markdown-source-code.js
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ function extractInlineConfigCommentsFromHTML(node) {
end.column =
commentLineCount === 0
? start.column + comment.length
: comment.length - comment.lastIndexOf("\n") - 1;
: comment.length - comment.lastIndexOf("\n");
end.offset = start.offset + comment.length;

comments.push(
Expand Down
6 changes: 3 additions & 3 deletions tests/language/markdown-source-code.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ describe("MarkdownSourceCode", () => {
value: "eslint-enable no-console -- ok to use console here",
position: {
start: { line: 17, column: 1, offset: 278 },
end: { line: 19, column: 3, offset: 337 },
end: { line: 19, column: 4, offset: 337 },
},
});

Expand All @@ -133,7 +133,7 @@ describe("MarkdownSourceCode", () => {
value: "eslint-disable-line no-console",
position: {
start: { line: 21, column: 1, offset: 386 },
end: { line: 23, column: 4, offset: 427 },
end: { line: 23, column: 5, offset: 427 },
},
});

Expand All @@ -154,7 +154,7 @@ describe("MarkdownSourceCode", () => {
);
assert.deepStrictEqual(problems[0].loc, {
start: { line: 21, column: 1, offset: 386 },
end: { line: 23, column: 4, offset: 427 },
end: { line: 23, column: 5, offset: 427 },
});

assert.strictEqual(directives.length, 4);
Expand Down

0 comments on commit faa17b4

Please sign in to comment.