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

Add lint rule against .tooltipped and introduce accessibility.yml config #2086

Merged
merged 16 commits into from
Jun 22, 2023

Conversation

khiga8
Copy link
Contributor

@khiga8 khiga8 commented Jun 20, 2023

What are you trying to accomplish?

I started this rule in dotcom, but then I realized that PVC might make more sense so this rule can be shared across many projects.

This PR:

  • Introduce a lint rule against .tooltipped in favor of alternatives, or the more recent tooltip.
  • Started a accessibility.yml which will allow consumers to easily pull in recommended accessibility linting configurations which we can count against the scorecard. This will specifically contain rules that count towards the accessibility scorecard.
  • I moved helpers out of base_linter.rb to a helpers module. BaseLinter seems to come with a lot of additional things this rule doesn't need, but I need to use these helpers.

I think consumers can now add the following in their .erb-lint.yml to automatically pull in rules:

inherit_gem:
  primer_view_components:
    - primer/view_components/linters/accessibility.yml

Integration

No

List the issues that this change affects.

Closes https://github.com/github/accessibility/issues/3704

Risk Assessment

  • Low risk the change is small, highly observable, and easily rolled back.
  • Medium risk changes that are isolated, reduced in scope or could impact few users. The change will not impact library availability.
  • High risk changes are those that could impact customers and SLOs, low or no test coverage, low observability, or slow to rollback.

What approach did you choose and why?

  • I introduced a accessibility.yml config so consumers can easily configure recommended rules.
  • I namespaced the rule as Primer::Accessibility.

Anything you want to highlight for special attention from reviewers?

I namespaced the rule Primer::Accessibility:: to align with what we do in erblint-github.

The pro of this is that it can help to identify where a rule originates from. The con, is that the disable comment is kind of long (e.g. `erblint:disable Primer::Accessibility::TooltipHasMigration).

This also isn't consistent with the other rules living in PVC. What do you think? @primer/rails-reviewers?? 📣

I would also like to add docs for this rule but I'm not sure where it belongs, also given the doc migration work. What do you think? 📣

Merge checklist

  • Added/updated tests
  • Added/updated documentation
  • Added/updated previews (Lookbook)
  • Tested in Chrome
  • Tested in Firefox
  • Tested in Safari
  • Tested in Edge

Take a look at the What we look for in reviews section of the contributing guidelines for more information on how we review PRs.

@khiga8 khiga8 requested review from a team and camertron June 20, 2023 18:45
@changeset-bot
Copy link

changeset-bot bot commented Jun 20, 2023

🦋 Changeset detected

Latest commit: 073b0cf

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

This PR includes changesets to release 1 package
Name Type
@primer/view-components Minor

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 temporarily deployed to preview June 20, 2023 18:47 — with GitHub Actions Inactive
@khiga8 khiga8 temporarily deployed to github-pages June 20, 2023 18:54 — with GitHub Actions Inactive
Copy link
Contributor

@camertron camertron left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks good to me 👍 Have you tested that it works without choking in dotcom?

Also, could you add a changeset?

@khiga8
Copy link
Contributor Author

khiga8 commented Jun 20, 2023

This looks good to me 👍 Have you tested that it works without choking in dotcom?

I'll give it a try! And also fix the tests, which are breaking for some reason :(

@khiga8 khiga8 temporarily deployed to github-pages June 22, 2023 14:20 — with GitHub Actions Inactive
@khiga8 khiga8 temporarily deployed to preview June 22, 2023 14:29 — with GitHub Actions Inactive
@khiga8 khiga8 temporarily deployed to github-pages June 22, 2023 14:33 — with GitHub Actions Inactive
@khiga8 khiga8 marked this pull request as draft June 22, 2023 14:34
@khiga8 khiga8 temporarily deployed to preview June 22, 2023 15:20 — with GitHub Actions Inactive
@khiga8 khiga8 temporarily deployed to github-pages June 22, 2023 15:25 — with GitHub Actions Inactive
@khiga8
Copy link
Contributor Author

khiga8 commented Jun 22, 2023

Have you tested that it works without choking in dotcom?

@camertron I started a test branch using the vendor script and pointing to this commit in dotcom. I updated the .erb-lint.yml config and got this rule running, and tried inserting inline disables. 💪

The one unexpected thing was the path which I had to set to get this config to work: Related commit. I did not expect to need to prefix the path to the config with lib. I didn't need to do that with erblint-github. I wonder why? It's not a blocker though.

@khiga8
Copy link
Contributor Author

khiga8 commented Jun 22, 2023

Since this was last reviewed, I made these updates @primer/rails-reviewers:

Your input is appreciated here:

Thank you so much 🙏.

@khiga8 khiga8 marked this pull request as ready for review June 22, 2023 15:45
Copy link
Member

@jonrohan jonrohan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good including the :: prefix 👍🏻

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants