Disable ESLint no-console In Development

December 15, 2019
Unexpected console statement (no-console), Enable console.log

Edit .eslintrc.js in your project directory.

module.exports = {
  ...
  // add your custom rules here
  'rules': {
    'no-console': process.env.NODE_ENV === 'production' ? 2 : 0
  }
}

Note: process.env.NODE_ENV is defined in Vue.js Webpack Template.

You can selective enable console.log

// eslint-disable-next-line no-console
console.log('hello');

or

console.log('hello'); // eslint-disable-line no-console

or

// eslint-disable no-console
console.log('hello');
console.log('world');
// eslint-enable no-console
This work is licensed under a
Creative Commons Attribution-NonCommercial 4.0 International License.