Accessibility
image-alt-text
Require meaningful alt text on every <img> element.
Flags <img> tags missing the alt attribute or shipping a generic placeholder ("image", "photo"). AI generators routinely omit alt entirely; the rule keeps the SEO + a11y promise of every image carrying its description.
Behavior
- Fixable: No.
- Suggestions: Yes.
- Maps to: WCAG 1.1.1 (Non-text Content).
Examples
Bad:
<img src="hero.png" />Good:
<img src="hero.png" alt="Product screenshot showing dashboard" />Related rules
responsive-image-optimizationFlag <img> elements missing loading, width/height, or srcset.icon-accessibilityRequire icons to carry an accessible name or be marked decorative.aria-validationForbid invalid ARIA roles and unknown aria-* attributes.
Use it
Enable image-alt-text in your eslint.config.js:
import deslint from '@deslint/eslint-plugin';
export default [
{
plugins: { deslint },
rules: {
'deslint/image-alt-text': 'error',
},
},
];Found a false positive? Report it on GitHub →