Skip to content

Latest commit

 

History

History
72 lines (54 loc) · 1010 Bytes

no_console_log.md

File metadata and controls

72 lines (54 loc) · 1010 Bytes
title Remove `console.log`
tags
good

Remove console.log statements.

engine marzano(0.1)
language js

`console.log($arg)` => . where { $arg <: not within catch_clause() }

Removes a simple console.log statement

// Do not remove this
console.error('foo');
console.log('foo');
// Do not remove this
console.error('foo');

Removes the statement in a function

function f() {
  console.log('foo');
}
function f() {}

Works in a list as well

server.listen(PORT, console.log(`Server started on port ${PORT}`));
server.listen(PORT);

Doesn't remove console.log in a catch clause

try {
} catch (e) {
  console.log('foo');
}

Works on multiple console logs in the same file

// Do not remove this
console.error('foo');
console.log('foo');
console.log('bar');
// Do not remove this
console.error('foo');