1. 程式人生 > 實用技巧 >vscode 的 prettier的配置項-筆記

vscode 的 prettier的配置項-筆記

{
  "printWidth": 100, // 超過最大值換行 
    "overrides": [
        {
            "files": ".prettierrc",
            "options": { "parser": "json" }
        }
    ],
  "tabWidth": 4, // 縮排位元組數 
  "useTabs": false, // 縮排不使用tab,使用空格 
  "semi": true, // 句尾新增分號 
  "singleQuote": true, // 使用單引號代替雙引號 
  "proseWrap": "preserve", // 預設值。因為使用了一些折行敏感型的渲染器(如GitHub comment)而按照markdown文字樣式進行折行 
  "arrowParens": "avoid", // (x) => {} 箭頭函式引數只有一個時是否要有小括號。avoid:省略括號 
  "bracketSpacing": true, // 在物件,陣列括號與文字之間加空格 "{ foo: bar }" 
  "disableLanguages": ["vue"], // 不格式化vue檔案,vue檔案的格式化單獨設定 
  "endOfLine": "auto", // 結尾是 \n \r \n\r auto
  "eslintIntegration": false, //不讓prettier使用eslint的程式碼格式進行校驗 
  "htmlWhitespaceSensitivity": "ignore",
  "ignorePath": ".prettierignore", // 不使用prettier格式化的檔案填寫在專案的.prettierignore檔案中  
  "jsxBracketSameLine": false, // 在jsx中把'>' 是否單獨放一行
  "jsxSingleQuote": false, // 在jsx中使用單引號代替雙引號  "prettier.parser": "babylon", // 格式化的解析器,預設是babylon
  "requireConfig": false, // Require a 'prettierconfig' to format prettier  
  "stylelintIntegration": false, //不讓prettier使用stylelint的程式碼格式進行校驗  
  "trailingComma": "es5", // 在物件或陣列最後一個元素後面是否加逗號(在ES5中加尾逗號)
  "prettier.tslintIntegration": false // 不讓prettier使用tslint的程式碼格式進行校驗
}