似乎所有 eslint 规则的默认错误级别都是 "error"
.这很烦人,因为即使省略了分号,我的应用程序也无法编译。
如何将其设置为 "warn"
以便我的应用程序编译但显示警告?
我知道我可以将每个规则设置为手动警告,但我更喜欢全局设置。在官方文档中我没有找到这样的选项。
这是我在 .eslingtrc.js
中的配置:
// http://eslint.org/docs/user-guide/configuring
module.exports = {
root: true,
parser: 'babel-eslint',
parserOptions: {
sourceType: 'module'
},
env: {
browser: true,
},
// https://github.com/feross/standard/blob/master/RULES.md#javascript-standard-style
extends: 'standard',
// required to lint *.vue files
plugins: [
'html'
],
// add your custom rules here
'rules': {
// allow paren-less arrow functions
'arrow-parens': 0,
'indent': 1,
// allow async-await
'generator-star-spacing': 0,
// allow debugger during development
'no-debugger': process.env.NODE_ENV === 'production' ? 2 : 0,
'padded-blocks': [1, {classes: 'always'}],
'semi': 1
}
}
最佳答案
您可以使用 eslint 插件 eslint-plugin-only-warn或使用与此插件中相同的方法通过修补验证功能
关于eslint - 将默认错误级别设置为 WARN,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/44303590/