{"id":13147,"library":"eslint-plugin-react-native","title":"ESLint Plugin for React Native","description":"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`.","status":"maintenance","version":"5.0.0","language":"javascript","source_language":"en","source_url":"https://github.com/intellicode/eslint-plugin-react-native","tags":["javascript","eslint","eslint-plugin","eslintplugin","react","react-native","react native"],"install":[{"cmd":"npm install eslint-plugin-react-native","lang":"bash","label":"npm"},{"cmd":"yarn add eslint-plugin-react-native","lang":"bash","label":"yarn"},{"cmd":"pnpm add eslint-plugin-react-native","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"Required peer dependency for ESLint to function.","package":"eslint","optional":false},{"reason":"Recommended for full functionality and general React best practices.","package":"eslint-plugin-react","optional":true}],"imports":[{"note":"ESLint plugins are configured via string names in your .eslintrc.* file, not imported as JavaScript modules.","wrong":"import { rules } from 'eslint-plugin-react-native'","symbol":"plugins: ['react-native']","correct":"{ \"plugins\": [\"react-native\"] }"},{"note":"The environment configuration uses a specific 'react-native/react-native' path to whitelist browser-like globals.","wrong":"\"env\": { \"react-native\": true }","symbol":"env: {'react-native/react-native': true}","correct":"{ \"env\": { \"react-native/react-native\": true } }"},{"note":"ESLint plugin rules must be prefixed with the plugin name (e.g., 'react-native/').","wrong":"{ \"rules\": { \"no-inline-styles\": 2 } }","symbol":"rules['react-native/no-inline-styles']","correct":"{ \"rules\": { \"react-native/no-inline-styles\": 2 } }"}],"quickstart":{"code":"module.exports = {\n  root: true,\n  extends: [\n    '@react-native-community'\n  ],\n  plugins: [\n    'react',\n    'react-native'\n  ],\n  parserOptions: {\n    ecmaFeatures: {\n      jsx: true\n    },\n    ecmaVersion: 2020,\n    sourceType: 'module'\n  },\n  env: {\n    'react-native/react-native': true\n  },\n  rules: {\n    'react-native/no-unused-styles': 2,\n    'react-native/split-platform-components': 2,\n    'react-native/no-inline-styles': 2,\n    'react-native/no-color-literals': 2,\n    'react-native/no-raw-text': 2,\n    'react-native/no-single-element-style-arrays': 2\n  },\n  settings: {\n    'react-native/style-sheet-object-names': ['EStyleSheet', 'OtherStyleSheet', 'PStyleSheet']\n  }\n};\n","lang":"javascript","description":"This configuration sets up ESLint with React Native specific rules, including support for JSX, global environment variables, and custom stylesheet object names."},"warnings":[{"fix":"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.","message":"This package is in maintenance mode with low development activity. New feature requests and most pull requests are not being actively reviewed or merged, focusing primarily on ESLint compatibility updates.","severity":"gotcha","affected_versions":">=3.0.0"},{"fix":"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`.","message":"ESLint peer dependency changes frequently. Ensure your installed 'eslint' version is compatible with 'eslint-plugin-react-native' as per its 'peerDependencies' in package.json to avoid runtime errors.","severity":"breaking","affected_versions":"all"},{"fix":"Add `\"parserOptions\": { \"ecmaFeatures\": { \"jsx\": true } }` to your `.eslintrc` configuration.","message":"Failure to configure 'parserOptions.ecmaFeatures.jsx' will lead to linting errors on JSX syntax in your React Native components.","severity":"gotcha","affected_versions":"all"},{"fix":"Install `npm install --save-dev eslint-plugin-react` and add `'react'` to your `plugins` array in `.eslintrc`.","message":"It is highly recommended to install and configure 'eslint-plugin-react' alongside this plugin for comprehensive React linting, as many React Native components are also React components.","severity":"gotcha","affected_versions":"all"}],"env_vars":null,"last_verified":"2026-04-19T00:00:00.000Z","next_check":"2026-07-18T00:00:00.000Z","problems":[{"fix":"Run `npm install --save-dev eslint-plugin-react-native` or `yarn add --dev eslint-plugin-react-native`.","cause":"The package 'eslint-plugin-react-native' is not installed or not resolvable.","error":"Error: Failed to load plugin 'react-native' declared in '.eslintrc.js': Cannot find module 'eslint-plugin-react-native'"},{"fix":"Ensure `'react-native'` is listed in the `plugins` array in your `.eslintrc` and the rule name is correct, including the `'react-native/'` prefix.","cause":"The plugin 'eslint-plugin-react-native' is not correctly configured or the rule name is misspelled.","error":"Definition for rule 'react-native/no-unused-styles' was not found"},{"fix":"Add `\"parserOptions\": { \"ecmaFeatures\": { \"jsx\": true } }` to your `.eslintrc` configuration.","cause":"ESLint is not configured to parse JSX syntax.","error":"Parsing error: Unexpected token <"}],"ecosystem":"npm","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null,"pypi_latest":null,"cli_name":""}