eslint-plugin-img-alt

1.0.7 • Public • Published

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-dev

Next, install eslint-plugin-img-alt:

npm install eslint-plugin-img-alt --save-dev

Note: 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".

Package Sidebar

Install

npm i eslint-plugin-img-alt

Weekly Downloads

0

Version

1.0.7

License

MIT

Unpacked Size

2.77 kB

Total Files

4

Last publish

Collaborators

  • sergeyisakhanyan