Skip to content

Commit def8cea

Browse files
committed
chore: update rule meta to satisfiy lint rules
Updates a few things in rule meta so the linter is happy: - Some descriptions didn't follow the naming convention (`enforce`, `require`, etc) - Some rules had no `type`, so these were set to `problem` - Some rules had no `recommended`, so these were set to if they are in the recommended config or not - Message IDs have been used instead of messages
1 parent 4832156 commit def8cea

32 files changed

+183
-55
lines changed

README.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -117,17 +117,17 @@ This config will be interpreted in the following way:
117117

118118
| Name                                        | Description | 💼 | 🔧 ||
119119
| :------------------------------------------------------------------------------------------------------- | :----------------------------------------------------------------------------------------------------------------------- | :- | :- | :- |
120-
| [a11y-aria-label-is-well-formatted](docs/rules/a11y-aria-label-is-well-formatted.md) | [aria-label] text should be formatted as you would visual text. | ⚛️ | | |
120+
| [a11y-aria-label-is-well-formatted](docs/rules/a11y-aria-label-is-well-formatted.md) | enforce [aria-label] text to be formatted as you would visual text. | ⚛️ | | |
121121
| [a11y-no-generic-link-text](docs/rules/a11y-no-generic-link-text.md) | disallow generic link text | | ||
122-
| [a11y-no-title-attribute](docs/rules/a11y-no-title-attribute.md) | Guards against developers using the title attribute | ⚛️ | | |
123-
| [a11y-no-visually-hidden-interactive-element](docs/rules/a11y-no-visually-hidden-interactive-element.md) | Ensures that interactive elements are not visually hidden | ⚛️ | | |
124-
| [a11y-role-supports-aria-props](docs/rules/a11y-role-supports-aria-props.md) | Enforce that elements with explicit or implicit roles defined contain only `aria-*` properties supported by that `role`. | ⚛️ | | |
125-
| [a11y-svg-has-accessible-name](docs/rules/a11y-svg-has-accessible-name.md) | SVGs must have an accessible name | ⚛️ | | |
122+
| [a11y-no-title-attribute](docs/rules/a11y-no-title-attribute.md) | disallow using the title attribute | ⚛️ | | |
123+
| [a11y-no-visually-hidden-interactive-element](docs/rules/a11y-no-visually-hidden-interactive-element.md) | enforce that interactive elements are not visually hidden | ⚛️ | | |
124+
| [a11y-role-supports-aria-props](docs/rules/a11y-role-supports-aria-props.md) | enforce that elements with explicit or implicit roles defined contain only `aria-*` properties supported by that `role`. | ⚛️ | | |
125+
| [a11y-svg-has-accessible-name](docs/rules/a11y-svg-has-accessible-name.md) | require SVGs to have an accessible name | ⚛️ | | |
126126
| [array-foreach](docs/rules/array-foreach.md) | enforce `for..of` loops over `Array.forEach` || | |
127127
| [async-currenttarget](docs/rules/async-currenttarget.md) | disallow `event.currentTarget` calls inside of async functions | 🔍 | | |
128128
| [async-preventdefault](docs/rules/async-preventdefault.md) | disallow `event.preventDefault` calls inside of async functions | 🔍 | | |
129129
| [authenticity-token](docs/rules/authenticity-token.md) | disallow usage of CSRF tokens in JavaScript | 🔐 | | |
130-
| [filenames-match-regex](docs/rules/filenames-match-regex.md) | ensure filenames match a regex naming convention | | | |
130+
| [filenames-match-regex](docs/rules/filenames-match-regex.md) | require filenames to match a regex naming convention | | | |
131131
| [get-attribute](docs/rules/get-attribute.md) | disallow wrong usage of attribute names | 🔍 | 🔧 | |
132132
| [js-class-name](docs/rules/js-class-name.md) | enforce a naming convention for js- prefixed classes | 🔐 | | |
133133
| [no-blur](docs/rules/no-blur.md) | disallow usage of `Element.prototype.blur()` | 🔍 | | |

docs/rules/a11y-aria-label-is-well-formatted.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# [aria-label] text should be formatted as you would visual text (`github/a11y-aria-label-is-well-formatted`)
1+
# Enforce [aria-label] text to be formatted as you would visual text (`github/a11y-aria-label-is-well-formatted`)
22

33
💼 This rule is enabled in the ⚛️ `react` config.
44

docs/rules/a11y-no-title-attribute.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Guards against developers using the title attribute (`github/a11y-no-title-attribute`)
1+
# Disallow using the title attribute (`github/a11y-no-title-attribute`)
22

33
💼 This rule is enabled in the ⚛️ `react` config.
44

docs/rules/a11y-no-visually-hidden-interactive-element.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Ensures that interactive elements are not visually hidden (`github/a11y-no-visually-hidden-interactive-element`)
1+
# Enforce that interactive elements are not visually hidden (`github/a11y-no-visually-hidden-interactive-element`)
22

33
💼 This rule is enabled in the ⚛️ `react` config.
44

docs/rules/a11y-svg-has-accessible-name.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# SVGs must have an accessible name (`github/a11y-svg-has-accessible-name`)
1+
# Require SVGs to have an accessible name (`github/a11y-svg-has-accessible-name`)
22

33
💼 This rule is enabled in the ⚛️ `react` config.
44

docs/rules/filenames-match-regex.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Ensure filenames match a regex naming convention (`github/filenames-match-regex`)
1+
# Require filenames to match a regex naming convention (`github/filenames-match-regex`)
22

33
<!-- end auto-generated rule header -->
44

eslint.config.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ module.exports = [
3232
'eslint-plugin/prefer-placeholders': 'off',
3333
'eslint-plugin/test-case-shorthand-strings': 'off',
3434
'eslint-plugin/require-meta-docs-url': 'off',
35+
'eslint-plugin/require-meta-default-options': 'off',
3536
},
3637
},
3738
]

lib/rules/a11y-aria-label-is-well-formatted.js

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,16 @@ const {getProp} = require('jsx-ast-utils')
22

33
module.exports = {
44
meta: {
5+
type: 'problem',
56
docs: {
6-
description: '[aria-label] text should be formatted as you would visual text.',
7+
description: 'enforce [aria-label] text to be formatted as you would visual text.',
78
url: require('../url')(module),
9+
recommended: false,
810
},
911
schema: [],
12+
messages: {
13+
formatting: '[aria-label] text should be formatted the same as you would visual text. Use sentence case.',
14+
},
1015
},
1116

1217
create(context) {
@@ -22,7 +27,7 @@ module.exports = {
2227
if (ariaLabel.match(/^[a-z]+.*$/)) {
2328
context.report({
2429
node,
25-
message: '[aria-label] text should be formatted the same as you would visual text. Use sentence case.',
30+
messageId: 'formatting',
2631
})
2732
}
2833
},

lib/rules/a11y-no-generic-link-text.js

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,13 +14,20 @@ const stripAndDowncaseText = text => {
1414

1515
module.exports = {
1616
meta: {
17+
type: 'problem',
1718
docs: {
1819
description: 'disallow generic link text',
1920
url: require('../url')(module),
21+
recommended: false,
2022
},
2123
deprecated: true,
2224
replacedBy: ['jsx-a11y/anchor-ambiguous-text'],
2325
schema: [],
26+
messages: {
27+
avoidGenericLinkText:
28+
'Avoid setting generic link text like `Here`, `Click here`, `Read more`. Make sure that your link text is both descriptive and concise.',
29+
ariaLabelDescriptive: 'When using ARIA to set a more descriptive text, it must fully contain the visible label.',
30+
},
2431
},
2532

2633
create(context) {
@@ -47,23 +54,21 @@ module.exports = {
4754
if (bannedLinkText.includes(cleanAriaLabelValue)) {
4855
context.report({
4956
node,
50-
message:
51-
'Avoid setting generic link text like `Here`, `Click here`, `Read more`. Make sure that your link text is both descriptive and concise.',
57+
messageId: 'avoidGenericLinkText',
5258
})
5359
}
5460
if (cleanTextContent && !cleanAriaLabelValue.includes(cleanTextContent)) {
5561
context.report({
5662
node,
57-
message: 'When using ARIA to set a more descriptive text, it must fully contain the visible label.',
63+
messageId: 'ariaLabelDescriptive',
5864
})
5965
}
6066
} else {
6167
if (cleanTextContent) {
6268
if (!bannedLinkText.includes(cleanTextContent)) return
6369
context.report({
6470
node: jsxTextNode,
65-
message:
66-
'Avoid setting generic link text like `Here`, `Click here`, `Read more`. Make sure that your link text is both descriptive and concise.',
71+
messageId: 'avoidGenericLinkText',
6772
})
6873
}
6974
}

lib/rules/a11y-no-title-attribute.js

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,11 +40,16 @@ const ifSemanticElement = (context, node) => {
4040

4141
module.exports = {
4242
meta: {
43+
type: 'problem',
4344
docs: {
44-
description: 'Guards against developers using the title attribute',
45+
description: 'disallow using the title attribute',
4546
url: require('../url')(module),
47+
recommended: false,
4648
},
4749
schema: [],
50+
messages: {
51+
titleAttribute: 'The title attribute is not accessible and should never be used unless for an `<iframe>`.',
52+
},
4853
},
4954

5055
create(context) {
@@ -56,7 +61,7 @@ module.exports = {
5661
if (titleProp) {
5762
context.report({
5863
node,
59-
message: 'The title attribute is not accessible and should never be used unless for an `<iframe>`.',
64+
messageId: 'titleAttribute',
6065
})
6166
}
6267
}

0 commit comments

Comments
 (0)