-
Notifications
You must be signed in to change notification settings - Fork 76
fix: improve no-html rule's tag location reporting #491
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
Conversation
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.
Pull Request Overview
This PR improves the error reporting precision for the no-html
rule by highlighting the entire opening HTML tag instead of just the tag name plus one character. The change enhances developer experience by providing clearer visual feedback about which portion of code violates the rule.
- Updated regex pattern to capture complete opening HTML tags including attributes
- Modified position calculation logic to report the full tag or first line if multi-line
- Added comprehensive test cases covering various HTML tag scenarios
Reviewed Changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.
File | Description |
---|---|
src/rules/no-html.js | Updated regex pattern and position calculation to report entire opening HTML tags |
tests/rules/no-html.test.js | Added test cases for various HTML tag formats including attributes and multi-line scenarios |
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! Please take a look at the Copilot comments.
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!
Leaving it open for @lumirlumir
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. Would like @snitin315 and @nzakas to verify the changes before merging.
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!
@TKDev7 can you take a look at the conflicts? |
Prerequisites checklist
What is the purpose of this pull request?
This pull request aims to enhance the clarity and precision of error reporting for the
no-html
rule. Previously, rule violations for HTML tags would highlight only a partial segment, specifically the tag name and an extra character.What changes did you make? (Give an overview)
I've modified the
no-html
rule's reporting logic to report the entire opening HTML tag, including any attributes and spaces, as long as it's on a single line. If the opening tag spans multiple lines, only the first line of the tag will be reported.<div id="foo">
, it will report the full<div id="foo">
.<p\n data-attribute="value">
, it will report only<p
.Related Issues
Fixes #478
Is there anything you'd like reviewers to focus on?