5.3.0 • Published 3 months ago

@checkdigit/prettier-config v5.3.0

Weekly downloads
50
License
MIT
Repository
github
Last release
3 months ago

MIT License

prettier-config

Check Digit Prettier configuration

Usage

Install

$ npm add -D -E @checkdigit/prettier-config

Important note from Prettier installation documentation:

Install an exact version of Prettier locally in your project. This makes sure that everyone in the project gets the exact same version of Prettier. Even a patch release of Prettier can result in slightly different formatting, so you wouldn’t want different team members using different versions and formatting each other’s changes back and forth.

To make this easier, just install @checkdigit/prettier-config as above, it will be locked to a specific version of prettier which will automatically be installed via its peerDependencies. Do not specific prettier itself as a dependency.

Edit package.json

{
  // ...
  "prettier": "@checkdigit/prettier-config"
  // ...
  scripts: {
    // ...
    "prettier": "prettier --ignore-path .gitignore --list-different .",
    "prettier:fix": "prettier --ignore-path .gitignore --write .",
    // ...
    "test": "... && npm run prettier"
    // ...
  }
}

In addition to running tests and linting, prettier should also be used by npm test to validate formatting.

If there are issues, npm run prettier:fix will re-format the entire project to the required style.

Note: using .gitignore as the ignore path will ensure that Prettier will ignore files that are ignored by Git. In most cases this is the desired behavior, otherwise you can use a custom .pretterignore file.

Add .prettierignore file (optional)

If you have generated TypeScript files you can have Prettier ignore them by creating a .prettierignore file like so:

src/api/*/swagger.ts

WebStorm

WebStorm supports Prettier, turn on within the preferences at: Languages and Frameworks | JavaScript | Prettier.

You can use ⌥⇧⌘P to format a block with Prettier. WebStorm should also ask if you want to apply Prettier code style rules across the project. (say yes)

License

MIT

5.3.0

3 months ago

5.3.0-PR.35-8e49

3 months ago

5.2.0

4 months ago

5.2.0-PR.33-3a7f

4 months ago

5.1.0

4 months ago

5.1.0-PR.31-ff8b

5 months ago

5.0.0

6 months ago

4.1.0-PR.27-ccb7

8 months ago

4.0.0-PR.23-8274

10 months ago

4.0.1-PR.25-bea0

9 months ago

4.1.0

8 months ago

4.0.1

9 months ago

4.0.0

10 months ago

5.0.0-PR.29-ad02

6 months ago

5.0.0-PR.29-33c7

6 months ago

4.0.0-PR.23-11e4

11 months ago

4.0.0-PR.23-9357

11 months ago

3.4.0-PR.23-1c2b

11 months ago

4.0.0-PR.23-629d

11 months ago

3.4.0

1 year ago

3.3.0

1 year ago

3.2.0

1 year ago

3.1.0

1 year ago

3.0.0

2 years ago

2.1.0

2 years ago

2.0.1

2 years ago

1.0.2

3 years ago

1.0.1

4 years ago

1.0.0

5 years ago