|
1 | 1 | // .prettierrc.js |
2 | 2 | module.exports = { |
3 | | - // max 120 characters per line |
| 3 | + // 一行最多 120 字符 |
4 | 4 | printWidth: 120, |
5 | | - // use 2 spaces for indentation |
| 5 | + // 使用 2 个空格缩进 |
6 | 6 | tabWidth: 2, |
7 | | - // use spaces instead of indentations |
| 7 | + // 不使用缩进符,而使用空格 |
8 | 8 | useTabs: false, |
9 | | - // semicolon at the end of the line |
| 9 | + // 行尾需要有分号 |
10 | 10 | semi: true, |
11 | | - // use single quotes |
| 11 | + // 使用单引号 |
12 | 12 | singleQuote: true, |
13 | | - // object's key is quoted only when necessary |
| 13 | + // 对象的 key 仅在必要时用引号 |
14 | 14 | quoteProps: 'as-needed', |
15 | | - // use double quotes instead of single quotes in jsx |
| 15 | + // jsx 不使用单引号,而使用双引号 |
16 | 16 | jsxSingleQuote: false, |
17 | | - // no comma at the end |
| 17 | + // 末尾需要有逗号 |
18 | 18 | trailingComma: 'all', |
19 | | - // spaces are required at the beginning and end of the braces |
| 19 | + // 大括号内的首尾需要空格 |
20 | 20 | bracketSpacing: true, |
21 | | - // end tag of jsx need to wrap |
22 | | - jsxBracketSameLine: false, |
23 | | - // brackets are required for arrow function parameter, even when there is only one parameter |
| 21 | + // jsx 标签的反尖括号需要换行 |
| 22 | + bracketSameLine: false, |
| 23 | + // 箭头函数,只有一个参数的时候,也需要括号 |
24 | 24 | arrowParens: 'always', |
25 | | - // format the entire contents of the file |
| 25 | + // 每个文件格式化的范围是文件的全部内容 |
26 | 26 | rangeStart: 0, |
27 | 27 | rangeEnd: Infinity, |
28 | | - // no need to write the beginning @prettier of the file |
| 28 | + // 不需要写文件开头的 @prettier |
29 | 29 | requirePragma: false, |
30 | | - // No need to automatically insert @prettier at the beginning of the file |
| 30 | + // 不需要自动在文件开头插入 @prettier |
31 | 31 | insertPragma: false, |
32 | | - // use default break criteria |
| 32 | + // 使用默认的折行标准 |
33 | 33 | proseWrap: 'preserve', |
34 | | - // decide whether to break the html according to the display style |
| 34 | + // 根据显示样式决定 html 要不要折行 |
35 | 35 | htmlWhitespaceSensitivity: 'css', |
36 | | - // lf for newline |
| 36 | + // vue 文件中的 script 和 style 内不用缩进 |
| 37 | + vueIndentScriptAndStyle: false, |
| 38 | + // 换行符使用 lf |
37 | 39 | endOfLine: 'lf', |
| 40 | + // 格式化嵌入的内容 |
| 41 | + embeddedLanguageFormatting: 'auto', |
| 42 | + // html, vue, jsx 中每个属性占一行 |
| 43 | + singleAttributePerLine: false, |
38 | 44 | }; |
0 commit comments