It seems that default error level for all eslint rules are "error"
. This is annoying as my app doesn't compile even for an omitted semicolon.
How can I set it to "warn"
so that my app compiles but shows warnings?
I know I can set each rule to warn manually but I'd prefer to do it globally. In the official docs I haven't found such option.
This my config in .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
}
}
To set the /W0, /W1, /W2, /W3, /W4, or /Wall options, modify the Warning Level property. To set the /WX or /WX- options, modify the Treat Warnings as Errors property.
To set the /W0, /W1, /W2, /W3, /W4, or /Wall options, modify the Warning Level property. To set the /WX or /WX- options, modify the Treat Warnings as Errors property. To set the version for the /Wv option, enter the compiler version number in the Warning Version property.
Warning pragma directives in source code are unaffected by the /w option. The build errors documentation describes the warnings and warning levels, and indicates why certain statements may not compile as you intend. Open the project's Property Pages dialog box.
To set the /we option, Select the Treat Specific Warnings As Errors property dropdown control and then choose Edit. In the edit box in the Treat Specific Warnings As Errors dialog, enter the warning number. To enter more than one warning, separate the values by using a semicolon (; ).
You can use eslint plugin eslint-plugin-only-warn or use the same method as it done in this plugin by patching verify function
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With