Skip to content

img-uses-alt does not allow empty string or possible empty string #6

@lencioni

Description

@lencioni

This rule considers the following JSX bad:

function Foo() {
  return <img alt={foo || ''} />;
}

this is also considered bad:

function Foo() {
  return <img alt="" />;
}

but this is okay:

function Foo() {
  return <img alt={foo} />;
}

However, I think that all three should be okay. Empty strings can be used appropriately for alt text on images that are decorative.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions