Keep Array Indentation
Config Key: keep_array_indentation
Description: Preserve array indentation
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·arr·=·[␊
······"a",·"b",␊
·"c",␊
·····"d",␊
];␊
🔧 true
Using JS-Beautify beautifier:
const·arr·=·[␊
······"a",·"b",␊
·"c",␊
·····"d",␊
];
How to configure
A .unibeautify.json
file would look like the following:
{
"JSX": {
"indent_size": 2,
"indent_char": " ",
"keep_array_indentation": true,
"beautifiers": [
"JS-Beautify"
]
}
}
Difference from original
Index: true
===================================================================
--- true Original
+++ true Beautified
@@ -1,5 +1,5 @@
const·arr·=·[␊
······"a",·"b",␊
·"c",␊
·····"d",␊
-];␊
+];
\ No newline at end of file
🔧 false
Using JS-Beautify beautifier:
const·arr·=·[␊
··"a",·"b",␊
··"c",␊
··"d",␊
];
How to configure
A .unibeautify.json
file would look like the following:
{
"JSX": {
"indent_size": 2,
"indent_char": " ",
"keep_array_indentation": false,
"beautifiers": [
"JS-Beautify"
]
}
}
Difference from original
Index: false
===================================================================
--- false Original
+++ false Beautified
@@ -1,5 +1,5 @@
const·arr·=·[␊
-······"a",·"b",␊
-·"c",␊
-·····"d",␊
-];␊
+··"a",·"b",␊
+··"c",␊
+··"d",␊
+];
\ No newline at end of file