Template style checking for GitHub's Ruby projects
- Update your
Gemfile
and runbundle install
gem "erb_lint", require: false
gem "erblint-github"
- Require the lint rules from this library. Currently, the only supported way is to add a new file in
.erb-linters/erblint-github.rb
with the line:
require "erblint-github/linters"
- Update your
erb-lint.yml
to pull in our recommended configs. This will ensure you are up-to-date with our recommendations.
---
inherit_gem:
erblint-github:
- config/accessibility.yml
- GitHub::Accessibility::AriaLabelIsWellFormatted
- GitHub::Accessibility::AvoidBothDisabledAndAriaDisabled
- GitHub::Accessibility::AvoidGenericLinkText
- GitHub::Accessibility::DisabledAttribute
- GitHub::Accessibility::NavigationHasLabel
- GitHub::Accessibility::LinkHasHref
- GitHub::Accessibility::NestedInteractiveElements
- GitHub::Accessibility::IframeHasTitle
- GitHub::Accessibility::ImageHasAlt
- GitHub::Accessibility::NoAriaHiddenOnFocusable
- GitHub::Accessibility::NoAriaLabelMisuse
- GitHub::Accessibility::NoPositiveTabIndex
- GitHub::Accessibility::NoRedundantImageAlt
- GitHub::Accessibility::NoVisuallyHiddenInteractiveElements
- GitHub::Accessibility::NoTitleAttribute
- GitHub::Accessibility::SvgHasAccessibleText
bundle install
bundle exec rake
If you use VS Code, we highly encourage ERB Linter extension to see immediate feedback in your editor.
This repo contains several accessibility-related linting rules to help surface accessibility issues that would otherwise go undetected until a later stage. Please note that due to the limitations of static code analysis, these ERB accessibility checks are NOT enough for ensuring the accessibility of your app. This shouldn't be the only tool you use to catch accessibility issues and should be supplemented with other tools that can check the runtime browser DOM output, as well as processes like accessibility design reviews, manual audits, user testing, etc.