Install packages
yarn add eslint prettier eslint-{config,plugin}-prettier eslint-plugin-react --dev --exact
package.json
{
"scripts": {
"lint": "prettier \"./src/**\" && eslint ./src"
}
}
.eslintrc.json
{
"parser": "babel-eslint",
"parserOptions": {
"ecmaVersion": 8,
"sourceType": "module",
"ecmaFeatures": {
"jsx": true
}
},
"env": {
"browser": true,
"node": true,
"jest": true
},
"rules": {
"no-console": "off",
"react/prop-types": "off",
"prettier/prettier": [
"error",
{
"singleQuote": true,
"semi": true
}
],
"no-unused-vars": ["error", { "ignoreRestSiblings": true }]
},
"plugins": ["react", "prettier"],
"extends": [
"eslint:recommended",
"plugin:react/recommended",
"prettier",
"prettier/react"
]
}
With a bit more stuff: https://github.com/lipis/prettier-setup