department-of-veterans-affairs / va-mobile-app

"If VA were a company, it would have a flagship mobile app."
https://department-of-veterans-affairs.github.io/va-mobile-app/
10 stars 1 forks source link

Install accessibility linting, evaluate errors and warnings #4813

Open timwright12 opened 1 year ago

timwright12 commented 1 year ago

We would like to get some level of automated accessibility checks into the code. For this ticket we want to install eslint-plugin-react-native-a11y into the repo. This plugin is a fork of the very popular eslint-plugin-jsx-a11y, which has been used in React development for a long time.

To install

  1. cd VAMobile && yarn add eslint-plugin-react-native-a11y --dev
  2. Update .eslintrc.js extends object with plugin:react-native-a11y/basic
  3. Update eslintrc.js rules with 'react-native-a11y/has-accessibility-hint': 1, to change this to a "warning"
  4. run yarn lint

As of 2/15, yarn lint turns up 82 issues. Most of these issues are related to react-native-a11y/has-accessibility-hint. There appear to be places in the app where the omission of accessibilityHint is intentional (this is why we reduce this rule to a warning). There should also be at least 3 "errors".

As part of this ticket the engineer should evaluate each instance of a warning and error and make the determination if the instance needs to be fixed or excluded (if it was intended) by turning off the linting rule for that line/block of code.

Acceptance Criteria

  1. Eslint plugin is installed
  2. Linting is extended, rules are updated
  3. All linting warning and errors are cleared by either fixing or manually skipping.
timwright12 commented 1 year ago

Branch with my testing work on it: chore/add-jsx-a11y-linting

This has the linter installed and setup with errors/warnings showing in the terminal

Sparowhawk commented 4 months ago

@alexandec was this resolved on your linting updates earlier?

alexandec commented 4 months ago

@Sparowhawk nope, this ticket is specific to a11y linting which we don't currently have installed