eslint-plugin-react-native-globals is a lightweight ESLint plugin designed to provide an environment that acknowledges common React Native global variables and APIs. Its primary purpose is to prevent `no-undef` errors for built-in React Native globals (like `__DEV__`, `__dirname`, `__filename`, `process`, `global`, `console`, `setTimeout`, `setInterval`, etc.) without needing to disable the `no-undef` rule entirely. This allows developers to maintain strict linting for undefined variables while working with the React Native specific global scope. The package is currently at version `0.1.2`, with its last significant update occurring in 2019. Due to its age and lack of recent updates, it can be considered abandoned or in indefinite maintenance mode, with no predictable release cadence. Newer React Native versions might introduce globals not covered by this plugin.
npm install eslint-plugin-react-native-globalsVerified import paths — ran on the pinned version, not inferred.
This configuration snippet shows how to integrate the plugin into your `.eslintrc` file.
Consider migrating to `eslint-plugin-react-native` (which has its own global environment), manually declaring globals in your ESLint config, or using more modern ESLint alternatives like `globals` package with specific React Native definitions.
Ensure both ESLint and its plugins are installed locally in your project for consistent behavior: `yarn add --dev eslint eslint-plugin-react-native-globals` or `npm install --save-dev eslint eslint-plugin-react-native-globals`.
For comprehensive React Native linting, install and configure `eslint-plugin-react-native` alongside this plugin (if you still choose to use it), or as a complete replacement for global definitions.
Run `npm install --save-dev eslint-plugin-react-native-globals` or `yarn add --dev eslint-plugin-react-native-globals` in your project's root directory. If ESLint is installed globally, install the plugin globally too.
Ensure your `.eslintrc` file contains `"plugins": ["react-native-globals"]` and `"env": {"react-native-globals/all": true}` as shown in the quickstart, with correct casing and spelling.