From 4b080585b94568f8d8247ebbddfe4d6cabad0256 Mon Sep 17 00:00:00 2001 From: Matt Glissmann Date: Thu, 8 Sep 2022 17:22:09 -0600 Subject: [PATCH] add links to rule docs and modify descriptions --- lib/rules/anchor-label.js | 3 ++- lib/rules/button-icon-a11ytitle.js | 4 ++-- lib/rules/button-single-kind.js | 1 + lib/rules/datatable-aria-describedby.js | 5 +++-- lib/rules/datatable-groupby-onmore.js | 4 ++-- lib/rules/formfield-htmlfor-id.js | 6 ++++-- lib/rules/formfield-name.js | 18 ++++-------------- lib/rules/formfield-prefer-children.js | 5 +++-- lib/rules/image-alt-text.js | 5 +++-- lib/rules/spinner-message.js | 5 +++-- 10 files changed, 27 insertions(+), 29 deletions(-) diff --git a/lib/rules/anchor-label.js b/lib/rules/anchor-label.js index 23aa461..b09775d 100644 --- a/lib/rules/anchor-label.js +++ b/lib/rules/anchor-label.js @@ -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.', }, }, diff --git a/lib/rules/button-icon-a11ytitle.js b/lib/rules/button-icon-a11ytitle.js index f15960f..4c952c7 100644 --- a/lib/rules/button-icon-a11ytitle.js +++ b/lib/rules/button-icon-a11ytitle.js @@ -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.`, }, }, diff --git a/lib/rules/button-single-kind.js b/lib/rules/button-single-kind.js index 4c11425..760eb02 100644 --- a/lib/rules/button-single-kind.js +++ b/lib/rules/button-single-kind.js @@ -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: { diff --git a/lib/rules/datatable-aria-describedby.js b/lib/rules/datatable-aria-describedby.js index 8ff2ae9..8a55054 100644 --- a/lib/rules/datatable-aria-describedby.js +++ b/lib/rules/datatable-aria-describedby.js @@ -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.`, }, }, diff --git a/lib/rules/datatable-groupby-onmore.js b/lib/rules/datatable-groupby-onmore.js index 1ec4b0b..8bf66eb 100644 --- a/lib/rules/datatable-groupby-onmore.js +++ b/lib/rules/datatable-groupby-onmore.js @@ -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.`, }, }, diff --git a/lib/rules/formfield-htmlfor-id.js b/lib/rules/formfield-htmlfor-id.js index a42aee0..f02a581 100644 --- a/lib/rules/formfield-htmlfor-id.js +++ b/lib/rules/formfield-htmlfor-id.js @@ -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.`, }, }, diff --git a/lib/rules/formfield-name.js b/lib/rules/formfield-name.js index a11679e..dbf53fe 100644 --- a/lib/rules/formfield-name.js +++ b/lib/rules/formfield-name.js @@ -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') { diff --git a/lib/rules/formfield-prefer-children.js b/lib/rules/formfield-prefer-children.js index af42682..3db7947 100644 --- a/lib/rules/formfield-prefer-children.js +++ b/lib/rules/formfield-prefer-children.js @@ -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', }, diff --git a/lib/rules/image-alt-text.js b/lib/rules/image-alt-text.js index 511f1af..44a2690 100644 --- a/lib/rules/image-alt-text.js +++ b/lib/rules/image-alt-text.js @@ -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.`, }, }, diff --git a/lib/rules/spinner-message.js b/lib/rules/spinner-message.js index d5c6296..480596d 100644 --- a/lib/rules/spinner-message.js +++ b/lib/rules/spinner-message.js @@ -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.`, }, },