Webstorm 格式化配置适配 Vscode

2019-11-27  本文已影响0人  代码界的小学生

我在使用webstorm做开发几年后,碰见了喜欢使用vscode的同事一起开发,但是出现了代码格式化不一致问题,这里我记录了我解决webstorm格式化适用vscode

use semicolon to terminate statement always
use double quotes always
Trailing comma Remove

我对应的eslint配置

{
  ...
  // add your custom rules here
  rules: {
    // allow async-await
    'generator-star-spacing': 'off',
    // allow debugger during development
    'no-debugger': process.env.NODE_ENV === 'production' ? 'error' : 'off',
    // script的下一行缩进2格
    // 'vue/script-indent': ['error', 0, {'baseIndent': 1, 'switchCase': 1}],
    // 允许空一行,为了阅读方便
    'no-trailing-spaces': [1, { 'skipBlankLines': true }],
    // 全等
    'eqeqeq': 0,
    // 关闭行末分号提示/报错
    'semi': 0,
    // 字符串尽可能使用双引号
    'quotes': [0, "double"],
    // 函数定义时括号前面要不要有空格
    "space-before-function-paren": [0, "always"]
  },
  overrides: [
    {
      'files': ['*.vue'],
      'rules': {
        'indent': 'off'
      }
    }
  ]
  ...
}
上一篇 下一篇

猜你喜欢

热点阅读