@flynns-devstation/prettier-config

1.0.2 • Public • Published

prettier-config

npm CircleCI

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

  1. Install config and peerDependencies
npm i -D @flynns-devstation/prettier-config prettier

or

yarn add -D @flynns-devstation/prettier-config prettier
  1. Create prettier config
// .prettierrc.js
module.exports = require('@flynns-devstation/prettier-config')
  1. Create a format job in your package.json
{
  "scripts": {
    "format": "prettier --write '**/*.{js,ts,md}'"
  }
}
  1. Run npm run format or yarn format to prettier your JavaScript, TypeScript and Markdown files

As commit hook

  1. Install config, peerDependencies and devDependencies for commit hook
yarn add -D @flynns-devstation/prettier-config prettier husky lint-staged
  1. Create prettier config
// .prettierrc.js
module.exports = require('@flynns-devstation/prettier-config')
  1. 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"
  }
}
  1. Now on every commit the files will be automatically beatified with prettier

Contributing

  1. Fork it
  2. Create your feature branch
  3. Commit your changes
  4. Push to the branch
  5. Create new Pull Request

LICENSE

Copyright (c) 2019-present. See License for details.

Readme

Keywords

Package Sidebar

Install

npm i @flynns-devstation/prettier-config

Weekly Downloads

5

Version

1.0.2

License

MIT

Unpacked Size

4.62 kB

Total Files

8

Last publish

Collaborators

  • chrishelgert