Socket
Socket
Sign inDemoInstall

@double-great/alt-text

Package Overview
Dependencies
Maintainers
2
Versions
17
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@double-great/alt-text - npm Package Compare versions

Comparing version 3.0.0 to 3.1.0

5

CHANGELOG.md
# Changelog
## 3.1.0
- Remove prettier as a dependency for generating documention.
- Switch to use doublegreat.dev for documentation.
## 3.0.0

@@ -4,0 +9,0 @@

15

dist/clues.js

@@ -1,3 +0,1 @@

import pkg from "prettier";
const { format } = pkg;
export default class Clue {

@@ -25,8 +23,8 @@ constructor(props) {

document() {
const codeDisable = format(`altText('My alt text.', ${JSON.stringify({
const codeDisable = `altText("My alt text.", ${JSON.stringify({
[this.id]: false,
})})`, { parser: "babel" });
const codeOptions = format(`altText("My alt text.", ${JSON.stringify({
})})`;
const codeOptions = `altText("My alt text.", ${JSON.stringify({
[this.id]: this.config,
})})`, { parser: "babel" });
})})`;
return `### ${this.heading}

@@ -47,2 +45,3 @@

<!-- prettier-ignore-start -->
\`\`\`js

@@ -54,3 +53,5 @@ // disable the rule:

${codeOptions}`
: ""}\`\`\`
: ""}
\`\`\`
<!-- prettier-ignore-end -->

@@ -57,0 +58,0 @@ Sources:

@@ -23,3 +23,3 @@ import emojiRegex from "emoji-regex";

heading: "Avoid emoji",
docs: "https://tinyurl.com/yylrxrus",
docs: "https://tinyurl.com/ybhwbyzk",
rationale: `Emoji have their own text descriptions. These descriptions can vary between operating systems and software. The spoken description of the emoji may not match your visual intention.`,

@@ -26,0 +26,0 @@ listen: "https://doublegreat.dev/listen/emoji/",

@@ -25,3 +25,3 @@ import Clue from "../clues.js";

heading: "Character length",
docs: "https://tinyurl.com/y2f7rhao",
docs: "https://tinyurl.com/yabhqplx",
rationale: "Alt text should be less than 125 characters in length. The JAWS screen reader reads alt text in 125 character chunks. Any information about the image, such as copyright information, image source or extra information should be placed in the caption text below the image.",

@@ -28,0 +28,0 @@ source: [

@@ -41,3 +41,3 @@ import Clue from "../clues.js";

heading: "Alt text contains unhelpful words",
docs: "https://tinyurl.com/y3v3jgux",
docs: "https://tinyurl.com/ydbwu53g",
rationale: "Screen readers announce the presence of an image before reading the alt text. Adding “picture of” or “photo of” is redundant in this context.",

@@ -44,0 +44,0 @@ source: [

@@ -17,3 +17,3 @@ import Clue from "../clues.js";

heading: "Image is decorative",
docs: "https://tinyurl.com/yxnvejgv",
docs: "https://tinyurl.com/y8mlwswv",
rationale: `Provide "null" \`alt\` attributes (using \`alt=""\`) for images which do not provide information or do not require alternative text because the image is described in the page content. Some developers will mistakenly leave off the alt attribute altogether on images which they deem do not need alternatives. This is not helpful to assistive technology users because the assistive technology, such as screen reader, will often read the source attribute (i.e., file name) as the alternative text. To tell assistive technology to ignore an image, use a "blank alternative text" attribute: \`alt=""\`.`,

@@ -20,0 +20,0 @@ source: ["https://dequeuniversity.com/rules/axe/3.0/image-alt"],

@@ -19,3 +19,3 @@ import Clue from "../clues.js";

heading: "End with punctuation",
docs: "https://tinyurl.com/y5krn3ny",
docs: "https://tinyurl.com/y9fcquhy",
rationale: "End the alt text with a period, exclamation point, or question mark. This will make screen readers pause a bit after the last word in the alt text, which creates a more pleasant reading experience for the user.",

@@ -22,0 +22,0 @@ listen: "https://doublegreat.dev/listen/punctuation-in-alt-text/",

@@ -40,3 +40,3 @@ import Clue from "../clues.js";

heading: "Alt text should not end with",
docs: "https://tinyurl.com/yy2q8bbb",
docs: "https://tinyurl.com/yb5w77fy",
rationale: "A file name in alt text does not provide helpful context.",

@@ -43,0 +43,0 @@ source: ["https://axesslab.com/alt-texts/"],

@@ -58,3 +58,3 @@ import Clue from "../clues.js";

heading: "Alt text is unhelpful",
docs: "https://tinyurl.com/yxwc2hof",
docs: "https://tinyurl.com/ycxdkm92",
rationale: "Usually, there’s no need to include words like “image”, “icon”, or “picture” in the alt text. People who can see will know this already, and screen readers announce the presence of an image.",

@@ -61,0 +61,0 @@ source: [

@@ -17,3 +17,3 @@ import Clue from "../clues.js";

heading: "Image is link",
docs: "https://tinyurl.com/yxhq2k5w",
docs: "https://tinyurl.com/y7s7je5u",
rationale: "Images inside a link tag require alt text that describes the purpose of the link.",

@@ -20,0 +20,0 @@ source: ["https://axesslab.com/alt-texts/#images-in-links"],

@@ -17,3 +17,3 @@ import Clue from "../clues.js";

heading: "Missing alt attribute",
docs: "https://tinyurl.com/yybc6bsy",
docs: "https://tinyurl.com/ycq4enq5",
rationale: "All images must have alternate text to convey their purpose and meaning to screen reader users.",

@@ -20,0 +20,0 @@ source: ["https://dequeuniversity.com/rules/axe/3.4/image-alt"],

@@ -19,3 +19,3 @@ import Clue from "../clues.js";

heading: "Empty alt text",
docs: "https://tinyurl.com/y2o7uctu",
docs: "https://tinyurl.com/y877n89g",
rationale: 'If you use null (empty) alt text (`alt=""`) to hide decorative images, make sure that there is no space character in between the quotes. **If a space character is present, the image may not be effectively hidden from assistive technologies.** For instance, some screen readers will still announce the presence of an image if a space character is put between the quotes.',

@@ -22,0 +22,0 @@ source: ["https://www.w3.org/WAI/tutorials/images/tips/#tips"],

@@ -41,3 +41,3 @@ import Clue from "../clues.js";

heading: "Alt text should not start with",
docs: "https://tinyurl.com/y5y98ygu",
docs: "https://tinyurl.com/y7xq5wbt",
rationale: "Usually, there’s no need to include words like “image”, “icon”, or “picture” in the alt text. People who can see will know this already, and screen readers announce the presence of an image.",

@@ -44,0 +44,0 @@ source: [

@@ -16,4 +16,4 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {

return __awaiter(this, void 0, void 0, function* () {
return yield getUrl(`https://github.com/double-great/alt-text#${slugger.slug(heading)}`);
return yield getUrl(`https://doublegreat.dev/alt-text/#${slugger.slug(heading)}`);
});
}
{
"name": "@double-great/alt-text",
"version": "3.0.0",
"version": "3.1.0",
"description": "Check for unhelpful alt text.",

@@ -29,3 +29,3 @@ "main": "dist/index.js",

"dependencies": {
"emoji-regex": "^10.0.1",
"emoji-regex": "^10.1.0",
"github-slugger": "^1.4.0",

@@ -40,4 +40,4 @@ "tinyurl": "^1.1.7"

"@types/node": "^17.0.18",
"@typescript-eslint/eslint-plugin": "^5.15.0",
"@typescript-eslint/parser": "^5.15.0",
"@typescript-eslint/eslint-plugin": "^5.18.0",
"@typescript-eslint/parser": "^5.18.0",
"eslint": "^8.11.0",

@@ -48,3 +48,3 @@ "eslint-config-prettier": "^8.5.0",

"pinst": "^3.0.0",
"prettier": "^2.5.1",
"prettier": "^2.6.2",
"pretty-quick": "^3.1.3",

@@ -51,0 +51,0 @@ "typescript": "^4.6.2"

@@ -30,3 +30,3 @@ # alt-text ![Build Status](https://github.com/double-great/alt-text/workflows/Test/badge.svg)

console.log(altText("A photo of a dog"));
// Alt text should not contain "photo of" (https://tinyurl.com/y3v3jgux). Alt text should end with punctuation (https://tinyurl.com/y5krn3ny).
// Alt text should not contain "photo of" (https://tinyurl.com/ydbwu53g). Alt text should end with punctuation (https://tinyurl.com/y9fcquhy).
```

@@ -40,3 +40,3 @@

console.log(altText("A photo of a dog", { "end-with-punctuation": false }));
// Alt text should not contain "photo of" (https://tinyurl.com/y3v3jgux).
// Alt text should not contain "photo of" (https://tinyurl.com/ydbwu53g).
```

@@ -73,23 +73,10 @@

<!-- prettier-ignore-start -->
```js
// disable the rule:
altText("My alt text.", { "contains-unhelpful-word": false });
altText("My alt text.", {"contains-unhelpful-word":false})
// adjust rule defaults:
altText("My alt text.", {
"contains-unhelpful-word": {
exclude: [
"graphic of",
"image of",
"photo of",
"photo:",
"photograph of",
"photographer:",
"picture of",
"screen shot of",
"screenshot of",
],
},
});
altText("My alt text.", {"contains-unhelpful-word":{"exclude":["graphic of","image of","photo of","photo:","photograph of","photographer:","picture of","screen shot of","screenshot of"]}})
```
<!-- prettier-ignore-end -->

@@ -112,40 +99,10 @@ Sources:

<!-- prettier-ignore-start -->
```js
// disable the rule:
altText("My alt text.", { "is-unhelpful": false });
altText("My alt text.", {"is-unhelpful":false})
// adjust rule defaults:
altText("My alt text.", {
"is-unhelpful": {
exclude: [
"*",
"alt",
"arrow",
"artwork",
"blank",
"bullet",
"button",
"chart",
"diagram",
"drawing",
"empty",
"graph",
"graphic",
"icon",
"image",
"logo",
"more",
"painting",
"photo",
"photograph",
"placeholder",
"screen shot",
"screenshot",
"spacer",
"table",
"temp",
],
},
});
altText("My alt text.", {"is-unhelpful":{"exclude":["*","alt","arrow","artwork","blank","bullet","button","chart","diagram","drawing","empty","graph","graphic","icon","image","logo","more","painting","photo","photograph","placeholder","screen shot","screenshot","spacer","table","temp"]}})
```
<!-- prettier-ignore-end -->

@@ -168,22 +125,10 @@ Sources:

<!-- prettier-ignore-start -->
```js
// disable the rule:
altText("My alt text.", { "should-not-end-with": false });
altText("My alt text.", {"should-not-end-with":false})
// adjust rule defaults:
altText("My alt text.", {
"should-not-end-with": {
exclude: [
".gif",
".jpeg",
".jpg",
".png",
".svg",
".webp",
"graphic",
"image",
],
},
});
altText("My alt text.", {"should-not-end-with":{"exclude":[".gif",".jpeg",".jpg",".png",".svg",".webp","graphic","image"]}})
```
<!-- prettier-ignore-end -->

@@ -205,23 +150,10 @@ Sources:

<!-- prettier-ignore-start -->
```js
// disable the rule:
altText("My alt text.", { "should-not-start-with": false });
altText("My alt text.", {"should-not-start-with":false})
// adjust rule defaults:
altText("My alt text.", {
"should-not-start-with": {
exclude: [
"graphic",
"image",
"photo",
"photograph",
"photographer",
"picture",
"screen shot",
"screenshot",
"spacer",
],
},
});
altText("My alt text.", {"should-not-start-with":{"exclude":["graphic","image","photo","photograph","photographer","picture","screen shot","screenshot","spacer"]}})
```
<!-- prettier-ignore-end -->

@@ -246,6 +178,8 @@ Sources:

<!-- prettier-ignore-start -->
```js
// disable the rule:
altText("My alt text.", { "avoid-emoji": false });
altText("My alt text.", {"avoid-emoji":false})
```
<!-- prettier-ignore-end -->

@@ -268,9 +202,10 @@ Sources:

<!-- prettier-ignore-start -->
```js
// disable the rule:
altText("My alt text.", { "character-length": false });
altText("My alt text.", {"character-length":false})
// adjust rule defaults:
altText("My alt text.", { "character-length": { length: 125 } });
altText("My alt text.", {"character-length":{"length":125}})
```
<!-- prettier-ignore-end -->

@@ -293,6 +228,8 @@ Sources:

<!-- prettier-ignore-start -->
```js
// disable the rule:
altText("My alt text.", { "empty-alt-text": false });
altText("My alt text.", {"empty-alt-text":false})
```
<!-- prettier-ignore-end -->

@@ -316,6 +253,8 @@ Sources:

<!-- prettier-ignore-start -->
```js
// disable the rule:
altText("My alt text.", { "end-with-punctuation": false });
altText("My alt text.", {"end-with-punctuation":false})
```
<!-- prettier-ignore-end -->

@@ -337,6 +276,8 @@ Sources:

<!-- prettier-ignore-start -->
```js
// disable the rule:
altText("My alt text.", { "image-is-decorative": false });
altText("My alt text.", {"image-is-decorative":false})
```
<!-- prettier-ignore-end -->

@@ -358,6 +299,8 @@ Sources:

<!-- prettier-ignore-start -->
```js
// disable the rule:
altText("My alt text.", { "image-is-link": false });
altText("My alt text.", {"image-is-link":false})
```
<!-- prettier-ignore-end -->

@@ -379,6 +322,8 @@ Sources:

<!-- prettier-ignore-start -->
```js
// disable the rule:
altText("My alt text.", { "no-alt": false });
altText("My alt text.", {"no-alt":false})
```
<!-- prettier-ignore-end -->

@@ -385,0 +330,0 @@ Sources:

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc