JsFormat for Sublime Text 3 conforms to most ES6 standards, however, when auto-formatting import statements, it adds a new line to object imports. Here is what the pre-formatted line looks like:
import {func1, func2, func3} from 'some-module';
When auto-formatting, it turns into:
import {
func1, func2, func3
}
from 'some-module';
Is there a way to disable this kind of formatting?
According to the Github repo, JsFormat uses js-beautify to do the formatting. That project has an open issue where folks complain about various formatting issues, one of them being this very thing. There's a mildly long comment thread which ends in "Pull requests welcome", so unfortunately it looks like there is currently no way to disable this kind of formatting.
On http://jsbeautifier.org/, there is check box to enable this setting: "Preserve inline braces/code blocks".
This feature was added in recent version for the beautifier as the preserve-inline
option for brace-style
. This will keep inline (all on the same line) brace blocks unchanged. It works as a modifier for the base setting (for example, brace-style: "collapse,preserve-inline"
).
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With