Skip to content

noConsoleLog

诊断类别:lint/suspicious/noConsoleLog

¥Diagnostic Category: lint/suspicious/noConsoleLog

自从:v1.0.0

¥Since: v1.0.0

禁止使用 console.log

¥Disallow the use of console.log

¥Examples

¥Invalid

console.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

console.info("info");
console.warn("warn");
console.error("error");
console.assert(true);
console.table(["foo", "bar"]);
const console = { log() {} };
console.log();

¥Related links