Skip to content
This repository has been archived by the owner on Sep 30, 2020. It is now read-only.

Latest commit

 

History

History
37 lines (23 loc) · 967 Bytes

no-duplicate-class-names.md

File metadata and controls

37 lines (23 loc) · 967 Bytes

Class names inside the "className" JSX attribute must be unique (no-duplicate-class-names)

This rule enforces (and autofixes) that the class names inside the "className" attribute of a JSX element are unique.

Rule Details

Examples of incorrect code for this rule:

<div className="one one two"></div>

Examples of correct code for this rule:

<div className="one two"></div>

Limitations

Note that this only looks at string literals and template literals.

It does not currently check calls to the popular classnames NPM package:

// `classNames()` calls are not checked:
<div className={classNames('one', 'one')}></div>

Related

Further Reading