Space In Paren
Config Key: space_in_paren
Description: Add padding spaces within parentheses, ie. f( a, b )
Available since version: 0.7.0 (Current: )
Type: boolean
Default: false
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
const·anonymousFunc1·=·function·(arg1)·{}␊
const·anonymousFunc2·=·function(arg1)·{}␊
const·anonymousFunc3·=·function(arg1,·arg2)·{}␊
const·anonymousFunc4·=·function(arg1,arg2)·{}␊
const·anonymousFunc5·=·function(·arg1,·arg2·)·{}␊
const·anonymousFunc6·=·function()·{}␊
function·namedFunc1·(arg1)·{}␊
function·namedFunc2(arg1)·{}␊
function·namedFunc3(arg1,·arg2)·{}␊
function·namedFunc4(arg1,arg2)·{}␊
function·namedFunc5(·arg1,·arg2·)·{}␊
function·namedFunc6()·{}␊
🔧 true
Using JS-Beautify beautifier:
const·anonymousFunc1·=·function(·arg1·)·{}␊
const·anonymousFunc2·=·function(·arg1·)·{}␊
const·anonymousFunc3·=·function(·arg1,·arg2·)·{}␊
const·anonymousFunc4·=·function(·arg1,·arg2·)·{}␊
const·anonymousFunc5·=·function(·arg1,·arg2·)·{}␊
const·anonymousFunc6·=·function()·{}␊
␊
function·namedFunc1(·arg1·)·{}␊
␊
function·namedFunc2(·arg1·)·{}␊
␊
function·namedFunc3(·arg1,·arg2·)·{}␊
␊
function·namedFunc4(·arg1,·arg2·)·{}␊
␊
function·namedFunc5(·arg1,·arg2·)·{}␊
␊
function·namedFunc6()·{}
How to configure
A .unibeautify.json
file would look like the following:
{
"JSX": {
"indent_size": 2,
"indent_char": " ",
"space_in_paren": true,
"beautifiers": [
"JS-Beautify"
]
}
}
Difference from original
Index: true
===================================================================
--- true Original
+++ true Beautified
@@ -1,12 +1,18 @@
-const·anonymousFunc1·=·function·(arg1)·{}␊
-const·anonymousFunc2·=·function(arg1)·{}␊
-const·anonymousFunc3·=·function(arg1,·arg2)·{}␊
-const·anonymousFunc4·=·function(arg1,arg2)·{}␊
+const·anonymousFunc1·=·function(·arg1·)·{}␊
+const·anonymousFunc2·=·function(·arg1·)·{}␊
+const·anonymousFunc3·=·function(·arg1,·arg2·)·{}␊
+const·anonymousFunc4·=·function(·arg1,·arg2·)·{}␊
const·anonymousFunc5·=·function(·arg1,·arg2·)·{}␊
const·anonymousFunc6·=·function()·{}␊
-function·namedFunc1·(arg1)·{}␊
-function·namedFunc2(arg1)·{}␊
-function·namedFunc3(arg1,·arg2)·{}␊
-function·namedFunc4(arg1,arg2)·{}␊
+␊
+function·namedFunc1(·arg1·)·{}␊
+␊
+function·namedFunc2(·arg1·)·{}␊
+␊
+function·namedFunc3(·arg1,·arg2·)·{}␊
+␊
+function·namedFunc4(·arg1,·arg2·)·{}␊
+␊
function·namedFunc5(·arg1,·arg2·)·{}␊
-function·namedFunc6()·{}␊
+␊
+function·namedFunc6()·{}
\ No newline at end of file
🔧 false
Using JS-Beautify beautifier:
const·anonymousFunc1·=·function(arg1)·{}␊
const·anonymousFunc2·=·function(arg1)·{}␊
const·anonymousFunc3·=·function(arg1,·arg2)·{}␊
const·anonymousFunc4·=·function(arg1,·arg2)·{}␊
const·anonymousFunc5·=·function(arg1,·arg2)·{}␊
const·anonymousFunc6·=·function()·{}␊
␊
function·namedFunc1(arg1)·{}␊
␊
function·namedFunc2(arg1)·{}␊
␊
function·namedFunc3(arg1,·arg2)·{}␊
␊
function·namedFunc4(arg1,·arg2)·{}␊
␊
function·namedFunc5(arg1,·arg2)·{}␊
␊
function·namedFunc6()·{}
How to configure
A .unibeautify.json
file would look like the following:
{
"JSX": {
"indent_size": 2,
"indent_char": " ",
"space_in_paren": false,
"beautifiers": [
"JS-Beautify"
]
}
}
Difference from original
Index: false
===================================================================
--- false Original
+++ false Beautified
@@ -1,12 +1,18 @@
-const·anonymousFunc1·=·function·(arg1)·{}␊
+const·anonymousFunc1·=·function(arg1)·{}␊
const·anonymousFunc2·=·function(arg1)·{}␊
const·anonymousFunc3·=·function(arg1,·arg2)·{}␊
-const·anonymousFunc4·=·function(arg1,arg2)·{}␊
-const·anonymousFunc5·=·function(·arg1,·arg2·)·{}␊
+const·anonymousFunc4·=·function(arg1,·arg2)·{}␊
+const·anonymousFunc5·=·function(arg1,·arg2)·{}␊
const·anonymousFunc6·=·function()·{}␊
-function·namedFunc1·(arg1)·{}␊
+␊
+function·namedFunc1(arg1)·{}␊
+␊
function·namedFunc2(arg1)·{}␊
+␊
function·namedFunc3(arg1,·arg2)·{}␊
-function·namedFunc4(arg1,arg2)·{}␊
-function·namedFunc5(·arg1,·arg2·)·{}␊
-function·namedFunc6()·{}␊
+␊
+function·namedFunc4(arg1,·arg2)·{}␊
+␊
+function·namedFunc5(arg1,·arg2)·{}␊
+␊
+function·namedFunc6()·{}
\ No newline at end of file