Skip to content

Commit

Permalink
add links to rule docs and modify descriptions
Browse files Browse the repository at this point in the history
  • Loading branch information
halocline committed Sep 8, 2022
1 parent 66cd44b commit 4b08058
Show file tree
Hide file tree
Showing 10 changed files with 27 additions and 29 deletions.
3 changes: 2 additions & 1 deletion lib/rules/anchor-label.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,12 @@ module.exports = {
description: 'Rule to enforce descriptive anchor label',
category: 'Best Practices',
recommended: true,
url: 'https://github.com/grommet/eslint-plugin-grommet/blob/master/docs/rules/anchor-label.md',
},
fixable: null,
messages: {
'anchor-label':
'Anchor should have a descriptive label that provides clear context about where it will navigate to.',
'Anchor should have a descriptive label providing clear context as to where it will navigate.',
},
},

Expand Down
4 changes: 2 additions & 2 deletions lib/rules/button-icon-a11ytitle.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,11 @@ module.exports = {
description: 'Rule to enforce a11yTitle on icon-only buttons',
category: 'Best Practices',
recommended: false,
url: 'https://github.com/grommet/eslint-plugin-grommet/blob/master/docs/rules/button-icon-a11ytitle.md',
},
fixable: null,
messages: {
'button-icon-a11ytitle':
'Icon-only button requires a11yTitle or aria-label that describes the action of the button.',
'button-icon-a11ytitle': `Icon-only button requires 'a11yTitle' or 'aria-label' describing the action of the button.`,
},
},

Expand Down
1 change: 1 addition & 0 deletions lib/rules/button-single-kind.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ module.exports = {
description: 'Rule to ensure Button does not have multiple kinds applied',
category: 'Best Practices',
recommended: true,
url: 'https://github.com/grommet/eslint-plugin-grommet/blob/master/docs/rules/button-single-kind.md',
},
fixable: null,
messages: {
Expand Down
5 changes: 3 additions & 2 deletions lib/rules/datatable-aria-describedby.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,12 @@ module.exports = {
description: 'Rule to enforce aria-describedby on DataTable',
category: 'Best Practices',
recommended: true,
url: 'https://github.com/grommet/eslint-plugin-grommet/blob/master/docs/rules/datatable-aria-describedby.md',
},
fixable: null,
messages: {
'datatable-aria-describedby':
'DataTable requires `aria-describedby` property that aligns with an `id` on a text element that describes the context of the DataTable.',
'datatable-aria-describedby': `DataTable requires 'aria-describedby' property. Its value should
correspond with the 'id' of a text element describing the subject of the DataTable.`,
},
},

Expand Down
4 changes: 2 additions & 2 deletions lib/rules/datatable-groupby-onmore.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,11 @@ module.exports = {
'Rule to ensure groupBy and onMore are not used together on DataTable',
category: 'Best Practices',
recommended: true,
url: 'https://github.com/grommet/eslint-plugin-grommet/blob/master/docs/rules/datatable-groupby-onmore.md',
},
fixable: null,
messages: {
'datatable-groupby-onmore':
'groupBy and onMore cannot be used together, remove one or the other.',
'datatable-groupby-onmore': `'groupBy' and 'onMore' cannot be used together, remove one.`,
},
},

Expand Down
6 changes: 4 additions & 2 deletions lib/rules/formfield-htmlfor-id.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,13 @@ module.exports = {
'Rule to enforce matching htmlFor and id on FormField and its child input, respectively',
category: 'Best Practices',
recommended: true,
url: 'https://github.com/grommet/eslint-plugin-grommet/blob/master/docs/rules/formfield-htmlfor-id.md',
},
fixable: null, // or "code" or "whitespace"
messages: {
'formfield-htmlfor-id':
'FormField requires `htmlFor` prop and its child input requires an `id` prop with matching value. This associates a FormField label with its input as is required for assistive technology.',
'formfield-htmlfor-id': `FormField requires an 'htmlFor' prop and its child
input requires an 'id' prop with matching value. This associates a label with
its input and is required for assistive technology.`,
},
},

Expand Down
18 changes: 4 additions & 14 deletions lib/rules/formfield-name.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,27 +14,17 @@ module.exports = {
description: 'Rule to enforce name on FormField and its child input',
category: 'Best Practices',
recommended: true,
url: 'https://github.com/grommet/eslint-plugin-grommet/blob/master/docs/rules/formfield-name.md',
},
fixable: null, // or "code" or "whitespace"
messages: {
'formfield-name':
'FormField requires `name` prop that matches `name` prop on its child input. Only form elements with a name attribute will have their values passed when submitting a form.',
'formfield-name': `FormField requires a 'name' prop with a value matching the
'name' prop of its child input. Only form inputs with a 'name' attribute will
have their values passed when submitting a form.`,
},
},

create: function (context) {
// variables should be defined here

//----------------------------------------------------------------------
// Helpers
//----------------------------------------------------------------------

// any helper functions should go here or else delete this section

//----------------------------------------------------------------------
// Public
//----------------------------------------------------------------------

return {
JSXElement(node) {
if (node.openingElement.name.name === 'FormField') {
Expand Down
5 changes: 3 additions & 2 deletions lib/rules/formfield-prefer-children.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,12 @@ module.exports = {
'Recommend use of children with FormField as opposed to component property',
category: 'Best Practices',
recommended: true,
url: 'https://github.com/grommet/eslint-plugin-grommet/blob/master/docs/rules/formfield-prefer-children.md',
},
fixable: null,
messages: {
'formfield-prefer-children':
'It is not recommended to use component property. Instead, implement input as a child of FormField.',
'formfield-prefer-children': `It is not recommended to use the 'component' property. Instead,
implement the input as a child of FormField.`,
},
type: 'suggestion',
},
Expand Down
5 changes: 3 additions & 2 deletions lib/rules/image-alt-text.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,12 @@ module.exports = {
description: 'enforce alt attribute on Image',
category: 'Best Practices',
recommended: true,
url: 'https://github.com/grommet/eslint-plugin-grommet/blob/master/docs/rules/image-alt-text.md',
},
fixable: null,
messages: {
'image-alt-text':
'Image requires alt text that is descriptive about what the image contains.',
'image-alt-text': `Image requires 'alt' text describing what the image depicts. Required for
assitive technologies.`,
},
},

Expand Down
5 changes: 3 additions & 2 deletions lib/rules/spinner-message.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,12 @@ module.exports = {
description: 'Rule to ensure message is applied to Spinner',
category: 'Best Practices',
recommended: true,
url: 'https://github.com/grommet/eslint-plugin-grommet/blob/master/docs/rules/spinner-message.md',
},
fixable: null,
messages: {
'spinner-message':
'Spinner requires message prop that is descriptive about what is being loaded. It will be announced by screen readers. See Spinner docs: https://v2.grommet.io/spinner#message.',
'spinner-message': `Spinner requires the 'message' prop describing what is being loaded.
The message will be announced by screen readers. See Spinner docs: https://v2.grommet.io/spinner#message.`,
},
},

Expand Down

0 comments on commit 4b08058

Please sign in to comment.