Prettier
$ yarn add -D eslint
$ yarn add -D prettier eslint-config-prettier eslint-plugin-prettier
.prettierrc
{
"printWidth": 120,
"tabWidth": 2,
"semi": true,
"singleQuote": true,
"bracketSpacing": true,
"arrowParens": "always"
}
**“arrowParens”: “always” If you need to always use brackets for function with single argument (x) **
.prettierignore
node_modules
*.test.js
*.spec.js
package.json
"eslintConfig": {
"parserOptions": {
"ecmaVersion": 6
},
"extends": [
"eslint:recommented",
"plugin:prettier/recommended"
],
"plugins": [
"prettier"
],
"env": {
"node": true,
"es6": true,
"jest": true
},
"rules": {
"eqeqeq": "warn",
"prettier/prettier": "warn"
}
}
"scripts": {
"format": "prettier --write src/**/*.{js,html}",
"format:check": "prettier --list-different src/**/*.{js,html}",
"lint": "eslint . --fix"
}