You should install this modules:
- eslint : for eslint
- prettier : for prettier
- eslint-config-prettier : Turns off all rules that are unnecessary or might conflict with Prettier.
- eslint-plugin-prettier : Runs Prettier as an ESLint rule and reports differences as individual ESLint issues.
yarn add eslint --dev
yarn add prettier --dev
yarn add eslint-config-prettier --dev
yarn add eslint-plugin-prettier --dev
After yarn run eslint --int
, there may hints you to install several modules:
The config that you've selected requires the following dependencies:
eslint-plugin-react@^7.20.0 eslint-config-airbnb@latest eslint@^5.16.0 || ^6.8.0 || ^7.2.0 eslint-plugin-import@^2.21.2 eslint-plugin-jsx-a11y@^6.3.0 eslint-plugin-react-hooks@^4 || ^3 || ^2.3.0 || ^1.7.0
You can add them manually:
yarn add --dev eslint-plugin-react eslint-config-airbnb eslint-plugin-import eslint-plugin-jsx-a11y eslint-plugin-react-hooks
For react native project:
extends:
- airbnb
- prettier
- prettier/react
parserOptions:
ecmaFeatures:
jsx: true
rules:
react/jsx-filename-extension:
- 1
- extensions: ['.js', '.jsx']