Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update link lint rule to skip Link with className #193

Merged
merged 2 commits into from
Jun 11, 2024

Conversation

khiga8
Copy link
Contributor

@khiga8 khiga8 commented Jun 10, 2024

Fixes: #192
Related: https://github.com/github/github/pull/328018

This PR modifies the a11y-link-in-text-block rule to avoid flagging Link in text block if it also has the className on it.

The a11y-link-in-text-block is aimed at flagging Link that do not have distinguishing styles on it, and encourages the use of the inline prop to underline the link in such scenarios.

Sometimes, the Link has a className attribute on it to style it differently with CSS classes. In such cases, the rule should skip the Link because it's possible the CSS class provides sufficient styling. However, the linter cannot actually determine whether the CSS class provides sufficient styling, so this errs on the side of caution and skips Link with className entirely to avoid false positive flags.

Reviewers

I'm open to your feedback on whether this is the right approach to take, or if there are others I'm not considering.

@khiga8 khiga8 requested a review from a team as a code owner June 10, 2024 14:03
@khiga8 khiga8 requested a review from joshblack June 10, 2024 14:03
Copy link

changeset-bot bot commented Jun 10, 2024

🦋 Changeset detected

Latest commit: 8477ca2

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
eslint-plugin-primer-react Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@khiga8 khiga8 merged commit 5fc19f6 into main Jun 11, 2024
8 checks passed
@khiga8 khiga8 deleted the kh-skip-links-with-classnames branch June 11, 2024 12:58
@primer-css primer-css mentioned this pull request Jun 11, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

a11y-link-in-text-block rule should avoid flagging Links with className
2 participants