Update a11y-link-in-text-block
rule to include HTML anchor elements
#344
Labels
a11y-link-in-text-block
rule to include HTML anchor elements
#344
We currently have an ESLint rule named
a11y-link-in-text-block
. This rule suggests usage of theinline
prop if the link is within a text block, as suggested ina11y-link-text-block.md
. We should add onto this rule by also looking at HTML anchor elements (e.g.<a href>
) in a similar fashion to how we currently do it in the rule. Instead of suggesting theinline
prop, we should suggest conversion of HTML links toLink
components that exist withinprimer/react
.For HTML anchor elements, we should suggest in the ESLint message that it is suggested to utilize the
Link
component that we provide in PRC. The autofix should replace the anchor element with theLink
component, and keep everything else, such as attributes and text content.src/rules/a11y-link-in-text-block.js
to introduce a new check for HTML anchor elementsLink
component, but instead suggest usage of theLink
component and include an autofix which will replace the anchor element with theLink
componentdocs/rules/a11y-link-in-text-block.md
with the new addition. The update to the docs should include examples of incorrect usage and correct usage, following the theme of the existing content within that file.src/rules/a11y-link-in-text-block.js
which should test the new change, and ensure that the anchor element is correctly replaced with theLink
componentnpm test
to ensure that there are no failures related to the changes addedIn summary, the change should ideally be lightweight and follow the themes that already exist.
The text was updated successfully, but these errors were encountered: