Eslint: How to disable “unexpected console statement” in Node.js?

后端 未结 17 1657
遇见更好的自我
遇见更好的自我 2020-12-07 07:39

I\'m using eslint with Sublime Text 3 and I am writing gulpfile.js.

/*eslint-env node*/
var gulp = require(\'gulp\');

gulp.task(\'default\', fu         


        
17条回答
  •  谎友^
    谎友^ (楼主)
    2020-12-07 08:20

    Alternatively instead of turning 'no-console' off, you can allow. In the .eslintrc.js file put

      rules: {
        "no-console": [
         "warn",
         { "allow": ["clear", "info", "error", "dir", "trace", "log"] }
        ]
      }
    

    This will allow you to do console.log and console.clear etc without throwing errors.

提交回复
热议问题