javascript
Maintainers:
Presets
remove-console-log
Usage $ hypermod --packages javascript#remove-console-log path/to/source
Removes all console.log
statements.
/* INPUT */
console.log('hello world');
foo('bar');
/* OUTPUT */
foo('bar');
remove-debugger
Usage $ hypermod --packages javascript#remove-debugger path/to/source
Removes all debugger
statements.
Credit: https://github.com/JamieMason/codemods
/* INPUT */
console.log('hello world');
debugger;
/* OUTPUT */
console.log('hello world');
sort-object-props
Usage $ hypermod --packages javascript#sort-object-props path/to/source
Sort members of Object Literals alphabetically.
Credit: https://github.com/JamieMason/codemods
/* INPUT */
const players = { messi: true, bergkamp: true, ginola: true };
/* OUTPUT */
const players = { bergkamp: true, ginola: true, messi: true };
var-to-let
Usage $ hypermod --packages javascript#var-to-let path/to/source
Replace all var
calls to use let
.
Credit: https://github.com/JamieMason/codemods
/* INPUT */
var foo = 'foo';
/* OUTPUT */
let foo = 'foo';
remove-unused-vars
Usage $ hypermod --packages javascript#remove-unused-vars path/to/source
Codemods for javascript#remove-unused-vars
Detects and removes unused variables in JavaScript code.
Credit: https://github.com/coderaiser/putout/tree/master/packages/plugin-remove-unused-variables
/* INPUT */
const x = 1;
const y = 2;
console.log(y);
/* OUTPUT */
const y = 2;
console.log(y);