noConsoleLog
Diagnostic Category: lint/suspicious/noConsoleLog
Since: v1.0.0
Description
Section titled DescriptionDisallow the use of console.log
Examples
Section titled ExamplesInvalid
Section titled Invalidconsole.log()
code-block.js:1:1 lint/suspicious/noConsoleLog FIXABLE ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
⚠ Don’t use console.log
> 1 │ console.log()
│ ^^^^^^^^^^^^^
2 │
ℹ console.log is usually a tool for debugging and you don’t want to have that in production.
ℹ If it is not for debugging purpose then using console.info might be more appropriate.
ℹ Unsafe fix: Remove console.log
1 │ console.log()
│ -------------
Valid
Section titled Validconsole.info("info");console.warn("warn");console.error("error");console.assert(true);console.table(["foo", "bar"]);const console = { log() {} };console.log();
How to configure
Section titled How to configure{ "linter": { "rules": { "suspicious": { "noConsoleLog": "error" } } }}