spa/.prettierrc.js
2025-03-29 11:46:12 +08:00

28 lines
1.6 KiB
JavaScript
Executable File
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

module.exports = {
printWidth: 100, // 设置prettier单行输出不折行最大长度
proseWrap: 'preserve', // 使用默认的折行标准
tabWidth: 2, // 设置工具每一个水平缩进的空格数
endOfLine: 'auto', // 文件换行格式 LF/CRLF
useTabs: false, // 使用tab制表位缩进而非空格
semi: false, // 在语句末尾添加分号
singleQuote: true, // 使用单引号代替双引号
quoteProps: 'as-needed', // 对象的 key 仅在必要时用引号
trailingComma: 'es5', // 在对象或数组最后一个元素后面是否加逗号
bracketSpacing: true, // 在对象字面量声明所使用的的花括号后({)和前(})输出空格
arrowParens: 'avoid', // 为单行箭头函数的参数添加圆括号参数个数为1时可以省略圆括号
// parser: 'babylon', // Prettier 会自动从输入文件路径推断解析器
jsxBracketSameLine: true, // 在多行JSX元素最后一行的末尾添加 > 而使 > 单独一行(不适用于自闭和元素)
filepath: 'none', // 指定文件的输入路径,这将被用于解析器参照
requirePragma: false, // (v1.7.0+) Prettier可以严格按照按照文件顶部的一些特殊的注释格式化代码这些注释称为“require pragma”(必须杂注)
insertPragma: false, // (v1.8.0+) Prettier可以在文件的顶部插入一个 @format的特殊注释以表明改文件已经被Prettier格式化过了。
// 配置覆盖
overrides: [
{
files: ['*.json', '*.css', '*.less', '*.sass'],
options: {
singleQuote: false, // 使用单引号代替双引号
},
},
],
}