如何在 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 回答
转到文件“tslint.json”并排除linterOptions中的所有文件 . 默认设置仅排除文件夹node_modules . 您也可以在tsconfig.json中设置“strict”:false
代替
Vue的初学者项目本身就是用模板语言构建的 .
查看the templates(
{{#lint}}
位),您可以删除整个preLoaders
块 .从当前版本(^ 3.0?)开始,您可以设置:
useEslint:false,
在config / index.js中
截至2019年3月:
在
vue.config.js
:祝好运...
这里有很多解决方案:https://github.com/vuejs-templates/webpack/issues/73
然而最好的是:
要添加一行
**/*
到.eslintignore,这将忽略所有文件 . 然后重新运行,如果它是一个Web应用程序!在最新版本中,打开".eslintrc.js"文件,然后设置"root: false" .
在
config/index.js
中设置useEslint: false,
see this image
这里有一些过时的答案 .
因为vue-cli 3使用的是零配置方法,所以禁用它的方法就是卸载模块: