Skip to content

estevaolucas/eslint-plugin-react-native-a11y

 
 

Repository files navigation

eslint-plugin-react-native-a11y

Eslint-plugin-react-native-a11y is a collection of React Native specific ESLint rules for identifying accessibility issues. Building upon the foundation set down by eslint-plugin-jsx-a11y, eslint-plugin-react-native-a11y detects a few of the most commonly made accessibility issues found in react native apps. These rules make it easier for your apps to be navigable by users with screen readers.

Installation

Install ESLint:

# npm
npm install eslint --save-dev

# yarn
yarn add eslint --dev

Next, install eslint-plugin-react-native-a11y:

# npm
npm install eslint-plugin-react-native-a11y --save-dev

# yarn
yarn add eslint-plugin-react-native-a11y --dev

Note: If you installed ESLint globally (using the -g flag in npm, or the global prefix in yarn) then you must also install eslint-plugin-react-native-a11y globally.

Usage

Add react-native-a11y to the plugins section of your .eslintrc configuration file.

{
  "plugins": ["react-native-a11y"]
}

Then configure the rules you want to use under the rules section.

{
  "rules": {
    "react-native-a11y/rule-name": 2
  }
}

Alternatively, you can enable all the recommended rules at once by adding plugin:react-native-a11y/recommended to the extends section of your .eslintrc configuration file:

{
  "extends": [
    "plugin:react-native-a11y/recommended"
  ]
}

Supported Rules

Creating a new rule

If you are developing new rules for this project, you can use the create-rule script to scaffold the new files.

$ ./scripts/create-rule.js my-new-rule

Attribution

This project started as a fork of eslint-plugin-jsx-a11y and a lot of the work was carried out by its contributors, to whom we owe a lot!

License

eslint-plugin-react-native-a11y is licensed under the MIT License.

About

React Native specific accessibility linting rules.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • JavaScript 100.0%