Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I override a react-beautify setting in VSCode?

I have a React Native project. In Visual Studio Code, I use the react-beautify add-in to beautify my code on the fly. The add-in uses a tool named prettydiff internally.

The only thing it does that I don't like is that it condenses

import { Componentname } from packagename

to

import {Componentname} from packagename

The correct prettydiff setting to change this behaviour is to set brace_style to collapse-preserve-inline.

However, I can't get prettydiff to accept the change.

I tried creating a .jsbeautifyrc file in my project's root directory, and added:

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

but this doesn't seem to work: the behaviour I don't want is still happening.

How do I do this correctly?

like image 304
Pekka Avatar asked Mar 10 '23 05:03

Pekka


1 Answers

I have VS Code in Mac v1.8.1 and if you open a Folder with a .jsbeautifyrc you could override the properties, in your example if you create a folder with 2 files:

index.js

import {code} from 'source';
import {otherCode} from 'source';

.jsbeautifyrc

{
  "bracepadding": true
}

you will get the next result after run the beautifier:

import { code } from 'source';
import { otherCode } from 'source';
like image 165
damianfabian Avatar answered Mar 20 '23 09:03

damianfabian