首页 文章

如何在vue-cli中禁用ESLint?

提问于
浏览
24

如何在 vue-cli 生成的项目中禁用 ESlint

preLoaders: [
  {
    test: /\.vue$/,
    loader: 'eslint',
    include: projectRoot,
    exclude: /node_modules/
  },
  {
    test: /\.js$/,
    loader: 'eslint',
    include: projectRoot,
    exclude: /node_modules/
  }
]

如果我删除 loader: 'eslint' 行,它将无法编译,同样将其设置为空字符串 . 我知道我可以在初始化阶段退出 ESLint ,但是如何在创建项目后禁用它?

8 回答

  • 1

    转到文件“tslint.json”并排除linterOptions中的所有文件 . 默认设置仅排除文件夹node_modules . 您也可以在tsconfig.json中设置“strict”:false

    "linterOptions": {
        "exclude": [
          "*/**"
        ]
      },
    

    代替

    "linterOptions": {
        "exclude": [
          "node_modules/**"
        ]
      },
    
  • 11

    Vue的初学者项目本身就是用模板语言构建的 .

    查看the templates{{#lint}} 位),您可以删除整个 preLoaders 块 .

  • 0

    从当前版本(^ 3.0?)开始,您可以设置:

    useEslint:false,

    在config / index.js中

  • 18

    截至2019年3月:

    vue.config.js

    module.exports = {
      ...
      lintOnSave: false
      ...
    }
    

    祝好运...

  • 3

    这里有很多解决方案:https://github.com/vuejs-templates/webpack/issues/73

    然而最好的是:
    要添加一行 **/* 到.eslintignore,这将忽略所有文件 . 然后重新运行,如果它是一个Web应用程序!

  • 1

    在最新版本中,打开".eslintrc.js"文件,然后设置"root: false" .
    enter image description here

  • 0

    config/index.js 中设置 useEslint: false,

    see this image

  • 1

    这里有一些过时的答案 .

    因为vue-cli 3使用的是零配置方法,所以禁用它的方法就是卸载模块:

    npm remove @vue/cli-plugin-eslint
    

相关问题