yuheng/.prettier.config.cjs
2025-03-19 15:54:28 +08:00

30 lines
883 B
JavaScript
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.

// 转换为 CommonJS 格式(重要!)
module.exports = {
printWidth: 100, // 最大行宽
semi: true, // 强制分号
singleQuote: true, // 使用单引号
trailingComma: 'all', // 自动尾逗号
tabWidth: 4, // 缩进空格数
// 新增常用配置
arrowParens: 'avoid', // 箭头函数单参数省略括号
bracketSpacing: true, // 对象花括号空格 { key: value }
endOfLine: 'auto', // 自动识别换行符
jsxBracketSameLine: false, // JSX 闭合标签换行React 项目适用)
// 文件类型覆盖规则
overrides: [
{
files: '*.md',
options: {
proseWrap: 'always' // Markdown 自动换行
}
},
{
files: '*.json',
options: {
tabWidth: 4 // JSON 使用 2 空格缩进
}
}
]
}; // 移除结尾分号保持风格统一