@zohodesk/eslint-plugin-data-attribute
v1.0.0
Published
ESLint plugin to enforce proper usage of data attributes in JSX elements
Maintainers
Readme
eslint-plugin-data-attribute
ESLint plugin to enforce proper usage of data attributes in JSX elements.
Rules
data-attribute/data-attribute
Requires data-test-id to be present whenever data-id is used on native HTML elements.
This rule helps ensure accessibility and testing consistency by enforcing that all elements with a data-id attribute also include a data-test-id attribute.
How It Works
- Only applies to native HTML elements (lowercase tag names like
div,button,span) - Ignores React components (uppercase tag names like
MyComponent) - Reports an error when
data-idis present butdata-test-idis missing
