Disallow wrong usage of attribute names (github/get-attribute)

February 8, 2023 ยท View on GitHub

๐Ÿ’ผ This rule is enabled in the ๐Ÿ” browser config.

๐Ÿ”ง This rule is automatically fixable by the --fix CLI option.

Rule Details

As HTML attributes are case insensitive, prefer using lowercase.

๐Ÿ‘Ž Examples of incorrect code for this rule:

el.getAttribute('autoComplete')
el.getAttribute('dataFoo')

๐Ÿ‘ Examples of correct code for this rule:

el.getAttribute('autocomplete')
el.getAttribute('data-foo')

Version

4.3.2