Skip to content

Conversation

lumirlumir
Copy link
Member

@lumirlumir lumirlumir commented Oct 3, 2025

Prerequisites checklist

What is the purpose of this pull request?

This PR originated from #536. While working on that, I found the scope had become too large, so I split this refactoring into a separate PR.

In this PR, I've used the native getLocFromIndex method added in #376 instead of the custom findOffsets util.

Notable changes:

  • Replace the findOffsets util with the native getLocFromIndex.
  • Use a named capture group in htmlTagPattern for better readability.
  • Consolidate the tag-name normalization logic (allowedIgnoreCase ? tagName.toLowerCase() : tagName) into a single helper function, normalizeTagName.
  • Remove the unnecessary allowedElements.size === 0 check from the if clause when reporting.

What changes did you make? (Give an overview)

In this PR, I've used the native getLocFromIndex method added in #376 instead of the custom findOffsets util.

Related Issues

Ref: #376, #536

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

N/A

@eslintbot eslintbot added this to Triage Oct 3, 2025
@github-project-automation github-project-automation bot moved this to Needs Triage in Triage Oct 3, 2025
@lumirlumir lumirlumir marked this pull request as ready for review October 3, 2025 11:48
@lumirlumir lumirlumir requested review from a team and mdjermanovic October 3, 2025 11:52
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 71bc53e into main Oct 3, 2025
24 checks passed
@mdjermanovic mdjermanovic deleted the refactor-use-getlocfromindex-in-no-html branch October 3, 2025 12:49
@github-project-automation github-project-automation bot moved this from Needs Triage to Complete in Triage Oct 3, 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.

2 participants