beautifier / js-beautify

Beautifier for javascript
https://beautifier.io
MIT License
8.62k stars 1.39k forks source link

Turn off spaces in Javascript object (space_inside_braces setting) #1204

Open zhiqiang21 opened 7 years ago

zhiqiang21 commented 7 years ago

Description

i want delete js object inside spaces 。How should i configure it? please help me

Input

The code looked like this before beautification:


import { aaa } from REACR;

var aaa = { a: 1 };

Expected Output

The code should have looked like this after beautification:

import {aaa} from REACR;

var aaa = {a: 1};

Actual Output

The code actually looked like this after beautification:

import { aaa } from REACR;

var aaa = { a: 1 };

Steps to Reproduce

Environment

OS:10.12.5

Settings

Example:

{
    "html": {
        "allowed_file_extensions": ["htm", "html", "xhtml", "shtml", "xml", "svg", "wxml"],
        "brace_style": "collapse",
        "indent_char": " ",
        "indent_size": 4
    },
    "css": {
        "allowed_file_extensions": ["css", "scss", "sass", "less", "wxss"],
        "indent_char": " ",
        "indent_size": 4
    },
    "js": {
        "allowed_file_extensions": ["js", "json", "jshintrc", "jsbeautifyrc"],
        "brace_style": "collapse-preserve-inline",
        "indent_char": " ",
        "indent_level": 0,
        "space_after_anon_function":true,
        "space_in_paren":false,
        "indent_size": 4
    }
}
i5ar commented 5 years ago

I suggest space_in_braces instead of space_inside_braces to be consistent with space_in_paren.
Bye.

sahilrajput03 commented 3 years ago

Please do this space in braces thing, I need it really baddd, as it get inconsisteny with my code design!! Please bring this to this extension!!

bitwiseman commented 3 years ago

@sahilrajput03 PRs welcome. Please contribute.