.prettierrc配置

114 阅读1分钟
{
  "printWidth": 500, // 超过最大值换行
  "tabWidth": 2, // 缩进字节数
  "useTabs": true, // 缩进使用tab  false使用空格
  "semi": true, // 句尾添加分号
  "singleQuote": true, // // 使用单引号代替双引号
  "quoteProps": "as-needed", // 
  "trailingComma": "es5", // 在对象或数组最后一个元素后面是否加逗号(在ES5中加尾逗号)
  "jsxSingleQuote": true, // 在jsx中使用单引号代替双引号
  "jsxBracketSameLine": false, // 在jsx中把'>' 是否单独放一行
  "bracketSpacing": true, // 在对象,数组括号与文字之间加空格 "{ foo: bar }"
  "arrowParens": "avoid", //  (x) => {} 箭头函数参数只有一个时是否要有小括号。avoid:省略括号
  "insertPragma": false,
  "disableLanguages": [
    "vue"
  ], // 不格式化vue文件,vue文件的格式化单独设置
  "proseWrap": "preserve", // 默认值。因为使用了一些折行敏感型的渲染器(如GitHub comment)而按照markdown文本样式进行折行
  "endOfLine": "auto", // 结尾是 \n \r \n\r auto
  "htmlWhitespaceSensitivity": "css",
  "endOfLine": "lf",
  "format": {
    "defaultFormatter": {
      "html": "js-beautify-html",
      "js": "prettier"
    },
    "defaultFormatterOptions": {
      "js-beautify-html": {
        "wrap_attributes": "auto",
        "wrap_line_length": 100,
        "end_with_newline": false,
        "semi": true,
        "singleQuote": true
      },
      "prettier": {
        "semi": true,
        "singleQuote": true
      }
    }
  }
}

粘贴进去把注释删掉