module.exports = { // 基本设置 printWidth: 100, tabWidth: 2, useTabs: false, semi: false, singleQuote: true, quoteProps: 'as-needed', // 对象和数组格式 trailingComma: 'none', bracketSpacing: true, bracketSameLine: false, arrowParens: 'avoid', // Vue 文件格式 vueIndentScriptAndStyle: false, // HTML 文件格式 htmlWhitespaceSensitivity: 'css', // 嵌入语言格式 embeddedLanguageFormatting: 'auto', // 换行符 endOfLine: 'lf', // 忽略某些文件的格式化 ignorePath: '.prettierignore', // 重写某些文件的规则 overrides: [ { files: '*.json', options: { parser: 'json-stringify' } }, { files: '*.md', options: { parser: 'markdown', printWidth: 80, proseWrap: 'preserve' } }, { files: '*.yml', options: { parser: 'yaml' } } ] }