eslint-config-react-native
raw JSON → 4.1.0 verified Sat Apr 25 auth: no javascript
Pluggable ESLint config for React Native that you can import, extend and override. Version 4.1.0 (latest). Provides a biased, opinionated set of lint rules focused on safety checks and best practices for React Native projects, with a bias toward code concision. Extends eslint-config-esnext and includes React, JSX, and React Native specific rules from eslint-plugin-react and eslint-plugin-react-native. It enables browser environment, JSX parsing, and recommended rules like display-name, prop-types, and no-unused-styles. Released with semver, maintained by kunalgolani.
Common errors
error ESLint couldn't find the config "react-native". ↓
cause The config package is not installed or not in node_modules
fix
npm install --save-dev eslint-config-react-native
error Failed to load plugin 'react' declared in 'eslint-config-react-native': Cannot find module 'eslint-plugin-react' ↓
cause Missing required plugin (eslint-plugin-react) as a dependency
fix
npm install --save-dev eslint-plugin-react
Warnings
deprecated eslint-config-react-native depends on eslint-config-esnext which may use outdated rules ↓
fix Consider overriding individual rules or migrating to modern alternatives like eslint-config-airbnb or @react-native/eslint-config
gotcha Config enables 'browser: true' which may be inappropriate for React Native environment ↓
fix Override env in your own config: env: { browser: false }
breaking Version 3.x to 4.x changed peer dependency eslint range from ^2.0.0 to ^6.0.0 ↓
fix Update eslint to ^6.0.0
Install
npm install eslint-config-react-native yarn add eslint-config-react-native pnpm add eslint-config-react-native Imports
- config
extends: ['react-native']
Quickstart
npm install --save-dev eslint-config-react-native eslint
# Create .eslintrc.js:
module.exports = {
extends: ['react-native'],
rules: {
'react-native/no-unused-styles': 'error',
},
};
# Run ESLint:
npx eslint src/