img-redundant-alt
Configuration
Enforce that <img> alt attributes do not contain the words image,
picture, or photo. Screen readers already announce img tags as images,
so describing them as such in the alt text is redundant.
Rule Details
This rule reports an <img> element whose alt value (a static string
literal) contains any of the words image, picture, or photo as a
whitespace-delimited token. Matching is case-insensitive.
For non-ASCII alt values (text without any ASCII printable characters), the
rule falls back to substring matching against the lowercased word list. This
keeps the rule effective for scripts that don't use space-delimited words
(e.g. <img alt="イメージ" /> with words: ["イメージ"]).
Examples of incorrect code for this rule:
Examples of correct code for this rule:
Rule Options
components
Type: string[]. Default: [].
Additional JSX element names to validate alongside <img>. Use this for
wrapper components that render an <img> internally.
Examples of incorrect code with { "components": ["Image"] }:
Examples of correct code with { "components": ["Image"] }:
words
Type: string[]. Default: [].
Additional words to flag as redundant. Appended to the built-in list
(image, photo, picture). Useful for non-English projects.
Examples of incorrect code with { "words": ["Bild", "Foto"] }:
Examples of correct code with { "words": ["Bild", "Foto"] }: