A simple transform that prepends uncommited console.log calls with a string
$ npm i --save-dev babel-plugin-console-prepend babel-cli
Transforms
console.log(val); // this line has been committed
console.log(val); // this line has not been committed
to
console.log(val); // this line has been committed
console.log('prefix', val); // this line has not been committed
{
"plugins": ["console-prepend"],
}
Set plugin options using an array of [pluginName, optionsObject]
.
{
"plugins": [["console-prepend", { "prefix": "I wrote this" }]],
}
$ babel --plugins console-prepend script.js
require('babel-core').transform('code', {
'plugins': ['console-prepend'],
});