Skip to content

Commit

Permalink
fixup! feat(linter): Implement img-redundant-alt rule for jsx_a11y pl…
Browse files Browse the repository at this point in the history
…ugin
  • Loading branch information
Shinyaigeek committed Nov 29, 2023
1 parent 7a0bfb8 commit 806fba4
Show file tree
Hide file tree
Showing 2 changed files with 71 additions and 71 deletions.
4 changes: 2 additions & 2 deletions crates/oxc_linter/src/rules/jsx_a11y/img_redundant_alt.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ use crate::utils::{get_prop_value, has_jsx_prop_lowercase, is_hidden_from_screen
use crate::{context::LintContext, rule::Rule, AstNode};

#[derive(Debug, Error, Diagnostic)]
#[error("eslint-plugin-jsx-a11y(img-redundant-alt): Redundant alt attribute. Screen-readers already announce `img` tags as an image. You don’t need to use the words `image`, `photo,` or `picture` (or any specified custom words) in the alt prop.")]
#[diagnostic(severity(warning), help("Provide no redundant alt text for image."))]
#[error("eslint-plugin-jsx-a11y(img-redundant-alt): Redundant alt attribute.")]
#[diagnostic(severity(warning), help("Provide no redundant alt text for image. Screen-readers already announce `img` tags as an image. You don’t need to use the words `image`, `photo,` or `picture` (or any specified custom words) in the alt prop."))]
struct ImgRedundantAltDiagnostic(#[label] pub Span);

declare_oxc_lint!(
Expand Down
138 changes: 69 additions & 69 deletions crates/oxc_linter/src/snapshots/img_redundant_alt.snap
Original file line number Diff line number Diff line change
Expand Up @@ -2,188 +2,188 @@
source: crates/oxc_linter/src/tester.rs
expression: img_redundant_alt
---
eslint-plugin-jsx-a11y(img-redundant-alt): Redundant alt attribute. Screen-readers already announce `img` tags as an image. You dont need to use the words `image`, `photo,` or `picture` (or any
specified custom words) in the alt prop.
eslint-plugin-jsx-a11y(img-redundant-alt): Redundant alt attribute.
╭─[img_redundant_alt.tsx:1:1]
1<img alt='Photo of friend.' />;
· ───
╰────
help: Provide no redundant alt text for image.
help: Provide no redundant alt text for image. Screen-readers already announce `img` tags as an image. You dont need to use the words `image`, `photo,` or `picture` (or any specified custom
words) in the alt prop.

eslint-plugin-jsx-a11y(img-redundant-alt): Redundant alt attribute. Screen-readers already announce `img` tags as an image. You dont need to use the words `image`, `photo,` or `picture` (or any
specified custom words) in the alt prop.
eslint-plugin-jsx-a11y(img-redundant-alt): Redundant alt attribute.
╭─[img_redundant_alt.tsx:1:1]
1<img alt='Picture of friend.' />;
· ───
╰────
help: Provide no redundant alt text for image.
help: Provide no redundant alt text for image. Screen-readers already announce `img` tags as an image. You dont need to use the words `image`, `photo,` or `picture` (or any specified custom
words) in the alt prop.

eslint-plugin-jsx-a11y(img-redundant-alt): Redundant alt attribute. Screen-readers already announce `img` tags as an image. You dont need to use the words `image`, `photo,` or `picture` (or any
specified custom words) in the alt prop.
eslint-plugin-jsx-a11y(img-redundant-alt): Redundant alt attribute.
╭─[img_redundant_alt.tsx:1:1]
1<img alt='Image of friend.' />;
· ───
╰────
help: Provide no redundant alt text for image.
help: Provide no redundant alt text for image. Screen-readers already announce `img` tags as an image. You dont need to use the words `image`, `photo,` or `picture` (or any specified custom
words) in the alt prop.

eslint-plugin-jsx-a11y(img-redundant-alt): Redundant alt attribute. Screen-readers already announce `img` tags as an image. You dont need to use the words `image`, `photo,` or `picture` (or any
specified custom words) in the alt prop.
eslint-plugin-jsx-a11y(img-redundant-alt): Redundant alt attribute.
╭─[img_redundant_alt.tsx:1:1]
1<img alt='PhOtO of friend.' />;
· ───
╰────
help: Provide no redundant alt text for image.
help: Provide no redundant alt text for image. Screen-readers already announce `img` tags as an image. You dont need to use the words `image`, `photo,` or `picture` (or any specified custom
words) in the alt prop.

eslint-plugin-jsx-a11y(img-redundant-alt): Redundant alt attribute. Screen-readers already announce `img` tags as an image. You dont need to use the words `image`, `photo,` or `picture` (or any
specified custom words) in the alt prop.
eslint-plugin-jsx-a11y(img-redundant-alt): Redundant alt attribute.
╭─[img_redundant_alt.tsx:1:1]
1<img alt={'photo'} />;
· ───
╰────
help: Provide no redundant alt text for image.
help: Provide no redundant alt text for image. Screen-readers already announce `img` tags as an image. You dont need to use the words `image`, `photo,` or `picture` (or any specified custom
words) in the alt prop.

eslint-plugin-jsx-a11y(img-redundant-alt): Redundant alt attribute. Screen-readers already announce `img` tags as an image. You dont need to use the words `image`, `photo,` or `picture` (or any
specified custom words) in the alt prop.
eslint-plugin-jsx-a11y(img-redundant-alt): Redundant alt attribute.
╭─[img_redundant_alt.tsx:1:1]
1<img alt='piCTUre of friend.' />;
· ───
╰────
help: Provide no redundant alt text for image.
help: Provide no redundant alt text for image. Screen-readers already announce `img` tags as an image. You dont need to use the words `image`, `photo,` or `picture` (or any specified custom
words) in the alt prop.

eslint-plugin-jsx-a11y(img-redundant-alt): Redundant alt attribute. Screen-readers already announce `img` tags as an image. You dont need to use the words `image`, `photo,` or `picture` (or any
specified custom words) in the alt prop.
eslint-plugin-jsx-a11y(img-redundant-alt): Redundant alt attribute.
╭─[img_redundant_alt.tsx:1:1]
1<img alt='imAGE of friend.' />;
· ───
╰────
help: Provide no redundant alt text for image.
help: Provide no redundant alt text for image. Screen-readers already announce `img` tags as an image. You dont need to use the words `image`, `photo,` or `picture` (or any specified custom
words) in the alt prop.

eslint-plugin-jsx-a11y(img-redundant-alt): Redundant alt attribute. Screen-readers already announce `img` tags as an image. You dont need to use the words `image`, `photo,` or `picture` (or any
specified custom words) in the alt prop.
eslint-plugin-jsx-a11y(img-redundant-alt): Redundant alt attribute.
╭─[img_redundant_alt.tsx:1:1]
1<img alt='photo of cool person' aria-hidden={false} />
· ───
╰────
help: Provide no redundant alt text for image.
help: Provide no redundant alt text for image. Screen-readers already announce `img` tags as an image. You dont need to use the words `image`, `photo,` or `picture` (or any specified custom
words) in the alt prop.

eslint-plugin-jsx-a11y(img-redundant-alt): Redundant alt attribute. Screen-readers already announce `img` tags as an image. You dont need to use the words `image`, `photo,` or `picture` (or any
specified custom words) in the alt prop.
eslint-plugin-jsx-a11y(img-redundant-alt): Redundant alt attribute.
╭─[img_redundant_alt.tsx:1:1]
1<img alt='picture of cool person' aria-hidden={false} />
· ───
╰────
help: Provide no redundant alt text for image.
help: Provide no redundant alt text for image. Screen-readers already announce `img` tags as an image. You dont need to use the words `image`, `photo,` or `picture` (or any specified custom
words) in the alt prop.

eslint-plugin-jsx-a11y(img-redundant-alt): Redundant alt attribute. Screen-readers already announce `img` tags as an image. You dont need to use the words `image`, `photo,` or `picture` (or any
specified custom words) in the alt prop.
eslint-plugin-jsx-a11y(img-redundant-alt): Redundant alt attribute.
╭─[img_redundant_alt.tsx:1:1]
1<img alt='image of cool person' aria-hidden={false} />
· ───
╰────
help: Provide no redundant alt text for image.
help: Provide no redundant alt text for image. Screen-readers already announce `img` tags as an image. You dont need to use the words `image`, `photo,` or `picture` (or any specified custom
words) in the alt prop.

eslint-plugin-jsx-a11y(img-redundant-alt): Redundant alt attribute. Screen-readers already announce `img` tags as an image. You dont need to use the words `image`, `photo,` or `picture` (or any
specified custom words) in the alt prop.
eslint-plugin-jsx-a11y(img-redundant-alt): Redundant alt attribute.
╭─[img_redundant_alt.tsx:1:1]
1<img alt='photo' {...this.props} />
· ───
╰────
help: Provide no redundant alt text for image.
help: Provide no redundant alt text for image. Screen-readers already announce `img` tags as an image. You dont need to use the words `image`, `photo,` or `picture` (or any specified custom
words) in the alt prop.

eslint-plugin-jsx-a11y(img-redundant-alt): Redundant alt attribute. Screen-readers already announce `img` tags as an image. You dont need to use the words `image`, `photo,` or `picture` (or any
specified custom words) in the alt prop.
eslint-plugin-jsx-a11y(img-redundant-alt): Redundant alt attribute.
╭─[img_redundant_alt.tsx:1:1]
1<img alt='image' {...this.props} />
· ───
╰────
help: Provide no redundant alt text for image.
help: Provide no redundant alt text for image. Screen-readers already announce `img` tags as an image. You dont need to use the words `image`, `photo,` or `picture` (or any specified custom
words) in the alt prop.

eslint-plugin-jsx-a11y(img-redundant-alt): Redundant alt attribute. Screen-readers already announce `img` tags as an image. You dont need to use the words `image`, `photo,` or `picture` (or any
specified custom words) in the alt prop.
eslint-plugin-jsx-a11y(img-redundant-alt): Redundant alt attribute.
╭─[img_redundant_alt.tsx:1:1]
1<img alt='picture' {...this.props} />
· ───
╰────
help: Provide no redundant alt text for image.
help: Provide no redundant alt text for image. Screen-readers already announce `img` tags as an image. You dont need to use the words `image`, `photo,` or `picture` (or any specified custom
words) in the alt prop.

eslint-plugin-jsx-a11y(img-redundant-alt): Redundant alt attribute. Screen-readers already announce `img` tags as an image. You dont need to use the words `image`, `photo,` or `picture` (or any
specified custom words) in the alt prop.
eslint-plugin-jsx-a11y(img-redundant-alt): Redundant alt attribute.
╭─[img_redundant_alt.tsx:1:1]
1<img alt={`picture doing ${things}`} {...this.props} />
· ───
╰────
help: Provide no redundant alt text for image.
help: Provide no redundant alt text for image. Screen-readers already announce `img` tags as an image. You don’t need to use the words `image`, `photo,` or `picture` (or any specified custom
words) in the alt prop.
⚠ eslint-plugin-jsx-a11y(img-redundant-alt): Redundant alt attribute. Screen-readers already announce `img` tags as an image. You don’t need to use the words `image`, `photo,` or `picture` (or any
│ specified custom words) in the alt prop.
⚠ eslint-plugin-jsx-a11y(img-redundant-alt): Redundant alt attribute.
╭─[img_redundant_alt.tsx:1:1]
1 │ <img alt={`photo doing ${things}`} {...this.props} />
· ───
╰────
help: Provide no redundant alt text for image.
help: Provide no redundant alt text for image. Screen-readers already announce `img` tags as an image. You don’t need to use the words `image`, `photo,` or `picture` (or any specified custom
words) in the alt prop.
⚠ eslint-plugin-jsx-a11y(img-redundant-alt): Redundant alt attribute. Screen-readers already announce `img` tags as an image. You don’t need to use the words `image`, `photo,` or `picture` (or any
│ specified custom words) in the alt prop.
⚠ eslint-plugin-jsx-a11y(img-redundant-alt): Redundant alt attribute.
╭─[img_redundant_alt.tsx:1:1]
1 │ <img alt={`image doing ${things}`} {...this.props} />
· ───
╰────
help: Provide no redundant alt text for image.
help: Provide no redundant alt text for image. Screen-readers already announce `img` tags as an image. You don’t need to use the words `image`, `photo,` or `picture` (or any specified custom
words) in the alt prop.
⚠ eslint-plugin-jsx-a11y(img-redundant-alt): Redundant alt attribute. Screen-readers already announce `img` tags as an image. You don’t need to use the words `image`, `photo,` or `picture` (or any
│ specified custom words) in the alt prop.
⚠ eslint-plugin-jsx-a11y(img-redundant-alt): Redundant alt attribute.
╭─[img_redundant_alt.tsx:1:1]
1 │ <img alt={`picture doing ${picture}`} {...this.props} />
· ───
╰────
help: Provide no redundant alt text for image.
help: Provide no redundant alt text for image. Screen-readers already announce `img` tags as an image. You don’t need to use the words `image`, `photo,` or `picture` (or any specified custom
words) in the alt prop.
⚠ eslint-plugin-jsx-a11y(img-redundant-alt): Redundant alt attribute. Screen-readers already announce `img` tags as an image. You don’t need to use the words `image`, `photo,` or `picture` (or any
│ specified custom words) in the alt prop.
⚠ eslint-plugin-jsx-a11y(img-redundant-alt): Redundant alt attribute.
╭─[img_redundant_alt.tsx:1:1]
1 │ <img alt={`photo doing ${photo}`} {...this.props} />
· ───
╰────
help: Provide no redundant alt text for image.
help: Provide no redundant alt text for image. Screen-readers already announce `img` tags as an image. You don’t need to use the words `image`, `photo,` or `picture` (or any specified custom
words) in the alt prop.
⚠ eslint-plugin-jsx-a11y(img-redundant-alt): Redundant alt attribute. Screen-readers already announce `img` tags as an image. You don’t need to use the words `image`, `photo,` or `picture` (or any
│ specified custom words) in the alt prop.
⚠ eslint-plugin-jsx-a11y(img-redundant-alt): Redundant alt attribute.
╭─[img_redundant_alt.tsx:1:1]
1 │ <img alt={`image doing ${image}`} {...this.props} />
· ───
╰────
help: Provide no redundant alt text for image.
help: Provide no redundant alt text for image. Screen-readers already announce `img` tags as an image. You don’t need to use the words `image`, `photo,` or `picture` (or any specified custom
words) in the alt prop.
⚠ eslint-plugin-jsx-a11y(img-redundant-alt): Redundant alt attribute. Screen-readers already announce `img` tags as an image. You don’t need to use the words `image`, `photo,` or `picture` (or any
│ specified custom words) in the alt prop.
⚠ eslint-plugin-jsx-a11y(img-redundant-alt): Redundant alt attribute.
╭─[img_redundant_alt.tsx:1:1]
1 │ <img alt='Word1' />;
· ───
╰────
help: Provide no redundant alt text for image.
help: Provide no redundant alt text for image. Screen-readers already announce `img` tags as an image. You don’t need to use the words `image`, `photo,` or `picture` (or any specified custom
words) in the alt prop.
⚠ eslint-plugin-jsx-a11y(img-redundant-alt): Redundant alt attribute. Screen-readers already announce `img` tags as an image. You don’t need to use the words `image`, `photo,` or `picture` (or any
│ specified custom words) in the alt prop.
⚠ eslint-plugin-jsx-a11y(img-redundant-alt): Redundant alt attribute.
╭─[img_redundant_alt.tsx:1:1]
1 │ <img alt='Word2' />;
· ───
╰────
help: Provide no redundant alt text for image.
help: Provide no redundant alt text for image. Screen-readers already announce `img` tags as an image. You don’t need to use the words `image`, `photo,` or `picture` (or any specified custom
words) in the alt prop.
⚠ eslint-plugin-jsx-a11y(img-redundant-alt): Redundant alt attribute. Screen-readers already announce `img` tags as an image. You don’t need to use the words `image`, `photo,` or `picture` (or any
│ specified custom words) in the alt prop.
⚠ eslint-plugin-jsx-a11y(img-redundant-alt): Redundant alt attribute.
╭─[img_redundant_alt.tsx:1:1]
1 │ <Image alt='Word1' />;
· ───
╰────
help: Provide no redundant alt text for image.
help: Provide no redundant alt text for image. Screen-readers already announce `img` tags as an image. You don’t need to use the words `image`, `photo,` or `picture` (or any specified custom
words) in the alt prop.
⚠ eslint-plugin-jsx-a11y(img-redundant-alt): Redundant alt attribute. Screen-readers already announce `img` tags as an image. You don’t need to use the words `image`, `photo,` or `picture` (or any
│ specified custom words) in the alt prop.
⚠ eslint-plugin-jsx-a11y(img-redundant-alt): Redundant alt attribute.
╭─[img_redundant_alt.tsx:1:1]
1 │ <Image alt='Word2' />;
· ───
╰────
help: Provide no redundant alt text for image.
help: Provide no redundant alt text for image. Screen-readers already announce `img` tags as an image. You don’t need to use the words `image`, `photo,` or `picture` (or any specified custom
words) in the alt prop.

0 comments on commit 806fba4

Please sign in to comment.