I used to have my console.log in Angular 6 to see the content of variables in the browser
console.log('CONSOLOG: M:paginateVar & O: this.var : ', this.var);
... and I was happy with it, but now I'm starting to use Angular 8 and I get this error (when I npm start):
No type errors found
Version: typescript 3.4.5
Time: 2104ms
× 「wdm」: 1029 modules
ERROR in ./src/main/webapp/app/home/home.component.ts
Module Error (from ./node_modules/eslint-loader/dist/cjs.js):
D:\JHipster\spingular\src\main\webapp\app\home\home.component.ts
105:7 error Unexpected console statement no-console
✖ 1 problem (1 error, 0 warnings)
i 「wdm」: Failed to compile.
How can I see the content of a variable back in the browser?
TSLINT:
{
"rulesDirectory": ["node_modules/codelyzer"],
"rules": {
"no-console": [false, "debug", "info", "time", "timeEnd", "trace" ],
"directive-selector": [true, "attribute", "jhi", "camelCase"],
"component-selector": [true, "element", "jhi", "kebab-case"],
"no-inputs-metadata-property": true,
"no-outputs-metadata-property": true,
"no-host-metadata-property": true,
"no-input-rename": true,
"no-output-rename": true,
"use-lifecycle-interface": true,
"use-pipe-transform-interface": false,
"component-class-suffix": true,
"directive-class-suffix": true
}
}
This is an ESLint rule in Node.js.
https://eslint.org/docs/rules/no-console
The reason it's disabled:
console is used to output information to the user and so is not strictly used for debugging purposes. If you are developing for Node.js then you most likely do not want this rule enabled.
You may like to consider a logger: https://github.com/code-chunks/angular2-logger
However, if you really just want to allow console.log you can edit the rules to set:
"no-console": "off",
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