Back to Expo

eslint-plugin-expo

packages/eslint-plugin-expo/README.md

latest1.5 KB
Original Source

eslint-plugin-expo

ESLint rules for Expo apps

Installation

You'll first need to install ESLint:

sh
npx expo install eslint --save-dev

Next, install eslint-plugin-expo:

sh
npx expo install eslint-plugin-expo --save-dev

Usage

Add expo to the plugins section of your .eslintrc configuration file. You can omit the eslint-plugin- prefix:

json
{
  "plugins": [
    "expo"
  ]
}

Then configure the rules you want to use under the rules section.

json
{
  "rules": {
    "expo/no-env-var-destructuring": "error",
    "expo/no-dynamic-env-var": "error",
    "expo/use-dom-exports": "error",
    "expo/prefer-box-shadow": "warn",
  }
}

Rules

NameDescription
no-dynamic-env-varPrevents process.env from being accessed dynamically
no-env-var-destructuringDisallow destructuring of environment variables
use-dom-exportsEnforce using DOM exports from react-native-web
prefer-box-shadowSuggest using box-shadow instead of shadowColor/shadowOffset/shadowOpacity/shadowRadius