My preferred eslint config for react native
// eslintrc
{
root: true,
extends: '@react-native-community',
}
yarn add --dev eslint prettier @react-native-commnunity/eslint-config
My preferred prettier for react native
// prettierrc
{
"printWidth": 80,
"singleQuote": true,
"trailingComma": "all",
}
My preferred editorconfig for react native
// .editorconfig
root = true
[*]
charset = utf-8
end_of_line = lf
indent_size = 2
indent_style = space
insert_final_newline = true
trim_trailing_whitespace = true
The following are the required packages for eslint and prettier
yarn add -D eslint eslint-config-prettier prettier @react-native-community/eslint-config
If typescript is present add these for eslint
yarn add -D @typescript-eslint/eslint-plugin @typescript-eslint/parser
These are well searched settings, so in future you don’t have to search it
tags: react-native , linter, formatter