Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/webpack/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript 如何在使用vue cli完成初始化后添加linter?_Javascript_Webpack_Vue.js - Fatal编程技术网

Javascript 如何在使用vue cli完成初始化后添加linter?

Javascript 如何在使用vue cli完成初始化后添加linter?,javascript,webpack,vue.js,Javascript,Webpack,Vue.js,我第一次使用vue cli初始化网页包模板时没有启用lint。但现在我想脱毛。如何使用vue cli在当前vuejs项目上正式添加lint功能,而无需手动添加 npm install eslint babel-eslint eslint-plugin-html eslint-config-standard 然后创建一个名为.eslintrc.js的文件,并使其如下所示: module.exports = { root: true, parser: 'babel-eslint', p

我第一次使用vue cli初始化网页包模板时没有启用lint。但现在我想脱毛。如何使用vue cli在当前vuejs项目上正式添加lint功能,而无需手动添加

npm install eslint babel-eslint eslint-plugin-html eslint-config-standard
然后创建一个名为
.eslintrc.js
的文件,并使其如下所示:

module.exports = {
  root: true,
  parser: 'babel-eslint',
  parserOptions: {
    sourceType: 'module'
  },
  env: {
    browser: true,
  },
  extends: 'standard',
  // required to lint *.vue files
  plugins: [
    'html'
  ],
  // add your custom rules here
  'rules': {

    // allow paren-less arrow functions
    'arrow-parens': 0,
    // allow async-await
    'generator-star-spacing': 0,
    // allow debugger during development
    'no-debugger': process.env.NODE_ENV === 'production' ? 2 : 0
  }
}

看起来新的方法是使用vue add添加:

vue添加eslint