Skip to content

Commit 3dc1622

Browse files
Update prettier.md
1 parent 592e0e8 commit 3dc1622

File tree

1 file changed

+27
-0
lines changed

1 file changed

+27
-0
lines changed

recipes/javascript/format-and-lint/prettier.md

+27
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,18 @@
11
# Prettier
22

3+
I would recommend setting up and use ESLint first as it can handle style things like quotes, semicolons and indentation and also semantic things like imports, unused variables and and syntax issues.
4+
5+
If you are not satisfied with ESLint, then you can add Prettier on top. This can help with formatting but not linting. Also maybe not want to add Prettier because it can conflict with ESLint and then you have to configure them both to use the same settings.
6+
37

48
## Samples
59

610
### Basic
711

12+
Copied from the docs.
13+
14+
You can use a JSON or JS file. Setting up a config file in JSON is best practice on general as it is not code like a JS file is.
15+
816
- `.prettierrc.json`
917
```json
1018
{
@@ -24,6 +32,25 @@
2432
};
2533
```
2634

35+
### More
36+
37+
I found this in use on a project and copied it.
38+
39+
- `.prettierrc.json`
40+
41+
```json
42+
{
43+
"printWidth": 80,
44+
"tabWidth": 2,
45+
"useTabs": false,
46+
"semi": false,
47+
"singleQuote": true,
48+
"trailingComma": "none",
49+
"bracketSpacing": false,
50+
"jsxBracketSameLine": false
51+
}
52+
```
53+
2754

2855
## VS Code notes
2956

0 commit comments

Comments
 (0)