Indent Chained Methods
Config Key: indent_chained_methods
Description: Indent chained method calls
Available since version: 0.10.0 (Current: )
Type: boolean
Default: true
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
foo.bar().baz();␊
␊
this.$("#fileName").val().addClass("disabled")␊
····.prop("disabled",·true)␊
␊
function·doStuff()·{␊
if·(oParameters.State·!==·ui().s2p().mm().supplinvoice().manage().util().Constants().blabla())·{␊
return·false;␊
}␊
}␊
🔧 true
Using JS-Beautify beautifier:
foo.bar().baz();␊
␊
this.$("#fileName").val().addClass("disabled")␊
··.prop("disabled",·true)␊
␊
function·doStuff()·{␊
··if·(oParameters.State·!==·ui().s2p().mm().supplinvoice().manage().util().Constants().blabla())·{␊
····return·false;␊
··}␊
}
How to configure
A .unibeautify.json
file would look like the following:
{
"JSX": {
"indent_size": 2,
"indent_char": " ",
"indent_chained_methods": true,
"beautifiers": [
"JS-Beautify"
]
}
}
Difference from original
Index: true
===================================================================
--- true Original
+++ true Beautified
@@ -1,10 +1,10 @@
foo.bar().baz();␊
␊
this.$("#fileName").val().addClass("disabled")␊
-····.prop("disabled",·true)␊
+··.prop("disabled",·true)␊
␊
function·doStuff()·{␊
-if·(oParameters.State·!==·ui().s2p().mm().supplinvoice().manage().util().Constants().blabla())·{␊
-return·false;␊
-}␊
-}␊
+··if·(oParameters.State·!==·ui().s2p().mm().supplinvoice().manage().util().Constants().blabla())·{␊
+····return·false;␊
+··}␊
+}
\ No newline at end of file
🔧 false
Using JS-Beautify beautifier:
foo.bar().baz();␊
␊
this.$("#fileName").val().addClass("disabled")␊
.prop("disabled",·true)␊
␊
function·doStuff()·{␊
··if·(oParameters.State·!==·ui().s2p().mm().supplinvoice().manage().util().Constants().blabla())·{␊
····return·false;␊
··}␊
}
How to configure
A .unibeautify.json
file would look like the following:
{
"JSX": {
"indent_size": 2,
"indent_char": " ",
"indent_chained_methods": false,
"beautifiers": [
"JS-Beautify"
]
}
}
Difference from original
Index: false
===================================================================
--- false Original
+++ false Beautified
@@ -1,10 +1,10 @@
foo.bar().baz();␊
␊
this.$("#fileName").val().addClass("disabled")␊
-····.prop("disabled",·true)␊
+.prop("disabled",·true)␊
␊
function·doStuff()·{␊
-if·(oParameters.State·!==·ui().s2p().mm().supplinvoice().manage().util().Constants().blabla())·{␊
-return·false;␊
-}␊
-}␊
+··if·(oParameters.State·!==·ui().s2p().mm().supplinvoice().manage().util().Constants().blabla())·{␊
+····return·false;␊
+··}␊
+}
\ No newline at end of file