coderaiser / putout

🐊 Pluggable and configurable JavaScript Linter, code transformer and formatter, drop-in ESLint superpower replacement πŸ’ͺ with built-in support for js, jsx, typescript, flow, markdown, yaml and json. Write declarative codemods in a simplest possible way 😏
https://putout.cloudcmd.io/
MIT License
698 stars 40 forks source link

question: how can i disable all plugins that are not in the rulesdir? #193

Closed quixoten closed 10 months ago

quixoten commented 10 months ago

i've been trying to use putout as a replacement forjscodeshift, but I haven't been able to successfully disable all of the builtin plugins.

I've tried using the config file:

{
    "plugins": []
}

and i've tried running npx putout --disable-all, but putout is still applying changes to my code afterwards. The repo I'm running on is very large, and I don't think the disable-all step completes 100% successfully. Is there another way to disable all of the builtin plugins so I can just run the ones in my rulesdir only?

coderaiser commented 10 months ago

You can disable-all rules 🐊Putout can find, just point the place for a lint:

putout . --disable-all

After that file .putout.json will be created with all found rules disabled. Is it works for you?

quixoten commented 10 months ago

putout is still modifying files after running --disable-all

https://asciinema.org/a/AsGiUFUNu3uJo9as9QT6lqU04

coderaiser commented 10 months ago

It modifies, but no rules applied. The thing is @putout/printer is used by default. This is opinionated code formatter which not try to guess formatting, just print it in best possible way. If you don’t like it, you can use recast, it is slower and not maintained, but it tries to guess formatting, update .putout.json with:

{
    "printer": "recast"
}

For more clear results configure ESLint with eslint-plugin-putout it fixes code after recast, or you can use prettier. In any case is better to have codebase consistent and formatted with one of tools, to get back to it’s original state after program manipulations.