1.0.7 • Published 3 years ago
eslint-plugin-img-alt v1.0.7
eslint-plugin-img-alt
An ESLint plugin to enforce adding the alt attribute to img tags in JSX. If an img tag doesn't have an alt attribute, the rule will automatically fix it by adding alt="no data".
Installation
You'll first need to install ESLint:
npm install eslint --save-devNext, install eslint-plugin-img-alt:
npm install eslint-plugin-img-alt --save-devNote: If you installed ESLint globally (using the -g flag) then you must also install eslint-plugin-img-alt globally.
Usage
Add img-alt to the plugins section of your .eslintrc configuration file. Then, configure the rule under the rules section:
{
"plugins": ["img-alt"],
"rules": {
"img-alt/require-alt-attribute": "error"
}
}Supported Rules
require-alt-attribute: Enforces the presence of the alt attribute on img tags. If the attribute is missing, ESLint will automatically fix it by adding alt="no data".