@double-great/alt-text
Advanced tools
Comparing version 0.3.1 to 0.4.0
# Changelog | ||
## 0.4.0 | ||
- Replace "End in period" suggestion with "End in punctuation". [#49](https://github.com/double-great/alt-text/pull/49) | ||
## 0.3.1 | ||
@@ -4,0 +8,0 @@ |
13
clues.js
@@ -40,8 +40,11 @@ module.exports = { | ||
}, | ||
endPeriod: { | ||
heading: "End in a period", | ||
suggestion: () => `Alt text should end in a period`, | ||
endPunctuation: { | ||
heading: "End with punctuation", | ||
suggestion: () => `Alt text should end with punctuation`, | ||
rationale: | ||
"End the alt text with a period. 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.", | ||
source: ["https://axesslab.com/alt-texts/#end-with-a-period"], | ||
"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.", | ||
source: [ | ||
"https://axesslab.com/alt-texts/#end-with-a-period", | ||
"https://doublegreat.dev/listen/punctuation-in-alt-text/" | ||
], | ||
ok: "A child holding a photograph.", | ||
@@ -48,0 +51,0 @@ notOk: "A child holding a photograph" |
@@ -10,3 +10,3 @@ const rules = require("./rules"); | ||
...rules.checkOnlySpace(alt), | ||
...rules.checkPeriod(alt), | ||
...rules.checkPunctuation(alt), | ||
...rules.checkEmoji(alt) | ||
@@ -13,0 +13,0 @@ ]; |
{ | ||
"name": "@double-great/alt-text", | ||
"version": "0.3.1", | ||
"version": "0.4.0", | ||
"description": "Check for unhelpful alt text.", | ||
@@ -29,8 +29,8 @@ "main": "index.js", | ||
"devDependencies": { | ||
"babel-eslint": "^10.0.3", | ||
"eslint": "^6.8.0", | ||
"husky": "^4.2.1", | ||
"prettier": "^1.19.1", | ||
"babel-eslint": "^10.1.0", | ||
"eslint": "^7.4.0", | ||
"husky": "^4.2.5", | ||
"prettier": "^2.0.5", | ||
"pretty-quick": "^2.0.1", | ||
"tape": "^4.13.0" | ||
"tape": "^5.0.1" | ||
}, | ||
@@ -37,0 +37,0 @@ "husky": { |
@@ -29,4 +29,4 @@ # alt-text ![Build Status](https://github.com/double-great/alt-text/workflows/Test/badge.svg) | ||
console.log(altText("A screenshot of a dog")); | ||
// Alt text should not contain "screenshot of". Alt text should end in a period. | ||
console.log(altText("A photo of a dog")); | ||
// Alt text should not contain "photo of" (https://git.io/JvqAM). Alt text should end with punctuation (https://git.io/JJk55). | ||
``` | ||
@@ -134,7 +134,7 @@ | ||
### End in a period | ||
### End with punctuation | ||
Suggestion: `Alt text should end in a period` | ||
Suggestion: `Alt text should end with punctuation` | ||
End the alt text with a period. 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. | ||
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. | ||
@@ -147,2 +147,3 @@ - ✅ A child holding a photograph. | ||
- <https://axesslab.com/alt-texts/#end-with-a-period> | ||
- <https://doublegreat.dev/listen/punctuation-in-alt-text/> | ||
@@ -149,0 +150,0 @@ ### Image is decorative |
@@ -32,5 +32,6 @@ const clues = require("./clues"); | ||
function checkPeriod(alt) { | ||
return !alt.endsWith(".") && alt.length > 1 | ||
? [createSuggestion("endPeriod")] | ||
function checkPunctuation(alt) { | ||
console.log("test", /[.!?]$/.test(alt)); | ||
return !/[.!?]$/.test(alt) && alt.length > 1 | ||
? [createSuggestion("endPunctuation")] | ||
: []; | ||
@@ -49,5 +50,5 @@ } | ||
checkOnlySpace, | ||
checkPeriod, | ||
checkPunctuation, | ||
createSuggestion, | ||
checkEmoji | ||
}; |
@@ -6,3 +6,3 @@ { | ||
"decorative": "https://git.io/Jvqx8", | ||
"endPeriod": "https://git.io/Jvqiq", | ||
"endPunctuation": "https://git.io/JJk55", | ||
"endWith": "https://git.io/JvfAf", | ||
@@ -9,0 +9,0 @@ "exactMatch": "https://git.io/JvqAK", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
19886
260
185