8000 fix: ignore checking tag names in svg in lowercase by yeonjuan · Pull Request #377 · yeonjuan/html-eslint · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

fix: ignore checking tag names in svg in lowercase #377

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

Merged
merged 1 commit into from
Jun 17, 2025
Merged

Conversation

yeonjuan
Copy link
Owner

Checklist

Description

@yeonjuan yeonjuan requested a review from Copilot June 16, 2025 23:08
Copy link
Contributor
@Copilot Copilot AI left a 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 addresses issue #350 by refining the ESLint rule that validates tag names to better handle SVG elements.

  • Introduces new test cases for nested SVG elements (e.g. clipPath) and for auto-correcting uppercase SVG tags.
  • Updates the rule logic in lowercase.js by incorporating svgStack and using isScript/isStyle helper functions to determine tag names.

Reviewed Changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.

File Description
packages/eslint-plugin/tests/rules/lowercase.test.js Added test cases to verify correct handling of SVG-related tags
packages/eslint-plugin/lib/rules/lowercase.js Modified condition in the check function to ensure only incorrect tag cases are reported
Comments suppressed due to low confidence (2)

packages/eslint-plugin/lib/rules/lowercase.js:79

  • [nitpick] The updated condition that checks svgStack and the tag name could benefit from an inline comment explaining its intent, to assist future maintainers in understanding why SVG tags are treated differently.
if (name !== raw && (svgStack.length === 0 || name.toLowerCase() === "svg")) {

packages/eslint-plugin/tests/rules/lowercase.test.js:46

  • [nitpick] Consider adding an inline comment in this test case to clarify that the non-lowercase tag names nested within SVG elements are intentionally not flagged, improving test readability.
{ code: `<svg viewBox="0 0 100 100">
  <clipPath id="myClip">
    <circle cx="40" cy="35" r="35" />
  </clipPath>
</svg>
`, }

@yeonjuan yeonjuan merged commit d484ad3 into main Jun 17, 2025
5 checks passed
Copy link
codecov bot commented Jun 17, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 98.29%. Comparing base (0e691b3) to head (3656e8a).
Report is 1 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main     #377   +/-   ##
=======================================
  Coverage   98.29%   98.29%           
=======================================
  Files          79       79           
  Lines        2515     2517    +2     
  Branches      685      687    +2     
=======================================
+ Hits         2472     2474    +2     
  Misses         43       43           
Flag Coverage Δ
unittest 98.29% <100.00%> (+<0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Files with missing lines Coverage Δ
packages/eslint-plugin/lib/rules/lowercase.js 100.00% <100.00%> (ø)
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[BUG] lowercase rule incorrectly flags case-sensitive SVG elements like clipPath
1 participant
0