Eslint: How to disable "unexpected console statement" in Node.js?
You should update eslint config file to fix this permanently. Else you can temporarily enable or disable eslint check for console like below
/* eslint-disable no-console */
console.log(someThing);
/* eslint-enable no-console */
Create a .eslintrc.js in the directory of your file, and put the following contents in it:
module.exports = {
rules: {
'no-console': 'off',
},
};
For vue-cli 3 open package.json
and under section eslintConfig
put no-console
under rules
and restart dev server (npm run serve
or yarn serve
)
...
"eslintConfig": {
...
"rules": {
"no-console": "off"
},
...
The following works with ESLint in VSCode if you want to disable the rule for just one line.
To disable the next line:
// eslint-disable-next-line no-console
console.log('hello world');
To disable the current line:
console.log('hello world'); // eslint-disable-line no-console