跳转到内容

noConsoleLog

此内容尚不支持你的语言。

Diagnostic Category: lint/suspicious/noConsoleLog

Since: v1.0.0

Disallow the use of console.log

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()
-------------
console.info("info");
console.warn("warn");
console.error("error");
console.assert(true);
console.table(["foo", "bar"]);
const console = { log() {} };
console.log();