This ESLint plugin provides a set of specific linting rules tailored for React Native development. It aims to enforce best practices and catch common issues in React Native codebases, such as detecting unused styles, preventing inline styles with literal values, and ensuring raw text is wrapped in `<Text>` components. The current stable version is 5.0.0. Due to the maintainer's limited time, development activity is low, with updates primarily focusing on compatibility with new ESLint versions rather than new features or active pull request reviews. Its key differentiator is its focus on React Native specific patterns, building upon the foundational approach of `eslint-plugin-react`.
npm install eslint-plugin-react-nativeVerified import paths — ran on the pinned version, not inferred.
This configuration sets up ESLint with React Native specific rules, including support for JSX, global environment variables, and custom stylesheet object names.
Be aware that the plugin might not support the latest React Native features or syntax immediately. Consider contributing or seeking alternative solutions for cutting-edge linting requirements.
Check the 'peerDependencies' of 'eslint-plugin-react-native' and install a compatible version of 'eslint'. For example, `npm install --save-dev eslint@^8` or `npm install --save-dev eslint@^9`.
Add `"parserOptions": { "ecmaFeatures": { "jsx": true } }` to your `.eslintrc` configuration.Install `npm install --save-dev eslint-plugin-react` and add `'react'` to your `plugins` array in `.eslintrc`.
Run `npm install --save-dev eslint-plugin-react-native` or `yarn add --dev eslint-plugin-react-native`.
Ensure `'react-native'` is listed in the `plugins` array in your `.eslintrc` and the rule name is correct, including the `'react-native/'` prefix.
Add `"parserOptions": { "ecmaFeatures": { "jsx": true } }` to your `.eslintrc` configuration.