Rick Rick - 2 months ago 17
Javascript Question

Import and Export line spacing in VSCode using Beautify.js

I have been using VSCodeBeautify to clean up some of my TypeScript files it works great for most cases with the exception of imports and exports.

Current Behavior on save

import {
AccountsModel
} from '../models/accounts';


Desired Behavior

import { AccountsModel } from '../models/accounts';


I tried creating a
.jsbeautifyrc
file in the root of the project, but it does not seem to be getting picked up.

{
"preserve_newlines": true,
"max_preserve_newlines": 2
}

Answer

This is what I ended up using.

{
    "brace_style": "collapse-preserve-inline"
}

Works great!

Comments