配置格式化换行 .prettierrc


配置格式化换行

  .prettierrc在根目录创建文件 
  .prettierrc  {   
      "printWidth": 150
     }

module.exports = {

  printWidth: 200, //行宽

  semi: true, //分号

  singleQuote: true, // 使用单引号

  useTabs: false, //使用 tab 缩进

  tabWidth: 2, //缩进

  trailingComma: 'es5', //后置逗号,多行对象、数组在最后一行增加逗号

  arrowParens: 'avoid', //箭头函数只有一个参数的时候可以忽略括号

  bracketSpacing: true, //括号内部不要出现空格

  proseWrap: 'preserve', //换行方式 默认值。因为使用了一些折行敏感型的渲染器(如GitHub comment)而按照markdown文本样式进行折行

  parser: 'babylon', //格式化的解析器,默认是babylon

  endOfLine: 'auto', // 结尾是 \n \r \n\r auto

  jsxSingleQuote: false, // 在jsx中使用单引号代替双引号

  jsxBracketSameLine: false, //在jsx中把'>' 是否单独放一行

  stylelintIntegration: false, //不让prettier使用stylelint的代码格式进行校验

  eslintIntegration: false, //不让prettier使用eslint的代码格式进行校验

  tslintIntegration: false, // 不让prettier使用tslint的代码格式进行校验

  disableLanguages: ['vue'], // 不格式化vue文件,vue文件的格式化单独设置

  htmlWhitespaceSensitivity: 'ignore',

  ignorePath: '.prettierignore', // 不使用prettier格式化的文件填写在项目的.prettierignore文件中

  requireConfig: false, // Require a 'prettierconfig' to format prettier
}


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM