在根目录创建.prettierrc文件
{
"//": "https://prettier.io/docs/en/options.html#prose-wrap",
"_comment0": "trailingComma:在多行逗号分隔的句法结构中尽可能打印尾随逗号,默认es5,'es5'- 在 ES5 中有效的尾随逗号(对象、数组等)。TypeScript 中的类型参数中没有尾随逗号。'none'- 没有尾随逗号。'all'- 尽可能使用尾随逗号",
"trailingComma": "none",
"_comment1": "printWidth:一行长度,默认80",
"printWidth": 120,
"_comment2": "tabWidth:缩进级别的空格数,默认2",
"tabWidth": 2,
"_comment3": "semi:在语句的末尾打印分号,默认true",
"semi": false,
"_comment4": "singleQuote:使用单引号而不是双引号,默认false",
"singleQuote": true,
"_comment5": "bracketSameLine:将>多行 HTML(HTML、JSX、Vue、Angular)元素放在最后一行的末尾,而不是单独放在下一行,默认false",
"bracketSameLine": true,
"_comment6": "useTabs:使用制表符而不是空格缩进行,默认false",
"useTabs": false,
"_comment7": "quoteProps:引用对象中的属性时更改,默认'as-needed'",
"quoteProps": "as-needed",
"_comment8": "jsxSingleQuote:在 JSX 中使用单引号而不是双引号,默认false",
"jsxSingleQuote": true,
"_comment9": "bracketSpacing:在语句的末尾打印分号,默认true",
"bracketSpacing": true,
"_comment10": "arrowParens:引用对象中的属性时更改,默认'always','always'- 始终包括括号。例子:(x) => x'avoid'- 尽可能省略括号。例子:x => x",
"arrowParens": "always",
"_comment11": "endOfLine:文本文件中的行尾风格,默认'lf','lf'– 仅换行 ( \n),常见于 Linux 和 macOS 以及 git repos 内部'crlf'- 回车 + 换行字符 ( \r\n),常见于 Windows",
"endOfLine": "lf"
}