Skip to content
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

Bug: Uncaught undefined for reporting after a code block #244

Closed
DMartens opened this issue Mar 25, 2024 · 1 comment · Fixed by #247
Closed

Bug: Uncaught undefined for reporting after a code block #244

DMartens opened this issue Mar 25, 2024 · 1 comment · Fixed by #247

Comments

@DMartens
Copy link
Contributor

Issue

Currently there is a guard for messages which report before the code block, but not if the message reports for a line after the code block.
This leads to an error in the block.rangeMap[lineInCode].indent access,
as block.rangeMap[lineInCode] evaluates to undefined.
I am willing to create an PR for this.

Minimal Reproduction

Markdown (I had to create an invalid document as the markdown renderer does not support nested code blocks):

Empty code block:
`` `js
`` `

Rule:

export default {
	create(context) {
		return {
			Program() {
				context.report({ message: 'message', loc: { start: { line: 2, column: 1 } } })
			}
		};
	}
}
@nzakas
Copy link
Member

nzakas commented Mar 26, 2024

Thanks for reporting this. It's definitely a bug we should get fixed. Please feel free to submit a PR.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Archived in project
Development

Successfully merging a pull request may close this issue.

2 participants