Arrow Parens
Config Key: arrow_parens
Description: Require parenthesis in arrow function arguments
Available since version: 0.7.0 (Current: )
Type: string
Default: "always"
Allowed values: "always"
or "as-needed"
Support
Languages: JSX, JavaScript, TypeScript
Beautifiers: Prettier, ESLint, TSLint
Comparison Table
Language | Prettier | ESLint | TSLint |
---|---|---|---|
JSX | ✅ | ✅ | ❌ |
JavaScript | ✅ | ✅ | ❌ |
TypeScript | ✅ | ❌ | ✅ |
Examples
Carriage Return = ␍; Line Feed = ␊; Tab = ⇥; Whitespace = ·.
🚧 Original Code
a·=>·{};␊
(a)·=>·{};␊
(a,·b)·=>·{};
🔧 "always"
Using Prettier beautifier:
(a)·=>·{};␊
(a)·=>·{};␊
(a,·b)·=>·{};␊
How to configure
A .unibeautify.json
file would look like the following:
{
"JSX": {
"indent_size": 2,
"indent_char": " ",
"arrow_parens": "always",
"beautifiers": [
"Prettier"
]
}
}
Difference from original
Index: always
===================================================================
--- always Original
+++ always Beautified
@@ -1,3 +1,3 @@
-a·=>·{};␊
(a)·=>·{};␊
-(a,·b)·=>·{};
\ No newline at end of file
+(a)·=>·{};␊
+(a,·b)·=>·{};␊
🔧 "as-needed"
Using Prettier beautifier:
a·=>·{};␊
a·=>·{};␊
(a,·b)·=>·{};␊
How to configure
A .unibeautify.json
file would look like the following:
{
"JSX": {
"indent_size": 2,
"indent_char": " ",
"arrow_parens": "as-needed",
"beautifiers": [
"Prettier"
]
}
}
Difference from original
Index: as-needed
===================================================================
--- as-needed Original
+++ as-needed Beautified
@@ -1,3 +1,3 @@
a·=>·{};␊
-(a)·=>·{};␊
-(a,·b)·=>·{};
\ No newline at end of file
+a·=>·{};␊
+(a,·b)·=>·{};␊