diff --git a/.prettierrc b/.prettierrc deleted file mode 100644 index b513262..0000000 --- a/.prettierrc +++ /dev/null @@ -1,17 +0,0 @@ -{ - "useTabs": true, - "singleQuote": true, - "trailingComma": "none", - "printWidth": 100, - "plugins": [ - "prettier-plugin-svelte" - ], - "overrides": [ - { - "files": "*.svelte", - "options": { - "parser": "svelte" - } - } - ] -} diff --git a/prettier.config.mjs b/prettier.config.mjs new file mode 100644 index 0000000..f99c352 --- /dev/null +++ b/prettier.config.mjs @@ -0,0 +1,48 @@ +/** + * @see https://prettier.io/docs/en/configuration.html + * @type {import('prettier').Config} + */ +export default { + // 打印宽度 + printWidth: 80, + // 缩进空格数 + tabWidth: 2, + // 使用制表符而不是空格缩进 + useTabs: false, + // 句尾添加分号 + semi: true, + // 使用单引号 + singleQuote: true, + // 尾随逗号 + trailingComma: 'es5', + // 对象大括号内的空格 + bracketSpacing: true, + // 箭头函数参数括号 + arrowParens: 'always', + // 括号行位置 + bracketSameLine: false, + // 换行符使用 lf + endOfLine: 'lf', + // HTML 空格敏感度 + htmlWhitespaceSensitivity: 'css', + + plugins: ['prettier-plugin-svelte'], + overrides: [ + { + files: '*.svelte', + options: { + parser: 'svelte', + }, + }, + { + // 对 CSS 文件使用双引号 + files: '*.css', + options: { singleQuote: false }, + }, + { + // 对 SCSS 文件使用双引号 + files: '*.scss', + options: { singleQuote: false }, + }, + ], +};