Skip to content

Instantly share code, notes, and snippets.

@AutMaple
Created September 12, 2023 05:50
Show Gist options
  • Save AutMaple/f3810f673c60eb91e333378317b5c108 to your computer and use it in GitHub Desktop.
Save AutMaple/f3810f673c60eb91e333378317b5c108 to your computer and use it in GitHub Desktop.
[prettier] prettier 配置文件 #prettier
module.exports = {
// 指定每行代码的最大长度(默认值:80)
printWidth: 80,
// 指定每个缩进级别的空格数(默认值:2)
tabWidth: 2,
// 使用制表符而不是空格进行缩进(默认值:false)
useTabs: false,
// 在语句末尾添加分号(默认值:true)
semi: true,
// 使用单引号而不是双引号(默认值:false)
singleQuote: false,
// 在对象或数组的末尾是否使用逗号(默认值:none)
trailingComma: 'none',
// 大括号内的首尾需要空格(默认值:true)
bracketSpacing: true,
// 将 JSX 标签的闭合符号放在最后一行的末尾,而不是另起一行(默认值:false)
jsxBracketSameLine: false,
// 箭头函数的参数是否带圆括号(默认值:avoid)
arrowParens: 'avoid',
// 指定 HTML 文件的全局空白区域敏感度(默认值:css)
htmlWhitespaceSensitivity: 'css',
// 指定要使用的解析器(默认值:none)
parser: null,
// 指定要使用的解析器插件列表(默认值:[])
plugins: [],
// 指定换行符样式(默认值:'auto')
endOfLine: 'auto',
// 在文件顶部插入一个特殊的 @format 标记,指定文件使用 Prettier 进行格式化(默认值:false)
insertPragma: false,
// 在文件开头插入一个 BOM(字节顺序标记)(默认值:false)
byteOrderMark: false,
// 不要在文件开头插入或删除文件的任何注释(默认值:false)
disableLanguages: [],
// 指定需要忽略的文件路径模式(默认值:[])
ignorePath: '.prettierignore',
// 指定要使用的解析器(默认值:'babylon')
parser: 'babel',
// 指定要使用的解析器工作目录的路径(默认值:'prettier')
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment