Selaa lähdekoodia

fix: 统一prettier规范

lfeish 1 vuosi sitten
vanhempi
commit
a5a79c447c
1 muutettua tiedostoa jossa 31 lisäystä ja 0 poistoa
  1. 31 0
      prettier.config.cjs

+ 31 - 0
prettier.config.cjs

@@ -1,6 +1,7 @@
 /**
  * Prettier 配置文件
  * 用于定义代码格式化的规则
+ * 参考: https://prettier.io/docs/options
  */
 module.exports = {
   /**
@@ -9,6 +10,12 @@ module.exports = {
    */
   printWidth: 120,
 
+  /**
+   * tab 缩进大小
+   * @type {number}
+   */
+  tabWidth: 2,
+
   /**
    * 是否在语句末尾添加分号
    * @type {boolean}
@@ -50,4 +57,28 @@ module.exports = {
    * @type {string}
    */
   endOfLine: 'auto',
+
+  /**
+   * 将 > 多行 HTML(HTML、JSX、Vue、Angular)元素放在最后一行的末尾,而不是单独放在下一行(不适用于自闭合元素)
+   * @type {boolean}
+   */
+  bracketSameLine: false,
+
+  /**
+   * 对象中的空格
+   * @type {boolean}
+   */
+  bracketSpacing: true,
+
+  /**
+   * 每行单个属性单独一行
+   * @type {boolean}
+   */
+  singleAttributePerLine: false,
+
+  /**
+   * 箭头函数的参数只有一个时,是否要求周围包含括号。
+   * @type {string}
+   */
+  arrowParens: 'always',
 };