Skip to content

Commit c7d19e4

Browse files
committed
Sync with template-lint
1 parent c34ec5d commit c7d19e4

2 files changed

Lines changed: 11 additions & 11 deletions

File tree

lib/rules/template-require-valid-alt-text.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -65,13 +65,13 @@ module.exports = {
6565
},
6666
schema: [],
6767
messages: {
68-
imgMissing: 'All `<img>` tags must have an alt attribute.',
68+
imgMissing: 'All `<img>` tags must have an alt attribute',
6969
imgRedundant:
7070
'Invalid alt attribute. Words such as `image`, `photo,` or `picture` are already announced by screen readers.',
71-
imgAltEqualsSrc: 'The alt text must not be the same as the image source.',
72-
imgNumericAlt: 'A number is not valid alt text.',
71+
imgAltEqualsSrc: 'The alt text must not be the same as the image source',
72+
imgNumericAlt: 'A number is not valid alt text',
7373
imgRolePresentation:
74-
'The `alt` attribute should be empty if `<img>` has `role` of `none` or `presentation`.',
74+
'The `alt` attribute should be empty if `<img>` has `role` of `none` or `presentation`',
7575
inputImage:
7676
'All <input> elements with type="image" must have a text alternative through the `alt`, `aria-label`, or `aria-labelledby` attribute.',
7777
objectMissing:
@@ -151,7 +151,7 @@ module.exports = {
151151
const words = normalizedAlt.split(' ');
152152
const hasRedundant = REDUNDANT_WORDS.some((w) => words.includes(w));
153153
if (hasRedundant) {
154-
context.report({ node: altAttr, messageId: 'imgRedundant' });
154+
context.report({ node, messageId: 'imgRedundant' });
155155
}
156156
}
157157
}

tests/lib/rules/template-require-valid-alt-text.js

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -212,17 +212,17 @@ hbsRuleTester.run('template-require-valid-alt-text', rule, {
212212
{
213213
code: '<img>',
214214
output: null,
215-
errors: [{ message: 'All `<img>` tags must have an alt attribute.' }],
215+
errors: [{ message: 'All `<img>` tags must have an alt attribute' }],
216216
},
217217
{
218218
code: '<img src="zoey.jpg">',
219219
output: null,
220-
errors: [{ message: 'All `<img>` tags must have an alt attribute.' }],
220+
errors: [{ message: 'All `<img>` tags must have an alt attribute' }],
221221
},
222222
{
223223
code: '<img alt="path/to/zoey.jpg" src="path/to/zoey.jpg">',
224224
output: null,
225-
errors: [{ message: 'The alt text must not be the same as the image source.' }],
225+
errors: [{ message: 'The alt text must not be the same as the image source' }],
226226
},
227227
{
228228
code: '<input type="image">',
@@ -317,15 +317,15 @@ hbsRuleTester.run('template-require-valid-alt-text', rule, {
317317
{
318318
code: '<img alt="52" src="b52.jpg">',
319319
output: null,
320-
errors: [{ message: 'A number is not valid alt text.' }],
320+
errors: [{ message: 'A number is not valid alt text' }],
321321
},
322322
{
323323
code: '<img alt="not-null-alt" src="zoey.jpg" role="none">',
324324
output: null,
325325
errors: [
326326
{
327327
message:
328-
'The `alt` attribute should be empty if `<img>` has `role` of `none` or `presentation`.',
328+
'The `alt` attribute should be empty if `<img>` has `role` of `none` or `presentation`',
329329
},
330330
],
331331
},
@@ -335,7 +335,7 @@ hbsRuleTester.run('template-require-valid-alt-text', rule, {
335335
errors: [
336336
{
337337
message:
338-
'The `alt` attribute should be empty if `<img>` has `role` of `none` or `presentation`.',
338+
'The `alt` attribute should be empty if `<img>` has `role` of `none` or `presentation`',
339339
},
340340
],
341341
},

0 commit comments

Comments
 (0)