Skip to content

Commit 6100f75

Browse files
committed
Fix error messages to match ember-template-lint exactly
- boolean: use default case (produces "a boolean.") instead of custom "a boolean (true or false)" - id/idlist: no trailing period, matching original lines 27/30 - Move period from message template into each description to match original's per-case punctuation
1 parent b08c8e2 commit 6100f75

1 file changed

Lines changed: 9 additions & 15 deletions

File tree

lib/rules/template-no-invalid-aria-attributes.js

Lines changed: 9 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -68,29 +68,23 @@ function getExpectedTypeDescription(attrName) {
6868
return 'a valid value';
6969
}
7070
switch (attrDef.type) {
71-
case 'boolean':
72-
return 'a boolean (true or false)';
7371
case 'tristate':
74-
return 'a boolean or the string "mixed"';
75-
case 'integer':
76-
return 'an integer';
77-
case 'number':
78-
return 'a number';
72+
return 'a boolean or the string "mixed".';
7973
case 'token': {
8074
const vals = attrDef.values.map((v) => (typeof v === 'boolean' ? v.toString() : v));
81-
return `a single token from the following: ${vals.join(', ')}`;
75+
return `a single token from the following: ${vals.join(', ')}.`;
8276
}
8377
case 'tokenlist': {
84-
return `a list of one or more tokens from the following: ${attrDef.values.join(', ')}`;
78+
return `a list of one or more tokens from the following: ${attrDef.values.join(', ')}.`;
8579
}
86-
case 'id':
87-
return 'a string that represents a DOM element ID';
8880
case 'idlist':
8981
return 'a list of strings that represent DOM element IDs (idlist)';
90-
case 'string':
91-
return 'a string';
82+
case 'id':
83+
return 'a string that represents a DOM element ID';
84+
case 'integer':
85+
return 'an integer.';
9286
default:
93-
return 'a valid value';
87+
return `a ${attrDef.type}.`;
9488
}
9589
}
9690

@@ -107,7 +101,7 @@ module.exports = {
107101
schema: [],
108102
messages: {
109103
noInvalidAriaAttribute: 'Invalid ARIA attribute: {{attribute}}',
110-
invalidAriaAttributeValue: 'The value for {{attribute}} must be {{expectedType}}.',
104+
invalidAriaAttributeValue: 'The value for {{attribute}} must be {{expectedType}}',
111105
},
112106
originallyFrom: {
113107
name: 'ember-template-lint',

0 commit comments

Comments
 (0)