-
-
Notifications
You must be signed in to change notification settings - Fork 43
Description
Hello, I have some questions that I would love some guidance, I'm not sure what I'm doing wrong.
I'm trying to use a babel plugin, so semi-following the readme I did the following:
Create a .putout.json with the following:
{
"plugins": [
"babel/transform-inline-consecutive-adds"
]
}a.js
const t = [];
t.push(1);
t.push(2);Then run the following:
npm install babel-plugin-transform-inline-consecutive-adds
npx putout a.js -f codeframe
I get a different output:
a.js:3:0
1 | const t = [];
2 | t.push(1);
> 3 | t.push(2);
| ^ transform inline consecutive adds (babel/transform-inline-consecutive-adds)
4 |
a.js:1:6
> 1 | const t = [];
| ^ 't' is defined but never used (remove-unused-variables)
2 | t.push(1);
3 | t.push(2);
4 |
a.js:1:0
> 1 | const t = [];
| ^ 'use strict' directive should be on top of CommonJS (strict-mode/add-missing)
2 | t.push(1);
3 | t.push(2);
4 |
✖ 3 errors in 1 files
fixable with the `--fix` option
If I run npx putout --fix a.js I now end up with a.js like this:
'use strict';What am I doing wrong? It's a bit weird that only the use strict rule "won" the whole file, but I'm sure it's only because I don't fully understand how putout works yet.
I then "fixed" it by using --disable-all and then enabling only the rule that I wanted (the babel one in this case). But that seems a bit odd, is there a way where I can only run the rules I'm defining?
I'm planning on using this to run codemods on large repos, mostly using babel plugins and I can't know ahead of time which rules will apply to all the repos. Would love some guidance!