Skip to content

New Rule: no-duplicate-properties #494

Description

@przemyslaw-zan

Rule details

Disallow duplicate properties within declaration blocks.

What type of rule is this?

Warns about a potential problem

Example code

a {
    /* Duplicate native property */
    color: pink;
    color: orange;

    /* Duplicate custom property */
    --custom-property: pink;
    --custom-property: orange;

    /* Not flagged with the option `allowFallbacks` */
    height: 100vh;
    height: 100dvh;
}

Prior Art

Participation

  • I am willing to submit a pull request to implement this rule.

AI acknowledgment

  • I did not use AI to generate this issue report.
  • (If the above is not checked) I have reviewed the AI-generated content before submitting.

Additional comments

  • This proposal would mean merging two original stylelint rules into one, as they are nearly identical.
  • Property comparison is case-insensitive for native properties but case-sensitive for custom ones - matching CSS spec.
  • Equivalent of consecutive-duplicates-with-different-syntaxes option from the declaration-block-no-duplicate-properties rule should also be included: allowFallbacks.

Metadata

Metadata

Labels

Type

No type

Fields

No fields configured for issues without a type.

Projects

Status
Feedback Needed

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions