prettier-config
This package provides Flynns Devstation's .prettierrc as an extensible shared config.
Features
- Trailing comma for
es5
- No semicolon
- Single quotes
Usage
As npm script
- Install config and peerDependencies
npm i -D @flynns-devstation/prettier-config prettier
or
yarn add -D @flynns-devstation/prettier-config prettier
- Create prettier config
// .prettierrc.js
module.exports = require('@flynns-devstation/prettier-config')
- Create a
format
job in your package.json
{
"scripts": {
"format": "prettier --write '**/*.{js,ts,md}'"
}
}
- Run
npm run format
oryarn format
to prettier yourJavaScript
,TypeScript
andMarkdown
files
As commit hook
- Install config, peerDependencies and devDependencies for commit hook
yarn add -D @flynns-devstation/prettier-config prettier husky lint-staged
- Create prettier config
// .prettierrc.js
module.exports = require('@flynns-devstation/prettier-config')
- Create the commit hook in
package.json
{
"husky": {
"hooks": {
"pre-commit": "lint-staged"
}
},
"lint-staged": {
"*{gql,js,jsx,json,md,ts,tsx,yml}": "prettier --write"
}
}
- Now on every commit the files will be automatically beatified with
prettier
Contributing
- Fork it
- Create your feature branch
- Commit your changes
- Push to the branch
- Create new Pull Request
LICENSE
Copyright (c) 2019-present. See License for details.