yarn add --dev eslint babel-eslint eslint eslint-plugin-react eslint-plugin-react-native
Copy the .eslintrc
to project folder
{ | |
"parser": "babel-eslint", | |
"env": { | |
"browser": true | |
}, | |
"plugins": [ | |
"react", | |
"react-native" | |
], | |
"ecmaFeatures": { | |
"jsx": true | |
}, | |
"extends": [ | |
"eslint:recommended", | |
"plugin:react/recommended" | |
], | |
"rules": { | |
"react/display-name": 0, | |
"react-native/split-platform-components": 2, | |
"react/no-did-mount-set-state": 2, | |
"react/no-did-update-set-state": 2, | |
"react/no-direct-mutation-state": 2, | |
"react/jsx-uses-vars": 2, | |
"no-unused-vars": [ | |
"error", | |
{ | |
"varsIgnorePattern": "React" | |
} | |
], | |
"comma-spacing": [ | |
"error", | |
{ | |
"before": false, | |
"after": true | |
} | |
], | |
"no-undef": 2, | |
"semi": 2, | |
"react/jsx-no-bind": 2, | |
"react/jsx-no-duplicate-props": 2, | |
"space-before-blocks": 2, | |
"space-in-parens": 2, | |
"space-infix-ops": 2, | |
"space-unary-ops": 2, | |
"spaced-comment": 2, | |
"rest-spread-spacing": 2, | |
"semi-spacing": 2, | |
"no-unneeded-ternary": 2, | |
"eqeqeq": 2, | |
"dot-location": 2, | |
"no-extra-bind": 2, | |
"keyword-spacing": 2, | |
"key-spacing": 2, | |
"indent": [ | |
"error", | |
2 | |
], | |
"react/jsx-indent": [ | |
2, | |
2 | |
], | |
"func-call-spacing": 2, | |
"array-bracket-spacing": 2, | |
"block-spacing": 2, | |
"brace-style": 2, | |
"arrow-body-style": 2, | |
"arrow-parens": 2, | |
"arrow-spacing": 2, | |
"react/self-closing-comp": 2, | |
"jsx-quotes": [ | |
"error", | |
"prefer-single" | |
], | |
"quotes": [ | |
"error", | |
"single" | |
], | |
"no-console": 2, | |
"react/prop-types": [ | |
"error", | |
{ | |
"ignore": [ | |
"navigation" | |
] | |
} | |
] | |
}, | |
"globals": { | |
"GLOBAL": false, | |
"it": false, | |
"xit": false, | |
"expect": false, | |
"describe": false, | |
"jest": false, | |
"require": false, | |
"module": false, | |
"Promise": false, | |
"beforeAll": false, | |
"beforeEach": true | |
} | |
} |