feat: fix incorrect regex pattern in no-multiple-h1#624
Merged
Conversation
1 task
no-multiple-h1
lumirlumir
commented
Feb 26, 2026
Member
Author
There was a problem hiding this comment.
Whitespace removal in the test cases was applied automatically by .editorconfig, and I've verified that this change has no side effects.
snitin315
reviewed
Mar 16, 2026
| // This heading tag is invalid because there is a whitespace between `</` and `h1`. | ||
| // HTML Spec: https://html.spec.whatwg.org/multipage/syntax.html#end-tags | ||
| dedent` | ||
| <h1>Heading</ h1> |
Contributor
There was a problem hiding this comment.
Can you add test case with whitespaces in start tag like <h1 >
Member
Author
There was a problem hiding this comment.
Sure, I've updated it in dd3359a.
I've also updated the ----^- marker pattern to be slightly more precise.
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 2 out of 2 changed files in this pull request and generated no new comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
You can also share your feedback on Copilot code review. Take the survey.
…correct-html-regex-patterns-in-rules
snitin315
approved these changes
Mar 18, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Prerequisites checklist
AI acknowledgment
What is the purpose of this pull request?
Which language are you using?
CommonMark and GFM.
What did you do?
I expected the
# Another H1heading in the following example to be reported.What did you expect to happen?
According to the HTML specification, I expected the following Markdown code to be reported, but it isn't. It's a false negative because the
h1TagPatternregex does not recognize tags that contain whitespace (any amount) immediately after the tag name, as shown below:https://html.spec.whatwg.org/multipage/syntax.html#end-tags
Link to minimal reproducible Example
The following example would help identify the problem:
It should report an error for
# Another H1, but it doesn't.What changes did you make? (Give an overview)
This PR fixes an incorrect regex pattern in
no-multiple-h1.Although this is a fix PR, per our Semantic Versioning Policy's clause "A bug fix in a rule that results in ESLint reporting more linting errors", I've marked the PR prefix as
feat.Related Issues
N/A
Is there anything you'd like reviewers to focus on?
N/A