Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 10 additions & 14 deletions docusaurus/docs/setting-up-your-editor.md
Original file line number Diff line number Diff line change
Expand Up @@ -134,25 +134,21 @@ Now we can make sure every file is formatted correctly by adding a few lines to
Add the following field to the `package.json` section:

```diff
+ "husky": {
+ "hooks": {
+ "pre-commit": "lint-staged"
+ }
+ }
"husky": {
"hooks": {
"pre-commit": "lint-staged"
}
}
```

Next we add a 'lint-staged' field to the `package.json`, for example:

```diff
"dependencies": {
// ...
},
+ "lint-staged": {
+ "src/**/*.{js,jsx,ts,tsx,json,css,scss,md}": [
+ "prettier --write"
+ ]
+ },
"scripts": {
"lint-staged": {
"src/**/*.{js,jsx,ts,tsx,json,css,scss,md}": [
"prettier --write"
]
},
```

Now, whenever you make a commit, Prettier will format the changed files automatically. You can also run `./node_modules/.bin/prettier --write "src/**/*.{js,jsx,ts,tsx,json,css,scss,md}"` to format your entire project for the first time.
Expand Down