rdio/jsfmt

User config only extends plugins instead of overwriting

hoschi opened this issue · 7 comments

Starting with version 0.4.1 my variable declarations are splitted by jsfmt. I think this is an issue because in the esformatter preview it doesn't do this. Example

var a, b;

gets formatted to:

var a;
var b;

Config is here https://github.com/hoschi/sweetp-service-project-workflow/blob/develop/.jsfmtrc
Also you can test it in this repository by running jsfmt -w test.

This is intentional per this PR: #125

You should be able to disable the plugin by overwriting the default plugins in your config:

"plugins": ["esformatter-braces", "esformatter-var-each"]

If overwriting the plugin doesn't work, please re-open.

EDIT: I see you have plugins specified. We're probably just merging the plugins instead of overwriting. Open to suggestions or PR on the best way to handle this.

@jimfleming the best thing I have here is disablePlugins: ["esformatter-var"] for the config.

It seems like an appropriate fix, but seems weird since we only have 2 plugins enabled.

Thoughts?

I added a PR for that idea, it was easy enough to implement. I'm content if we decide not to merge it.

@hoschi I could not reproduce this issue on v0.4.1 using your example script and config.

@brettlangdon strange, I try to test this again at the weekend and see what happens ;)

@brettlangdon you are right I tested it again and it works with the posted config (not using disablePlugins)

@hoschi awesome!