vscode配置vue项目(eslint+standard),保存自动格式化

·  阅读 1420

vue+eslint+standard保存自动格式化

vscode插件

ESLint
standard
Prettier-Standard - JavaScript formatter
StandardJS - JavaScript Standard Style
vue
复制代码

vscode的setting.json

{
  "editor.formatOnSave": true,
  "standard.autoFixOnSave": true,
  "standard.enable": true,
}
复制代码

vue项目的.eslintrc

自动生成的文件

module.exports = {
  root: true,
  env: {
    node: true
  },
  extends: [
    'plugin:vue/essential',
    '@vue/standard'
  ],
  parserOptions: {
    parser: 'babel-eslint'
  },
  rules: {
    'no-console': process.env.NODE_ENV === 'production' ? 'warn' : 'off',
    'no-debugger': process.env.NODE_ENV === 'production' ? 'warn' : 'off'
  },
  overrides: [
    {
      files: [
        '**/__tests__/*.{j,t}s?(x)',
        '**/tests/unit/**/*.spec.{j,t}s?(x)'
      ],
      env: {
        jest: true
      }
    }
  ]
}

复制代码

自用vscode插件和用户setting配置

{
  "editor.formatOnSave": true,
  "standard.autoFixOnSave": true,
  "standard.enable": true,
  "workbench.colorTheme": "One Dark Pro",
  "workbench.iconTheme": "vscode-great-icons",
  "editor.fontSize": 16,
}
复制代码

分类:
阅读
标签:
分类:
阅读
标签: