feat: add allowedIgnoreCase option to no-html#500
Conversation
There was a problem hiding this comment.
Pull Request Overview
This PR introduces a new allowedIgnoreCase option to the no-html rule to enable case-insensitive matching of HTML tag names against the allowed list, addressing HTML's case-insensitive nature.
- Adds
allowedIgnoreCaseboolean option for case-insensitive tag matching - Implements lowercase conversion logic for both allowed tags and found tag names when the option is enabled
- Includes comprehensive test coverage for various case scenarios
Reviewed Changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
src/rules/no-html.js |
Implements the core logic for case-insensitive matching with new option schema and comparison logic |
tests/rules/no-html.test.js |
Adds comprehensive test cases covering valid/invalid scenarios for case-sensitive and case-insensitive matching |
docs/rules/no-html.md |
Documents the new option with examples showing case-insensitive behavior |
snitin315
left a comment
There was a problem hiding this comment.
@TKDev7 Before starting work, please wait for the issue to be accepted. The team is still finalizing the solution approach, and you can find more details in the contributing guidelines.
lumirlumir
left a comment
There was a problem hiding this comment.
It mostly looks good to me. I’ve left a few comments regarding documentation cleanups.
lumirlumir
left a comment
There was a problem hiding this comment.
LGTM, Would like another review before merging.
Prerequisites checklist
What is the purpose of this pull request?
This PR adds a new
allowedIgnoreCaseoption to theno-htmlrule to enable case-insensitive matching for HTML tag names against theallowedarray. This addresses the issue where HTML tag names are case-insensitive by specification, but the rule was performing case-sensitive matching, leading to false positives.For example, with
allowed: ["DIV"]configured:<DIV></DIV>was allowed, but<div></div>was reported as an errorallowedIgnoreCase: true, both<div></div>,<DIV></DIV>, and<DiV></DiV>are allowedWhat changes did you make? (Give an overview)
allowedIgnoreCaseis trueRelated Issues
Fixes #479
Is there anything you'd like reviewers to focus on?