Expo ESLint Plugin
raw JSON → 1.0.0 verified Sat Apr 25 auth: no javascript
A collection of ESLint rules for Expo apps, providing linting for Expo-specific APIs and best practices. Current stable version is 1.0.0. Released alongside Expo SDK updates. Key differentiators: focused on Expo ecosystem, catches common mistakes like missing expo-constants or incorrect import paths for Expo modules.
Common errors
error Could not find plugin "eslint-plugin-expo". ↓
cause Missing npm package or incorrect module resolution.
fix
Run: npm install eslint-plugin-expo --save-dev
error Error: Failed to load plugin 'expo' declared in '.eslintrc': Cannot find module 'eslint-plugin-expo' ↓
cause Plugin not installed in project's node_modules or global ESLint installation.
fix
Install locally: npm install eslint-plugin-expo@latest --save-dev
Warnings
deprecated Using require('eslint-plugin-expo') is deprecated in v1.0.0; use ESM imports instead. ↓
fix Switch to import expoPlugin from 'eslint-plugin-expo';
gotcha Flat config import path changed in v1.0.0-beta.3: use 'eslint-plugin-expo/configs/flat' not 'eslint-plugin-expo/flat'. ↓
fix Correct import: import expo from 'eslint-plugin-expo/configs/flat';
gotcha Plugin rules only work with ESLint >=8.10; older versions do not support the plugin's features. ↓
fix Upgrade ESLint to version 8.10 or higher.
Install
npm install eslint-plugin-expo yarn add eslint-plugin-expo pnpm add eslint-plugin-expo Imports
- default wrong
const expoPlugin = require('eslint-plugin-expo')correctimport expoPlugin from 'eslint-plugin-expo' - flat config (ESLint 9+) wrong
import expo from 'eslint-plugin-expo'correctimport expo from 'eslint-plugin-expo/configs/flat' - rules wrong
const { rules } = require('eslint-plugin-expo')correctimport { rules } from 'eslint-plugin-expo'
Quickstart
// .eslintrc.cjs (CommonJS)
module.exports = {
plugins: ['expo'],
extends: ['plugin:expo/recommended'],
rules: {
'expo/no-env-var-imports': 'error',
},
};
// eslint.config.js (Flat config, ESLint 9+)
import expo from 'eslint-plugin-expo/configs/flat';
export default [
...expo.configs.recommended,
{
rules: {
'expo/no-env-var-imports': 'error',
},
},
];