diff --git a/.prettierignore b/.prettierignore new file mode 100644 index 0000000..5492696 --- /dev/null +++ b/.prettierignore @@ -0,0 +1,15 @@ +# prettier 会忽略的文件 + +/dist/* +.local +.output.js +/node_modules/** + +**/*.svg +**/*.sh + +/public/* + +.DS_Store +*.local +*.log diff --git a/package.json b/package.json index d7e0004..3fb1655 100644 --- a/package.json +++ b/package.json @@ -17,6 +17,7 @@ "devDependencies": { "@types/node": "^17.0.25", "@vitejs/plugin-vue": "^2.3.1", + "prettier": "^2.6.2", "typescript": "^4.6.3", "unplugin-auto-import": "^0.7.1", "unplugin-vue-components": "^0.19.3", diff --git a/prettier.config.js b/prettier.config.js new file mode 100644 index 0000000..aaec6a2 --- /dev/null +++ b/prettier.config.js @@ -0,0 +1,21 @@ +/** 配置项文档:https://prettier.io/docs/en/configuration.html */ +module.exports = { + /** 每一行的宽度 */ + printWidth: 120, + /** tab 健的空格数 */ + tabWidth: 2, + /** 在对象中的括号之间用空格来间隔 */ + bracketSpacing: true, + /** 箭头函数的参数无论有几个,都要括号包裹 */ + arrowParens: 'always', + /** 换行符的使用 */ + endOfLine: 'auto', + /** 采用单引号 */ + singleQuote: true, + /** 对象或者数组的最后一个元素后面是否要加逗号 */ + trailingComma: 'all', + /** 不加分号 */ + semi: false, + /** 不使用 tab 格式化 */ + useTabs: false, +} diff --git a/src/App.vue b/src/App.vue index 084f311..1b90cf6 100644 --- a/src/App.vue +++ b/src/App.vue @@ -1,15 +1,16 @@