Skip to content

Commit ebe03df

Browse files
Create prettier.md
1 parent 0a9b81c commit ebe03df

File tree

1 file changed

+42
-0
lines changed

1 file changed

+42
-0
lines changed

recipes/format-and-lint/prettier.md

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
# Prettier
2+
3+
JavaScript formatting with Prettier.
4+
5+
## Disable
6+
7+
Disable a line:
8+
9+
```
10+
// eslint-disable-next-line prettier/prettier
11+
```
12+
13+
14+
## Resources
15+
16+
- [Prettier](https://prettier.io/) homepage
17+
- [Configuration file](https://prettier.io/docs/en/configuration.html)
18+
- [Options](https://prettier.io/docs/en/options.html)
19+
20+
21+
## Samples
22+
23+
### Basic
24+
25+
- `.prettierrc.json`
26+
```json
27+
{
28+
"trailingComma": "all",
29+
"tabWidth": 2,
30+
"semi": true,
31+
"singleQuote": false
32+
}
33+
```
34+
- `prettier.config.js` or `.prettierrc.js`
35+
```javascript
36+
module.exports = {
37+
trailingComma: "es5",
38+
tabWidth: 4,
39+
semi: false,
40+
singleQuote: true,
41+
};
42+
```

0 commit comments

Comments
 (0)