Skip to content

Conversation

@DMartens
Copy link
Contributor

Prerequisites checklist

What is the purpose of this pull request?

Fix a bug in no-reversed-media-syntax-inline for ignoring text inside code blocks.

What changes did you make? (Give an overview)

Add the offset of the paragraph when comparing whether the matched text is inside code spans.
This is required as the regular expression match index is relative to the paragraph and the offsets of the code span is absolute.
They only match up if the paragraph containing the code span is the first node.

Related Issues

I hope it is okay not create an issue for such a small change/fix.

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

@github-project-automation github-project-automation bot moved this to Needs Triage in Triage Jul 14, 2025
@lumirlumir lumirlumir requested review from a team and nzakas July 14, 2025 14:08
@lumirlumir lumirlumir moved this from Needs Triage to Triaging in Triage Jul 14, 2025
Comment on lines 42 to 50
dedent`
# Heading,
\`myobj.getFiles(test)[0]\`,
`,
dedent`
foo
# Heading,
\`myobj.getFiles(test)[0]\`,
`,
Copy link
Member

Choose a reason for hiding this comment

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

Good catch, thanks 👍

Interestingly, the current test cases don’t detect the changed logic properly, since the matchIndex is ignored by the range of the InlineCode node by chance!

Image

So even if we revert this change, the test cases still pass 😄


Suggested change
dedent`
# Heading,
\`myobj.getFiles(test)[0]\`,
`,
dedent`
foo
# Heading,
\`myobj.getFiles(test)[0]\`,
`,
dedent`
# Heading
\`(test)[0]\`
`,
dedent`
foo
# Heading
\`(test)[0]\`
`,

Would it be possible to use the above test cases instead? If we modify them, the tests wouldn’t pass if we reverted this change.

Also, it’s not a technical issue, but I think the comma (,) was added by mistake. If it wasn’t intentional, it would be great if you could remove it.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

You are right that it did not actuall test the change 😅 .
I removed the unnecessary first test case and added more text in the next.

@lumirlumir lumirlumir moved this from Triaging to Implementing in Triage Jul 14, 2025
Copy link
Member

@lumirlumir lumirlumir 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!

Would like another review before merging.

@lumirlumir lumirlumir moved this from Implementing to Second Review Needed in Triage Jul 18, 2025
@lumirlumir lumirlumir requested a review from a team July 18, 2025 06:20
Copy link
Member

@nzakas nzakas left a comment

Choose a reason for hiding this comment

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

LGTM. It's okay to not create an issue, but in the future, please use the same format for the PR description as the bug template (What did you do, what happened, what did you expect to happen, etc.). It makes it a lot easier to understand what you're trying to fix.

@nzakas nzakas merged commit af7736c into eslint:main Jul 22, 2025
23 checks passed
@github-project-automation github-project-automation bot moved this from Second Review Needed to Complete in Triage Jul 22, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

Status: Complete

Development

Successfully merging this pull request may close these issues.

4 participants