Files
NavSiteReact/.prettierrc.cjs
2025-11-16 15:00:14 +08:00

65 lines
1.8 KiB
JavaScript
Raw Permalink 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.
// Prettier 配置文件CommonJS 写法)
// 保存文件后 Prettier 插件会自动读取并格式化项目代码
module.exports = {
// 使用的 Prettier 插件,这里启用 TailwindCSS 排序插件
plugins: ["prettier-plugin-tailwindcss"],
// 每行最大长度,超过后自动换行
printWidth: 80,
// 每个缩进层级使用的空格数
tabWidth: 2,
// 使用制表符tab而不是空格进行缩进
useTabs: true,
// 每句结尾加分号
semi: true,
// 使用单引号而不是双引号
singleQuote: true,
// 对象属性引号的使用规则:
// as-needed仅在必要时添加
// consistent同一对象中保持一致
// preserve保持原样
quoteProps: "as-needed",
// 在 JSX 中是否使用单引号
jsxSingleQuote: false,
// 多行结构时是否在末尾加逗号
// 可选值none | es5 | all
trailingComma: "es5",
// 在对象字面量中,是否在大括号之间加空格
bracketSpacing: true,
// 标签的 `>` 是否与最后一行标签同一行
bracketSameLine: false,
// 箭头函数参数是否总是加括号
// always总是加如 (x) => x
// avoid当只有一个参数时省略括号如 x => x
arrowParens: "always",
// 控制 Markdown 文本的换行策略
// preserve保持原样
// never不换行
// always超过 printWidth 自动换行
proseWrap: "preserve",
// 控制 HTML 空白敏感度
// css遵循 CSS 的 display 属性
// strict严格保留
// ignore忽略空白
htmlWhitespaceSensitivity: "css",
// 在 Vue 文件的 <script> 和 <style> 标签内是否缩进
vueIndentScriptAndStyle: false,
// 文件换行符风格
// 可选值auto | lf | crlf | cr
endOfLine: "lf",
};