Config Key: end_with_comma
Description: If a terminating comma should be inserted into arrays, object literals, and destructured objects.
Available since version: 0.7.0 (Current: )
Type: boolean
Default: false
Support
Languages: EJS, JSX, JavaScript, Riot, Swig, Twig, TypeScript
Beautifiers: Prettier, Pretty Diff, ESLint, TSLint
Comparison Table
Examples
Invisible characters are shown with the following symbols:
Carriage Return = ␍; Line Feed = ␊; Tab = ⇥; Whitespace = ·.
No example found. Please submit a Pull Request!
🚧 Original Code
var·foo·=·{␊
····bar:·"baz",␊
····qux:·"quux",␊
};␊
␊
var·bar·=·{␊
····bar:·"baz",␊
····qux:·"quux"␊
};
🔧 true
Using Prettier beautifier:
var·foo·=·{␊
··bar:·"baz",␊
··qux:·"quux",␊
};␊
␊
var·bar·=·{␊
··bar:·"baz",␊
··qux:·"quux",␊
};␊
How to configure
A .unibeautify.json
file would look like the following:
{
"JSX": {
"indent_size": 2,
"indent_char": " ",
"end_with_comma": true,
"beautifiers": [
"Prettier"
]
}
}
Difference from original
@@ -1,9 +1,9 @@
var·foo·=·{␊
-····bar:·"baz",␊
-····qux:·"quux",␊
+··bar:·"baz",␊
+··qux:·"quux",␊
};␊
␊
var·bar·=·{␊
-····bar:·"baz",␊
\ No newline at end of file
-····qux:·"quux"␊
-};
+··bar:·"baz",␊
+··qux:·"quux",␊
+};␊
🔧 false
Using Prettier beautifier:
var·foo·=·{␊
··bar:·"baz",␊
··qux:·"quux"␊
};␊
␊
var·bar·=·{␊
··bar:·"baz",␊
··qux:·"quux"␊
};␊
How to configure
A .unibeautify.json
file would look like the following:
{
"JSX": {
"indent_size": 2,
"indent_char": " ",
"end_with_comma": false,
"beautifiers": [
"Prettier"
]
}
}
Difference from original
@@ -1,9 +1,9 @@
var·foo·=·{␊
-····bar:·"baz",␊
-····qux:·"quux",␊
+··bar:·"baz",␊
+··qux:·"quux"␊
};␊
␊
var·bar·=·{␊
-····bar:·"baz",␊
\ No newline at end of file
-····qux:·"quux"␊
-};
+··bar:·"baz",␊
+··qux:·"quux"␊
+};␊
🚧 Original Code
var·foo·=·{␊
····bar:·"baz",␊
····qux:·"quux",␊
};␊
␊
var·bar·=·{␊
····bar:·"baz",␊
····qux:·"quux"␊
};
🔧 true
Using Prettier beautifier:
var·foo·=·{␊
··bar:·"baz",␊
··qux:·"quux",␊
};␊
␊
var·bar·=·{␊
··bar:·"baz",␊
··qux:·"quux",␊
};␊
How to configure
A .unibeautify.json
file would look like the following:
{
"JavaScript": {
"indent_size": 2,
"indent_char": " ",
"end_with_comma": true,
"beautifiers": [
"Prettier"
]
}
}
Difference from original
@@ -1,9 +1,9 @@
var·foo·=·{␊
-····bar:·"baz",␊
-····qux:·"quux",␊
+··bar:·"baz",␊
+··qux:·"quux",␊
};␊
␊
var·bar·=·{␊
-····bar:·"baz",␊
\ No newline at end of file
-····qux:·"quux"␊
-};
+··bar:·"baz",␊
+··qux:·"quux",␊
+};␊
🔧 false
Using Prettier beautifier:
var·foo·=·{␊
··bar:·"baz",␊
··qux:·"quux"␊
};␊
␊
var·bar·=·{␊
··bar:·"baz",␊
··qux:·"quux"␊
};␊
How to configure
A .unibeautify.json
file would look like the following:
{
"JavaScript": {
"indent_size": 2,
"indent_char": " ",
"end_with_comma": false,
"beautifiers": [
"Prettier"
]
}
}
Difference from original
@@ -1,9 +1,9 @@
var·foo·=·{␊
-····bar:·"baz",␊
-····qux:·"quux",␊
+··bar:·"baz",␊
+··qux:·"quux"␊
};␊
␊
var·bar·=·{␊
-····bar:·"baz",␊
\ No newline at end of file
-····qux:·"quux"␊
-};
+··bar:·"baz",␊
+··qux:·"quux"␊
+};␊
No example found. Please submit a Pull Request!
No example found. Please submit a Pull Request!
No example found. Please submit a Pull Request!
🚧 Original Code
var·foo·=·{␊
····bar:·"baz",␊
····qux:·"quux",␊
};␊
␊
var·bar·=·{␊
····bar:·"baz",␊
····qux:·"quux"␊
};
🔧 true
Using Prettier beautifier:
var·foo·=·{␊
··bar:·"baz",␊
··qux:·"quux",␊
};␊
␊
var·bar·=·{␊
··bar:·"baz",␊
··qux:·"quux",␊
};␊
How to configure
A .unibeautify.json
file would look like the following:
{
"TypeScript": {
"indent_size": 2,
"indent_char": " ",
"end_with_comma": true,
"beautifiers": [
"Prettier"
]
}
}
Difference from original
@@ -1,9 +1,9 @@
var·foo·=·{␊
-····bar:·"baz",␊
-····qux:·"quux",␊
+··bar:·"baz",␊
+··qux:·"quux",␊
};␊
␊
var·bar·=·{␊
-····bar:·"baz",␊
\ No newline at end of file
-····qux:·"quux"␊
-};
+··bar:·"baz",␊
+··qux:·"quux",␊
+};␊
🔧 false
Using Prettier beautifier:
var·foo·=·{␊
··bar:·"baz",␊
··qux:·"quux"␊
};␊
␊
var·bar·=·{␊
··bar:·"baz",␊
··qux:·"quux"␊
};␊
How to configure
A .unibeautify.json
file would look like the following:
{
"TypeScript": {
"indent_size": 2,
"indent_char": " ",
"end_with_comma": false,
"beautifiers": [
"Prettier"
]
}
}
Difference from original
@@ -1,9 +1,9 @@
var·foo·=·{␊
-····bar:·"baz",␊
-····qux:·"quux",␊
+··bar:·"baz",␊
+··qux:·"quux"␊
};␊
␊
var·bar·=·{␊
-····bar:·"baz",␊
\ No newline at end of file
-····qux:·"quux"␊
-};
+··bar:·"baz",␊
+··qux:·"quux"␊
+};␊