This is my eslint configuration for React Native. I use this across all my React Native projects.
yarn add eslint prettier typescript eslint-config-react-native-gerardketuma --dev
Note: I'm using yarn
to install deps. Feel free to change commands to use npm
3+ and npx
if you like
Add to your eslint config (.eslintrc
, or eslintConfig
field in package.json
):
{
"extends": "react-native-gerardketuma"
}
Since this project lints TypeScript projects, you must have a tsconfig.json file in your root directory.
Since this package uses Prettier to format code styles, we suggest adding a prettier config file to the root directory and setting your code editor to use a prettier plugin.
{
"trailingComma": "es5",
"tabWidth": 2,
"semi": false,
"singleQuote": true
}
Set VSCode to Auto Fix ESLint errors and warnings on save:
"editor.codeActionsOnSave": {
"source.fixAll.eslint": true
}