tslint says calls to console.log are not allowed - How do I allow this? tslint says calls to console.log are not allowed - How do I allow this? reactjs reactjs

tslint says calls to console.log are not allowed - How do I allow this?


Add // tslint:disable-next-line:no-console in the line right before your calls to console.log to prevent the error message only once.

If you want to disable the rule entirely add the following to your tslint.json (most likely in your root folder):

{    "rules": {        "no-console": false    }}


For those of you coming here with a mixed codebase of javascript and typescript.

You may need to define the 'no-console' option in jsRules, jslints rules object for javascript files, i.e. there are separate rules objects for javascript and typescript.

//tslint.json

{  "extends": ["tslint:recommended", "tslint-react", "tslint-config-prettier"], //Example...   "rules": {    "no-console": false //Disable for typescript  },  "jsRules": {    "no-console": false //Disable for javascript  }}


Add the following to your tslint.json

{   "rules": {      "no-console": {         "severity": "warning",      }    }}