Skip to content

fix: improve attr-value-no-duplication logic #1667

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 18, 2025

Conversation

coliff
Copy link
Member

@coliff coliff commented Jun 18, 2025

ignore: d, on* (Skip all event handlers; onclick, onchange, etc.), sizes, src and style from attr-value-no-duplication checking logic.

@coliff coliff requested a review from thedaviddias as a code owner June 18, 2025 02:26
@github-actions github-actions bot added dependencies Pull requests that update a dependency file test labels Jun 18, 2025
Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

The pull request updates the attr-value-no-duplication rule, excluding specified attributes. Tests and documentation have been updated. An unrelated change in tag-no-obsolete.mdx was noted.

Comment on lines +23 to +28
attr.name.toLowerCase() === 'd' ||
attr.name.toLowerCase() === 'media' ||
attr.name.toLowerCase() === 'style'
attr.name.toLowerCase() === 'sizes' ||
attr.name.toLowerCase() === 'src' ||
attr.name.toLowerCase() === 'style' ||
attr.name.toLowerCase().startsWith('on') // Skip all event handlers (onclick, onchange, etc.)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

Consider extracting the excluded attribute names into a constant array for better readability and maintainability.

const excludedAttributes = ['content', 'd', 'media', 'sizes', 'src', 'style'];
if (excludedAttributes.includes(attr.name.toLowerCase()) || attr.name.toLowerCase().startsWith('on')) {

This comment was marked as resolved.

@coliff coliff merged commit 702ebca into main Jun 18, 2025
20 checks passed
@coliff coliff deleted the dev/coliff/improve-attr-value-no-duplicaion branch June 18, 2025 02:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
dependencies Pull requests that update a dependency file test
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant