Space Before Conditional
Config Key: space_before_conditional
Description: Add a space before conditional, if(true) vs if (true)
Available since version: 0.7.0 (Current: )
Type: boolean
Default: true
Support
Languages: EJS, JSX, JavaScript
Beautifiers: JS-Beautify, ESLint
Comparison Table
| Language | JS-Beautify | ESLint | 
|---|---|---|
| EJS | ✅ | ❌ | 
| JSX | ✅ | ✅ | 
| JavaScript | ✅ | ✅ | 
Examples
Carriage Return = ␍; Line Feed = ␊; Tab = ⇥; Whitespace = ·.
🚧 Original Code
if·(a)·{␊
··b=c;␊
}␊
🔧 true
Using JS-Beautify beautifier:
if·(a)·{␊
··b·=·c;␊
}
How to configure
A .unibeautify.json file would look like the following:
{
  "JSX": {
    "indent_size": 2,
    "indent_char": " ",
    "space_before_conditional": true,
    "beautifiers": [
      "JS-Beautify"
    ]
  }
}
Difference from original
Index: true
===================================================================
--- true    Original
+++ true    Beautified
@@ -1,3 +1,3 @@
 if·(a)·{␊
-··b=c;␊
-}␊
+··b·=·c;␊
+}
\ No newline at end of file
🔧 false
Using JS-Beautify beautifier:
if(a)·{␊
··b·=·c;␊
}
How to configure
A .unibeautify.json file would look like the following:
{
  "JSX": {
    "indent_size": 2,
    "indent_char": " ",
    "space_before_conditional": false,
    "beautifiers": [
      "JS-Beautify"
    ]
  }
}
Difference from original
Index: false
===================================================================
--- false   Original
+++ false   Beautified
@@ -1,3 +1,3 @@
-if·(a)·{␊
-··b=c;␊
-}␊
+if(a)·{␊
+··b·=·c;␊
+}
\ No newline at end of file