Skip to content

Conversation

@lumirlumir
Copy link
Member

@lumirlumir lumirlumir commented Nov 2, 2025

Prerequisites checklist

What is the purpose of this pull request?

Which language are you using?

CommonMark and GFM.

What did you do?

I expected a multi-line <img> tag to report the correct location, but it doesn't for the example below:

image

What did you expect to happen?

I expect a multi-line <img> tag to report the correct location.

Link to minimal reproducible Example

The following Markdown code may help identify the problem:

<!-- eslint markdown/require-alt-text: "error" -->

<!-- Correct -->

<img 
src="https://example.com/image.png">

<!-- Incorrect -->

<img 
 src="https://example.com/image.png">

<img 
  src="https://example.com/image.png"> 

<img 
   src="https://example.com/image.png">

What changes did you make? (Give an overview)

In this PR, I've fixed wrong location reporting in require-alt-text rule.

Related Issues

N/A

Is there anything you'd like reviewers to focus on?

N/A

@eslint-github-bot eslint-github-bot bot added the bug label Nov 2, 2025
@eslintbot eslintbot added this to Triage Nov 2, 2025
@github-project-automation github-project-automation bot moved this to Needs Triage in Triage Nov 2, 2025
@lumirlumir lumirlumir marked this pull request as ready for review November 2, 2025 14:43
@lumirlumir lumirlumir requested a review from a team November 2, 2025 14:45

html(node) {
const text = stripHtmlComments(node.value);
const text = stripHtmlComments(sourceCode.getText(node));
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So, html#value doesn't have leading spaces of lines, and that causes this problem.

Copy link
Member

@mdjermanovic mdjermanovic left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, thanks!

@mdjermanovic mdjermanovic merged commit bd69254 into main Nov 2, 2025
25 checks passed
@mdjermanovic mdjermanovic deleted the fix-wrong-location-reporting-in-require-alt-text branch November 2, 2025 18:15
@github-project-automation github-project-automation bot moved this from Needs Triage to Complete in Triage Nov 2, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

Status: Complete

Development

Successfully merging this pull request may close these issues.

3 participants