1.0.2 • Published 6 years ago
@flynns-devstation/prettier-config v1.0.2
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 prettieror
yarn add -D @flynns-devstation/prettier-config prettier- Create prettier config
// .prettierrc.js
module.exports = require('@flynns-devstation/prettier-config')- Create a
formatjob in your package.json
{
"scripts": {
"format": "prettier --write '**/*.{js,ts,md}'"
}
}- Run
npm run formatoryarn formatto prettier yourJavaScript,TypeScriptandMarkdownfiles
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.