Skip to content

[FEATURE] Add no-duplicate-in-head rule #328

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

Open
yeonjuan opened this issue Apr 28, 2025 · 2 comments
Open

[FEATURE] Add no-duplicate-in-head rule #328

yeonjuan opened this issue Apr 28, 2025 · 2 comments
Labels
enhancement New feature or request

Comments

@yeonjuan
Copy link
Owner

Is your feature request related to a problem? Please describe.

The no-duplicate-meta rule would ensure that <meta> elements within the <head> section do not duplicate the same name or property

Additional context
Add any other context or screenshots about the feature request here.

Incorrect example

<head>
  <meta name="description" content="First description">
  <meta name="description" content="Second description">
</head>

correct example

<head>
  <meta name="description" content="Only one description">
</head>
@yeonjuan yeonjuan added the enhancement New feature or request label Apr 28, 2025
@yeonjuan yeonjuan assigned yeonjuan and unassigned yeonjuan Apr 28, 2025
@tausiq2003
Copy link

tausiq2003 commented May 11, 2025

hey, I am now working on this issue, so you mentioned <meta> elements should not contain same name or property, do you mean the property attribute or properties in general, my guess here is property attribute here.

Also, I have to edit these files shown in screenshot right

Image
@yeonjuan

@yeonjuan
Copy link
Owner Author

yeonjuan commented May 12, 2025

Hi @tausiq2003 Thank you for sharing this while you're working on it.

At first, I came up with a simple rule that reports tags under the <head> element if they have duplicate values in either the name or property attributes.

<head>
    <meta name="viewport" content=""> 
    <meta name="viewport" content=""> 
</head>

However, on second thought, there are some tags that shouldn't be duplicated under the <head> element even if they don't use name or property—such as <title>, <base>, or <link rel="stylesheet"> tags with the same href, and so on. Ultimately, it would be nice to handle these cases as well, but it's not necessary to cover everything in the initial implementation.

I think no-duplicate-in-head would be a good name for the rule.

@yeonjuan yeonjuan changed the title [FEATURE] Add no-duplicate-meta rule [FEATURE] Add no-duplicate-in-head rule May 12, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants