eslint-plugin

@masknet/jsx/prefer-test-id

Enforces data-test-id attribute is present on interactive DOM elements to help with UI testing

Rule Details

Options

/**
 * @minItems Infinity
 */
export type Options = [
  {
    'id'?: string
    'elements'?: string[]
    'attributes'?: string[]
    'ignore-attributes'?: string[]
  },
]

:x: Incorrect

<button>Download</button>

:white_check_mark: Correct

<button data-test-id="download-button">Download</button>

Attributes

Thanks