Unibeautify
  • Install
  • Docs
  • Assistant
  • Playground
  • GitHub

›E

A

  • Align Assignments
  • Arrow Parens

B

  • Brace Style
  • Break Chained Methods

C

  • Comma First

E

  • End With Comma
  • End With Newline
  • End With Semicolon

F

  • Force Indentation

I

  • Identifier Case
  • Indent Chained Methods
  • Indent Comments
  • Indent Inner Html
  • Indent Scripts
  • Indent Size
  • Indent Style

J

  • JSLint Happy
  • JSX Brackets

K

  • Keep Array Indentation
  • Keyword Case

M

  • Max Preserve Newlines
  • Multiline Ternary

N

  • Newline Before Tags
  • Newline Between Rules
  • No Leading Zero

O

  • Object Curly Spacing

P

  • Pragma Insert
  • Pragma Require
  • Preserve Newlines

Q

  • Quotes

R

  • Remove Trailing Whitespace

S

  • Selector Separator Newline
  • Space After Anon Function
  • Space Before Conditional
  • Space In Empty Paren
  • Space In Paren

U

  • Unescape Strings
  • Unformatted

W

  • Wrap Attributes
  • Wrap Attributes Indent Size
  • Wrap Line Length
  • Wrap Prose
Edit

End With Newline

Config Key: end_with_newline

Description: End output with newline

Available since version: 0.7.0 (Current: npm)

Type: boolean

Default: false

Support

Edit Beautifiers

Languages: CSS, EJS, HTML, Handlebars, JSX, JavaScript, Less, Liquid, Mustache, SCSS, Sass, SugarSS, XML

Beautifiers: JS-Beautify, ESLint, stylelint

Comparison Table

LanguageJS-BeautifyESLintstylelint
CSS✅❌✅
EJS✅❌❌
HTML✅❌❌
Handlebars✅❌❌
JSX✅✅❌
JavaScript✅✅❌
Less❌❌✅
Liquid✅❌❌
Mustache✅❌❌
SCSS❌❌✅
Sass❌❌✅
SugarSS❌❌✅
XML✅❌❌

Examples

Invisible characters are shown with the following symbols:

Carriage Return = ␍; Line Feed = ␊; Tab = ⇥; Whitespace = ·.

Edit CSS Example

🚧 Original Code

.class1·{␊
··background-color:·red;␊
}

🔧 true

Using JS-Beautify beautifier:

.class1·{␊
··background-color:·red;␊
}␊

How to configure A .unibeautify.json file would look like the following:

{
  "CSS": {
    "indent_size": 2,
    "indent_char": " ",
    "end_with_newline": true,
    "beautifiers": [
      "JS-Beautify"
    ]
  }
}

Difference from original

Index: true
===================================================================
--- true    Original
+++ true    Beautified
@@ -1,3 +1,3 @@
 .class1·{␊
 ··background-color:·red;␊
-}
\ No newline at end of file
+}␊

🔧 false

Using JS-Beautify beautifier:

.class1·{␊
··background-color:·red;␊
}

How to configure A .unibeautify.json file would look like the following:

{
  "CSS": {
    "indent_size": 2,
    "indent_char": " ",
    "end_with_newline": false,
    "beautifiers": [
      "JS-Beautify"
    ]
  }
}

Difference from original

Index: false
===================================================================
--- false   Original
+++ false   Beautified

Add EJS Example

No example found. Please submit a Pull Request!

Edit HTML Example

🚧 Original Code

<div>␊
<span>Hello</span>␊
<span>World</span>␊
</div>

🔧 true

Using JS-Beautify beautifier:

<div>␊
··<span>Hello</span>␊
··<span>World</span>␊
</div>␊

How to configure A .unibeautify.json file would look like the following:

{
  "HTML": {
    "indent_size": 2,
    "indent_char": " ",
    "end_with_newline": true,
    "beautifiers": [
      "JS-Beautify"
    ]
  }
}

Difference from original

Index: true
===================================================================
--- true    Original
+++ true    Beautified
@@ -1,4 +1,4 @@
 <div>␊
-<span>Hello</span>␊
-<span>World</span>␊
-</div>
\ No newline at end of file
+··<span>Hello</span>␊
+··<span>World</span>␊
+</div>␊

🔧 false

Using JS-Beautify beautifier:

<div>␊
··<span>Hello</span>␊
··<span>World</span>␊
</div>

How to configure A .unibeautify.json file would look like the following:

{
  "HTML": {
    "indent_size": 2,
    "indent_char": " ",
    "end_with_newline": false,
    "beautifiers": [
      "JS-Beautify"
    ]
  }
}

Difference from original

Index: false
===================================================================
--- false   Original
+++ false   Beautified
@@ -1,4 +1,4 @@
 <div>␊
-<span>Hello</span>␊
-<span>World</span>␊
+··<span>Hello</span>␊
+··<span>World</span>␊
 </div>
\ No newline at end of file

Add Handlebars Example

No example found. Please submit a Pull Request!

Edit JSX Example

🚧 Original Code

console.log("hello·world");

🔧 true

Using JS-Beautify beautifier:

console.log("hello·world");␊

How to configure A .unibeautify.json file would look like the following:

{
  "JSX": {
    "indent_size": 2,
    "indent_char": " ",
    "end_with_newline": true,
    "beautifiers": [
      "JS-Beautify"
    ]
  }
}

Difference from original

Index: true
===================================================================
--- true    Original
+++ true    Beautified
@@ -1,1 +1,1 @@
-console.log("hello·world");
\ No newline at end of file
+console.log("hello·world");␊

🔧 false

Using JS-Beautify beautifier:

console.log("hello·world");

How to configure A .unibeautify.json file would look like the following:

{
  "JSX": {
    "indent_size": 2,
    "indent_char": " ",
    "end_with_newline": false,
    "beautifiers": [
      "JS-Beautify"
    ]
  }
}

Difference from original

Index: false
===================================================================
--- false   Original
+++ false   Beautified

Edit JavaScript Example

🚧 Original Code

console.log("hello·world");

🔧 true

Using JS-Beautify beautifier:

console.log("hello·world");␊

How to configure A .unibeautify.json file would look like the following:

{
  "JavaScript": {
    "indent_size": 2,
    "indent_char": " ",
    "end_with_newline": true,
    "beautifiers": [
      "JS-Beautify"
    ]
  }
}

Difference from original

Index: true
===================================================================
--- true    Original
+++ true    Beautified
@@ -1,1 +1,1 @@
-console.log("hello·world");
\ No newline at end of file
+console.log("hello·world");␊

🔧 false

Using JS-Beautify beautifier:

console.log("hello·world");

How to configure A .unibeautify.json file would look like the following:

{
  "JavaScript": {
    "indent_size": 2,
    "indent_char": " ",
    "end_with_newline": false,
    "beautifiers": [
      "JS-Beautify"
    ]
  }
}

Difference from original

Index: false
===================================================================
--- false   Original
+++ false   Beautified

Add Less Example

No example found. Please submit a Pull Request!

Add Liquid Example

No example found. Please submit a Pull Request!

Add Mustache Example

No example found. Please submit a Pull Request!

Add SCSS Example

No example found. Please submit a Pull Request!

Add Sass Example

No example found. Please submit a Pull Request!

Edit SugarSS Example

🚧 Original Code

a␊
··color:·blue

🔧 true

Using stylelint beautifier:

a␊
··color:·blue␊

How to configure A .unibeautify.json file would look like the following:

{
  "SugarSS": {
    "indent_size": 2,
    "indent_char": " ",
    "end_with_newline": true,
    "beautifiers": [
      "stylelint"
    ]
  }
}

Difference from original

Index: true
===================================================================
--- true    Original
+++ true    Beautified
@@ -1,2 +1,2 @@
 a␊
-··color:·blue
\ No newline at end of file
+··color:·blue␊

🔧 false

Using stylelint beautifier:

a␊
··color:·blue␊

How to configure A .unibeautify.json file would look like the following:

{
  "SugarSS": {
    "indent_size": 2,
    "indent_char": " ",
    "end_with_newline": false,
    "beautifiers": [
      "stylelint"
    ]
  }
}

Difference from original

Index: false
===================================================================
--- false   Original
+++ false   Beautified
@@ -1,2 +1,2 @@
 a␊
-··color:·blue
\ No newline at end of file
+··color:·blue␊

Edit XML Example

🚧 Original Code

<div>End·with·newline</div>

🔧 true

Using JS-Beautify beautifier:

<div>End·with·newline</div>␊

How to configure A .unibeautify.json file would look like the following:

{
  "XML": {
    "indent_size": 2,
    "indent_char": " ",
    "end_with_newline": true,
    "beautifiers": [
      "JS-Beautify"
    ]
  }
}

Difference from original

Index: true
===================================================================
--- true    Original
+++ true    Beautified
@@ -1,1 +1,1 @@
-<div>End·with·newline</div>
\ No newline at end of file
+<div>End·with·newline</div>␊

🔧 false

Using JS-Beautify beautifier:

<div>End·with·newline</div>

How to configure A .unibeautify.json file would look like the following:

{
  "XML": {
    "indent_size": 2,
    "indent_char": " ",
    "end_with_newline": false,
    "beautifiers": [
      "JS-Beautify"
    ]
  }
}

Difference from original

Index: false
===================================================================
--- false   Original
+++ false   Beautified

← End With CommaEnd With Semicolon →
  • Support
  • Examples
Unibeautify
Docs
Getting StartedCLIConfigurationOptions
Community
User ShowcaseStack Overflow@Unibeautify on TwitterFollow Unibeautify on Twitter
More
GitHubStar Unibeautify on GitHubCode coverage of UnibeautifyCode coverage of Unibeautify
© 2020 Glavin Wiechert
Credits