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
705 stars 40 forks source link

[plugin-remove-console]: Removes any kind of `console` function and not only `console.log` #151

Closed ElPrudi closed 1 year ago

ElPrudi commented 1 year ago

While I like the idea of removing console.log, It's a bit to much to also remove console.error or console.warn for logging or error utilities. It would be better to update the README and/or to add configurations to remove only specific kinds of console commands, such as:

{
    "rules": {
        "remove-console": ["on", {
            "log": true,
            "warn": false,
            "error": false
        }]
    }
}
coderaiser commented 1 year ago

That's a nice idea! You can configure it right now in a way you like using 🦎Putout Script.

{
    "rules": {
        "remove-console": ["on", {
            "exclude": [
                "console.warn(__args)",
                "console.error(__args)"
            ]
        }]
    }
}
ElPrudi commented 1 year ago

Surprisingly enough, it does work. Thank you very much :)

Still, it would be nice to include it in the readme. It's a very good selling point, because eslints no-console has no configuration. And I'm sure I'm not the only one with this problem.

coderaiser commented 1 year ago

exclude works for all plugins :).