Skip to content

no-warn

Reports direct calls to the global warn() function.

This rule reports warn(...) when it is called as a global function. The rule does not take options.

The message points you toward a logging package instead, because raw warning output is hard to filter and harder to work with once a codebase gets larger.

Incorrect
warn("API endpoint deprecated");
warn("Missing config property:", key);
warn("Unexpected state in component");
Correct
log.Warning("API endpoint deprecated");
log.Warning("Missing config property:", key);
logger.warn("Unexpected state in component");