-
Notifications
You must be signed in to change notification settings - Fork 80
fix: wrong location reporting in no-invalid-label-refs
#545
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix: wrong location reporting in no-invalid-label-refs
#545
Conversation
| [eslint][ | ||
|
|
||
| ] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| const endLine = nodeStartLine + endLineOffset; | ||
| const endColumn = | ||
| (endLine === startLine ? nodeStartColumn : 0) + endColumnOffset; | ||
| (endLine === startLine ? nodeStartColumn : 1) + endColumnOffset; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The column is a 1-indexed value, so it needs to be 1, not 0.
markdown/src/language/markdown-language.js
Lines 118 to 122 in bae7da7
| /** | |
| * The column number at which the parser starts counting. | |
| * @type {0|1} | |
| */ | |
| columnStart = 1; |
mdjermanovic
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, thanks!

Prerequisites checklist
What is the purpose of this pull request?
Which language are you using?
CommonMark and GFM.
What did you do?
The error location reported by
no-invalid-label-refsis correct for single-line text, but in multi-line text, it's one index(offset) behind where I expect.What did you expect to happen?
I expected the error location to begin at
[and end at], but in multi-line text the end column is one index behind.Link to minimal reproducible Example
Adding the following test case to the
invalidsection would help identify the problem.Originally, the
endColumnwas1, but it needs to be2so it includes]as it does for single-line text.What changes did you make? (Give an overview)
In this PR, I've fixed wrong location reporting in
no-invalid-label-refs.Related Issues
N/A
Is there anything you'd like reviewers to focus on?
N/A