Comma First
Config Key: comma_first
Description: Put commas at the beginning of new line instead of end
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·a·=·"a",·b·=·"b",·c·=·"c";␊
🔧 true
Using JS-Beautify beautifier:
const·a·=·"a"␊
··,·b·=·"b"␊
··,·c·=·"c";
How to configure
A .unibeautify.json
file would look like the following:
{
"JSX": {
"indent_size": 2,
"indent_char": " ",
"comma_first": true,
"beautifiers": [
"JS-Beautify"
]
}
}
Difference from original
Index: true
===================================================================
--- true Original
+++ true Beautified
@@ -1,1 +1,3 @@
-const·a·=·"a",·b·=·"b",·c·=·"c";␊
+const·a·=·"a"␊
+··,·b·=·"b"␊
+··,·c·=·"c";
\ No newline at end of file
🔧 false
Using JS-Beautify beautifier:
const·a·=·"a",␊
··b·=·"b",␊
··c·=·"c";
How to configure
A .unibeautify.json
file would look like the following:
{
"JSX": {
"indent_size": 2,
"indent_char": " ",
"comma_first": false,
"beautifiers": [
"JS-Beautify"
]
}
}
Difference from original
Index: false
===================================================================
--- false Original
+++ false Beautified
@@ -1,1 +1,3 @@
-const·a·=·"a",·b·=·"b",·c·=·"c";␊
+const·a·=·"a",␊
+··b·=·"b",␊
+··c·=·"c";
\ No newline at end of file