eslint-plugin-react-native-a11y is an ESLint plugin specifically designed to identify common accessibility issues within React Native applications. It extends the principles of web accessibility linters like `eslint-plugin-jsx-a11y` by providing rules tailored to React Native's unique component structure and accessibility APIs. The plugin offers real-time feedback during development, helping teams create more inclusive and navigable experiences for users with screen readers and other assistive technologies. Currently stable at version `3.5.1`, it sees an active development pace with frequent patch and minor releases addressing bug fixes and new features. A key differentiator is its ability to offer platform-specific configurations (`basic`, `ios`, `android`, `all`) to optimize linting for projects targeting particular environments.
npm install eslint-plugin-react-native-a11yVerified import paths — ran on the pinned version, not inferred.
This quickstart demonstrates installing the plugin via npm and configuring it in a `.eslintrc.js` file to extend the `all` recommended accessibility rules for a React Native project. It also shows where to include `eslint` as a dev dependency in `package.json`.
Upgrade your Node.js environment to version 12.0 or higher. Check your project's `engines` field in `package.json` and local Node.js version.
Ensure you are using `eslint-plugin-react-native-a11y@3.5.1` or newer, which includes a specific fix for ESLint 9 compatibility regarding this rule.
Always install `eslint-plugin-react-native-a11y` as a local `devDependency` in your project using `npm install --save-dev eslint-plugin-react-native-a11y` or `yarn add eslint-plugin-react-native-a11y --dev`.
Always include the `plugin:` prefix when extending a plugin's configuration, for example, `extends: ['plugin:react-native-a11y/all']`.
Run `npm install eslint-plugin-react-native-a11y --save-dev` in your project's root directory. If ESLint is globally installed, ensure the plugin is also globally installed (though local installation is recommended).
Use `npm list eslint` or `yarn list eslint` to check for duplicate `eslint` packages. If conflicts exist, try `npm install --force` or `yarn install --force` to resolve peer dependency issues, or use `resolutions` in `package.json` for specific packages if necessary. Ensure your ESLint config aligns with your project's module type (CommonJS or ESM).
Double-check the rule name for typos and consult the official documentation for the `eslint-plugin-react-native-a11y` rules to ensure valid options and syntax are used in your `.eslintrc.js` file. For instance, `has-accessibility-props` accepts an array of `touchableComponents`.