Angel Studios Prettier config.
If you are importing global styles, create one file that imports all of the others in the preferred order so that the order sorting plugin doesn't put them in the incorrect order.
Install:
$ npm install -D prettier @angel-studios/prettier-config @trivago/prettier-plugin-sort-imports
or
$ yarn add --dev prettier @angel-studios/prettier-config @trivago/prettier-plugin-sort-imports
Edit package.json
:
{
// ...
"prettier": "@angel-studios/prettier-config"
}
$ npm install -D eslint-config-prettier eslint-plugin-prettier
or
$ yarn add --dev eslint-config-prettier eslint-plugin-prettier
Edit eslintrc.js
:
{
// ...
"extends": [
// ...
'prettier'
],
"plugins": [
// ...
'prettier':
],
"rules": [
// ...
'prettier/prettier': 'error'
]
}
Follow the steps below to setup lint-staged / husky and enable prettier running on every commit!
https://github.com/okonet/lint-staged
Edit package.json
{
// ...
"lint-staged": {
"*.js": [
"eslint --cache --fix"
],
"*.{js,css,md}": "prettier --write"
}
}