question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Unclear how to run only a single rule

See original GitHub issue

I’m unable to figure out how to run Putout with only a single rule enabled. One would assume that putout src --enable remove-unused-variables, or that only having one plugin/rule specified in .putout.json would do the trick, but that turns out not to be the case, instead all default rules are enabled.

(This is not an issue as such, but if anyone could tell me how to do this I would like to add it to the docs. I do see now what --enable does, but it’s not quite what one would expect.)

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:15 (12 by maintainers)

github_iconTop GitHub Comments

2reactions
egilllcommented, Sep 15, 2021

Hm yes I do see your point.

My idea was to propose something along the lines of:

putout
  --rules apply-optional-chaining,merge-if-statements
  --fix

Or possibly:

putout
  --enable apply-optional-chaining
  --enable merge-if-statements
  --fix

But alternatively I do like Milahu’s suggestion of disabling all defaults in the config:

{
+  "defaults": "off",
  "rules": {
    "apply-destructuring/array": "on"
  },
  "processors": [["javascript", "on"]]
}

as it would make Putout’s behaviour more in line with one’s expectations. For example, if one later adds some new code pattern one wouldn’t have to think “Do I have to turn all the defaults off in Putout again?”. It might also to make the config file more managable for those who are starting out with Putout and who are being cautious regarding transformations. At least in my case it wasn’t feasible to start with all defaults enabled since there are a handful of rules that cause my code to break in some subtle way, therefore I’ve been turning them on one by one to be able to review the outcome.

2reactions
milahucommented, Sep 1, 2021

aah! : )

my error was to combine --fix and --disable-all in one call

in that case, putout should throw an error like “only one command per call” where commands are --fix, --disable-all, --enable, …

Read more comments on GitHub >

github_iconTop Results From Across the Web

How do you run eslint for only a specific rule or set of rules
I know you can define rules in an .eslintrc file, but what if I just want to run eslint and check for one...
Read more >
Snakefiles and Rules — Snakemake 7.19.1 documentation
Instead of a shell command, a rule can run some python code to generate the output: rule NAME: input: "path/to/inputfile", "path/to/other/inputfile" output: " ......
Read more >
Programming Rules of Thumb
If the code exists in only one place, then it can be easily changed there. This rule is can even be applied to...
Read more >
Video: Fix the “ambiguous outer join” error - Microsoft Support
Save and run the parent query. Rule of thumb for ambiguous outer joins. Ambiguous outer joins occur when you have two or more...
Read more >
Choose vs. Chose - Confusing Words - Ginger Software
Only a single 'O' is added to make the sentences different, but the context completely changes. When to Use Choose + Original Examples....
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found