Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docs(readme): refine prettier examples #541

Merged
merged 1 commit into from Nov 13, 2018
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
14 changes: 10 additions & 4 deletions README.md
Expand Up @@ -199,7 +199,7 @@ Starting from [v2.0.0](https://github.com/okonet/lint-staged/releases/tag/2.0.0)

## Reformatting the code

Tools like [Prettier](https://prettier.io), ESLint/TSLint, or stylefmt can reformat your code according to an appropriate config by running `prettier --write`/`eslint --fix`/`tslint --fix`. After the code is reformatted, we want it to be added to the same commit. This can be done using following config:
Tools like [Prettier](https://prettier.io), ESLint/TSLint, or stylelint can reformat your code according to an appropriate config by running `prettier --write`/`eslint --fix`/`tslint --fix`/`stylelint --fix`. After the code is reformatted, we want it to be added to the same commit. This can be done using following config:

```json
{
Expand Down Expand Up @@ -267,17 +267,23 @@ The following is equivalent:
}
```

### Automatically fix code style with `prettier` for javascript + flow or typescript
### Automatically fix code style with `prettier` for javascript + flow, typescript, markdown or html

```json
{
"*.{js,jsx}": ["prettier --parser flow --write", "git add"]
"*.{js,jsx}": ["prettier --write", "git add"]
}
```

```json
{
"*.{ts,tsx}": ["prettier --parser typescript --write", "git add"]
"*.{ts,tsx}": ["prettier --write", "git add"]
}
```

```json
{
"*.{md,html}": ["prettier --write", "git add"]
}
```

Expand Down