Remove console.log
statements.
Apply with the Grit CLI
grit apply no_console_log
Removes a simple console.log
statement
BEFORE
// Do not remove this console.error('foo'); console.log('foo');
AFTER
// Do not remove this console.error('foo');
Removes the statement in a function
BEFORE
function f() { console.log('foo'); }
AFTER
function f() {}
Works in a list as well
BEFORE
server.listen(PORT, console.log(`Server started on port ${PORT}`));
AFTER
server.listen(PORT);
Doesn't remove console.log
in a catch clause
JAVASCRIPT
try { } catch (e) { console.log('foo'); }
Works on multiple console logs in the same file
BEFORE
// Do not remove this console.error('foo'); console.log('foo'); console.log('bar');
AFTER
// Do not remove this console.error('foo');