From c48eaf967e38e281d87c124cf8323eba2bae60f1 Mon Sep 17 00:00:00 2001 From: Deforder Date: Sat, 14 Jan 2017 10:21:56 +0700 Subject: [PATCH 1/5] Added Overrided EOL option for JS , JSX --- docs/options.md | 3362 ++++------------------------ src/beautifiers/beautifier.coffee | 20 + src/beautifiers/js-beautify.coffee | 34 +- src/beautifiers/prettydiff.coffee | 9 + src/languages/javascript.coffee | 5 + 5 files changed, 455 insertions(+), 2975 deletions(-) diff --git a/docs/options.md b/docs/options.md index 6bb63b3..88beddf 100644 --- a/docs/options.md +++ b/docs/options.md @@ -766,6 +766,7 @@ Automatically beautify Clojure files on save | `beautify_on_save` | :white_check_mark: | :white_check_mark: | | `brace_style` | :white_check_mark: | :x: | | `break_chained_methods` | :white_check_mark: | :x: | +| `end_of_line` | :white_check_mark: | :x: | | `end_with_comma` | :white_check_mark: | :x: | | `end_with_newline` | :white_check_mark: | :x: | | `eval_code` | :white_check_mark: | :x: | @@ -895,6 +896,34 @@ Break chained method calls across subsequent lines (Supported by Coffee Formatte } ``` +##### [End of line](#end-of-line) + +**Namespace**: `js` + +**Key**: `end_of_line` + +**Default**: `System Default` + +**Type**: `string` + +**Enum**: `CRLF` `LF` `System Default` + +**Supported Beautifiers**: [`Coffee Formatter`](#coffee-formatter) + +**Description**: + +Override EOL from line-ending-selector (Supported by Coffee Formatter) + +**Example `.jsbeautifyrc` Configuration** + +```json +{ + "js": { + "end_of_line": "System Default" + } +} +``` + ##### [End with comma](#end-with-comma) **Namespace**: `js` @@ -2177,30 +2206,16 @@ Path to uncrustify config file. i.e. uncrustify.cfg (Supported by Uncrustify) | `disabled` | :white_check_mark: | :white_check_mark: | | `default_beautifier` | :white_check_mark: | :white_check_mark: | | `beautify_on_save` | :white_check_mark: | :white_check_mark: | -| `brace_style` | :white_check_mark: | :x: | -| `break_chained_methods` | :white_check_mark: | :white_check_mark: | -| `end_with_comma` | :white_check_mark: | :white_check_mark: | +| `break_chained_methods` | :x: | :white_check_mark: | +| `end_of_line` | :white_check_mark: | :white_check_mark: | +| `end_with_comma` | :x: | :white_check_mark: | | `end_with_newline` | :white_check_mark: | :x: | -| `eval_code` | :white_check_mark: | :x: | -| `extra_liners` | :white_check_mark: | :x: | | `indent_char` | :white_check_mark: | :white_check_mark: | -| `indent_inner_html` | :white_check_mark: | :x: | -| `indent_level` | :white_check_mark: | :x: | -| `indent_scripts` | :white_check_mark: | :x: | | `indent_size` | :white_check_mark: | :white_check_mark: | -| `indent_with_tabs` | :white_check_mark: | :white_check_mark: | -| `jslint_happy` | :white_check_mark: | :x: | -| `keep_array_indentation` | :white_check_mark: | :x: | -| `keep_function_indentation` | :white_check_mark: | :x: | -| `max_preserve_newlines` | :white_check_mark: | :x: | +| `indent_with_tabs` | :x: | :white_check_mark: | | `preserve_newlines` | :white_check_mark: | :white_check_mark: | -| `space_after_anon_function` | :white_check_mark: | :white_check_mark: | -| `space_before_conditional` | :white_check_mark: | :x: | -| `space_in_paren` | :white_check_mark: | :white_check_mark: | -| `unescape_strings` | :white_check_mark: | :x: | -| `unformatted` | :white_check_mark: | :x: | -| `wrap_attributes` | :white_check_mark: | :x: | -| `wrap_attributes_indent_size` | :white_check_mark: | :x: | +| `space_after_anon_function` | :x: | :white_check_mark: | +| `space_in_paren` | :x: | :white_check_mark: | | `wrap_line_length` | :white_check_mark: | :white_check_mark: | **Description**: @@ -2262,34 +2277,6 @@ Automatically beautify EJS files on save 2. Go into *Packages* and search for "*Atom Beautify*" package. 3. Find the option "*Beautify On Save*" and change it to your desired configuration. -##### [Brace style](#brace-style) - -**Namespace**: `html` - -**Key**: `brace_style` - -**Default**: `collapse` - -**Type**: `string` - -**Enum**: `collapse` `collapse-preserve-inline` `expand` `end-expand` `none` - -**Supported Beautifiers**: [`JS Beautify`](#js-beautify) - -**Description**: - -[collapse|expand|end-expand|none] (Supported by JS Beautify) - -**Example `.jsbeautifyrc` Configuration** - -```json -{ - "html": { - "brace_style": "collapse" - } -} -``` - ##### [Break chained methods](#break-chained-methods) **Namespace**: `js` @@ -2298,11 +2285,11 @@ Automatically beautify EJS files on save **Type**: `boolean` -**Supported Beautifiers**: [`JS Beautify`](#js-beautify) [`Pretty Diff`](#pretty-diff) +**Supported Beautifiers**: [`Pretty Diff`](#pretty-diff) **Description**: -Break chained method calls across subsequent lines (Supported by JS Beautify, Pretty Diff) +Break chained method calls across subsequent lines (Supported by Pretty Diff) **Example `.jsbeautifyrc` Configuration** @@ -2314,6 +2301,34 @@ Break chained method calls across subsequent lines (Supported by JS Beautify, Pr } ``` +##### [End of line](#end-of-line) + +**Namespace**: `js` + +**Key**: `end_of_line` + +**Default**: `System Default` + +**Type**: `string` + +**Enum**: `CRLF` `LF` `System Default` + +**Supported Beautifiers**: [`JS Beautify`](#js-beautify) [`Pretty Diff`](#pretty-diff) + +**Description**: + +Override EOL from line-ending-selector (Supported by JS Beautify, Pretty Diff) + +**Example `.jsbeautifyrc` Configuration** + +```json +{ + "js": { + "end_of_line": "System Default" + } +} +``` + ##### [End with comma](#end-with-comma) **Namespace**: `js` @@ -2322,11 +2337,11 @@ Break chained method calls across subsequent lines (Supported by JS Beautify, Pr **Type**: `boolean` -**Supported Beautifiers**: [`JS Beautify`](#js-beautify) [`Pretty Diff`](#pretty-diff) +**Supported Beautifiers**: [`Pretty Diff`](#pretty-diff) **Description**: -If a terminating comma should be inserted into arrays, object literals, and destructured objects. (Supported by JS Beautify, Pretty Diff) +If a terminating comma should be inserted into arrays, object literals, and destructured objects. (Supported by Pretty Diff) **Example `.jsbeautifyrc` Configuration** @@ -2362,60 +2377,6 @@ End output with newline (Supported by JS Beautify) } ``` -##### [Eval code](#eval-code) - -**Namespace**: `js` - -**Key**: `eval_code` - -**Type**: `boolean` - -**Supported Beautifiers**: [`JS Beautify`](#js-beautify) - -**Description**: - - (Supported by JS Beautify) - -**Example `.jsbeautifyrc` Configuration** - -```json -{ - "js": { - "eval_code": false - } -} -``` - -##### [Extra liners](#extra-liners) - -**Namespace**: `html` - -**Key**: `extra_liners` - -**Default**: `head,body,/html` - -**Type**: `array` - -**Supported Beautifiers**: [`JS Beautify`](#js-beautify) - -**Description**: - -List of tags (defaults to [head,body,/html] that should have an extra newline before them. (Supported by JS Beautify) - -**Example `.jsbeautifyrc` Configuration** - -```json -{ - "html": { - "extra_liners": [ - "head", - "body", - "/html" - ] - } -} -``` - ##### [Indent char](#indent-char) **Namespace**: `html` @@ -2442,82 +2403,6 @@ Indentation character (Supported by JS Beautify, Pretty Diff) } ``` -##### [Indent inner html](#indent-inner-html) - -**Namespace**: `html` - -**Key**: `indent_inner_html` - -**Type**: `boolean` - -**Supported Beautifiers**: [`JS Beautify`](#js-beautify) - -**Description**: - -Indent and sections. (Supported by JS Beautify) - -**Example `.jsbeautifyrc` Configuration** - -```json -{ - "html": { - "indent_inner_html": false - } -} -``` - -##### [Indent level](#indent-level) - -**Namespace**: `js` - -**Key**: `indent_level` - -**Type**: `integer` - -**Supported Beautifiers**: [`JS Beautify`](#js-beautify) - -**Description**: - -Initial indentation level (Supported by JS Beautify) - -**Example `.jsbeautifyrc` Configuration** - -```json -{ - "js": { - "indent_level": 0 - } -} -``` - -##### [Indent scripts](#indent-scripts) - -**Namespace**: `html` - -**Key**: `indent_scripts` - -**Default**: `normal` - -**Type**: `string` - -**Enum**: `keep` `separate` `normal` - -**Supported Beautifiers**: [`JS Beautify`](#js-beautify) - -**Description**: - -[keep|separate|normal] (Supported by JS Beautify) - -**Example `.jsbeautifyrc` Configuration** - -```json -{ - "html": { - "indent_scripts": "normal" - } -} -``` - ##### [Indent size](#indent-size) **Namespace**: `html` @@ -2552,11 +2437,11 @@ Indentation size/length (Supported by JS Beautify, Pretty Diff) **Type**: `boolean` -**Supported Beautifiers**: [`JS Beautify`](#js-beautify) [`Pretty Diff`](#pretty-diff) +**Supported Beautifiers**: [`Pretty Diff`](#pretty-diff) **Description**: -Indentation uses tabs, overrides `Indent Size` and `Indent Char` (Supported by JS Beautify, Pretty Diff) +Indentation uses tabs, overrides `Indent Size` and `Indent Char` (Supported by Pretty Diff) **Example `.jsbeautifyrc` Configuration** @@ -2568,104 +2453,6 @@ Indentation uses tabs, overrides `Indent Size` and `Indent Char` (Supported by J } ``` -##### [Jslint happy](#jslint-happy) - -**Namespace**: `js` - -**Key**: `jslint_happy` - -**Type**: `boolean` - -**Supported Beautifiers**: [`JS Beautify`](#js-beautify) - -**Description**: - -Enable jslint-stricter mode (Supported by JS Beautify) - -**Example `.jsbeautifyrc` Configuration** - -```json -{ - "js": { - "jslint_happy": false - } -} -``` - -##### [Keep array indentation](#keep-array-indentation) - -**Namespace**: `js` - -**Key**: `keep_array_indentation` - -**Type**: `boolean` - -**Supported Beautifiers**: [`JS Beautify`](#js-beautify) - -**Description**: - -Preserve array indentation (Supported by JS Beautify) - -**Example `.jsbeautifyrc` Configuration** - -```json -{ - "js": { - "keep_array_indentation": false - } -} -``` - -##### [Keep function indentation](#keep-function-indentation) - -**Namespace**: `js` - -**Key**: `keep_function_indentation` - -**Type**: `boolean` - -**Supported Beautifiers**: [`JS Beautify`](#js-beautify) - -**Description**: - - (Supported by JS Beautify) - -**Example `.jsbeautifyrc` Configuration** - -```json -{ - "js": { - "keep_function_indentation": false - } -} -``` - -##### [Max preserve newlines](#max-preserve-newlines) - -**Namespace**: `html` - -**Key**: `max_preserve_newlines` - -**Default**: `10` - -**Type**: `integer` - -**Supported Beautifiers**: [`JS Beautify`](#js-beautify) - -**Description**: - -Number of line-breaks to be preserved in one chunk (Supported by JS Beautify) - -**Example `.jsbeautifyrc` Configuration** - -```json -{ - "html": { - "max_preserve_newlines": 10 - } -} -``` - ##### [Preserve newlines](#preserve-newlines) **Namespace**: `html` @@ -2700,11 +2487,11 @@ Preserve line-breaks (Supported by JS Beautify, Pretty Diff) **Type**: `boolean` -**Supported Beautifiers**: [`JS Beautify`](#js-beautify) [`Pretty Diff`](#pretty-diff) +**Supported Beautifiers**: [`Pretty Diff`](#pretty-diff) **Description**: -Add a space before an anonymous function's parens, ie. function () (Supported by JS Beautify, Pretty Diff) +Add a space before an anonymous function's parens, ie. function () (Supported by Pretty Diff) **Example `.jsbeautifyrc` Configuration** @@ -2716,32 +2503,6 @@ Add a space before an anonymous function's parens, ie. function () (Supported by } ``` -##### [Space before conditional](#space-before-conditional) - -**Namespace**: `js` - -**Key**: `space_before_conditional` - -**Default**: `true` - -**Type**: `boolean` - -**Supported Beautifiers**: [`JS Beautify`](#js-beautify) - -**Description**: - - (Supported by JS Beautify) - -**Example `.jsbeautifyrc` Configuration** - -```json -{ - "js": { - "space_before_conditional": true - } -} -``` - ##### [Space in paren](#space-in-paren) **Namespace**: `js` @@ -2750,11 +2511,11 @@ Add a space before an anonymous function's parens, ie. function () (Supported by **Type**: `boolean` -**Supported Beautifiers**: [`JS Beautify`](#js-beautify) [`Pretty Diff`](#pretty-diff) +**Supported Beautifiers**: [`Pretty Diff`](#pretty-diff) **Description**: -Add padding spaces within paren, ie. f( a, b ) (Supported by JS Beautify, Pretty Diff) +Add padding spaces within paren, ie. f( a, b ) (Supported by Pretty Diff) **Example `.jsbeautifyrc` Configuration** @@ -2766,179 +2527,6 @@ Add padding spaces within paren, ie. f( a, b ) (Supported by JS Beautify, Pretty } ``` -##### [Unescape strings](#unescape-strings) - -**Namespace**: `js` - -**Key**: `unescape_strings` - -**Type**: `boolean` - -**Supported Beautifiers**: [`JS Beautify`](#js-beautify) - -**Description**: - -Decode printable characters encoded in xNN notation (Supported by JS Beautify) - -**Example `.jsbeautifyrc` Configuration** - -```json -{ - "js": { - "unescape_strings": false - } -} -``` - -##### [Unformatted](#unformatted) - -**Namespace**: `html` - -**Key**: `unformatted` - -**Default**: `a,abbr,area,audio,b,bdi,bdo,br,button,canvas,cite,code,data,datalist,del,dfn,em,embed,i,iframe,img,input,ins,kbd,keygen,label,map,mark,math,meter,noscript,object,output,progress,q,ruby,s,samp,select,small,span,strong,sub,sup,svg,template,textarea,time,u,var,video,wbr,text,acronym,address,big,dt,ins,small,strike,tt,pre,h1,h2,h3,h4,h5,h6` - -**Type**: `array` - -**Supported Beautifiers**: [`JS Beautify`](#js-beautify) - -**Description**: - -List of tags (defaults to inline) that should not be reformatted (Supported by JS Beautify) - -**Example `.jsbeautifyrc` Configuration** - -```json -{ - "html": { - "unformatted": [ - "a", - "abbr", - "area", - "audio", - "b", - "bdi", - "bdo", - "br", - "button", - "canvas", - "cite", - "code", - "data", - "datalist", - "del", - "dfn", - "em", - "embed", - "i", - "iframe", - "img", - "input", - "ins", - "kbd", - "keygen", - "label", - "map", - "mark", - "math", - "meter", - "noscript", - "object", - "output", - "progress", - "q", - "ruby", - "s", - "samp", - "select", - "small", - "span", - "strong", - "sub", - "sup", - "svg", - "template", - "textarea", - "time", - "u", - "var", - "video", - "wbr", - "text", - "acronym", - "address", - "big", - "dt", - "ins", - "small", - "strike", - "tt", - "pre", - "h1", - "h2", - "h3", - "h4", - "h5", - "h6" - ] - } -} -``` - -##### [Wrap attributes](#wrap-attributes) - -**Namespace**: `html` - -**Key**: `wrap_attributes` - -**Default**: `auto` - -**Type**: `string` - -**Enum**: `auto` `force` - -**Supported Beautifiers**: [`JS Beautify`](#js-beautify) - -**Description**: - -Wrap attributes to new lines [auto|force] (Supported by JS Beautify) - -**Example `.jsbeautifyrc` Configuration** - -```json -{ - "html": { - "wrap_attributes": "auto" - } -} -``` - -##### [Wrap attributes indent size](#wrap-attributes-indent-size) - -**Namespace**: `html` - -**Key**: `wrap_attributes_indent_size` - -**Default**: `4` - -**Type**: `integer` - -**Supported Beautifiers**: [`JS Beautify`](#js-beautify) - -**Description**: - -Indent wrapped attributes to after N characters (Supported by JS Beautify) - -**Example `.jsbeautifyrc` Configuration** - -```json -{ - "html": { - "wrap_attributes_indent_size": 4 - } -} -``` - ##### [Wrap line length](#wrap-line-length) **Namespace**: `html` @@ -3694,18 +3282,10 @@ Automatically beautify Go files on save | `disabled` | :white_check_mark: | :white_check_mark: | | `default_beautifier` | :white_check_mark: | :white_check_mark: | | `beautify_on_save` | :white_check_mark: | :white_check_mark: | -| `brace_style` | :white_check_mark: | :x: | | `end_with_newline` | :white_check_mark: | :x: | -| `extra_liners` | :white_check_mark: | :x: | | `indent_char` | :white_check_mark: | :white_check_mark: | -| `indent_inner_html` | :white_check_mark: | :x: | -| `indent_scripts` | :white_check_mark: | :x: | | `indent_size` | :white_check_mark: | :white_check_mark: | -| `max_preserve_newlines` | :white_check_mark: | :x: | | `preserve_newlines` | :white_check_mark: | :white_check_mark: | -| `unformatted` | :white_check_mark: | :x: | -| `wrap_attributes` | :white_check_mark: | :x: | -| `wrap_attributes_indent_size` | :white_check_mark: | :x: | | `wrap_line_length` | :white_check_mark: | :white_check_mark: | **Description**: @@ -3767,34 +3347,6 @@ Automatically beautify Handlebars files on save 2. Go into *Packages* and search for "*Atom Beautify*" package. 3. Find the option "*Beautify On Save*" and change it to your desired configuration. -##### [Brace style](#brace-style) - -**Namespace**: `html` - -**Key**: `brace_style` - -**Default**: `collapse` - -**Type**: `string` - -**Enum**: `collapse` `expand` `end-expand` `none` - -**Supported Beautifiers**: [`JS Beautify`](#js-beautify) - -**Description**: - -[collapse|expand|end-expand|none] (Supported by JS Beautify) - -**Example `.jsbeautifyrc` Configuration** - -```json -{ - "html": { - "brace_style": "collapse" - } -} -``` - ##### [End with newline](#end-with-newline) **Namespace**: `html` @@ -3819,36 +3371,6 @@ End output with newline (Supported by JS Beautify) } ``` -##### [Extra liners](#extra-liners) - -**Namespace**: `html` - -**Key**: `extra_liners` - -**Default**: `head,body,/html` - -**Type**: `array` - -**Supported Beautifiers**: [`JS Beautify`](#js-beautify) - -**Description**: - -List of tags (defaults to [head,body,/html] that should have an extra newline before them. (Supported by JS Beautify) - -**Example `.jsbeautifyrc` Configuration** - -```json -{ - "html": { - "extra_liners": [ - "head", - "body", - "/html" - ] - } -} -``` - ##### [Indent char](#indent-char) **Namespace**: `html` @@ -3875,58 +3397,6 @@ Indentation character (Supported by JS Beautify, Pretty Diff) } ``` -##### [Indent inner html](#indent-inner-html) - -**Namespace**: `html` - -**Key**: `indent_inner_html` - -**Type**: `boolean` - -**Supported Beautifiers**: [`JS Beautify`](#js-beautify) - -**Description**: - -Indent and sections. (Supported by JS Beautify) - -**Example `.jsbeautifyrc` Configuration** - -```json -{ - "html": { - "indent_inner_html": false - } -} -``` - -##### [Indent scripts](#indent-scripts) - -**Namespace**: `html` - -**Key**: `indent_scripts` - -**Default**: `normal` - -**Type**: `string` - -**Enum**: `keep` `separate` `normal` - -**Supported Beautifiers**: [`JS Beautify`](#js-beautify) - -**Description**: - -[keep|separate|normal] (Supported by JS Beautify) - -**Example `.jsbeautifyrc` Configuration** - -```json -{ - "html": { - "indent_scripts": "normal" - } -} -``` - ##### [Indent size](#indent-size) **Namespace**: `html` @@ -3953,32 +3423,6 @@ Indentation size/length (Supported by JS Beautify, Pretty Diff) } ``` -##### [Max preserve newlines](#max-preserve-newlines) - -**Namespace**: `html` - -**Key**: `max_preserve_newlines` - -**Default**: `10` - -**Type**: `integer` - -**Supported Beautifiers**: [`JS Beautify`](#js-beautify) - -**Description**: - -Number of line-breaks to be preserved in one chunk (Supported by JS Beautify) - -**Example `.jsbeautifyrc` Configuration** - -```json -{ - "html": { - "max_preserve_newlines": 10 - } -} -``` - ##### [Preserve newlines](#preserve-newlines) **Namespace**: `html` @@ -4005,155 +3449,6 @@ Preserve line-breaks (Supported by JS Beautify, Pretty Diff) } ``` -##### [Unformatted](#unformatted) - -**Namespace**: `html` - -**Key**: `unformatted` - -**Default**: `a,abbr,area,audio,b,bdi,bdo,br,button,canvas,cite,code,data,datalist,del,dfn,em,embed,i,iframe,img,input,ins,kbd,keygen,label,map,mark,math,meter,noscript,object,output,progress,q,ruby,s,samp,select,small,span,strong,sub,sup,svg,template,textarea,time,u,var,video,wbr,text,acronym,address,big,dt,ins,small,strike,tt,pre,h1,h2,h3,h4,h5,h6` - -**Type**: `array` - -**Supported Beautifiers**: [`JS Beautify`](#js-beautify) - -**Description**: - -List of tags (defaults to inline) that should not be reformatted (Supported by JS Beautify) - -**Example `.jsbeautifyrc` Configuration** - -```json -{ - "html": { - "unformatted": [ - "a", - "abbr", - "area", - "audio", - "b", - "bdi", - "bdo", - "br", - "button", - "canvas", - "cite", - "code", - "data", - "datalist", - "del", - "dfn", - "em", - "embed", - "i", - "iframe", - "img", - "input", - "ins", - "kbd", - "keygen", - "label", - "map", - "mark", - "math", - "meter", - "noscript", - "object", - "output", - "progress", - "q", - "ruby", - "s", - "samp", - "select", - "small", - "span", - "strong", - "sub", - "sup", - "svg", - "template", - "textarea", - "time", - "u", - "var", - "video", - "wbr", - "text", - "acronym", - "address", - "big", - "dt", - "ins", - "small", - "strike", - "tt", - "pre", - "h1", - "h2", - "h3", - "h4", - "h5", - "h6" - ] - } -} -``` - -##### [Wrap attributes](#wrap-attributes) - -**Namespace**: `html` - -**Key**: `wrap_attributes` - -**Default**: `auto` - -**Type**: `string` - -**Enum**: `auto` `force` - -**Supported Beautifiers**: [`JS Beautify`](#js-beautify) - -**Description**: - -Wrap attributes to new lines [auto|force] (Supported by JS Beautify) - -**Example `.jsbeautifyrc` Configuration** - -```json -{ - "html": { - "wrap_attributes": "auto" - } -} -``` - -##### [Wrap attributes indent size](#wrap-attributes-indent-size) - -**Namespace**: `html` - -**Key**: `wrap_attributes_indent_size` - -**Default**: `4` - -**Type**: `integer` - -**Supported Beautifiers**: [`JS Beautify`](#js-beautify) - -**Description**: - -Indent wrapped attributes to after N characters (Supported by JS Beautify) - -**Example `.jsbeautifyrc` Configuration** - -```json -{ - "html": { - "wrap_attributes_indent_size": 4 - } -} -``` - ##### [Wrap line length](#wrap-line-length) **Namespace**: `html` @@ -4258,18 +3553,10 @@ Automatically beautify Haskell files on save | `disabled` | :white_check_mark: | :white_check_mark: | | `default_beautifier` | :white_check_mark: | :white_check_mark: | | `beautify_on_save` | :white_check_mark: | :white_check_mark: | -| `brace_style` | :white_check_mark: | :x: | | `end_with_newline` | :white_check_mark: | :x: | -| `extra_liners` | :white_check_mark: | :x: | | `indent_char` | :white_check_mark: | :white_check_mark: | -| `indent_inner_html` | :white_check_mark: | :x: | -| `indent_scripts` | :white_check_mark: | :x: | | `indent_size` | :white_check_mark: | :white_check_mark: | -| `max_preserve_newlines` | :white_check_mark: | :x: | | `preserve_newlines` | :white_check_mark: | :white_check_mark: | -| `unformatted` | :white_check_mark: | :x: | -| `wrap_attributes` | :white_check_mark: | :x: | -| `wrap_attributes_indent_size` | :white_check_mark: | :x: | | `wrap_line_length` | :white_check_mark: | :white_check_mark: | **Description**: @@ -4331,34 +3618,6 @@ Automatically beautify HTML files on save 2. Go into *Packages* and search for "*Atom Beautify*" package. 3. Find the option "*Beautify On Save*" and change it to your desired configuration. -##### [Brace style](#brace-style) - -**Namespace**: `html` - -**Key**: `brace_style` - -**Default**: `collapse` - -**Type**: `string` - -**Enum**: `collapse` `expand` `end-expand` `none` - -**Supported Beautifiers**: [`JS Beautify`](#js-beautify) - -**Description**: - -[collapse|expand|end-expand|none] (Supported by JS Beautify) - -**Example `.jsbeautifyrc` Configuration** - -```json -{ - "html": { - "brace_style": "collapse" - } -} -``` - ##### [End with newline](#end-with-newline) **Namespace**: `html` @@ -4383,36 +3642,6 @@ End output with newline (Supported by JS Beautify) } ``` -##### [Extra liners](#extra-liners) - -**Namespace**: `html` - -**Key**: `extra_liners` - -**Default**: `head,body,/html` - -**Type**: `array` - -**Supported Beautifiers**: [`JS Beautify`](#js-beautify) - -**Description**: - -List of tags (defaults to [head,body,/html] that should have an extra newline before them. (Supported by JS Beautify) - -**Example `.jsbeautifyrc` Configuration** - -```json -{ - "html": { - "extra_liners": [ - "head", - "body", - "/html" - ] - } -} -``` - ##### [Indent char](#indent-char) **Namespace**: `html` @@ -4439,58 +3668,6 @@ Indentation character (Supported by JS Beautify, Pretty Diff) } ``` -##### [Indent inner html](#indent-inner-html) - -**Namespace**: `html` - -**Key**: `indent_inner_html` - -**Type**: `boolean` - -**Supported Beautifiers**: [`JS Beautify`](#js-beautify) - -**Description**: - -Indent and sections. (Supported by JS Beautify) - -**Example `.jsbeautifyrc` Configuration** - -```json -{ - "html": { - "indent_inner_html": false - } -} -``` - -##### [Indent scripts](#indent-scripts) - -**Namespace**: `html` - -**Key**: `indent_scripts` - -**Default**: `normal` - -**Type**: `string` - -**Enum**: `keep` `separate` `normal` - -**Supported Beautifiers**: [`JS Beautify`](#js-beautify) - -**Description**: - -[keep|separate|normal] (Supported by JS Beautify) - -**Example `.jsbeautifyrc` Configuration** - -```json -{ - "html": { - "indent_scripts": "normal" - } -} -``` - ##### [Indent size](#indent-size) **Namespace**: `html` @@ -4517,32 +3694,6 @@ Indentation size/length (Supported by JS Beautify, Pretty Diff) } ``` -##### [Max preserve newlines](#max-preserve-newlines) - -**Namespace**: `html` - -**Key**: `max_preserve_newlines` - -**Default**: `10` - -**Type**: `integer` - -**Supported Beautifiers**: [`JS Beautify`](#js-beautify) - -**Description**: - -Number of line-breaks to be preserved in one chunk (Supported by JS Beautify) - -**Example `.jsbeautifyrc` Configuration** - -```json -{ - "html": { - "max_preserve_newlines": 10 - } -} -``` - ##### [Preserve newlines](#preserve-newlines) **Namespace**: `html` @@ -4569,155 +3720,6 @@ Preserve line-breaks (Supported by JS Beautify, Pretty Diff) } ``` -##### [Unformatted](#unformatted) - -**Namespace**: `html` - -**Key**: `unformatted` - -**Default**: `a,abbr,area,audio,b,bdi,bdo,br,button,canvas,cite,code,data,datalist,del,dfn,em,embed,i,iframe,img,input,ins,kbd,keygen,label,map,mark,math,meter,noscript,object,output,progress,q,ruby,s,samp,select,small,span,strong,sub,sup,svg,template,textarea,time,u,var,video,wbr,text,acronym,address,big,dt,ins,small,strike,tt,pre,h1,h2,h3,h4,h5,h6` - -**Type**: `array` - -**Supported Beautifiers**: [`JS Beautify`](#js-beautify) - -**Description**: - -List of tags (defaults to inline) that should not be reformatted (Supported by JS Beautify) - -**Example `.jsbeautifyrc` Configuration** - -```json -{ - "html": { - "unformatted": [ - "a", - "abbr", - "area", - "audio", - "b", - "bdi", - "bdo", - "br", - "button", - "canvas", - "cite", - "code", - "data", - "datalist", - "del", - "dfn", - "em", - "embed", - "i", - "iframe", - "img", - "input", - "ins", - "kbd", - "keygen", - "label", - "map", - "mark", - "math", - "meter", - "noscript", - "object", - "output", - "progress", - "q", - "ruby", - "s", - "samp", - "select", - "small", - "span", - "strong", - "sub", - "sup", - "svg", - "template", - "textarea", - "time", - "u", - "var", - "video", - "wbr", - "text", - "acronym", - "address", - "big", - "dt", - "ins", - "small", - "strike", - "tt", - "pre", - "h1", - "h2", - "h3", - "h4", - "h5", - "h6" - ] - } -} -``` - -##### [Wrap attributes](#wrap-attributes) - -**Namespace**: `html` - -**Key**: `wrap_attributes` - -**Default**: `auto` - -**Type**: `string` - -**Enum**: `auto` `force` - -**Supported Beautifiers**: [`JS Beautify`](#js-beautify) - -**Description**: - -Wrap attributes to new lines [auto|force] (Supported by JS Beautify) - -**Example `.jsbeautifyrc` Configuration** - -```json -{ - "html": { - "wrap_attributes": "auto" - } -} -``` - -##### [Wrap attributes indent size](#wrap-attributes-indent-size) - -**Namespace**: `html` - -**Key**: `wrap_attributes_indent_size` - -**Default**: `4` - -**Type**: `integer` - -**Supported Beautifiers**: [`JS Beautify`](#js-beautify) - -**Description**: - -Indent wrapped attributes to after N characters (Supported by JS Beautify) - -**Example `.jsbeautifyrc` Configuration** - -```json -{ - "html": { - "wrap_attributes_indent_size": 4 - } -} -``` - ##### [Wrap line length](#wrap-line-length) **Namespace**: `html` @@ -4970,24 +3972,16 @@ Path to uncrustify config file. i.e. uncrustify.cfg (Supported by Uncrustify) | `disabled` | :white_check_mark: | :white_check_mark: | :white_check_mark: | | `default_beautifier` | :white_check_mark: | :white_check_mark: | :white_check_mark: | | `beautify_on_save` | :white_check_mark: | :white_check_mark: | :white_check_mark: | -| `brace_style` | :white_check_mark: | :x: | :x: | -| `break_chained_methods` | :white_check_mark: | :x: | :white_check_mark: | -| `end_with_comma` | :white_check_mark: | :x: | :white_check_mark: | +| `break_chained_methods` | :x: | :x: | :white_check_mark: | +| `end_of_line` | :white_check_mark: | :x: | :white_check_mark: | +| `end_with_comma` | :x: | :x: | :white_check_mark: | | `end_with_newline` | :white_check_mark: | :x: | :x: | -| `eval_code` | :white_check_mark: | :x: | :x: | | `indent_char` | :white_check_mark: | :x: | :white_check_mark: | -| `indent_level` | :white_check_mark: | :x: | :x: | | `indent_size` | :white_check_mark: | :x: | :white_check_mark: | -| `indent_with_tabs` | :white_check_mark: | :x: | :white_check_mark: | -| `jslint_happy` | :white_check_mark: | :x: | :x: | -| `keep_array_indentation` | :white_check_mark: | :x: | :x: | -| `keep_function_indentation` | :white_check_mark: | :x: | :x: | -| `max_preserve_newlines` | :white_check_mark: | :x: | :x: | +| `indent_with_tabs` | :x: | :x: | :white_check_mark: | | `preserve_newlines` | :white_check_mark: | :x: | :white_check_mark: | -| `space_after_anon_function` | :white_check_mark: | :x: | :white_check_mark: | -| `space_before_conditional` | :white_check_mark: | :x: | :x: | -| `space_in_paren` | :white_check_mark: | :x: | :white_check_mark: | -| `unescape_strings` | :white_check_mark: | :x: | :x: | +| `space_after_anon_function` | :x: | :x: | :white_check_mark: | +| `space_in_paren` | :x: | :x: | :white_check_mark: | | `wrap_line_length` | :white_check_mark: | :x: | :white_check_mark: | **Description**: @@ -5049,34 +4043,6 @@ Automatically beautify JavaScript files on save 2. Go into *Packages* and search for "*Atom Beautify*" package. 3. Find the option "*Beautify On Save*" and change it to your desired configuration. -##### [Brace style](#brace-style) - -**Namespace**: `js` - -**Key**: `brace_style` - -**Default**: `collapse` - -**Type**: `string` - -**Enum**: `collapse` `collapse-preserve-inline` `expand` `end-expand` `none` - -**Supported Beautifiers**: [`JS Beautify`](#js-beautify) - -**Description**: - -[collapse|collapse-preserve-inline|expand|end-expand|none] (Supported by JS Beautify) - -**Example `.jsbeautifyrc` Configuration** - -```json -{ - "js": { - "brace_style": "collapse" - } -} -``` - ##### [Break chained methods](#break-chained-methods) **Namespace**: `js` @@ -5085,11 +4051,11 @@ Automatically beautify JavaScript files on save **Type**: `boolean` -**Supported Beautifiers**: [`JS Beautify`](#js-beautify) [`Pretty Diff`](#pretty-diff) +**Supported Beautifiers**: [`Pretty Diff`](#pretty-diff) **Description**: -Break chained method calls across subsequent lines (Supported by JS Beautify, Pretty Diff) +Break chained method calls across subsequent lines (Supported by Pretty Diff) **Example `.jsbeautifyrc` Configuration** @@ -5101,6 +4067,34 @@ Break chained method calls across subsequent lines (Supported by JS Beautify, Pr } ``` +##### [End of line](#end-of-line) + +**Namespace**: `js` + +**Key**: `end_of_line` + +**Default**: `System Default` + +**Type**: `string` + +**Enum**: `CRLF` `LF` `System Default` + +**Supported Beautifiers**: [`JS Beautify`](#js-beautify) [`Pretty Diff`](#pretty-diff) + +**Description**: + +Override EOL from line-ending-selector (Supported by JS Beautify, Pretty Diff) + +**Example `.jsbeautifyrc` Configuration** + +```json +{ + "js": { + "end_of_line": "System Default" + } +} +``` + ##### [End with comma](#end-with-comma) **Namespace**: `js` @@ -5109,11 +4103,11 @@ Break chained method calls across subsequent lines (Supported by JS Beautify, Pr **Type**: `boolean` -**Supported Beautifiers**: [`JS Beautify`](#js-beautify) [`Pretty Diff`](#pretty-diff) +**Supported Beautifiers**: [`Pretty Diff`](#pretty-diff) **Description**: -If a terminating comma should be inserted into arrays, object literals, and destructured objects. (Supported by JS Beautify, Pretty Diff) +If a terminating comma should be inserted into arrays, object literals, and destructured objects. (Supported by Pretty Diff) **Example `.jsbeautifyrc` Configuration** @@ -5149,30 +4143,6 @@ End output with newline (Supported by JS Beautify) } ``` -##### [Eval code](#eval-code) - -**Namespace**: `js` - -**Key**: `eval_code` - -**Type**: `boolean` - -**Supported Beautifiers**: [`JS Beautify`](#js-beautify) - -**Description**: - - (Supported by JS Beautify) - -**Example `.jsbeautifyrc` Configuration** - -```json -{ - "js": { - "eval_code": false - } -} -``` - ##### [Indent char](#indent-char) **Namespace**: `js` @@ -5199,30 +4169,6 @@ Indentation character (Supported by JS Beautify, Pretty Diff) } ``` -##### [Indent level](#indent-level) - -**Namespace**: `js` - -**Key**: `indent_level` - -**Type**: `integer` - -**Supported Beautifiers**: [`JS Beautify`](#js-beautify) - -**Description**: - -Initial indentation level (Supported by JS Beautify) - -**Example `.jsbeautifyrc` Configuration** - -```json -{ - "js": { - "indent_level": 0 - } -} -``` - ##### [Indent size](#indent-size) **Namespace**: `js` @@ -5257,11 +4203,11 @@ Indentation size/length (Supported by JS Beautify, Pretty Diff) **Type**: `boolean` -**Supported Beautifiers**: [`JS Beautify`](#js-beautify) [`Pretty Diff`](#pretty-diff) +**Supported Beautifiers**: [`Pretty Diff`](#pretty-diff) **Description**: -Indentation uses tabs, overrides `Indent Size` and `Indent Char` (Supported by JS Beautify, Pretty Diff) +Indentation uses tabs, overrides `Indent Size` and `Indent Char` (Supported by Pretty Diff) **Example `.jsbeautifyrc` Configuration** @@ -5273,104 +4219,6 @@ Indentation uses tabs, overrides `Indent Size` and `Indent Char` (Supported by J } ``` -##### [Jslint happy](#jslint-happy) - -**Namespace**: `js` - -**Key**: `jslint_happy` - -**Type**: `boolean` - -**Supported Beautifiers**: [`JS Beautify`](#js-beautify) - -**Description**: - -Enable jslint-stricter mode (Supported by JS Beautify) - -**Example `.jsbeautifyrc` Configuration** - -```json -{ - "js": { - "jslint_happy": false - } -} -``` - -##### [Keep array indentation](#keep-array-indentation) - -**Namespace**: `js` - -**Key**: `keep_array_indentation` - -**Type**: `boolean` - -**Supported Beautifiers**: [`JS Beautify`](#js-beautify) - -**Description**: - -Preserve array indentation (Supported by JS Beautify) - -**Example `.jsbeautifyrc` Configuration** - -```json -{ - "js": { - "keep_array_indentation": false - } -} -``` - -##### [Keep function indentation](#keep-function-indentation) - -**Namespace**: `js` - -**Key**: `keep_function_indentation` - -**Type**: `boolean` - -**Supported Beautifiers**: [`JS Beautify`](#js-beautify) - -**Description**: - - (Supported by JS Beautify) - -**Example `.jsbeautifyrc` Configuration** - -```json -{ - "js": { - "keep_function_indentation": false - } -} -``` - -##### [Max preserve newlines](#max-preserve-newlines) - -**Namespace**: `js` - -**Key**: `max_preserve_newlines` - -**Default**: `10` - -**Type**: `integer` - -**Supported Beautifiers**: [`JS Beautify`](#js-beautify) - -**Description**: - -Number of line-breaks to be preserved in one chunk (Supported by JS Beautify) - -**Example `.jsbeautifyrc` Configuration** - -```json -{ - "js": { - "max_preserve_newlines": 10 - } -} -``` - ##### [Preserve newlines](#preserve-newlines) **Namespace**: `js` @@ -5405,11 +4253,11 @@ Preserve line-breaks (Supported by JS Beautify, Pretty Diff) **Type**: `boolean` -**Supported Beautifiers**: [`JS Beautify`](#js-beautify) [`Pretty Diff`](#pretty-diff) +**Supported Beautifiers**: [`Pretty Diff`](#pretty-diff) **Description**: -Add a space before an anonymous function's parens, ie. function () (Supported by JS Beautify, Pretty Diff) +Add a space before an anonymous function's parens, ie. function () (Supported by Pretty Diff) **Example `.jsbeautifyrc` Configuration** @@ -5421,32 +4269,6 @@ Add a space before an anonymous function's parens, ie. function () (Supported by } ``` -##### [Space before conditional](#space-before-conditional) - -**Namespace**: `js` - -**Key**: `space_before_conditional` - -**Default**: `true` - -**Type**: `boolean` - -**Supported Beautifiers**: [`JS Beautify`](#js-beautify) - -**Description**: - - (Supported by JS Beautify) - -**Example `.jsbeautifyrc` Configuration** - -```json -{ - "js": { - "space_before_conditional": true - } -} -``` - ##### [Space in paren](#space-in-paren) **Namespace**: `js` @@ -5455,11 +4277,11 @@ Add a space before an anonymous function's parens, ie. function () (Supported by **Type**: `boolean` -**Supported Beautifiers**: [`JS Beautify`](#js-beautify) [`Pretty Diff`](#pretty-diff) +**Supported Beautifiers**: [`Pretty Diff`](#pretty-diff) **Description**: -Add padding spaces within paren, ie. f( a, b ) (Supported by JS Beautify, Pretty Diff) +Add padding spaces within paren, ie. f( a, b ) (Supported by Pretty Diff) **Example `.jsbeautifyrc` Configuration** @@ -5471,30 +4293,6 @@ Add padding spaces within paren, ie. f( a, b ) (Supported by JS Beautify, Pretty } ``` -##### [Unescape strings](#unescape-strings) - -**Namespace**: `js` - -**Key**: `unescape_strings` - -**Type**: `boolean` - -**Supported Beautifiers**: [`JS Beautify`](#js-beautify) - -**Description**: - -Decode printable characters encoded in xNN notation (Supported by JS Beautify) - -**Example `.jsbeautifyrc` Configuration** - -```json -{ - "js": { - "unescape_strings": false - } -} -``` - ##### [Wrap line length](#wrap-line-length) **Namespace**: `js` @@ -5528,24 +4326,16 @@ Wrap lines at next opportunity after N characters (Supported by JS Beautify, Pre | `disabled` | :white_check_mark: | :white_check_mark: | | `default_beautifier` | :white_check_mark: | :white_check_mark: | | `beautify_on_save` | :white_check_mark: | :white_check_mark: | -| `brace_style` | :white_check_mark: | :x: | -| `break_chained_methods` | :white_check_mark: | :white_check_mark: | -| `end_with_comma` | :white_check_mark: | :white_check_mark: | +| `break_chained_methods` | :x: | :white_check_mark: | +| `end_of_line` | :white_check_mark: | :white_check_mark: | +| `end_with_comma` | :x: | :white_check_mark: | | `end_with_newline` | :white_check_mark: | :x: | -| `eval_code` | :white_check_mark: | :x: | | `indent_char` | :white_check_mark: | :white_check_mark: | -| `indent_level` | :white_check_mark: | :x: | | `indent_size` | :white_check_mark: | :white_check_mark: | -| `indent_with_tabs` | :white_check_mark: | :white_check_mark: | -| `jslint_happy` | :white_check_mark: | :x: | -| `keep_array_indentation` | :white_check_mark: | :x: | -| `keep_function_indentation` | :white_check_mark: | :x: | -| `max_preserve_newlines` | :white_check_mark: | :x: | +| `indent_with_tabs` | :x: | :white_check_mark: | | `preserve_newlines` | :white_check_mark: | :white_check_mark: | -| `space_after_anon_function` | :white_check_mark: | :white_check_mark: | -| `space_before_conditional` | :white_check_mark: | :x: | -| `space_in_paren` | :white_check_mark: | :white_check_mark: | -| `unescape_strings` | :white_check_mark: | :x: | +| `space_after_anon_function` | :x: | :white_check_mark: | +| `space_in_paren` | :x: | :white_check_mark: | | `wrap_line_length` | :white_check_mark: | :white_check_mark: | **Description**: @@ -5607,34 +4397,6 @@ Automatically beautify JSON files on save 2. Go into *Packages* and search for "*Atom Beautify*" package. 3. Find the option "*Beautify On Save*" and change it to your desired configuration. -##### [Brace style](#brace-style) - -**Namespace**: `js` - -**Key**: `brace_style` - -**Default**: `collapse` - -**Type**: `string` - -**Enum**: `collapse` `collapse-preserve-inline` `expand` `end-expand` `none` - -**Supported Beautifiers**: [`JS Beautify`](#js-beautify) - -**Description**: - -[collapse|collapse-preserve-inline|expand|end-expand|none] (Supported by JS Beautify) - -**Example `.jsbeautifyrc` Configuration** - -```json -{ - "js": { - "brace_style": "collapse" - } -} -``` - ##### [Break chained methods](#break-chained-methods) **Namespace**: `js` @@ -5643,11 +4405,11 @@ Automatically beautify JSON files on save **Type**: `boolean` -**Supported Beautifiers**: [`JS Beautify`](#js-beautify) [`Pretty Diff`](#pretty-diff) +**Supported Beautifiers**: [`Pretty Diff`](#pretty-diff) **Description**: -Break chained method calls across subsequent lines (Supported by JS Beautify, Pretty Diff) +Break chained method calls across subsequent lines (Supported by Pretty Diff) **Example `.jsbeautifyrc` Configuration** @@ -5659,6 +4421,34 @@ Break chained method calls across subsequent lines (Supported by JS Beautify, Pr } ``` +##### [End of line](#end-of-line) + +**Namespace**: `js` + +**Key**: `end_of_line` + +**Default**: `System Default` + +**Type**: `string` + +**Enum**: `CRLF` `LF` `System Default` + +**Supported Beautifiers**: [`JS Beautify`](#js-beautify) [`Pretty Diff`](#pretty-diff) + +**Description**: + +Override EOL from line-ending-selector (Supported by JS Beautify, Pretty Diff) + +**Example `.jsbeautifyrc` Configuration** + +```json +{ + "js": { + "end_of_line": "System Default" + } +} +``` + ##### [End with comma](#end-with-comma) **Namespace**: `js` @@ -5667,11 +4457,11 @@ Break chained method calls across subsequent lines (Supported by JS Beautify, Pr **Type**: `boolean` -**Supported Beautifiers**: [`JS Beautify`](#js-beautify) [`Pretty Diff`](#pretty-diff) +**Supported Beautifiers**: [`Pretty Diff`](#pretty-diff) **Description**: -If a terminating comma should be inserted into arrays, object literals, and destructured objects. (Supported by JS Beautify, Pretty Diff) +If a terminating comma should be inserted into arrays, object literals, and destructured objects. (Supported by Pretty Diff) **Example `.jsbeautifyrc` Configuration** @@ -5707,30 +4497,6 @@ End output with newline (Supported by JS Beautify) } ``` -##### [Eval code](#eval-code) - -**Namespace**: `js` - -**Key**: `eval_code` - -**Type**: `boolean` - -**Supported Beautifiers**: [`JS Beautify`](#js-beautify) - -**Description**: - - (Supported by JS Beautify) - -**Example `.jsbeautifyrc` Configuration** - -```json -{ - "js": { - "eval_code": false - } -} -``` - ##### [Indent char](#indent-char) **Namespace**: `js` @@ -5757,30 +4523,6 @@ Indentation character (Supported by JS Beautify, Pretty Diff) } ``` -##### [Indent level](#indent-level) - -**Namespace**: `js` - -**Key**: `indent_level` - -**Type**: `integer` - -**Supported Beautifiers**: [`JS Beautify`](#js-beautify) - -**Description**: - -Initial indentation level (Supported by JS Beautify) - -**Example `.jsbeautifyrc` Configuration** - -```json -{ - "js": { - "indent_level": 0 - } -} -``` - ##### [Indent size](#indent-size) **Namespace**: `js` @@ -5815,11 +4557,11 @@ Indentation size/length (Supported by JS Beautify, Pretty Diff) **Type**: `boolean` -**Supported Beautifiers**: [`JS Beautify`](#js-beautify) [`Pretty Diff`](#pretty-diff) +**Supported Beautifiers**: [`Pretty Diff`](#pretty-diff) **Description**: -Indentation uses tabs, overrides `Indent Size` and `Indent Char` (Supported by JS Beautify, Pretty Diff) +Indentation uses tabs, overrides `Indent Size` and `Indent Char` (Supported by Pretty Diff) **Example `.jsbeautifyrc` Configuration** @@ -5831,104 +4573,6 @@ Indentation uses tabs, overrides `Indent Size` and `Indent Char` (Supported by J } ``` -##### [Jslint happy](#jslint-happy) - -**Namespace**: `js` - -**Key**: `jslint_happy` - -**Type**: `boolean` - -**Supported Beautifiers**: [`JS Beautify`](#js-beautify) - -**Description**: - -Enable jslint-stricter mode (Supported by JS Beautify) - -**Example `.jsbeautifyrc` Configuration** - -```json -{ - "js": { - "jslint_happy": false - } -} -``` - -##### [Keep array indentation](#keep-array-indentation) - -**Namespace**: `js` - -**Key**: `keep_array_indentation` - -**Type**: `boolean` - -**Supported Beautifiers**: [`JS Beautify`](#js-beautify) - -**Description**: - -Preserve array indentation (Supported by JS Beautify) - -**Example `.jsbeautifyrc` Configuration** - -```json -{ - "js": { - "keep_array_indentation": false - } -} -``` - -##### [Keep function indentation](#keep-function-indentation) - -**Namespace**: `js` - -**Key**: `keep_function_indentation` - -**Type**: `boolean` - -**Supported Beautifiers**: [`JS Beautify`](#js-beautify) - -**Description**: - - (Supported by JS Beautify) - -**Example `.jsbeautifyrc` Configuration** - -```json -{ - "js": { - "keep_function_indentation": false - } -} -``` - -##### [Max preserve newlines](#max-preserve-newlines) - -**Namespace**: `js` - -**Key**: `max_preserve_newlines` - -**Default**: `10` - -**Type**: `integer` - -**Supported Beautifiers**: [`JS Beautify`](#js-beautify) - -**Description**: - -Number of line-breaks to be preserved in one chunk (Supported by JS Beautify) - -**Example `.jsbeautifyrc` Configuration** - -```json -{ - "js": { - "max_preserve_newlines": 10 - } -} -``` - ##### [Preserve newlines](#preserve-newlines) **Namespace**: `js` @@ -5963,11 +4607,11 @@ Preserve line-breaks (Supported by JS Beautify, Pretty Diff) **Type**: `boolean` -**Supported Beautifiers**: [`JS Beautify`](#js-beautify) [`Pretty Diff`](#pretty-diff) +**Supported Beautifiers**: [`Pretty Diff`](#pretty-diff) **Description**: -Add a space before an anonymous function's parens, ie. function () (Supported by JS Beautify, Pretty Diff) +Add a space before an anonymous function's parens, ie. function () (Supported by Pretty Diff) **Example `.jsbeautifyrc` Configuration** @@ -5979,32 +4623,6 @@ Add a space before an anonymous function's parens, ie. function () (Supported by } ``` -##### [Space before conditional](#space-before-conditional) - -**Namespace**: `js` - -**Key**: `space_before_conditional` - -**Default**: `true` - -**Type**: `boolean` - -**Supported Beautifiers**: [`JS Beautify`](#js-beautify) - -**Description**: - - (Supported by JS Beautify) - -**Example `.jsbeautifyrc` Configuration** - -```json -{ - "js": { - "space_before_conditional": true - } -} -``` - ##### [Space in paren](#space-in-paren) **Namespace**: `js` @@ -6013,11 +4631,11 @@ Add a space before an anonymous function's parens, ie. function () (Supported by **Type**: `boolean` -**Supported Beautifiers**: [`JS Beautify`](#js-beautify) [`Pretty Diff`](#pretty-diff) +**Supported Beautifiers**: [`Pretty Diff`](#pretty-diff) **Description**: -Add padding spaces within paren, ie. f( a, b ) (Supported by JS Beautify, Pretty Diff) +Add padding spaces within paren, ie. f( a, b ) (Supported by Pretty Diff) **Example `.jsbeautifyrc` Configuration** @@ -6029,30 +4647,6 @@ Add padding spaces within paren, ie. f( a, b ) (Supported by JS Beautify, Pretty } ``` -##### [Unescape strings](#unescape-strings) - -**Namespace**: `js` - -**Key**: `unescape_strings` - -**Type**: `boolean` - -**Supported Beautifiers**: [`JS Beautify`](#js-beautify) - -**Description**: - -Decode printable characters encoded in xNN notation (Supported by JS Beautify) - -**Example `.jsbeautifyrc` Configuration** - -```json -{ - "js": { - "unescape_strings": false - } -} -``` - ##### [Wrap line length](#wrap-line-length) **Namespace**: `js` @@ -6086,24 +4680,16 @@ Wrap lines at next opportunity after N characters (Supported by JS Beautify, Pre | `disabled` | :white_check_mark: | :white_check_mark: | | `default_beautifier` | :white_check_mark: | :white_check_mark: | | `beautify_on_save` | :white_check_mark: | :white_check_mark: | -| `brace_style` | :white_check_mark: | :x: | -| `break_chained_methods` | :white_check_mark: | :white_check_mark: | -| `end_with_comma` | :white_check_mark: | :white_check_mark: | +| `break_chained_methods` | :x: | :white_check_mark: | +| `end_of_line` | :white_check_mark: | :white_check_mark: | +| `end_with_comma` | :x: | :white_check_mark: | | `end_with_newline` | :white_check_mark: | :x: | -| `eval_code` | :white_check_mark: | :x: | | `indent_char` | :white_check_mark: | :white_check_mark: | -| `indent_level` | :white_check_mark: | :x: | | `indent_size` | :white_check_mark: | :white_check_mark: | -| `indent_with_tabs` | :white_check_mark: | :white_check_mark: | -| `jslint_happy` | :white_check_mark: | :x: | -| `keep_array_indentation` | :white_check_mark: | :x: | -| `keep_function_indentation` | :white_check_mark: | :x: | -| `max_preserve_newlines` | :white_check_mark: | :x: | +| `indent_with_tabs` | :x: | :white_check_mark: | | `preserve_newlines` | :white_check_mark: | :white_check_mark: | -| `space_after_anon_function` | :white_check_mark: | :white_check_mark: | -| `space_before_conditional` | :white_check_mark: | :x: | -| `space_in_paren` | :white_check_mark: | :white_check_mark: | -| `unescape_strings` | :white_check_mark: | :x: | +| `space_after_anon_function` | :x: | :white_check_mark: | +| `space_in_paren` | :x: | :white_check_mark: | | `wrap_line_length` | :white_check_mark: | :white_check_mark: | **Description**: @@ -6165,34 +4751,6 @@ Automatically beautify JSX files on save 2. Go into *Packages* and search for "*Atom Beautify*" package. 3. Find the option "*Beautify On Save*" and change it to your desired configuration. -##### [Brace style](#brace-style) - -**Namespace**: `js` - -**Key**: `brace_style` - -**Default**: `collapse` - -**Type**: `string` - -**Enum**: `collapse` `collapse-preserve-inline` `expand` `end-expand` `none` - -**Supported Beautifiers**: [`JS Beautify`](#js-beautify) - -**Description**: - -[collapse|collapse-preserve-inline|expand|end-expand|none] (Supported by JS Beautify) - -**Example `.jsbeautifyrc` Configuration** - -```json -{ - "js": { - "brace_style": "collapse" - } -} -``` - ##### [Break chained methods](#break-chained-methods) **Namespace**: `js` @@ -6201,11 +4759,11 @@ Automatically beautify JSX files on save **Type**: `boolean` -**Supported Beautifiers**: [`JS Beautify`](#js-beautify) [`Pretty Diff`](#pretty-diff) +**Supported Beautifiers**: [`Pretty Diff`](#pretty-diff) **Description**: -Break chained method calls across subsequent lines (Supported by JS Beautify, Pretty Diff) +Break chained method calls across subsequent lines (Supported by Pretty Diff) **Example `.jsbeautifyrc` Configuration** @@ -6217,6 +4775,34 @@ Break chained method calls across subsequent lines (Supported by JS Beautify, Pr } ``` +##### [End of line](#end-of-line) + +**Namespace**: `js` + +**Key**: `end_of_line` + +**Default**: `System Default` + +**Type**: `string` + +**Enum**: `CRLF` `LF` `System Default` + +**Supported Beautifiers**: [`JS Beautify`](#js-beautify) [`Pretty Diff`](#pretty-diff) + +**Description**: + +Override EOL from line-ending-selector (Supported by JS Beautify, Pretty Diff) + +**Example `.jsbeautifyrc` Configuration** + +```json +{ + "js": { + "end_of_line": "System Default" + } +} +``` + ##### [End with comma](#end-with-comma) **Namespace**: `js` @@ -6225,11 +4811,11 @@ Break chained method calls across subsequent lines (Supported by JS Beautify, Pr **Type**: `boolean` -**Supported Beautifiers**: [`JS Beautify`](#js-beautify) [`Pretty Diff`](#pretty-diff) +**Supported Beautifiers**: [`Pretty Diff`](#pretty-diff) **Description**: -If a terminating comma should be inserted into arrays, object literals, and destructured objects. (Supported by JS Beautify, Pretty Diff) +If a terminating comma should be inserted into arrays, object literals, and destructured objects. (Supported by Pretty Diff) **Example `.jsbeautifyrc` Configuration** @@ -6265,30 +4851,6 @@ End output with newline (Supported by JS Beautify) } ``` -##### [Eval code](#eval-code) - -**Namespace**: `js` - -**Key**: `eval_code` - -**Type**: `boolean` - -**Supported Beautifiers**: [`JS Beautify`](#js-beautify) - -**Description**: - - (Supported by JS Beautify) - -**Example `.jsbeautifyrc` Configuration** - -```json -{ - "js": { - "eval_code": false - } -} -``` - ##### [Indent char](#indent-char) **Namespace**: `js` @@ -6315,30 +4877,6 @@ Indentation character (Supported by JS Beautify, Pretty Diff) } ``` -##### [Indent level](#indent-level) - -**Namespace**: `js` - -**Key**: `indent_level` - -**Type**: `integer` - -**Supported Beautifiers**: [`JS Beautify`](#js-beautify) - -**Description**: - -Initial indentation level (Supported by JS Beautify) - -**Example `.jsbeautifyrc` Configuration** - -```json -{ - "js": { - "indent_level": 0 - } -} -``` - ##### [Indent size](#indent-size) **Namespace**: `js` @@ -6373,11 +4911,11 @@ Indentation size/length (Supported by JS Beautify, Pretty Diff) **Type**: `boolean` -**Supported Beautifiers**: [`JS Beautify`](#js-beautify) [`Pretty Diff`](#pretty-diff) +**Supported Beautifiers**: [`Pretty Diff`](#pretty-diff) **Description**: -Indentation uses tabs, overrides `Indent Size` and `Indent Char` (Supported by JS Beautify, Pretty Diff) +Indentation uses tabs, overrides `Indent Size` and `Indent Char` (Supported by Pretty Diff) **Example `.jsbeautifyrc` Configuration** @@ -6389,104 +4927,6 @@ Indentation uses tabs, overrides `Indent Size` and `Indent Char` (Supported by J } ``` -##### [Jslint happy](#jslint-happy) - -**Namespace**: `js` - -**Key**: `jslint_happy` - -**Type**: `boolean` - -**Supported Beautifiers**: [`JS Beautify`](#js-beautify) - -**Description**: - -Enable jslint-stricter mode (Supported by JS Beautify) - -**Example `.jsbeautifyrc` Configuration** - -```json -{ - "js": { - "jslint_happy": false - } -} -``` - -##### [Keep array indentation](#keep-array-indentation) - -**Namespace**: `js` - -**Key**: `keep_array_indentation` - -**Type**: `boolean` - -**Supported Beautifiers**: [`JS Beautify`](#js-beautify) - -**Description**: - -Preserve array indentation (Supported by JS Beautify) - -**Example `.jsbeautifyrc` Configuration** - -```json -{ - "js": { - "keep_array_indentation": false - } -} -``` - -##### [Keep function indentation](#keep-function-indentation) - -**Namespace**: `js` - -**Key**: `keep_function_indentation` - -**Type**: `boolean` - -**Supported Beautifiers**: [`JS Beautify`](#js-beautify) - -**Description**: - - (Supported by JS Beautify) - -**Example `.jsbeautifyrc` Configuration** - -```json -{ - "js": { - "keep_function_indentation": false - } -} -``` - -##### [Max preserve newlines](#max-preserve-newlines) - -**Namespace**: `js` - -**Key**: `max_preserve_newlines` - -**Default**: `10` - -**Type**: `integer` - -**Supported Beautifiers**: [`JS Beautify`](#js-beautify) - -**Description**: - -Number of line-breaks to be preserved in one chunk (Supported by JS Beautify) - -**Example `.jsbeautifyrc` Configuration** - -```json -{ - "js": { - "max_preserve_newlines": 10 - } -} -``` - ##### [Preserve newlines](#preserve-newlines) **Namespace**: `js` @@ -6521,11 +4961,11 @@ Preserve line-breaks (Supported by JS Beautify, Pretty Diff) **Type**: `boolean` -**Supported Beautifiers**: [`JS Beautify`](#js-beautify) [`Pretty Diff`](#pretty-diff) +**Supported Beautifiers**: [`Pretty Diff`](#pretty-diff) **Description**: -Add a space before an anonymous function's parens, ie. function () (Supported by JS Beautify, Pretty Diff) +Add a space before an anonymous function's parens, ie. function () (Supported by Pretty Diff) **Example `.jsbeautifyrc` Configuration** @@ -6537,32 +4977,6 @@ Add a space before an anonymous function's parens, ie. function () (Supported by } ``` -##### [Space before conditional](#space-before-conditional) - -**Namespace**: `js` - -**Key**: `space_before_conditional` - -**Default**: `true` - -**Type**: `boolean` - -**Supported Beautifiers**: [`JS Beautify`](#js-beautify) - -**Description**: - - (Supported by JS Beautify) - -**Example `.jsbeautifyrc` Configuration** - -```json -{ - "js": { - "space_before_conditional": true - } -} -``` - ##### [Space in paren](#space-in-paren) **Namespace**: `js` @@ -6571,11 +4985,11 @@ Add a space before an anonymous function's parens, ie. function () (Supported by **Type**: `boolean` -**Supported Beautifiers**: [`JS Beautify`](#js-beautify) [`Pretty Diff`](#pretty-diff) +**Supported Beautifiers**: [`Pretty Diff`](#pretty-diff) **Description**: -Add padding spaces within paren, ie. f( a, b ) (Supported by JS Beautify, Pretty Diff) +Add padding spaces within paren, ie. f( a, b ) (Supported by Pretty Diff) **Example `.jsbeautifyrc` Configuration** @@ -6587,30 +5001,6 @@ Add padding spaces within paren, ie. f( a, b ) (Supported by JS Beautify, Pretty } ``` -##### [Unescape strings](#unescape-strings) - -**Namespace**: `js` - -**Key**: `unescape_strings` - -**Type**: `boolean` - -**Supported Beautifiers**: [`JS Beautify`](#js-beautify) - -**Description**: - -Decode printable characters encoded in xNN notation (Supported by JS Beautify) - -**Example `.jsbeautifyrc` Configuration** - -```json -{ - "js": { - "unescape_strings": false - } -} -``` - ##### [Wrap line length](#wrap-line-length) **Namespace**: `js` @@ -8027,18 +6417,10 @@ Maximum characters per line (0 disables) (Supported by Marko Beautifier) | `disabled` | :white_check_mark: | | `default_beautifier` | :white_check_mark: | | `beautify_on_save` | :white_check_mark: | -| `brace_style` | :white_check_mark: | | `end_with_newline` | :white_check_mark: | -| `extra_liners` | :white_check_mark: | | `indent_char` | :white_check_mark: | -| `indent_inner_html` | :white_check_mark: | -| `indent_scripts` | :white_check_mark: | | `indent_size` | :white_check_mark: | -| `max_preserve_newlines` | :white_check_mark: | | `preserve_newlines` | :white_check_mark: | -| `unformatted` | :white_check_mark: | -| `wrap_attributes` | :white_check_mark: | -| `wrap_attributes_indent_size` | :white_check_mark: | | `wrap_line_length` | :white_check_mark: | **Description**: @@ -8100,34 +6482,6 @@ Automatically beautify Mustache files on save 2. Go into *Packages* and search for "*Atom Beautify*" package. 3. Find the option "*Beautify On Save*" and change it to your desired configuration. -##### [Brace style](#brace-style) - -**Namespace**: `html` - -**Key**: `brace_style` - -**Default**: `collapse` - -**Type**: `string` - -**Enum**: `collapse` `expand` `end-expand` `none` - -**Supported Beautifiers**: [`JS Beautify`](#js-beautify) - -**Description**: - -[collapse|expand|end-expand|none] (Supported by JS Beautify) - -**Example `.jsbeautifyrc` Configuration** - -```json -{ - "html": { - "brace_style": "collapse" - } -} -``` - ##### [End with newline](#end-with-newline) **Namespace**: `html` @@ -8152,36 +6506,6 @@ End output with newline (Supported by JS Beautify) } ``` -##### [Extra liners](#extra-liners) - -**Namespace**: `html` - -**Key**: `extra_liners` - -**Default**: `head,body,/html` - -**Type**: `array` - -**Supported Beautifiers**: [`JS Beautify`](#js-beautify) - -**Description**: - -List of tags (defaults to [head,body,/html] that should have an extra newline before them. (Supported by JS Beautify) - -**Example `.jsbeautifyrc` Configuration** - -```json -{ - "html": { - "extra_liners": [ - "head", - "body", - "/html" - ] - } -} -``` - ##### [Indent char](#indent-char) **Namespace**: `html` @@ -8208,58 +6532,6 @@ Indentation character (Supported by JS Beautify) } ``` -##### [Indent inner html](#indent-inner-html) - -**Namespace**: `html` - -**Key**: `indent_inner_html` - -**Type**: `boolean` - -**Supported Beautifiers**: [`JS Beautify`](#js-beautify) - -**Description**: - -Indent and sections. (Supported by JS Beautify) - -**Example `.jsbeautifyrc` Configuration** - -```json -{ - "html": { - "indent_inner_html": false - } -} -``` - -##### [Indent scripts](#indent-scripts) - -**Namespace**: `html` - -**Key**: `indent_scripts` - -**Default**: `normal` - -**Type**: `string` - -**Enum**: `keep` `separate` `normal` - -**Supported Beautifiers**: [`JS Beautify`](#js-beautify) - -**Description**: - -[keep|separate|normal] (Supported by JS Beautify) - -**Example `.jsbeautifyrc` Configuration** - -```json -{ - "html": { - "indent_scripts": "normal" - } -} -``` - ##### [Indent size](#indent-size) **Namespace**: `html` @@ -8286,32 +6558,6 @@ Indentation size/length (Supported by JS Beautify) } ``` -##### [Max preserve newlines](#max-preserve-newlines) - -**Namespace**: `html` - -**Key**: `max_preserve_newlines` - -**Default**: `10` - -**Type**: `integer` - -**Supported Beautifiers**: [`JS Beautify`](#js-beautify) - -**Description**: - -Number of line-breaks to be preserved in one chunk (Supported by JS Beautify) - -**Example `.jsbeautifyrc` Configuration** - -```json -{ - "html": { - "max_preserve_newlines": 10 - } -} -``` - ##### [Preserve newlines](#preserve-newlines) **Namespace**: `html` @@ -8338,153 +6584,6 @@ Preserve line-breaks (Supported by JS Beautify) } ``` -##### [Unformatted](#unformatted) - -**Namespace**: `html` - -**Key**: `unformatted` - -**Default**: `a,abbr,area,audio,b,bdi,bdo,br,button,canvas,cite,code,data,datalist,del,dfn,em,embed,i,iframe,img,input,ins,kbd,keygen,label,map,mark,math,meter,noscript,object,output,progress,q,ruby,s,samp,select,small,span,strong,sub,sup,svg,template,textarea,time,u,var,video,wbr,text,acronym,address,big,dt,strike,tt,pre,h1,h2,h3,h4,h5,h6` - -**Type**: `array` - -**Supported Beautifiers**: [`JS Beautify`](#js-beautify) - -**Description**: - -List of tags (defaults to inline) that should not be reformatted (Supported by JS Beautify) - -**Example `.jsbeautifyrc` Configuration** - -```json -{ - "html": { - "unformatted": [ - "a", - "abbr", - "area", - "audio", - "b", - "bdi", - "bdo", - "br", - "button", - "canvas", - "cite", - "code", - "data", - "datalist", - "del", - "dfn", - "em", - "embed", - "i", - "iframe", - "img", - "input", - "ins", - "kbd", - "keygen", - "label", - "map", - "mark", - "math", - "meter", - "noscript", - "object", - "output", - "progress", - "q", - "ruby", - "s", - "samp", - "select", - "small", - "span", - "strong", - "sub", - "sup", - "svg", - "template", - "textarea", - "time", - "u", - "var", - "video", - "wbr", - "text", - "acronym", - "address", - "big", - "dt", - "strike", - "tt", - "pre", - "h1", - "h2", - "h3", - "h4", - "h5", - "h6" - ] - } -} -``` - -##### [Wrap attributes](#wrap-attributes) - -**Namespace**: `html` - -**Key**: `wrap_attributes` - -**Default**: `auto` - -**Type**: `string` - -**Enum**: `auto` `force` - -**Supported Beautifiers**: [`JS Beautify`](#js-beautify) - -**Description**: - -Wrap attributes to new lines [auto|force] (Supported by JS Beautify) - -**Example `.jsbeautifyrc` Configuration** - -```json -{ - "html": { - "wrap_attributes": "auto" - } -} -``` - -##### [Wrap attributes indent size](#wrap-attributes-indent-size) - -**Namespace**: `html` - -**Key**: `wrap_attributes_indent_size` - -**Default**: `4` - -**Type**: `integer` - -**Supported Beautifiers**: [`JS Beautify`](#js-beautify) - -**Description**: - -Indent wrapped attributes to after N characters (Supported by JS Beautify) - -**Example `.jsbeautifyrc` Configuration** - -```json -{ - "html": { - "wrap_attributes_indent_size": 4 - } -} -``` - ##### [Wrap line length](#wrap-line-length) **Namespace**: `html` @@ -11476,6 +9575,7 @@ Maximum amount of characters per line (0 = disable) (Supported by Pretty Diff) | `default_beautifier` | :white_check_mark: | | `beautify_on_save` | :white_check_mark: | | `break_chained_methods` | :white_check_mark: | +| `end_of_line` | :white_check_mark: | | `end_with_comma` | :white_check_mark: | | `indent_char` | :white_check_mark: | | `indent_size` | :white_check_mark: | @@ -11568,6 +9668,34 @@ Break chained method calls across subsequent lines (Supported by Pretty Diff) } ``` +##### [End of line](#end-of-line) + +**Namespace**: `js` + +**Key**: `end_of_line` + +**Default**: `System Default` + +**Type**: `string` + +**Enum**: `CRLF` `LF` `System Default` + +**Supported Beautifiers**: [`Pretty Diff`](#pretty-diff) + +**Description**: + +Override EOL from line-ending-selector (Supported by Pretty Diff) + +**Example `.jsbeautifyrc` Configuration** + +```json +{ + "js": { + "end_of_line": "System Default" + } +} +``` + ##### [End with comma](#end-with-comma) **Namespace**: `js` @@ -11779,6 +9907,7 @@ Maximum characters per line (0 disables) (Supported by Pretty Diff) | `beautify_on_save` | :white_check_mark: | | `brace_style` | :white_check_mark: | | `break_chained_methods` | :white_check_mark: | +| `end_of_line` | :white_check_mark: | | `end_with_comma` | :white_check_mark: | | `end_with_newline` | :white_check_mark: | | `eval_code` | :white_check_mark: | @@ -11908,6 +10037,34 @@ Break chained method calls across subsequent lines (Supported by TypeScript Form } ``` +##### [End of line](#end-of-line) + +**Namespace**: `js` + +**Key**: `end_of_line` + +**Default**: `System Default` + +**Type**: `string` + +**Enum**: `CRLF` `LF` `System Default` + +**Supported Beautifiers**: [`TypeScript Formatter`](#typescript-formatter) + +**Description**: + +Override EOL from line-ending-selector (Supported by TypeScript Formatter) + +**Example `.jsbeautifyrc` Configuration** + +```json +{ + "js": { + "end_of_line": "System Default" + } +} +``` + ##### [End with comma](#end-with-comma) **Namespace**: `js` @@ -12785,6 +10942,7 @@ Maximum characters per line (0 disables) (Supported by Pretty Diff) | `beautify_on_save` | :white_check_mark: | | `brace_style` | :white_check_mark: | | `break_chained_methods` | :white_check_mark: | +| `end_of_line` | :white_check_mark: | | `end_with_comma` | :white_check_mark: | | `end_with_newline` | :white_check_mark: | | `eval_code` | :white_check_mark: | @@ -12920,6 +11078,34 @@ Break chained method calls across subsequent lines (Supported by Vue Beautifier) } ``` +##### [End of line](#end-of-line) + +**Namespace**: `js` + +**Key**: `end_of_line` + +**Default**: `System Default` + +**Type**: `string` + +**Enum**: `CRLF` `LF` `System Default` + +**Supported Beautifiers**: [`Vue Beautifier`](#vue-beautifier) + +**Description**: + +Override EOL from line-ending-selector (Supported by Vue Beautifier) + +**Example `.jsbeautifyrc` Configuration** + +```json +{ + "js": { + "end_of_line": "System Default" + } +} +``` + ##### [End with comma](#end-with-comma) **Namespace**: `js` @@ -13580,18 +11766,10 @@ Maximum characters per line (0 disables) (Supported by Vue Beautifier) | `disabled` | :white_check_mark: | :white_check_mark: | | `default_beautifier` | :white_check_mark: | :white_check_mark: | | `beautify_on_save` | :white_check_mark: | :white_check_mark: | -| `brace_style` | :white_check_mark: | :x: | | `end_with_newline` | :white_check_mark: | :x: | -| `extra_liners` | :white_check_mark: | :x: | | `indent_char` | :white_check_mark: | :white_check_mark: | -| `indent_inner_html` | :white_check_mark: | :x: | -| `indent_scripts` | :white_check_mark: | :x: | | `indent_size` | :white_check_mark: | :white_check_mark: | -| `max_preserve_newlines` | :white_check_mark: | :x: | | `preserve_newlines` | :white_check_mark: | :white_check_mark: | -| `unformatted` | :white_check_mark: | :x: | -| `wrap_attributes` | :white_check_mark: | :x: | -| `wrap_attributes_indent_size` | :white_check_mark: | :x: | | `wrap_line_length` | :white_check_mark: | :white_check_mark: | **Description**: @@ -13653,34 +11831,6 @@ Automatically beautify XML files on save 2. Go into *Packages* and search for "*Atom Beautify*" package. 3. Find the option "*Beautify On Save*" and change it to your desired configuration. -##### [Brace style](#brace-style) - -**Namespace**: `html` - -**Key**: `brace_style` - -**Default**: `collapse` - -**Type**: `string` - -**Enum**: `collapse` `expand` `end-expand` `none` - -**Supported Beautifiers**: [`JS Beautify`](#js-beautify) - -**Description**: - -[collapse|expand|end-expand|none] (Supported by JS Beautify) - -**Example `.jsbeautifyrc` Configuration** - -```json -{ - "html": { - "brace_style": "collapse" - } -} -``` - ##### [End with newline](#end-with-newline) **Namespace**: `html` @@ -13705,36 +11855,6 @@ End output with newline (Supported by JS Beautify) } ``` -##### [Extra liners](#extra-liners) - -**Namespace**: `html` - -**Key**: `extra_liners` - -**Default**: `head,body,/html` - -**Type**: `array` - -**Supported Beautifiers**: [`JS Beautify`](#js-beautify) - -**Description**: - -List of tags (defaults to [head,body,/html] that should have an extra newline before them. (Supported by JS Beautify) - -**Example `.jsbeautifyrc` Configuration** - -```json -{ - "html": { - "extra_liners": [ - "head", - "body", - "/html" - ] - } -} -``` - ##### [Indent char](#indent-char) **Namespace**: `html` @@ -13761,58 +11881,6 @@ Indentation character (Supported by JS Beautify, Pretty Diff) } ``` -##### [Indent inner html](#indent-inner-html) - -**Namespace**: `html` - -**Key**: `indent_inner_html` - -**Type**: `boolean` - -**Supported Beautifiers**: [`JS Beautify`](#js-beautify) - -**Description**: - -Indent and sections. (Supported by JS Beautify) - -**Example `.jsbeautifyrc` Configuration** - -```json -{ - "html": { - "indent_inner_html": false - } -} -``` - -##### [Indent scripts](#indent-scripts) - -**Namespace**: `html` - -**Key**: `indent_scripts` - -**Default**: `normal` - -**Type**: `string` - -**Enum**: `keep` `separate` `normal` - -**Supported Beautifiers**: [`JS Beautify`](#js-beautify) - -**Description**: - -[keep|separate|normal] (Supported by JS Beautify) - -**Example `.jsbeautifyrc` Configuration** - -```json -{ - "html": { - "indent_scripts": "normal" - } -} -``` - ##### [Indent size](#indent-size) **Namespace**: `html` @@ -13839,32 +11907,6 @@ Indentation size/length (Supported by JS Beautify, Pretty Diff) } ``` -##### [Max preserve newlines](#max-preserve-newlines) - -**Namespace**: `html` - -**Key**: `max_preserve_newlines` - -**Default**: `10` - -**Type**: `integer` - -**Supported Beautifiers**: [`JS Beautify`](#js-beautify) - -**Description**: - -Number of line-breaks to be preserved in one chunk (Supported by JS Beautify) - -**Example `.jsbeautifyrc` Configuration** - -```json -{ - "html": { - "max_preserve_newlines": 10 - } -} -``` - ##### [Preserve newlines](#preserve-newlines) **Namespace**: `html` @@ -13891,155 +11933,6 @@ Preserve line-breaks (Supported by JS Beautify, Pretty Diff) } ``` -##### [Unformatted](#unformatted) - -**Namespace**: `html` - -**Key**: `unformatted` - -**Default**: `a,abbr,area,audio,b,bdi,bdo,br,button,canvas,cite,code,data,datalist,del,dfn,em,embed,i,iframe,img,input,ins,kbd,keygen,label,map,mark,math,meter,noscript,object,output,progress,q,ruby,s,samp,select,small,span,strong,sub,sup,svg,template,textarea,time,u,var,video,wbr,text,acronym,address,big,dt,ins,small,strike,tt,pre,h1,h2,h3,h4,h5,h6` - -**Type**: `array` - -**Supported Beautifiers**: [`JS Beautify`](#js-beautify) - -**Description**: - -List of tags (defaults to inline) that should not be reformatted (Supported by JS Beautify) - -**Example `.jsbeautifyrc` Configuration** - -```json -{ - "html": { - "unformatted": [ - "a", - "abbr", - "area", - "audio", - "b", - "bdi", - "bdo", - "br", - "button", - "canvas", - "cite", - "code", - "data", - "datalist", - "del", - "dfn", - "em", - "embed", - "i", - "iframe", - "img", - "input", - "ins", - "kbd", - "keygen", - "label", - "map", - "mark", - "math", - "meter", - "noscript", - "object", - "output", - "progress", - "q", - "ruby", - "s", - "samp", - "select", - "small", - "span", - "strong", - "sub", - "sup", - "svg", - "template", - "textarea", - "time", - "u", - "var", - "video", - "wbr", - "text", - "acronym", - "address", - "big", - "dt", - "ins", - "small", - "strike", - "tt", - "pre", - "h1", - "h2", - "h3", - "h4", - "h5", - "h6" - ] - } -} -``` - -##### [Wrap attributes](#wrap-attributes) - -**Namespace**: `html` - -**Key**: `wrap_attributes` - -**Default**: `auto` - -**Type**: `string` - -**Enum**: `auto` `force` - -**Supported Beautifiers**: [`JS Beautify`](#js-beautify) - -**Description**: - -Wrap attributes to new lines [auto|force] (Supported by JS Beautify) - -**Example `.jsbeautifyrc` Configuration** - -```json -{ - "html": { - "wrap_attributes": "auto" - } -} -``` - -##### [Wrap attributes indent size](#wrap-attributes-indent-size) - -**Namespace**: `html` - -**Key**: `wrap_attributes_indent_size` - -**Default**: `4` - -**Type**: `integer` - -**Supported Beautifiers**: [`JS Beautify`](#js-beautify) - -**Description**: - -Indent wrapped attributes to after N characters (Supported by JS Beautify) - -**Example `.jsbeautifyrc` Configuration** - -```json -{ - "html": { - "wrap_attributes_indent_size": 4 - } -} -``` - ##### [Wrap line length](#wrap-line-length) **Namespace**: `html` @@ -14777,6 +12670,34 @@ If a terminating comma should be inserted into arrays, object literals, and dest } ``` +##### [End of line](#end-of-line) + +**Namespace**: `js` + +**Key**: `end_of_line` + +**Default**: `System Default` + +**Type**: `string` + +**Enum**: `CRLF` `LF` `System Default` + +**Supported Beautifiers**: [`Coffee Formatter`](#coffee-formatter) + +**Description**: + +Override EOL from line-ending-selector (Supported by Coffee Formatter) + +**Example `.jsbeautifyrc` Configuration** + +```json +{ + "js": { + "end_of_line": "System Default" + } +} +``` + ### Fortran Beautifier @@ -15093,577 +13014,30 @@ End output with newline (Supported by JS Beautify) } ``` -##### [Indent level](#indent-level) +##### [End of line](#end-of-line) **Namespace**: `js` -**Key**: `indent_level` +**Key**: `end_of_line` -**Type**: `integer` - -**Supported Beautifiers**: [`JS Beautify`](#js-beautify) - -**Description**: - -Initial indentation level (Supported by JS Beautify) - -**Example `.jsbeautifyrc` Configuration** - -```json -{ - "js": { - "indent_level": 0 - } -} -``` - -##### [Indent with tabs](#indent-with-tabs) - -**Namespace**: `js` - -**Key**: `indent_with_tabs` - -**Type**: `boolean` - -**Supported Beautifiers**: [`JS Beautify`](#js-beautify) [`Pretty Diff`](#pretty-diff) - -**Description**: - -Indentation uses tabs, overrides `Indent Size` and `Indent Char` (Supported by JS Beautify, Pretty Diff) - -**Example `.jsbeautifyrc` Configuration** - -```json -{ - "js": { - "indent_with_tabs": false - } -} -``` - -##### [Max preserve newlines](#max-preserve-newlines) - -**Namespace**: `html` - -**Key**: `max_preserve_newlines` - -**Default**: `10` - -**Type**: `integer` - -**Supported Beautifiers**: [`JS Beautify`](#js-beautify) - -**Description**: - -Number of line-breaks to be preserved in one chunk (Supported by JS Beautify) - -**Example `.jsbeautifyrc` Configuration** - -```json -{ - "html": { - "max_preserve_newlines": 10 - } -} -``` - -##### [Space in paren](#space-in-paren) - -**Namespace**: `js` - -**Key**: `space_in_paren` - -**Type**: `boolean` - -**Supported Beautifiers**: [`JS Beautify`](#js-beautify) [`Pretty Diff`](#pretty-diff) - -**Description**: - -Add padding spaces within paren, ie. f( a, b ) (Supported by JS Beautify, Pretty Diff) - -**Example `.jsbeautifyrc` Configuration** - -```json -{ - "js": { - "space_in_paren": false - } -} -``` - -##### [Jslint happy](#jslint-happy) - -**Namespace**: `js` - -**Key**: `jslint_happy` - -**Type**: `boolean` - -**Supported Beautifiers**: [`JS Beautify`](#js-beautify) - -**Description**: - -Enable jslint-stricter mode (Supported by JS Beautify) - -**Example `.jsbeautifyrc` Configuration** - -```json -{ - "js": { - "jslint_happy": false - } -} -``` - -##### [Space after anon function](#space-after-anon-function) - -**Namespace**: `js` - -**Key**: `space_after_anon_function` - -**Type**: `boolean` - -**Supported Beautifiers**: [`JS Beautify`](#js-beautify) [`Pretty Diff`](#pretty-diff) - -**Description**: - -Add a space before an anonymous function's parens, ie. function () (Supported by JS Beautify, Pretty Diff) - -**Example `.jsbeautifyrc` Configuration** - -```json -{ - "js": { - "space_after_anon_function": false - } -} -``` - -##### [Brace style](#brace-style) - -**Namespace**: `html` - -**Key**: `brace_style` - -**Default**: `collapse` +**Default**: `System Default` **Type**: `string` -**Enum**: `collapse` `expand` `end-expand` `none` - -**Supported Beautifiers**: [`JS Beautify`](#js-beautify) - -**Description**: - -[collapse|expand|end-expand|none] (Supported by JS Beautify) - -**Example `.jsbeautifyrc` Configuration** - -```json -{ - "html": { - "brace_style": "collapse" - } -} -``` - -##### [Break chained methods](#break-chained-methods) - -**Namespace**: `js` - -**Key**: `break_chained_methods` - -**Type**: `boolean` +**Enum**: `CRLF` `LF` `System Default` **Supported Beautifiers**: [`JS Beautify`](#js-beautify) [`Pretty Diff`](#pretty-diff) **Description**: -Break chained method calls across subsequent lines (Supported by JS Beautify, Pretty Diff) +Override EOL from line-ending-selector (Supported by JS Beautify, Pretty Diff) **Example `.jsbeautifyrc` Configuration** ```json { "js": { - "break_chained_methods": false - } -} -``` - -##### [Keep array indentation](#keep-array-indentation) - -**Namespace**: `js` - -**Key**: `keep_array_indentation` - -**Type**: `boolean` - -**Supported Beautifiers**: [`JS Beautify`](#js-beautify) - -**Description**: - -Preserve array indentation (Supported by JS Beautify) - -**Example `.jsbeautifyrc` Configuration** - -```json -{ - "js": { - "keep_array_indentation": false - } -} -``` - -##### [Keep function indentation](#keep-function-indentation) - -**Namespace**: `js` - -**Key**: `keep_function_indentation` - -**Type**: `boolean` - -**Supported Beautifiers**: [`JS Beautify`](#js-beautify) - -**Description**: - - (Supported by JS Beautify) - -**Example `.jsbeautifyrc` Configuration** - -```json -{ - "js": { - "keep_function_indentation": false - } -} -``` - -##### [Space before conditional](#space-before-conditional) - -**Namespace**: `js` - -**Key**: `space_before_conditional` - -**Default**: `true` - -**Type**: `boolean` - -**Supported Beautifiers**: [`JS Beautify`](#js-beautify) - -**Description**: - - (Supported by JS Beautify) - -**Example `.jsbeautifyrc` Configuration** - -```json -{ - "js": { - "space_before_conditional": true - } -} -``` - -##### [Eval code](#eval-code) - -**Namespace**: `js` - -**Key**: `eval_code` - -**Type**: `boolean` - -**Supported Beautifiers**: [`JS Beautify`](#js-beautify) - -**Description**: - - (Supported by JS Beautify) - -**Example `.jsbeautifyrc` Configuration** - -```json -{ - "js": { - "eval_code": false - } -} -``` - -##### [Unescape strings](#unescape-strings) - -**Namespace**: `js` - -**Key**: `unescape_strings` - -**Type**: `boolean` - -**Supported Beautifiers**: [`JS Beautify`](#js-beautify) - -**Description**: - -Decode printable characters encoded in xNN notation (Supported by JS Beautify) - -**Example `.jsbeautifyrc` Configuration** - -```json -{ - "js": { - "unescape_strings": false - } -} -``` - -##### [End with comma](#end-with-comma) - -**Namespace**: `js` - -**Key**: `end_with_comma` - -**Type**: `boolean` - -**Supported Beautifiers**: [`JS Beautify`](#js-beautify) [`Pretty Diff`](#pretty-diff) - -**Description**: - -If a terminating comma should be inserted into arrays, object literals, and destructured objects. (Supported by JS Beautify, Pretty Diff) - -**Example `.jsbeautifyrc` Configuration** - -```json -{ - "js": { - "end_with_comma": false - } -} -``` - -##### [Indent inner html](#indent-inner-html) - -**Namespace**: `html` - -**Key**: `indent_inner_html` - -**Type**: `boolean` - -**Supported Beautifiers**: [`JS Beautify`](#js-beautify) - -**Description**: - -Indent and sections. (Supported by JS Beautify) - -**Example `.jsbeautifyrc` Configuration** - -```json -{ - "html": { - "indent_inner_html": false - } -} -``` - -##### [Indent scripts](#indent-scripts) - -**Namespace**: `html` - -**Key**: `indent_scripts` - -**Default**: `normal` - -**Type**: `string` - -**Enum**: `keep` `separate` `normal` - -**Supported Beautifiers**: [`JS Beautify`](#js-beautify) - -**Description**: - -[keep|separate|normal] (Supported by JS Beautify) - -**Example `.jsbeautifyrc` Configuration** - -```json -{ - "html": { - "indent_scripts": "normal" - } -} -``` - -##### [Wrap attributes](#wrap-attributes) - -**Namespace**: `html` - -**Key**: `wrap_attributes` - -**Default**: `auto` - -**Type**: `string` - -**Enum**: `auto` `force` - -**Supported Beautifiers**: [`JS Beautify`](#js-beautify) - -**Description**: - -Wrap attributes to new lines [auto|force] (Supported by JS Beautify) - -**Example `.jsbeautifyrc` Configuration** - -```json -{ - "html": { - "wrap_attributes": "auto" - } -} -``` - -##### [Wrap attributes indent size](#wrap-attributes-indent-size) - -**Namespace**: `html` - -**Key**: `wrap_attributes_indent_size` - -**Default**: `4` - -**Type**: `integer` - -**Supported Beautifiers**: [`JS Beautify`](#js-beautify) - -**Description**: - -Indent wrapped attributes to after N characters (Supported by JS Beautify) - -**Example `.jsbeautifyrc` Configuration** - -```json -{ - "html": { - "wrap_attributes_indent_size": 4 - } -} -``` - -##### [Unformatted](#unformatted) - -**Namespace**: `html` - -**Key**: `unformatted` - -**Default**: `a,abbr,area,audio,b,bdi,bdo,br,button,canvas,cite,code,data,datalist,del,dfn,em,embed,i,iframe,img,input,ins,kbd,keygen,label,map,mark,math,meter,noscript,object,output,progress,q,ruby,s,samp,select,small,span,strong,sub,sup,svg,template,textarea,time,u,var,video,wbr,text,acronym,address,big,dt,ins,small,strike,tt,pre,h1,h2,h3,h4,h5,h6` - -**Type**: `array` - -**Supported Beautifiers**: [`JS Beautify`](#js-beautify) - -**Description**: - -List of tags (defaults to inline) that should not be reformatted (Supported by JS Beautify) - -**Example `.jsbeautifyrc` Configuration** - -```json -{ - "html": { - "unformatted": [ - "a", - "abbr", - "area", - "audio", - "b", - "bdi", - "bdo", - "br", - "button", - "canvas", - "cite", - "code", - "data", - "datalist", - "del", - "dfn", - "em", - "embed", - "i", - "iframe", - "img", - "input", - "ins", - "kbd", - "keygen", - "label", - "map", - "mark", - "math", - "meter", - "noscript", - "object", - "output", - "progress", - "q", - "ruby", - "s", - "samp", - "select", - "small", - "span", - "strong", - "sub", - "sup", - "svg", - "template", - "textarea", - "time", - "u", - "var", - "video", - "wbr", - "text", - "acronym", - "address", - "big", - "dt", - "ins", - "small", - "strike", - "tt", - "pre", - "h1", - "h2", - "h3", - "h4", - "h5", - "h6" - ] - } -} -``` - -##### [Extra liners](#extra-liners) - -**Namespace**: `html` - -**Key**: `extra_liners` - -**Default**: `head,body,/html` - -**Type**: `array` - -**Supported Beautifiers**: [`JS Beautify`](#js-beautify) - -**Description**: - -List of tags (defaults to [head,body,/html] that should have an extra newline before them. (Supported by JS Beautify) - -**Example `.jsbeautifyrc` Configuration** - -```json -{ - "html": { - "extra_liners": [ - "head", - "body", - "/html" - ] + "end_of_line": "System Default" } } ``` @@ -16852,6 +14226,34 @@ If a terminating comma should be inserted into arrays, object literals, and dest } ``` +##### [End of line](#end-of-line) + +**Namespace**: `js` + +**Key**: `end_of_line` + +**Default**: `System Default` + +**Type**: `string` + +**Enum**: `CRLF` `LF` `System Default` + +**Supported Beautifiers**: [`Pretty Diff`](#pretty-diff) + +**Description**: + +Override EOL from line-ending-selector (Supported by Pretty Diff) + +**Example `.jsbeautifyrc` Configuration** + +```json +{ + "js": { + "end_of_line": "System Default" + } +} +``` + ### Pug Beautify @@ -17569,6 +14971,34 @@ If a terminating comma should be inserted into arrays, object literals, and dest } ``` +##### [End of line](#end-of-line) + +**Namespace**: `js` + +**Key**: `end_of_line` + +**Default**: `System Default` + +**Type**: `string` + +**Enum**: `CRLF` `LF` `System Default` + +**Supported Beautifiers**: [`TypeScript Formatter`](#typescript-formatter) + +**Description**: + +Override EOL from line-ending-selector (Supported by TypeScript Formatter) + +**Example `.jsbeautifyrc` Configuration** + +```json +{ + "js": { + "end_of_line": "System Default" + } +} +``` + ### Uncrustify @@ -18071,6 +15501,34 @@ If a terminating comma should be inserted into arrays, object literals, and dest } ``` +##### [End of line](#end-of-line) + +**Namespace**: `js` + +**Key**: `end_of_line` + +**Default**: `System Default` + +**Type**: `string` + +**Enum**: `CRLF` `LF` `System Default` + +**Supported Beautifiers**: [`Vue Beautifier`](#vue-beautifier) + +**Description**: + +Override EOL from line-ending-selector (Supported by Vue Beautifier) + +**Example `.jsbeautifyrc` Configuration** + +```json +{ + "js": { + "end_of_line": "System Default" + } +} +``` + ##### [Indent inner html](#indent-inner-html) **Namespace**: `html` diff --git a/src/beautifiers/beautifier.coffee b/src/beautifiers/beautifier.coffee index e369ac6..c4b6ec0 100644 --- a/src/beautifiers/beautifier.coffee +++ b/src/beautifiers/beautifier.coffee @@ -97,6 +97,26 @@ module.exports = class Beautifier startDir.pop() return null + # Retrieves the default line ending based upon the Atom configuration + # `line-ending-selector.defaultLineEnding`. If the Atom configuration + # indicates "OS Default", the `process.platform` is queried, returning + # CRLF for Windows systems and LF for all other systems. + # Code modified from atom/line-ending-selector + # returns: The correct line-ending character sequence based upon the Atom + # configuration, or `null` if the Atom line ending configuration was not + # recognized. + # see: https://github.com/atom/line-ending-selector/blob/master/lib/main.js + getDefaultLineEnding: (crlf,lf) -> + switch atom.config.get('line-ending-selector.defaultLineEnding') + when 'LF' + return lf + when 'CRLF' + return crlf + when 'OS Default' + return if process.platform is 'win32' then crlf else lf + else + return lf + ### If platform is Windows ### diff --git a/src/beautifiers/js-beautify.coffee b/src/beautifiers/js-beautify.coffee index 7092e23..96f15c3 100644 --- a/src/beautifiers/js-beautify.coffee +++ b/src/beautifiers/js-beautify.coffee @@ -6,6 +6,15 @@ module.exports = class JSBeautify extends Beautifier link: "https://github.com/beautify-web/js-beautify" options: { + _: + eol: ['end_of_line', (end_of_line) -> + if (end_of_line == 'CRLF') + '\r\n' + else if (end_of_line == 'LF') + '\n' + else + null + ] HTML: true XML: true Handlebars: true @@ -25,11 +34,10 @@ module.exports = class JSBeautify extends Beautifier } beautify: (text, language, options) -> + @verbose("JS Beautify language #{language}") @info("JS Beautify Options: #{JSON.stringify(options, null, 4)}") - #TODO reconsider handling of EOL once js-beautify adds EOL detection - #see https://github.com/beautify-web/js-beautify/issues/899 - options.eol = getDefaultLineEnding() ? options.eol #fixes issue #707 + options.eol = options.eol ? @getDefaultLineEnding('\r\n','\n') return new @Promise((resolve, reject) => try switch language @@ -58,23 +66,3 @@ module.exports = class JSBeautify extends Beautifier reject(err) ) - - # Retrieves the default line ending based upon the Atom configuration - # `line-ending-selector.defaultLineEnding`. If the Atom configuration - # indicates "OS Default", the `process.platform` is queried, returning - # CRLF for Windows systems and LF for all other systems. - # Code modified from atom/line-ending-selector - # returns: The correct line-ending character sequence based upon the Atom - # configuration, or `null` if the Atom line ending configuration was not - # recognized. - # see: https://github.com/atom/line-ending-selector/blob/master/lib/main.js - getDefaultLineEnding= -> - switch atom.config.get('line-ending-selector.defaultLineEnding') - when 'LF' - return '\n' - when 'CRLF' - return '\r\n' - when 'OS Default' - return if process.platform is 'win32' then '\r\n' else '\n' - else - return null diff --git a/src/beautifiers/prettydiff.coffee b/src/beautifiers/prettydiff.coffee index 2be957e..37c040a 100644 --- a/src/beautifiers/prettydiff.coffee +++ b/src/beautifiers/prettydiff.coffee @@ -42,6 +42,14 @@ module.exports = class PrettyDiff extends Beautifier ] ternaryline: "preserve_ternary_lines" bracepadding: "space_in_paren" + crlf: ['end_of_line', (end_of_line) -> + if (end_of_line == 'CRLF') + true + else if (end_of_line == 'LF') + false + else + null + ] # Apply language-specific options CSV: true Coldfusion: true @@ -70,6 +78,7 @@ module.exports = class PrettyDiff extends Beautifier beautify: (text, language, options) -> + options.crlf = options.crlf ? @getDefaultLineEnding(true,false) return new @Promise((resolve, reject) => prettydiff = require("prettydiff") _ = require('lodash') diff --git a/src/languages/javascript.coffee b/src/languages/javascript.coffee index 49c7a34..e5c2892 100644 --- a/src/languages/javascript.coffee +++ b/src/languages/javascript.coffee @@ -111,5 +111,10 @@ module.exports = { default: false description: "If a terminating comma should be inserted into \ arrays, object literals, and destructured objects." + end_of_line: + type: 'string' + default: "System Default" + enum: ["CRLF","LF","System Default"] + description: "Override EOL from line-ending-selector" } From 97d62680e4057dc20cd7d8f92b00c9038c785fa3 Mon Sep 17 00:00:00 2001 From: Deforder Date: Sat, 14 Jan 2017 14:47:27 +0700 Subject: [PATCH 2/5] Revert "Added Overrided EOL option for JS , JSX" This reverts commit c48eaf967e38e281d87c124cf8323eba2bae60f1. --- docs/options.md | 3370 ++++++++++++++++++++++++---- src/beautifiers/beautifier.coffee | 20 - src/beautifiers/js-beautify.coffee | 34 +- src/beautifiers/prettydiff.coffee | 9 - src/languages/javascript.coffee | 5 - 5 files changed, 2979 insertions(+), 459 deletions(-) diff --git a/docs/options.md b/docs/options.md index 88beddf..6bb63b3 100644 --- a/docs/options.md +++ b/docs/options.md @@ -766,7 +766,6 @@ Automatically beautify Clojure files on save | `beautify_on_save` | :white_check_mark: | :white_check_mark: | | `brace_style` | :white_check_mark: | :x: | | `break_chained_methods` | :white_check_mark: | :x: | -| `end_of_line` | :white_check_mark: | :x: | | `end_with_comma` | :white_check_mark: | :x: | | `end_with_newline` | :white_check_mark: | :x: | | `eval_code` | :white_check_mark: | :x: | @@ -896,34 +895,6 @@ Break chained method calls across subsequent lines (Supported by Coffee Formatte } ``` -##### [End of line](#end-of-line) - -**Namespace**: `js` - -**Key**: `end_of_line` - -**Default**: `System Default` - -**Type**: `string` - -**Enum**: `CRLF` `LF` `System Default` - -**Supported Beautifiers**: [`Coffee Formatter`](#coffee-formatter) - -**Description**: - -Override EOL from line-ending-selector (Supported by Coffee Formatter) - -**Example `.jsbeautifyrc` Configuration** - -```json -{ - "js": { - "end_of_line": "System Default" - } -} -``` - ##### [End with comma](#end-with-comma) **Namespace**: `js` @@ -2206,16 +2177,30 @@ Path to uncrustify config file. i.e. uncrustify.cfg (Supported by Uncrustify) | `disabled` | :white_check_mark: | :white_check_mark: | | `default_beautifier` | :white_check_mark: | :white_check_mark: | | `beautify_on_save` | :white_check_mark: | :white_check_mark: | -| `break_chained_methods` | :x: | :white_check_mark: | -| `end_of_line` | :white_check_mark: | :white_check_mark: | -| `end_with_comma` | :x: | :white_check_mark: | +| `brace_style` | :white_check_mark: | :x: | +| `break_chained_methods` | :white_check_mark: | :white_check_mark: | +| `end_with_comma` | :white_check_mark: | :white_check_mark: | | `end_with_newline` | :white_check_mark: | :x: | +| `eval_code` | :white_check_mark: | :x: | +| `extra_liners` | :white_check_mark: | :x: | | `indent_char` | :white_check_mark: | :white_check_mark: | +| `indent_inner_html` | :white_check_mark: | :x: | +| `indent_level` | :white_check_mark: | :x: | +| `indent_scripts` | :white_check_mark: | :x: | | `indent_size` | :white_check_mark: | :white_check_mark: | -| `indent_with_tabs` | :x: | :white_check_mark: | +| `indent_with_tabs` | :white_check_mark: | :white_check_mark: | +| `jslint_happy` | :white_check_mark: | :x: | +| `keep_array_indentation` | :white_check_mark: | :x: | +| `keep_function_indentation` | :white_check_mark: | :x: | +| `max_preserve_newlines` | :white_check_mark: | :x: | | `preserve_newlines` | :white_check_mark: | :white_check_mark: | -| `space_after_anon_function` | :x: | :white_check_mark: | -| `space_in_paren` | :x: | :white_check_mark: | +| `space_after_anon_function` | :white_check_mark: | :white_check_mark: | +| `space_before_conditional` | :white_check_mark: | :x: | +| `space_in_paren` | :white_check_mark: | :white_check_mark: | +| `unescape_strings` | :white_check_mark: | :x: | +| `unformatted` | :white_check_mark: | :x: | +| `wrap_attributes` | :white_check_mark: | :x: | +| `wrap_attributes_indent_size` | :white_check_mark: | :x: | | `wrap_line_length` | :white_check_mark: | :white_check_mark: | **Description**: @@ -2277,6 +2262,34 @@ Automatically beautify EJS files on save 2. Go into *Packages* and search for "*Atom Beautify*" package. 3. Find the option "*Beautify On Save*" and change it to your desired configuration. +##### [Brace style](#brace-style) + +**Namespace**: `html` + +**Key**: `brace_style` + +**Default**: `collapse` + +**Type**: `string` + +**Enum**: `collapse` `collapse-preserve-inline` `expand` `end-expand` `none` + +**Supported Beautifiers**: [`JS Beautify`](#js-beautify) + +**Description**: + +[collapse|expand|end-expand|none] (Supported by JS Beautify) + +**Example `.jsbeautifyrc` Configuration** + +```json +{ + "html": { + "brace_style": "collapse" + } +} +``` + ##### [Break chained methods](#break-chained-methods) **Namespace**: `js` @@ -2285,11 +2298,11 @@ Automatically beautify EJS files on save **Type**: `boolean` -**Supported Beautifiers**: [`Pretty Diff`](#pretty-diff) +**Supported Beautifiers**: [`JS Beautify`](#js-beautify) [`Pretty Diff`](#pretty-diff) **Description**: -Break chained method calls across subsequent lines (Supported by Pretty Diff) +Break chained method calls across subsequent lines (Supported by JS Beautify, Pretty Diff) **Example `.jsbeautifyrc` Configuration** @@ -2301,34 +2314,6 @@ Break chained method calls across subsequent lines (Supported by Pretty Diff) } ``` -##### [End of line](#end-of-line) - -**Namespace**: `js` - -**Key**: `end_of_line` - -**Default**: `System Default` - -**Type**: `string` - -**Enum**: `CRLF` `LF` `System Default` - -**Supported Beautifiers**: [`JS Beautify`](#js-beautify) [`Pretty Diff`](#pretty-diff) - -**Description**: - -Override EOL from line-ending-selector (Supported by JS Beautify, Pretty Diff) - -**Example `.jsbeautifyrc` Configuration** - -```json -{ - "js": { - "end_of_line": "System Default" - } -} -``` - ##### [End with comma](#end-with-comma) **Namespace**: `js` @@ -2337,11 +2322,11 @@ Override EOL from line-ending-selector (Supported by JS Beautify, Pretty Diff) **Type**: `boolean` -**Supported Beautifiers**: [`Pretty Diff`](#pretty-diff) +**Supported Beautifiers**: [`JS Beautify`](#js-beautify) [`Pretty Diff`](#pretty-diff) **Description**: -If a terminating comma should be inserted into arrays, object literals, and destructured objects. (Supported by Pretty Diff) +If a terminating comma should be inserted into arrays, object literals, and destructured objects. (Supported by JS Beautify, Pretty Diff) **Example `.jsbeautifyrc` Configuration** @@ -2377,6 +2362,60 @@ End output with newline (Supported by JS Beautify) } ``` +##### [Eval code](#eval-code) + +**Namespace**: `js` + +**Key**: `eval_code` + +**Type**: `boolean` + +**Supported Beautifiers**: [`JS Beautify`](#js-beautify) + +**Description**: + + (Supported by JS Beautify) + +**Example `.jsbeautifyrc` Configuration** + +```json +{ + "js": { + "eval_code": false + } +} +``` + +##### [Extra liners](#extra-liners) + +**Namespace**: `html` + +**Key**: `extra_liners` + +**Default**: `head,body,/html` + +**Type**: `array` + +**Supported Beautifiers**: [`JS Beautify`](#js-beautify) + +**Description**: + +List of tags (defaults to [head,body,/html] that should have an extra newline before them. (Supported by JS Beautify) + +**Example `.jsbeautifyrc` Configuration** + +```json +{ + "html": { + "extra_liners": [ + "head", + "body", + "/html" + ] + } +} +``` + ##### [Indent char](#indent-char) **Namespace**: `html` @@ -2403,6 +2442,82 @@ Indentation character (Supported by JS Beautify, Pretty Diff) } ``` +##### [Indent inner html](#indent-inner-html) + +**Namespace**: `html` + +**Key**: `indent_inner_html` + +**Type**: `boolean` + +**Supported Beautifiers**: [`JS Beautify`](#js-beautify) + +**Description**: + +Indent and sections. (Supported by JS Beautify) + +**Example `.jsbeautifyrc` Configuration** + +```json +{ + "html": { + "indent_inner_html": false + } +} +``` + +##### [Indent level](#indent-level) + +**Namespace**: `js` + +**Key**: `indent_level` + +**Type**: `integer` + +**Supported Beautifiers**: [`JS Beautify`](#js-beautify) + +**Description**: + +Initial indentation level (Supported by JS Beautify) + +**Example `.jsbeautifyrc` Configuration** + +```json +{ + "js": { + "indent_level": 0 + } +} +``` + +##### [Indent scripts](#indent-scripts) + +**Namespace**: `html` + +**Key**: `indent_scripts` + +**Default**: `normal` + +**Type**: `string` + +**Enum**: `keep` `separate` `normal` + +**Supported Beautifiers**: [`JS Beautify`](#js-beautify) + +**Description**: + +[keep|separate|normal] (Supported by JS Beautify) + +**Example `.jsbeautifyrc` Configuration** + +```json +{ + "html": { + "indent_scripts": "normal" + } +} +``` + ##### [Indent size](#indent-size) **Namespace**: `html` @@ -2437,11 +2552,11 @@ Indentation size/length (Supported by JS Beautify, Pretty Diff) **Type**: `boolean` -**Supported Beautifiers**: [`Pretty Diff`](#pretty-diff) +**Supported Beautifiers**: [`JS Beautify`](#js-beautify) [`Pretty Diff`](#pretty-diff) **Description**: -Indentation uses tabs, overrides `Indent Size` and `Indent Char` (Supported by Pretty Diff) +Indentation uses tabs, overrides `Indent Size` and `Indent Char` (Supported by JS Beautify, Pretty Diff) **Example `.jsbeautifyrc` Configuration** @@ -2453,6 +2568,104 @@ Indentation uses tabs, overrides `Indent Size` and `Indent Char` (Supported by P } ``` +##### [Jslint happy](#jslint-happy) + +**Namespace**: `js` + +**Key**: `jslint_happy` + +**Type**: `boolean` + +**Supported Beautifiers**: [`JS Beautify`](#js-beautify) + +**Description**: + +Enable jslint-stricter mode (Supported by JS Beautify) + +**Example `.jsbeautifyrc` Configuration** + +```json +{ + "js": { + "jslint_happy": false + } +} +``` + +##### [Keep array indentation](#keep-array-indentation) + +**Namespace**: `js` + +**Key**: `keep_array_indentation` + +**Type**: `boolean` + +**Supported Beautifiers**: [`JS Beautify`](#js-beautify) + +**Description**: + +Preserve array indentation (Supported by JS Beautify) + +**Example `.jsbeautifyrc` Configuration** + +```json +{ + "js": { + "keep_array_indentation": false + } +} +``` + +##### [Keep function indentation](#keep-function-indentation) + +**Namespace**: `js` + +**Key**: `keep_function_indentation` + +**Type**: `boolean` + +**Supported Beautifiers**: [`JS Beautify`](#js-beautify) + +**Description**: + + (Supported by JS Beautify) + +**Example `.jsbeautifyrc` Configuration** + +```json +{ + "js": { + "keep_function_indentation": false + } +} +``` + +##### [Max preserve newlines](#max-preserve-newlines) + +**Namespace**: `html` + +**Key**: `max_preserve_newlines` + +**Default**: `10` + +**Type**: `integer` + +**Supported Beautifiers**: [`JS Beautify`](#js-beautify) + +**Description**: + +Number of line-breaks to be preserved in one chunk (Supported by JS Beautify) + +**Example `.jsbeautifyrc` Configuration** + +```json +{ + "html": { + "max_preserve_newlines": 10 + } +} +``` + ##### [Preserve newlines](#preserve-newlines) **Namespace**: `html` @@ -2487,11 +2700,11 @@ Preserve line-breaks (Supported by JS Beautify, Pretty Diff) **Type**: `boolean` -**Supported Beautifiers**: [`Pretty Diff`](#pretty-diff) +**Supported Beautifiers**: [`JS Beautify`](#js-beautify) [`Pretty Diff`](#pretty-diff) **Description**: -Add a space before an anonymous function's parens, ie. function () (Supported by Pretty Diff) +Add a space before an anonymous function's parens, ie. function () (Supported by JS Beautify, Pretty Diff) **Example `.jsbeautifyrc` Configuration** @@ -2503,6 +2716,32 @@ Add a space before an anonymous function's parens, ie. function () (Supported by } ``` +##### [Space before conditional](#space-before-conditional) + +**Namespace**: `js` + +**Key**: `space_before_conditional` + +**Default**: `true` + +**Type**: `boolean` + +**Supported Beautifiers**: [`JS Beautify`](#js-beautify) + +**Description**: + + (Supported by JS Beautify) + +**Example `.jsbeautifyrc` Configuration** + +```json +{ + "js": { + "space_before_conditional": true + } +} +``` + ##### [Space in paren](#space-in-paren) **Namespace**: `js` @@ -2511,11 +2750,11 @@ Add a space before an anonymous function's parens, ie. function () (Supported by **Type**: `boolean` -**Supported Beautifiers**: [`Pretty Diff`](#pretty-diff) +**Supported Beautifiers**: [`JS Beautify`](#js-beautify) [`Pretty Diff`](#pretty-diff) **Description**: -Add padding spaces within paren, ie. f( a, b ) (Supported by Pretty Diff) +Add padding spaces within paren, ie. f( a, b ) (Supported by JS Beautify, Pretty Diff) **Example `.jsbeautifyrc` Configuration** @@ -2527,6 +2766,179 @@ Add padding spaces within paren, ie. f( a, b ) (Supported by Pretty Diff) } ``` +##### [Unescape strings](#unescape-strings) + +**Namespace**: `js` + +**Key**: `unescape_strings` + +**Type**: `boolean` + +**Supported Beautifiers**: [`JS Beautify`](#js-beautify) + +**Description**: + +Decode printable characters encoded in xNN notation (Supported by JS Beautify) + +**Example `.jsbeautifyrc` Configuration** + +```json +{ + "js": { + "unescape_strings": false + } +} +``` + +##### [Unformatted](#unformatted) + +**Namespace**: `html` + +**Key**: `unformatted` + +**Default**: `a,abbr,area,audio,b,bdi,bdo,br,button,canvas,cite,code,data,datalist,del,dfn,em,embed,i,iframe,img,input,ins,kbd,keygen,label,map,mark,math,meter,noscript,object,output,progress,q,ruby,s,samp,select,small,span,strong,sub,sup,svg,template,textarea,time,u,var,video,wbr,text,acronym,address,big,dt,ins,small,strike,tt,pre,h1,h2,h3,h4,h5,h6` + +**Type**: `array` + +**Supported Beautifiers**: [`JS Beautify`](#js-beautify) + +**Description**: + +List of tags (defaults to inline) that should not be reformatted (Supported by JS Beautify) + +**Example `.jsbeautifyrc` Configuration** + +```json +{ + "html": { + "unformatted": [ + "a", + "abbr", + "area", + "audio", + "b", + "bdi", + "bdo", + "br", + "button", + "canvas", + "cite", + "code", + "data", + "datalist", + "del", + "dfn", + "em", + "embed", + "i", + "iframe", + "img", + "input", + "ins", + "kbd", + "keygen", + "label", + "map", + "mark", + "math", + "meter", + "noscript", + "object", + "output", + "progress", + "q", + "ruby", + "s", + "samp", + "select", + "small", + "span", + "strong", + "sub", + "sup", + "svg", + "template", + "textarea", + "time", + "u", + "var", + "video", + "wbr", + "text", + "acronym", + "address", + "big", + "dt", + "ins", + "small", + "strike", + "tt", + "pre", + "h1", + "h2", + "h3", + "h4", + "h5", + "h6" + ] + } +} +``` + +##### [Wrap attributes](#wrap-attributes) + +**Namespace**: `html` + +**Key**: `wrap_attributes` + +**Default**: `auto` + +**Type**: `string` + +**Enum**: `auto` `force` + +**Supported Beautifiers**: [`JS Beautify`](#js-beautify) + +**Description**: + +Wrap attributes to new lines [auto|force] (Supported by JS Beautify) + +**Example `.jsbeautifyrc` Configuration** + +```json +{ + "html": { + "wrap_attributes": "auto" + } +} +``` + +##### [Wrap attributes indent size](#wrap-attributes-indent-size) + +**Namespace**: `html` + +**Key**: `wrap_attributes_indent_size` + +**Default**: `4` + +**Type**: `integer` + +**Supported Beautifiers**: [`JS Beautify`](#js-beautify) + +**Description**: + +Indent wrapped attributes to after N characters (Supported by JS Beautify) + +**Example `.jsbeautifyrc` Configuration** + +```json +{ + "html": { + "wrap_attributes_indent_size": 4 + } +} +``` + ##### [Wrap line length](#wrap-line-length) **Namespace**: `html` @@ -3282,10 +3694,18 @@ Automatically beautify Go files on save | `disabled` | :white_check_mark: | :white_check_mark: | | `default_beautifier` | :white_check_mark: | :white_check_mark: | | `beautify_on_save` | :white_check_mark: | :white_check_mark: | +| `brace_style` | :white_check_mark: | :x: | | `end_with_newline` | :white_check_mark: | :x: | +| `extra_liners` | :white_check_mark: | :x: | | `indent_char` | :white_check_mark: | :white_check_mark: | +| `indent_inner_html` | :white_check_mark: | :x: | +| `indent_scripts` | :white_check_mark: | :x: | | `indent_size` | :white_check_mark: | :white_check_mark: | +| `max_preserve_newlines` | :white_check_mark: | :x: | | `preserve_newlines` | :white_check_mark: | :white_check_mark: | +| `unformatted` | :white_check_mark: | :x: | +| `wrap_attributes` | :white_check_mark: | :x: | +| `wrap_attributes_indent_size` | :white_check_mark: | :x: | | `wrap_line_length` | :white_check_mark: | :white_check_mark: | **Description**: @@ -3347,6 +3767,34 @@ Automatically beautify Handlebars files on save 2. Go into *Packages* and search for "*Atom Beautify*" package. 3. Find the option "*Beautify On Save*" and change it to your desired configuration. +##### [Brace style](#brace-style) + +**Namespace**: `html` + +**Key**: `brace_style` + +**Default**: `collapse` + +**Type**: `string` + +**Enum**: `collapse` `expand` `end-expand` `none` + +**Supported Beautifiers**: [`JS Beautify`](#js-beautify) + +**Description**: + +[collapse|expand|end-expand|none] (Supported by JS Beautify) + +**Example `.jsbeautifyrc` Configuration** + +```json +{ + "html": { + "brace_style": "collapse" + } +} +``` + ##### [End with newline](#end-with-newline) **Namespace**: `html` @@ -3371,6 +3819,36 @@ End output with newline (Supported by JS Beautify) } ``` +##### [Extra liners](#extra-liners) + +**Namespace**: `html` + +**Key**: `extra_liners` + +**Default**: `head,body,/html` + +**Type**: `array` + +**Supported Beautifiers**: [`JS Beautify`](#js-beautify) + +**Description**: + +List of tags (defaults to [head,body,/html] that should have an extra newline before them. (Supported by JS Beautify) + +**Example `.jsbeautifyrc` Configuration** + +```json +{ + "html": { + "extra_liners": [ + "head", + "body", + "/html" + ] + } +} +``` + ##### [Indent char](#indent-char) **Namespace**: `html` @@ -3397,6 +3875,58 @@ Indentation character (Supported by JS Beautify, Pretty Diff) } ``` +##### [Indent inner html](#indent-inner-html) + +**Namespace**: `html` + +**Key**: `indent_inner_html` + +**Type**: `boolean` + +**Supported Beautifiers**: [`JS Beautify`](#js-beautify) + +**Description**: + +Indent and sections. (Supported by JS Beautify) + +**Example `.jsbeautifyrc` Configuration** + +```json +{ + "html": { + "indent_inner_html": false + } +} +``` + +##### [Indent scripts](#indent-scripts) + +**Namespace**: `html` + +**Key**: `indent_scripts` + +**Default**: `normal` + +**Type**: `string` + +**Enum**: `keep` `separate` `normal` + +**Supported Beautifiers**: [`JS Beautify`](#js-beautify) + +**Description**: + +[keep|separate|normal] (Supported by JS Beautify) + +**Example `.jsbeautifyrc` Configuration** + +```json +{ + "html": { + "indent_scripts": "normal" + } +} +``` + ##### [Indent size](#indent-size) **Namespace**: `html` @@ -3423,6 +3953,32 @@ Indentation size/length (Supported by JS Beautify, Pretty Diff) } ``` +##### [Max preserve newlines](#max-preserve-newlines) + +**Namespace**: `html` + +**Key**: `max_preserve_newlines` + +**Default**: `10` + +**Type**: `integer` + +**Supported Beautifiers**: [`JS Beautify`](#js-beautify) + +**Description**: + +Number of line-breaks to be preserved in one chunk (Supported by JS Beautify) + +**Example `.jsbeautifyrc` Configuration** + +```json +{ + "html": { + "max_preserve_newlines": 10 + } +} +``` + ##### [Preserve newlines](#preserve-newlines) **Namespace**: `html` @@ -3449,6 +4005,155 @@ Preserve line-breaks (Supported by JS Beautify, Pretty Diff) } ``` +##### [Unformatted](#unformatted) + +**Namespace**: `html` + +**Key**: `unformatted` + +**Default**: `a,abbr,area,audio,b,bdi,bdo,br,button,canvas,cite,code,data,datalist,del,dfn,em,embed,i,iframe,img,input,ins,kbd,keygen,label,map,mark,math,meter,noscript,object,output,progress,q,ruby,s,samp,select,small,span,strong,sub,sup,svg,template,textarea,time,u,var,video,wbr,text,acronym,address,big,dt,ins,small,strike,tt,pre,h1,h2,h3,h4,h5,h6` + +**Type**: `array` + +**Supported Beautifiers**: [`JS Beautify`](#js-beautify) + +**Description**: + +List of tags (defaults to inline) that should not be reformatted (Supported by JS Beautify) + +**Example `.jsbeautifyrc` Configuration** + +```json +{ + "html": { + "unformatted": [ + "a", + "abbr", + "area", + "audio", + "b", + "bdi", + "bdo", + "br", + "button", + "canvas", + "cite", + "code", + "data", + "datalist", + "del", + "dfn", + "em", + "embed", + "i", + "iframe", + "img", + "input", + "ins", + "kbd", + "keygen", + "label", + "map", + "mark", + "math", + "meter", + "noscript", + "object", + "output", + "progress", + "q", + "ruby", + "s", + "samp", + "select", + "small", + "span", + "strong", + "sub", + "sup", + "svg", + "template", + "textarea", + "time", + "u", + "var", + "video", + "wbr", + "text", + "acronym", + "address", + "big", + "dt", + "ins", + "small", + "strike", + "tt", + "pre", + "h1", + "h2", + "h3", + "h4", + "h5", + "h6" + ] + } +} +``` + +##### [Wrap attributes](#wrap-attributes) + +**Namespace**: `html` + +**Key**: `wrap_attributes` + +**Default**: `auto` + +**Type**: `string` + +**Enum**: `auto` `force` + +**Supported Beautifiers**: [`JS Beautify`](#js-beautify) + +**Description**: + +Wrap attributes to new lines [auto|force] (Supported by JS Beautify) + +**Example `.jsbeautifyrc` Configuration** + +```json +{ + "html": { + "wrap_attributes": "auto" + } +} +``` + +##### [Wrap attributes indent size](#wrap-attributes-indent-size) + +**Namespace**: `html` + +**Key**: `wrap_attributes_indent_size` + +**Default**: `4` + +**Type**: `integer` + +**Supported Beautifiers**: [`JS Beautify`](#js-beautify) + +**Description**: + +Indent wrapped attributes to after N characters (Supported by JS Beautify) + +**Example `.jsbeautifyrc` Configuration** + +```json +{ + "html": { + "wrap_attributes_indent_size": 4 + } +} +``` + ##### [Wrap line length](#wrap-line-length) **Namespace**: `html` @@ -3553,10 +4258,18 @@ Automatically beautify Haskell files on save | `disabled` | :white_check_mark: | :white_check_mark: | | `default_beautifier` | :white_check_mark: | :white_check_mark: | | `beautify_on_save` | :white_check_mark: | :white_check_mark: | +| `brace_style` | :white_check_mark: | :x: | | `end_with_newline` | :white_check_mark: | :x: | +| `extra_liners` | :white_check_mark: | :x: | | `indent_char` | :white_check_mark: | :white_check_mark: | +| `indent_inner_html` | :white_check_mark: | :x: | +| `indent_scripts` | :white_check_mark: | :x: | | `indent_size` | :white_check_mark: | :white_check_mark: | +| `max_preserve_newlines` | :white_check_mark: | :x: | | `preserve_newlines` | :white_check_mark: | :white_check_mark: | +| `unformatted` | :white_check_mark: | :x: | +| `wrap_attributes` | :white_check_mark: | :x: | +| `wrap_attributes_indent_size` | :white_check_mark: | :x: | | `wrap_line_length` | :white_check_mark: | :white_check_mark: | **Description**: @@ -3618,6 +4331,34 @@ Automatically beautify HTML files on save 2. Go into *Packages* and search for "*Atom Beautify*" package. 3. Find the option "*Beautify On Save*" and change it to your desired configuration. +##### [Brace style](#brace-style) + +**Namespace**: `html` + +**Key**: `brace_style` + +**Default**: `collapse` + +**Type**: `string` + +**Enum**: `collapse` `expand` `end-expand` `none` + +**Supported Beautifiers**: [`JS Beautify`](#js-beautify) + +**Description**: + +[collapse|expand|end-expand|none] (Supported by JS Beautify) + +**Example `.jsbeautifyrc` Configuration** + +```json +{ + "html": { + "brace_style": "collapse" + } +} +``` + ##### [End with newline](#end-with-newline) **Namespace**: `html` @@ -3642,6 +4383,36 @@ End output with newline (Supported by JS Beautify) } ``` +##### [Extra liners](#extra-liners) + +**Namespace**: `html` + +**Key**: `extra_liners` + +**Default**: `head,body,/html` + +**Type**: `array` + +**Supported Beautifiers**: [`JS Beautify`](#js-beautify) + +**Description**: + +List of tags (defaults to [head,body,/html] that should have an extra newline before them. (Supported by JS Beautify) + +**Example `.jsbeautifyrc` Configuration** + +```json +{ + "html": { + "extra_liners": [ + "head", + "body", + "/html" + ] + } +} +``` + ##### [Indent char](#indent-char) **Namespace**: `html` @@ -3668,6 +4439,58 @@ Indentation character (Supported by JS Beautify, Pretty Diff) } ``` +##### [Indent inner html](#indent-inner-html) + +**Namespace**: `html` + +**Key**: `indent_inner_html` + +**Type**: `boolean` + +**Supported Beautifiers**: [`JS Beautify`](#js-beautify) + +**Description**: + +Indent and sections. (Supported by JS Beautify) + +**Example `.jsbeautifyrc` Configuration** + +```json +{ + "html": { + "indent_inner_html": false + } +} +``` + +##### [Indent scripts](#indent-scripts) + +**Namespace**: `html` + +**Key**: `indent_scripts` + +**Default**: `normal` + +**Type**: `string` + +**Enum**: `keep` `separate` `normal` + +**Supported Beautifiers**: [`JS Beautify`](#js-beautify) + +**Description**: + +[keep|separate|normal] (Supported by JS Beautify) + +**Example `.jsbeautifyrc` Configuration** + +```json +{ + "html": { + "indent_scripts": "normal" + } +} +``` + ##### [Indent size](#indent-size) **Namespace**: `html` @@ -3694,6 +4517,32 @@ Indentation size/length (Supported by JS Beautify, Pretty Diff) } ``` +##### [Max preserve newlines](#max-preserve-newlines) + +**Namespace**: `html` + +**Key**: `max_preserve_newlines` + +**Default**: `10` + +**Type**: `integer` + +**Supported Beautifiers**: [`JS Beautify`](#js-beautify) + +**Description**: + +Number of line-breaks to be preserved in one chunk (Supported by JS Beautify) + +**Example `.jsbeautifyrc` Configuration** + +```json +{ + "html": { + "max_preserve_newlines": 10 + } +} +``` + ##### [Preserve newlines](#preserve-newlines) **Namespace**: `html` @@ -3720,6 +4569,155 @@ Preserve line-breaks (Supported by JS Beautify, Pretty Diff) } ``` +##### [Unformatted](#unformatted) + +**Namespace**: `html` + +**Key**: `unformatted` + +**Default**: `a,abbr,area,audio,b,bdi,bdo,br,button,canvas,cite,code,data,datalist,del,dfn,em,embed,i,iframe,img,input,ins,kbd,keygen,label,map,mark,math,meter,noscript,object,output,progress,q,ruby,s,samp,select,small,span,strong,sub,sup,svg,template,textarea,time,u,var,video,wbr,text,acronym,address,big,dt,ins,small,strike,tt,pre,h1,h2,h3,h4,h5,h6` + +**Type**: `array` + +**Supported Beautifiers**: [`JS Beautify`](#js-beautify) + +**Description**: + +List of tags (defaults to inline) that should not be reformatted (Supported by JS Beautify) + +**Example `.jsbeautifyrc` Configuration** + +```json +{ + "html": { + "unformatted": [ + "a", + "abbr", + "area", + "audio", + "b", + "bdi", + "bdo", + "br", + "button", + "canvas", + "cite", + "code", + "data", + "datalist", + "del", + "dfn", + "em", + "embed", + "i", + "iframe", + "img", + "input", + "ins", + "kbd", + "keygen", + "label", + "map", + "mark", + "math", + "meter", + "noscript", + "object", + "output", + "progress", + "q", + "ruby", + "s", + "samp", + "select", + "small", + "span", + "strong", + "sub", + "sup", + "svg", + "template", + "textarea", + "time", + "u", + "var", + "video", + "wbr", + "text", + "acronym", + "address", + "big", + "dt", + "ins", + "small", + "strike", + "tt", + "pre", + "h1", + "h2", + "h3", + "h4", + "h5", + "h6" + ] + } +} +``` + +##### [Wrap attributes](#wrap-attributes) + +**Namespace**: `html` + +**Key**: `wrap_attributes` + +**Default**: `auto` + +**Type**: `string` + +**Enum**: `auto` `force` + +**Supported Beautifiers**: [`JS Beautify`](#js-beautify) + +**Description**: + +Wrap attributes to new lines [auto|force] (Supported by JS Beautify) + +**Example `.jsbeautifyrc` Configuration** + +```json +{ + "html": { + "wrap_attributes": "auto" + } +} +``` + +##### [Wrap attributes indent size](#wrap-attributes-indent-size) + +**Namespace**: `html` + +**Key**: `wrap_attributes_indent_size` + +**Default**: `4` + +**Type**: `integer` + +**Supported Beautifiers**: [`JS Beautify`](#js-beautify) + +**Description**: + +Indent wrapped attributes to after N characters (Supported by JS Beautify) + +**Example `.jsbeautifyrc` Configuration** + +```json +{ + "html": { + "wrap_attributes_indent_size": 4 + } +} +``` + ##### [Wrap line length](#wrap-line-length) **Namespace**: `html` @@ -3972,16 +4970,24 @@ Path to uncrustify config file. i.e. uncrustify.cfg (Supported by Uncrustify) | `disabled` | :white_check_mark: | :white_check_mark: | :white_check_mark: | | `default_beautifier` | :white_check_mark: | :white_check_mark: | :white_check_mark: | | `beautify_on_save` | :white_check_mark: | :white_check_mark: | :white_check_mark: | -| `break_chained_methods` | :x: | :x: | :white_check_mark: | -| `end_of_line` | :white_check_mark: | :x: | :white_check_mark: | -| `end_with_comma` | :x: | :x: | :white_check_mark: | +| `brace_style` | :white_check_mark: | :x: | :x: | +| `break_chained_methods` | :white_check_mark: | :x: | :white_check_mark: | +| `end_with_comma` | :white_check_mark: | :x: | :white_check_mark: | | `end_with_newline` | :white_check_mark: | :x: | :x: | +| `eval_code` | :white_check_mark: | :x: | :x: | | `indent_char` | :white_check_mark: | :x: | :white_check_mark: | +| `indent_level` | :white_check_mark: | :x: | :x: | | `indent_size` | :white_check_mark: | :x: | :white_check_mark: | -| `indent_with_tabs` | :x: | :x: | :white_check_mark: | +| `indent_with_tabs` | :white_check_mark: | :x: | :white_check_mark: | +| `jslint_happy` | :white_check_mark: | :x: | :x: | +| `keep_array_indentation` | :white_check_mark: | :x: | :x: | +| `keep_function_indentation` | :white_check_mark: | :x: | :x: | +| `max_preserve_newlines` | :white_check_mark: | :x: | :x: | | `preserve_newlines` | :white_check_mark: | :x: | :white_check_mark: | -| `space_after_anon_function` | :x: | :x: | :white_check_mark: | -| `space_in_paren` | :x: | :x: | :white_check_mark: | +| `space_after_anon_function` | :white_check_mark: | :x: | :white_check_mark: | +| `space_before_conditional` | :white_check_mark: | :x: | :x: | +| `space_in_paren` | :white_check_mark: | :x: | :white_check_mark: | +| `unescape_strings` | :white_check_mark: | :x: | :x: | | `wrap_line_length` | :white_check_mark: | :x: | :white_check_mark: | **Description**: @@ -4043,6 +5049,34 @@ Automatically beautify JavaScript files on save 2. Go into *Packages* and search for "*Atom Beautify*" package. 3. Find the option "*Beautify On Save*" and change it to your desired configuration. +##### [Brace style](#brace-style) + +**Namespace**: `js` + +**Key**: `brace_style` + +**Default**: `collapse` + +**Type**: `string` + +**Enum**: `collapse` `collapse-preserve-inline` `expand` `end-expand` `none` + +**Supported Beautifiers**: [`JS Beautify`](#js-beautify) + +**Description**: + +[collapse|collapse-preserve-inline|expand|end-expand|none] (Supported by JS Beautify) + +**Example `.jsbeautifyrc` Configuration** + +```json +{ + "js": { + "brace_style": "collapse" + } +} +``` + ##### [Break chained methods](#break-chained-methods) **Namespace**: `js` @@ -4051,11 +5085,11 @@ Automatically beautify JavaScript files on save **Type**: `boolean` -**Supported Beautifiers**: [`Pretty Diff`](#pretty-diff) +**Supported Beautifiers**: [`JS Beautify`](#js-beautify) [`Pretty Diff`](#pretty-diff) **Description**: -Break chained method calls across subsequent lines (Supported by Pretty Diff) +Break chained method calls across subsequent lines (Supported by JS Beautify, Pretty Diff) **Example `.jsbeautifyrc` Configuration** @@ -4067,34 +5101,6 @@ Break chained method calls across subsequent lines (Supported by Pretty Diff) } ``` -##### [End of line](#end-of-line) - -**Namespace**: `js` - -**Key**: `end_of_line` - -**Default**: `System Default` - -**Type**: `string` - -**Enum**: `CRLF` `LF` `System Default` - -**Supported Beautifiers**: [`JS Beautify`](#js-beautify) [`Pretty Diff`](#pretty-diff) - -**Description**: - -Override EOL from line-ending-selector (Supported by JS Beautify, Pretty Diff) - -**Example `.jsbeautifyrc` Configuration** - -```json -{ - "js": { - "end_of_line": "System Default" - } -} -``` - ##### [End with comma](#end-with-comma) **Namespace**: `js` @@ -4103,11 +5109,11 @@ Override EOL from line-ending-selector (Supported by JS Beautify, Pretty Diff) **Type**: `boolean` -**Supported Beautifiers**: [`Pretty Diff`](#pretty-diff) +**Supported Beautifiers**: [`JS Beautify`](#js-beautify) [`Pretty Diff`](#pretty-diff) **Description**: -If a terminating comma should be inserted into arrays, object literals, and destructured objects. (Supported by Pretty Diff) +If a terminating comma should be inserted into arrays, object literals, and destructured objects. (Supported by JS Beautify, Pretty Diff) **Example `.jsbeautifyrc` Configuration** @@ -4143,6 +5149,30 @@ End output with newline (Supported by JS Beautify) } ``` +##### [Eval code](#eval-code) + +**Namespace**: `js` + +**Key**: `eval_code` + +**Type**: `boolean` + +**Supported Beautifiers**: [`JS Beautify`](#js-beautify) + +**Description**: + + (Supported by JS Beautify) + +**Example `.jsbeautifyrc` Configuration** + +```json +{ + "js": { + "eval_code": false + } +} +``` + ##### [Indent char](#indent-char) **Namespace**: `js` @@ -4169,6 +5199,30 @@ Indentation character (Supported by JS Beautify, Pretty Diff) } ``` +##### [Indent level](#indent-level) + +**Namespace**: `js` + +**Key**: `indent_level` + +**Type**: `integer` + +**Supported Beautifiers**: [`JS Beautify`](#js-beautify) + +**Description**: + +Initial indentation level (Supported by JS Beautify) + +**Example `.jsbeautifyrc` Configuration** + +```json +{ + "js": { + "indent_level": 0 + } +} +``` + ##### [Indent size](#indent-size) **Namespace**: `js` @@ -4203,11 +5257,11 @@ Indentation size/length (Supported by JS Beautify, Pretty Diff) **Type**: `boolean` -**Supported Beautifiers**: [`Pretty Diff`](#pretty-diff) +**Supported Beautifiers**: [`JS Beautify`](#js-beautify) [`Pretty Diff`](#pretty-diff) **Description**: -Indentation uses tabs, overrides `Indent Size` and `Indent Char` (Supported by Pretty Diff) +Indentation uses tabs, overrides `Indent Size` and `Indent Char` (Supported by JS Beautify, Pretty Diff) **Example `.jsbeautifyrc` Configuration** @@ -4219,6 +5273,104 @@ Indentation uses tabs, overrides `Indent Size` and `Indent Char` (Supported by P } ``` +##### [Jslint happy](#jslint-happy) + +**Namespace**: `js` + +**Key**: `jslint_happy` + +**Type**: `boolean` + +**Supported Beautifiers**: [`JS Beautify`](#js-beautify) + +**Description**: + +Enable jslint-stricter mode (Supported by JS Beautify) + +**Example `.jsbeautifyrc` Configuration** + +```json +{ + "js": { + "jslint_happy": false + } +} +``` + +##### [Keep array indentation](#keep-array-indentation) + +**Namespace**: `js` + +**Key**: `keep_array_indentation` + +**Type**: `boolean` + +**Supported Beautifiers**: [`JS Beautify`](#js-beautify) + +**Description**: + +Preserve array indentation (Supported by JS Beautify) + +**Example `.jsbeautifyrc` Configuration** + +```json +{ + "js": { + "keep_array_indentation": false + } +} +``` + +##### [Keep function indentation](#keep-function-indentation) + +**Namespace**: `js` + +**Key**: `keep_function_indentation` + +**Type**: `boolean` + +**Supported Beautifiers**: [`JS Beautify`](#js-beautify) + +**Description**: + + (Supported by JS Beautify) + +**Example `.jsbeautifyrc` Configuration** + +```json +{ + "js": { + "keep_function_indentation": false + } +} +``` + +##### [Max preserve newlines](#max-preserve-newlines) + +**Namespace**: `js` + +**Key**: `max_preserve_newlines` + +**Default**: `10` + +**Type**: `integer` + +**Supported Beautifiers**: [`JS Beautify`](#js-beautify) + +**Description**: + +Number of line-breaks to be preserved in one chunk (Supported by JS Beautify) + +**Example `.jsbeautifyrc` Configuration** + +```json +{ + "js": { + "max_preserve_newlines": 10 + } +} +``` + ##### [Preserve newlines](#preserve-newlines) **Namespace**: `js` @@ -4253,11 +5405,11 @@ Preserve line-breaks (Supported by JS Beautify, Pretty Diff) **Type**: `boolean` -**Supported Beautifiers**: [`Pretty Diff`](#pretty-diff) +**Supported Beautifiers**: [`JS Beautify`](#js-beautify) [`Pretty Diff`](#pretty-diff) **Description**: -Add a space before an anonymous function's parens, ie. function () (Supported by Pretty Diff) +Add a space before an anonymous function's parens, ie. function () (Supported by JS Beautify, Pretty Diff) **Example `.jsbeautifyrc` Configuration** @@ -4269,6 +5421,32 @@ Add a space before an anonymous function's parens, ie. function () (Supported by } ``` +##### [Space before conditional](#space-before-conditional) + +**Namespace**: `js` + +**Key**: `space_before_conditional` + +**Default**: `true` + +**Type**: `boolean` + +**Supported Beautifiers**: [`JS Beautify`](#js-beautify) + +**Description**: + + (Supported by JS Beautify) + +**Example `.jsbeautifyrc` Configuration** + +```json +{ + "js": { + "space_before_conditional": true + } +} +``` + ##### [Space in paren](#space-in-paren) **Namespace**: `js` @@ -4277,11 +5455,11 @@ Add a space before an anonymous function's parens, ie. function () (Supported by **Type**: `boolean` -**Supported Beautifiers**: [`Pretty Diff`](#pretty-diff) +**Supported Beautifiers**: [`JS Beautify`](#js-beautify) [`Pretty Diff`](#pretty-diff) **Description**: -Add padding spaces within paren, ie. f( a, b ) (Supported by Pretty Diff) +Add padding spaces within paren, ie. f( a, b ) (Supported by JS Beautify, Pretty Diff) **Example `.jsbeautifyrc` Configuration** @@ -4293,6 +5471,30 @@ Add padding spaces within paren, ie. f( a, b ) (Supported by Pretty Diff) } ``` +##### [Unescape strings](#unescape-strings) + +**Namespace**: `js` + +**Key**: `unescape_strings` + +**Type**: `boolean` + +**Supported Beautifiers**: [`JS Beautify`](#js-beautify) + +**Description**: + +Decode printable characters encoded in xNN notation (Supported by JS Beautify) + +**Example `.jsbeautifyrc` Configuration** + +```json +{ + "js": { + "unescape_strings": false + } +} +``` + ##### [Wrap line length](#wrap-line-length) **Namespace**: `js` @@ -4326,16 +5528,24 @@ Wrap lines at next opportunity after N characters (Supported by JS Beautify, Pre | `disabled` | :white_check_mark: | :white_check_mark: | | `default_beautifier` | :white_check_mark: | :white_check_mark: | | `beautify_on_save` | :white_check_mark: | :white_check_mark: | -| `break_chained_methods` | :x: | :white_check_mark: | -| `end_of_line` | :white_check_mark: | :white_check_mark: | -| `end_with_comma` | :x: | :white_check_mark: | +| `brace_style` | :white_check_mark: | :x: | +| `break_chained_methods` | :white_check_mark: | :white_check_mark: | +| `end_with_comma` | :white_check_mark: | :white_check_mark: | | `end_with_newline` | :white_check_mark: | :x: | +| `eval_code` | :white_check_mark: | :x: | | `indent_char` | :white_check_mark: | :white_check_mark: | +| `indent_level` | :white_check_mark: | :x: | | `indent_size` | :white_check_mark: | :white_check_mark: | -| `indent_with_tabs` | :x: | :white_check_mark: | +| `indent_with_tabs` | :white_check_mark: | :white_check_mark: | +| `jslint_happy` | :white_check_mark: | :x: | +| `keep_array_indentation` | :white_check_mark: | :x: | +| `keep_function_indentation` | :white_check_mark: | :x: | +| `max_preserve_newlines` | :white_check_mark: | :x: | | `preserve_newlines` | :white_check_mark: | :white_check_mark: | -| `space_after_anon_function` | :x: | :white_check_mark: | -| `space_in_paren` | :x: | :white_check_mark: | +| `space_after_anon_function` | :white_check_mark: | :white_check_mark: | +| `space_before_conditional` | :white_check_mark: | :x: | +| `space_in_paren` | :white_check_mark: | :white_check_mark: | +| `unescape_strings` | :white_check_mark: | :x: | | `wrap_line_length` | :white_check_mark: | :white_check_mark: | **Description**: @@ -4397,6 +5607,34 @@ Automatically beautify JSON files on save 2. Go into *Packages* and search for "*Atom Beautify*" package. 3. Find the option "*Beautify On Save*" and change it to your desired configuration. +##### [Brace style](#brace-style) + +**Namespace**: `js` + +**Key**: `brace_style` + +**Default**: `collapse` + +**Type**: `string` + +**Enum**: `collapse` `collapse-preserve-inline` `expand` `end-expand` `none` + +**Supported Beautifiers**: [`JS Beautify`](#js-beautify) + +**Description**: + +[collapse|collapse-preserve-inline|expand|end-expand|none] (Supported by JS Beautify) + +**Example `.jsbeautifyrc` Configuration** + +```json +{ + "js": { + "brace_style": "collapse" + } +} +``` + ##### [Break chained methods](#break-chained-methods) **Namespace**: `js` @@ -4405,11 +5643,11 @@ Automatically beautify JSON files on save **Type**: `boolean` -**Supported Beautifiers**: [`Pretty Diff`](#pretty-diff) +**Supported Beautifiers**: [`JS Beautify`](#js-beautify) [`Pretty Diff`](#pretty-diff) **Description**: -Break chained method calls across subsequent lines (Supported by Pretty Diff) +Break chained method calls across subsequent lines (Supported by JS Beautify, Pretty Diff) **Example `.jsbeautifyrc` Configuration** @@ -4421,34 +5659,6 @@ Break chained method calls across subsequent lines (Supported by Pretty Diff) } ``` -##### [End of line](#end-of-line) - -**Namespace**: `js` - -**Key**: `end_of_line` - -**Default**: `System Default` - -**Type**: `string` - -**Enum**: `CRLF` `LF` `System Default` - -**Supported Beautifiers**: [`JS Beautify`](#js-beautify) [`Pretty Diff`](#pretty-diff) - -**Description**: - -Override EOL from line-ending-selector (Supported by JS Beautify, Pretty Diff) - -**Example `.jsbeautifyrc` Configuration** - -```json -{ - "js": { - "end_of_line": "System Default" - } -} -``` - ##### [End with comma](#end-with-comma) **Namespace**: `js` @@ -4457,11 +5667,11 @@ Override EOL from line-ending-selector (Supported by JS Beautify, Pretty Diff) **Type**: `boolean` -**Supported Beautifiers**: [`Pretty Diff`](#pretty-diff) +**Supported Beautifiers**: [`JS Beautify`](#js-beautify) [`Pretty Diff`](#pretty-diff) **Description**: -If a terminating comma should be inserted into arrays, object literals, and destructured objects. (Supported by Pretty Diff) +If a terminating comma should be inserted into arrays, object literals, and destructured objects. (Supported by JS Beautify, Pretty Diff) **Example `.jsbeautifyrc` Configuration** @@ -4497,6 +5707,30 @@ End output with newline (Supported by JS Beautify) } ``` +##### [Eval code](#eval-code) + +**Namespace**: `js` + +**Key**: `eval_code` + +**Type**: `boolean` + +**Supported Beautifiers**: [`JS Beautify`](#js-beautify) + +**Description**: + + (Supported by JS Beautify) + +**Example `.jsbeautifyrc` Configuration** + +```json +{ + "js": { + "eval_code": false + } +} +``` + ##### [Indent char](#indent-char) **Namespace**: `js` @@ -4523,6 +5757,30 @@ Indentation character (Supported by JS Beautify, Pretty Diff) } ``` +##### [Indent level](#indent-level) + +**Namespace**: `js` + +**Key**: `indent_level` + +**Type**: `integer` + +**Supported Beautifiers**: [`JS Beautify`](#js-beautify) + +**Description**: + +Initial indentation level (Supported by JS Beautify) + +**Example `.jsbeautifyrc` Configuration** + +```json +{ + "js": { + "indent_level": 0 + } +} +``` + ##### [Indent size](#indent-size) **Namespace**: `js` @@ -4557,11 +5815,11 @@ Indentation size/length (Supported by JS Beautify, Pretty Diff) **Type**: `boolean` -**Supported Beautifiers**: [`Pretty Diff`](#pretty-diff) +**Supported Beautifiers**: [`JS Beautify`](#js-beautify) [`Pretty Diff`](#pretty-diff) **Description**: -Indentation uses tabs, overrides `Indent Size` and `Indent Char` (Supported by Pretty Diff) +Indentation uses tabs, overrides `Indent Size` and `Indent Char` (Supported by JS Beautify, Pretty Diff) **Example `.jsbeautifyrc` Configuration** @@ -4573,6 +5831,104 @@ Indentation uses tabs, overrides `Indent Size` and `Indent Char` (Supported by P } ``` +##### [Jslint happy](#jslint-happy) + +**Namespace**: `js` + +**Key**: `jslint_happy` + +**Type**: `boolean` + +**Supported Beautifiers**: [`JS Beautify`](#js-beautify) + +**Description**: + +Enable jslint-stricter mode (Supported by JS Beautify) + +**Example `.jsbeautifyrc` Configuration** + +```json +{ + "js": { + "jslint_happy": false + } +} +``` + +##### [Keep array indentation](#keep-array-indentation) + +**Namespace**: `js` + +**Key**: `keep_array_indentation` + +**Type**: `boolean` + +**Supported Beautifiers**: [`JS Beautify`](#js-beautify) + +**Description**: + +Preserve array indentation (Supported by JS Beautify) + +**Example `.jsbeautifyrc` Configuration** + +```json +{ + "js": { + "keep_array_indentation": false + } +} +``` + +##### [Keep function indentation](#keep-function-indentation) + +**Namespace**: `js` + +**Key**: `keep_function_indentation` + +**Type**: `boolean` + +**Supported Beautifiers**: [`JS Beautify`](#js-beautify) + +**Description**: + + (Supported by JS Beautify) + +**Example `.jsbeautifyrc` Configuration** + +```json +{ + "js": { + "keep_function_indentation": false + } +} +``` + +##### [Max preserve newlines](#max-preserve-newlines) + +**Namespace**: `js` + +**Key**: `max_preserve_newlines` + +**Default**: `10` + +**Type**: `integer` + +**Supported Beautifiers**: [`JS Beautify`](#js-beautify) + +**Description**: + +Number of line-breaks to be preserved in one chunk (Supported by JS Beautify) + +**Example `.jsbeautifyrc` Configuration** + +```json +{ + "js": { + "max_preserve_newlines": 10 + } +} +``` + ##### [Preserve newlines](#preserve-newlines) **Namespace**: `js` @@ -4607,11 +5963,11 @@ Preserve line-breaks (Supported by JS Beautify, Pretty Diff) **Type**: `boolean` -**Supported Beautifiers**: [`Pretty Diff`](#pretty-diff) +**Supported Beautifiers**: [`JS Beautify`](#js-beautify) [`Pretty Diff`](#pretty-diff) **Description**: -Add a space before an anonymous function's parens, ie. function () (Supported by Pretty Diff) +Add a space before an anonymous function's parens, ie. function () (Supported by JS Beautify, Pretty Diff) **Example `.jsbeautifyrc` Configuration** @@ -4623,6 +5979,32 @@ Add a space before an anonymous function's parens, ie. function () (Supported by } ``` +##### [Space before conditional](#space-before-conditional) + +**Namespace**: `js` + +**Key**: `space_before_conditional` + +**Default**: `true` + +**Type**: `boolean` + +**Supported Beautifiers**: [`JS Beautify`](#js-beautify) + +**Description**: + + (Supported by JS Beautify) + +**Example `.jsbeautifyrc` Configuration** + +```json +{ + "js": { + "space_before_conditional": true + } +} +``` + ##### [Space in paren](#space-in-paren) **Namespace**: `js` @@ -4631,11 +6013,11 @@ Add a space before an anonymous function's parens, ie. function () (Supported by **Type**: `boolean` -**Supported Beautifiers**: [`Pretty Diff`](#pretty-diff) +**Supported Beautifiers**: [`JS Beautify`](#js-beautify) [`Pretty Diff`](#pretty-diff) **Description**: -Add padding spaces within paren, ie. f( a, b ) (Supported by Pretty Diff) +Add padding spaces within paren, ie. f( a, b ) (Supported by JS Beautify, Pretty Diff) **Example `.jsbeautifyrc` Configuration** @@ -4647,6 +6029,30 @@ Add padding spaces within paren, ie. f( a, b ) (Supported by Pretty Diff) } ``` +##### [Unescape strings](#unescape-strings) + +**Namespace**: `js` + +**Key**: `unescape_strings` + +**Type**: `boolean` + +**Supported Beautifiers**: [`JS Beautify`](#js-beautify) + +**Description**: + +Decode printable characters encoded in xNN notation (Supported by JS Beautify) + +**Example `.jsbeautifyrc` Configuration** + +```json +{ + "js": { + "unescape_strings": false + } +} +``` + ##### [Wrap line length](#wrap-line-length) **Namespace**: `js` @@ -4680,16 +6086,24 @@ Wrap lines at next opportunity after N characters (Supported by JS Beautify, Pre | `disabled` | :white_check_mark: | :white_check_mark: | | `default_beautifier` | :white_check_mark: | :white_check_mark: | | `beautify_on_save` | :white_check_mark: | :white_check_mark: | -| `break_chained_methods` | :x: | :white_check_mark: | -| `end_of_line` | :white_check_mark: | :white_check_mark: | -| `end_with_comma` | :x: | :white_check_mark: | +| `brace_style` | :white_check_mark: | :x: | +| `break_chained_methods` | :white_check_mark: | :white_check_mark: | +| `end_with_comma` | :white_check_mark: | :white_check_mark: | | `end_with_newline` | :white_check_mark: | :x: | +| `eval_code` | :white_check_mark: | :x: | | `indent_char` | :white_check_mark: | :white_check_mark: | +| `indent_level` | :white_check_mark: | :x: | | `indent_size` | :white_check_mark: | :white_check_mark: | -| `indent_with_tabs` | :x: | :white_check_mark: | +| `indent_with_tabs` | :white_check_mark: | :white_check_mark: | +| `jslint_happy` | :white_check_mark: | :x: | +| `keep_array_indentation` | :white_check_mark: | :x: | +| `keep_function_indentation` | :white_check_mark: | :x: | +| `max_preserve_newlines` | :white_check_mark: | :x: | | `preserve_newlines` | :white_check_mark: | :white_check_mark: | -| `space_after_anon_function` | :x: | :white_check_mark: | -| `space_in_paren` | :x: | :white_check_mark: | +| `space_after_anon_function` | :white_check_mark: | :white_check_mark: | +| `space_before_conditional` | :white_check_mark: | :x: | +| `space_in_paren` | :white_check_mark: | :white_check_mark: | +| `unescape_strings` | :white_check_mark: | :x: | | `wrap_line_length` | :white_check_mark: | :white_check_mark: | **Description**: @@ -4751,6 +6165,34 @@ Automatically beautify JSX files on save 2. Go into *Packages* and search for "*Atom Beautify*" package. 3. Find the option "*Beautify On Save*" and change it to your desired configuration. +##### [Brace style](#brace-style) + +**Namespace**: `js` + +**Key**: `brace_style` + +**Default**: `collapse` + +**Type**: `string` + +**Enum**: `collapse` `collapse-preserve-inline` `expand` `end-expand` `none` + +**Supported Beautifiers**: [`JS Beautify`](#js-beautify) + +**Description**: + +[collapse|collapse-preserve-inline|expand|end-expand|none] (Supported by JS Beautify) + +**Example `.jsbeautifyrc` Configuration** + +```json +{ + "js": { + "brace_style": "collapse" + } +} +``` + ##### [Break chained methods](#break-chained-methods) **Namespace**: `js` @@ -4759,11 +6201,11 @@ Automatically beautify JSX files on save **Type**: `boolean` -**Supported Beautifiers**: [`Pretty Diff`](#pretty-diff) +**Supported Beautifiers**: [`JS Beautify`](#js-beautify) [`Pretty Diff`](#pretty-diff) **Description**: -Break chained method calls across subsequent lines (Supported by Pretty Diff) +Break chained method calls across subsequent lines (Supported by JS Beautify, Pretty Diff) **Example `.jsbeautifyrc` Configuration** @@ -4775,34 +6217,6 @@ Break chained method calls across subsequent lines (Supported by Pretty Diff) } ``` -##### [End of line](#end-of-line) - -**Namespace**: `js` - -**Key**: `end_of_line` - -**Default**: `System Default` - -**Type**: `string` - -**Enum**: `CRLF` `LF` `System Default` - -**Supported Beautifiers**: [`JS Beautify`](#js-beautify) [`Pretty Diff`](#pretty-diff) - -**Description**: - -Override EOL from line-ending-selector (Supported by JS Beautify, Pretty Diff) - -**Example `.jsbeautifyrc` Configuration** - -```json -{ - "js": { - "end_of_line": "System Default" - } -} -``` - ##### [End with comma](#end-with-comma) **Namespace**: `js` @@ -4811,11 +6225,11 @@ Override EOL from line-ending-selector (Supported by JS Beautify, Pretty Diff) **Type**: `boolean` -**Supported Beautifiers**: [`Pretty Diff`](#pretty-diff) +**Supported Beautifiers**: [`JS Beautify`](#js-beautify) [`Pretty Diff`](#pretty-diff) **Description**: -If a terminating comma should be inserted into arrays, object literals, and destructured objects. (Supported by Pretty Diff) +If a terminating comma should be inserted into arrays, object literals, and destructured objects. (Supported by JS Beautify, Pretty Diff) **Example `.jsbeautifyrc` Configuration** @@ -4851,6 +6265,30 @@ End output with newline (Supported by JS Beautify) } ``` +##### [Eval code](#eval-code) + +**Namespace**: `js` + +**Key**: `eval_code` + +**Type**: `boolean` + +**Supported Beautifiers**: [`JS Beautify`](#js-beautify) + +**Description**: + + (Supported by JS Beautify) + +**Example `.jsbeautifyrc` Configuration** + +```json +{ + "js": { + "eval_code": false + } +} +``` + ##### [Indent char](#indent-char) **Namespace**: `js` @@ -4877,6 +6315,30 @@ Indentation character (Supported by JS Beautify, Pretty Diff) } ``` +##### [Indent level](#indent-level) + +**Namespace**: `js` + +**Key**: `indent_level` + +**Type**: `integer` + +**Supported Beautifiers**: [`JS Beautify`](#js-beautify) + +**Description**: + +Initial indentation level (Supported by JS Beautify) + +**Example `.jsbeautifyrc` Configuration** + +```json +{ + "js": { + "indent_level": 0 + } +} +``` + ##### [Indent size](#indent-size) **Namespace**: `js` @@ -4911,11 +6373,11 @@ Indentation size/length (Supported by JS Beautify, Pretty Diff) **Type**: `boolean` -**Supported Beautifiers**: [`Pretty Diff`](#pretty-diff) +**Supported Beautifiers**: [`JS Beautify`](#js-beautify) [`Pretty Diff`](#pretty-diff) **Description**: -Indentation uses tabs, overrides `Indent Size` and `Indent Char` (Supported by Pretty Diff) +Indentation uses tabs, overrides `Indent Size` and `Indent Char` (Supported by JS Beautify, Pretty Diff) **Example `.jsbeautifyrc` Configuration** @@ -4927,6 +6389,104 @@ Indentation uses tabs, overrides `Indent Size` and `Indent Char` (Supported by P } ``` +##### [Jslint happy](#jslint-happy) + +**Namespace**: `js` + +**Key**: `jslint_happy` + +**Type**: `boolean` + +**Supported Beautifiers**: [`JS Beautify`](#js-beautify) + +**Description**: + +Enable jslint-stricter mode (Supported by JS Beautify) + +**Example `.jsbeautifyrc` Configuration** + +```json +{ + "js": { + "jslint_happy": false + } +} +``` + +##### [Keep array indentation](#keep-array-indentation) + +**Namespace**: `js` + +**Key**: `keep_array_indentation` + +**Type**: `boolean` + +**Supported Beautifiers**: [`JS Beautify`](#js-beautify) + +**Description**: + +Preserve array indentation (Supported by JS Beautify) + +**Example `.jsbeautifyrc` Configuration** + +```json +{ + "js": { + "keep_array_indentation": false + } +} +``` + +##### [Keep function indentation](#keep-function-indentation) + +**Namespace**: `js` + +**Key**: `keep_function_indentation` + +**Type**: `boolean` + +**Supported Beautifiers**: [`JS Beautify`](#js-beautify) + +**Description**: + + (Supported by JS Beautify) + +**Example `.jsbeautifyrc` Configuration** + +```json +{ + "js": { + "keep_function_indentation": false + } +} +``` + +##### [Max preserve newlines](#max-preserve-newlines) + +**Namespace**: `js` + +**Key**: `max_preserve_newlines` + +**Default**: `10` + +**Type**: `integer` + +**Supported Beautifiers**: [`JS Beautify`](#js-beautify) + +**Description**: + +Number of line-breaks to be preserved in one chunk (Supported by JS Beautify) + +**Example `.jsbeautifyrc` Configuration** + +```json +{ + "js": { + "max_preserve_newlines": 10 + } +} +``` + ##### [Preserve newlines](#preserve-newlines) **Namespace**: `js` @@ -4961,11 +6521,11 @@ Preserve line-breaks (Supported by JS Beautify, Pretty Diff) **Type**: `boolean` -**Supported Beautifiers**: [`Pretty Diff`](#pretty-diff) +**Supported Beautifiers**: [`JS Beautify`](#js-beautify) [`Pretty Diff`](#pretty-diff) **Description**: -Add a space before an anonymous function's parens, ie. function () (Supported by Pretty Diff) +Add a space before an anonymous function's parens, ie. function () (Supported by JS Beautify, Pretty Diff) **Example `.jsbeautifyrc` Configuration** @@ -4977,6 +6537,32 @@ Add a space before an anonymous function's parens, ie. function () (Supported by } ``` +##### [Space before conditional](#space-before-conditional) + +**Namespace**: `js` + +**Key**: `space_before_conditional` + +**Default**: `true` + +**Type**: `boolean` + +**Supported Beautifiers**: [`JS Beautify`](#js-beautify) + +**Description**: + + (Supported by JS Beautify) + +**Example `.jsbeautifyrc` Configuration** + +```json +{ + "js": { + "space_before_conditional": true + } +} +``` + ##### [Space in paren](#space-in-paren) **Namespace**: `js` @@ -4985,11 +6571,11 @@ Add a space before an anonymous function's parens, ie. function () (Supported by **Type**: `boolean` -**Supported Beautifiers**: [`Pretty Diff`](#pretty-diff) +**Supported Beautifiers**: [`JS Beautify`](#js-beautify) [`Pretty Diff`](#pretty-diff) **Description**: -Add padding spaces within paren, ie. f( a, b ) (Supported by Pretty Diff) +Add padding spaces within paren, ie. f( a, b ) (Supported by JS Beautify, Pretty Diff) **Example `.jsbeautifyrc` Configuration** @@ -5001,6 +6587,30 @@ Add padding spaces within paren, ie. f( a, b ) (Supported by Pretty Diff) } ``` +##### [Unescape strings](#unescape-strings) + +**Namespace**: `js` + +**Key**: `unescape_strings` + +**Type**: `boolean` + +**Supported Beautifiers**: [`JS Beautify`](#js-beautify) + +**Description**: + +Decode printable characters encoded in xNN notation (Supported by JS Beautify) + +**Example `.jsbeautifyrc` Configuration** + +```json +{ + "js": { + "unescape_strings": false + } +} +``` + ##### [Wrap line length](#wrap-line-length) **Namespace**: `js` @@ -6417,10 +8027,18 @@ Maximum characters per line (0 disables) (Supported by Marko Beautifier) | `disabled` | :white_check_mark: | | `default_beautifier` | :white_check_mark: | | `beautify_on_save` | :white_check_mark: | +| `brace_style` | :white_check_mark: | | `end_with_newline` | :white_check_mark: | +| `extra_liners` | :white_check_mark: | | `indent_char` | :white_check_mark: | +| `indent_inner_html` | :white_check_mark: | +| `indent_scripts` | :white_check_mark: | | `indent_size` | :white_check_mark: | +| `max_preserve_newlines` | :white_check_mark: | | `preserve_newlines` | :white_check_mark: | +| `unformatted` | :white_check_mark: | +| `wrap_attributes` | :white_check_mark: | +| `wrap_attributes_indent_size` | :white_check_mark: | | `wrap_line_length` | :white_check_mark: | **Description**: @@ -6482,6 +8100,34 @@ Automatically beautify Mustache files on save 2. Go into *Packages* and search for "*Atom Beautify*" package. 3. Find the option "*Beautify On Save*" and change it to your desired configuration. +##### [Brace style](#brace-style) + +**Namespace**: `html` + +**Key**: `brace_style` + +**Default**: `collapse` + +**Type**: `string` + +**Enum**: `collapse` `expand` `end-expand` `none` + +**Supported Beautifiers**: [`JS Beautify`](#js-beautify) + +**Description**: + +[collapse|expand|end-expand|none] (Supported by JS Beautify) + +**Example `.jsbeautifyrc` Configuration** + +```json +{ + "html": { + "brace_style": "collapse" + } +} +``` + ##### [End with newline](#end-with-newline) **Namespace**: `html` @@ -6506,6 +8152,36 @@ End output with newline (Supported by JS Beautify) } ``` +##### [Extra liners](#extra-liners) + +**Namespace**: `html` + +**Key**: `extra_liners` + +**Default**: `head,body,/html` + +**Type**: `array` + +**Supported Beautifiers**: [`JS Beautify`](#js-beautify) + +**Description**: + +List of tags (defaults to [head,body,/html] that should have an extra newline before them. (Supported by JS Beautify) + +**Example `.jsbeautifyrc` Configuration** + +```json +{ + "html": { + "extra_liners": [ + "head", + "body", + "/html" + ] + } +} +``` + ##### [Indent char](#indent-char) **Namespace**: `html` @@ -6532,6 +8208,58 @@ Indentation character (Supported by JS Beautify) } ``` +##### [Indent inner html](#indent-inner-html) + +**Namespace**: `html` + +**Key**: `indent_inner_html` + +**Type**: `boolean` + +**Supported Beautifiers**: [`JS Beautify`](#js-beautify) + +**Description**: + +Indent and sections. (Supported by JS Beautify) + +**Example `.jsbeautifyrc` Configuration** + +```json +{ + "html": { + "indent_inner_html": false + } +} +``` + +##### [Indent scripts](#indent-scripts) + +**Namespace**: `html` + +**Key**: `indent_scripts` + +**Default**: `normal` + +**Type**: `string` + +**Enum**: `keep` `separate` `normal` + +**Supported Beautifiers**: [`JS Beautify`](#js-beautify) + +**Description**: + +[keep|separate|normal] (Supported by JS Beautify) + +**Example `.jsbeautifyrc` Configuration** + +```json +{ + "html": { + "indent_scripts": "normal" + } +} +``` + ##### [Indent size](#indent-size) **Namespace**: `html` @@ -6558,6 +8286,32 @@ Indentation size/length (Supported by JS Beautify) } ``` +##### [Max preserve newlines](#max-preserve-newlines) + +**Namespace**: `html` + +**Key**: `max_preserve_newlines` + +**Default**: `10` + +**Type**: `integer` + +**Supported Beautifiers**: [`JS Beautify`](#js-beautify) + +**Description**: + +Number of line-breaks to be preserved in one chunk (Supported by JS Beautify) + +**Example `.jsbeautifyrc` Configuration** + +```json +{ + "html": { + "max_preserve_newlines": 10 + } +} +``` + ##### [Preserve newlines](#preserve-newlines) **Namespace**: `html` @@ -6584,6 +8338,153 @@ Preserve line-breaks (Supported by JS Beautify) } ``` +##### [Unformatted](#unformatted) + +**Namespace**: `html` + +**Key**: `unformatted` + +**Default**: `a,abbr,area,audio,b,bdi,bdo,br,button,canvas,cite,code,data,datalist,del,dfn,em,embed,i,iframe,img,input,ins,kbd,keygen,label,map,mark,math,meter,noscript,object,output,progress,q,ruby,s,samp,select,small,span,strong,sub,sup,svg,template,textarea,time,u,var,video,wbr,text,acronym,address,big,dt,strike,tt,pre,h1,h2,h3,h4,h5,h6` + +**Type**: `array` + +**Supported Beautifiers**: [`JS Beautify`](#js-beautify) + +**Description**: + +List of tags (defaults to inline) that should not be reformatted (Supported by JS Beautify) + +**Example `.jsbeautifyrc` Configuration** + +```json +{ + "html": { + "unformatted": [ + "a", + "abbr", + "area", + "audio", + "b", + "bdi", + "bdo", + "br", + "button", + "canvas", + "cite", + "code", + "data", + "datalist", + "del", + "dfn", + "em", + "embed", + "i", + "iframe", + "img", + "input", + "ins", + "kbd", + "keygen", + "label", + "map", + "mark", + "math", + "meter", + "noscript", + "object", + "output", + "progress", + "q", + "ruby", + "s", + "samp", + "select", + "small", + "span", + "strong", + "sub", + "sup", + "svg", + "template", + "textarea", + "time", + "u", + "var", + "video", + "wbr", + "text", + "acronym", + "address", + "big", + "dt", + "strike", + "tt", + "pre", + "h1", + "h2", + "h3", + "h4", + "h5", + "h6" + ] + } +} +``` + +##### [Wrap attributes](#wrap-attributes) + +**Namespace**: `html` + +**Key**: `wrap_attributes` + +**Default**: `auto` + +**Type**: `string` + +**Enum**: `auto` `force` + +**Supported Beautifiers**: [`JS Beautify`](#js-beautify) + +**Description**: + +Wrap attributes to new lines [auto|force] (Supported by JS Beautify) + +**Example `.jsbeautifyrc` Configuration** + +```json +{ + "html": { + "wrap_attributes": "auto" + } +} +``` + +##### [Wrap attributes indent size](#wrap-attributes-indent-size) + +**Namespace**: `html` + +**Key**: `wrap_attributes_indent_size` + +**Default**: `4` + +**Type**: `integer` + +**Supported Beautifiers**: [`JS Beautify`](#js-beautify) + +**Description**: + +Indent wrapped attributes to after N characters (Supported by JS Beautify) + +**Example `.jsbeautifyrc` Configuration** + +```json +{ + "html": { + "wrap_attributes_indent_size": 4 + } +} +``` + ##### [Wrap line length](#wrap-line-length) **Namespace**: `html` @@ -9575,7 +11476,6 @@ Maximum amount of characters per line (0 = disable) (Supported by Pretty Diff) | `default_beautifier` | :white_check_mark: | | `beautify_on_save` | :white_check_mark: | | `break_chained_methods` | :white_check_mark: | -| `end_of_line` | :white_check_mark: | | `end_with_comma` | :white_check_mark: | | `indent_char` | :white_check_mark: | | `indent_size` | :white_check_mark: | @@ -9668,34 +11568,6 @@ Break chained method calls across subsequent lines (Supported by Pretty Diff) } ``` -##### [End of line](#end-of-line) - -**Namespace**: `js` - -**Key**: `end_of_line` - -**Default**: `System Default` - -**Type**: `string` - -**Enum**: `CRLF` `LF` `System Default` - -**Supported Beautifiers**: [`Pretty Diff`](#pretty-diff) - -**Description**: - -Override EOL from line-ending-selector (Supported by Pretty Diff) - -**Example `.jsbeautifyrc` Configuration** - -```json -{ - "js": { - "end_of_line": "System Default" - } -} -``` - ##### [End with comma](#end-with-comma) **Namespace**: `js` @@ -9907,7 +11779,6 @@ Maximum characters per line (0 disables) (Supported by Pretty Diff) | `beautify_on_save` | :white_check_mark: | | `brace_style` | :white_check_mark: | | `break_chained_methods` | :white_check_mark: | -| `end_of_line` | :white_check_mark: | | `end_with_comma` | :white_check_mark: | | `end_with_newline` | :white_check_mark: | | `eval_code` | :white_check_mark: | @@ -10037,34 +11908,6 @@ Break chained method calls across subsequent lines (Supported by TypeScript Form } ``` -##### [End of line](#end-of-line) - -**Namespace**: `js` - -**Key**: `end_of_line` - -**Default**: `System Default` - -**Type**: `string` - -**Enum**: `CRLF` `LF` `System Default` - -**Supported Beautifiers**: [`TypeScript Formatter`](#typescript-formatter) - -**Description**: - -Override EOL from line-ending-selector (Supported by TypeScript Formatter) - -**Example `.jsbeautifyrc` Configuration** - -```json -{ - "js": { - "end_of_line": "System Default" - } -} -``` - ##### [End with comma](#end-with-comma) **Namespace**: `js` @@ -10942,7 +12785,6 @@ Maximum characters per line (0 disables) (Supported by Pretty Diff) | `beautify_on_save` | :white_check_mark: | | `brace_style` | :white_check_mark: | | `break_chained_methods` | :white_check_mark: | -| `end_of_line` | :white_check_mark: | | `end_with_comma` | :white_check_mark: | | `end_with_newline` | :white_check_mark: | | `eval_code` | :white_check_mark: | @@ -11078,34 +12920,6 @@ Break chained method calls across subsequent lines (Supported by Vue Beautifier) } ``` -##### [End of line](#end-of-line) - -**Namespace**: `js` - -**Key**: `end_of_line` - -**Default**: `System Default` - -**Type**: `string` - -**Enum**: `CRLF` `LF` `System Default` - -**Supported Beautifiers**: [`Vue Beautifier`](#vue-beautifier) - -**Description**: - -Override EOL from line-ending-selector (Supported by Vue Beautifier) - -**Example `.jsbeautifyrc` Configuration** - -```json -{ - "js": { - "end_of_line": "System Default" - } -} -``` - ##### [End with comma](#end-with-comma) **Namespace**: `js` @@ -11766,10 +13580,18 @@ Maximum characters per line (0 disables) (Supported by Vue Beautifier) | `disabled` | :white_check_mark: | :white_check_mark: | | `default_beautifier` | :white_check_mark: | :white_check_mark: | | `beautify_on_save` | :white_check_mark: | :white_check_mark: | +| `brace_style` | :white_check_mark: | :x: | | `end_with_newline` | :white_check_mark: | :x: | +| `extra_liners` | :white_check_mark: | :x: | | `indent_char` | :white_check_mark: | :white_check_mark: | +| `indent_inner_html` | :white_check_mark: | :x: | +| `indent_scripts` | :white_check_mark: | :x: | | `indent_size` | :white_check_mark: | :white_check_mark: | +| `max_preserve_newlines` | :white_check_mark: | :x: | | `preserve_newlines` | :white_check_mark: | :white_check_mark: | +| `unformatted` | :white_check_mark: | :x: | +| `wrap_attributes` | :white_check_mark: | :x: | +| `wrap_attributes_indent_size` | :white_check_mark: | :x: | | `wrap_line_length` | :white_check_mark: | :white_check_mark: | **Description**: @@ -11831,6 +13653,34 @@ Automatically beautify XML files on save 2. Go into *Packages* and search for "*Atom Beautify*" package. 3. Find the option "*Beautify On Save*" and change it to your desired configuration. +##### [Brace style](#brace-style) + +**Namespace**: `html` + +**Key**: `brace_style` + +**Default**: `collapse` + +**Type**: `string` + +**Enum**: `collapse` `expand` `end-expand` `none` + +**Supported Beautifiers**: [`JS Beautify`](#js-beautify) + +**Description**: + +[collapse|expand|end-expand|none] (Supported by JS Beautify) + +**Example `.jsbeautifyrc` Configuration** + +```json +{ + "html": { + "brace_style": "collapse" + } +} +``` + ##### [End with newline](#end-with-newline) **Namespace**: `html` @@ -11855,6 +13705,36 @@ End output with newline (Supported by JS Beautify) } ``` +##### [Extra liners](#extra-liners) + +**Namespace**: `html` + +**Key**: `extra_liners` + +**Default**: `head,body,/html` + +**Type**: `array` + +**Supported Beautifiers**: [`JS Beautify`](#js-beautify) + +**Description**: + +List of tags (defaults to [head,body,/html] that should have an extra newline before them. (Supported by JS Beautify) + +**Example `.jsbeautifyrc` Configuration** + +```json +{ + "html": { + "extra_liners": [ + "head", + "body", + "/html" + ] + } +} +``` + ##### [Indent char](#indent-char) **Namespace**: `html` @@ -11881,6 +13761,58 @@ Indentation character (Supported by JS Beautify, Pretty Diff) } ``` +##### [Indent inner html](#indent-inner-html) + +**Namespace**: `html` + +**Key**: `indent_inner_html` + +**Type**: `boolean` + +**Supported Beautifiers**: [`JS Beautify`](#js-beautify) + +**Description**: + +Indent and sections. (Supported by JS Beautify) + +**Example `.jsbeautifyrc` Configuration** + +```json +{ + "html": { + "indent_inner_html": false + } +} +``` + +##### [Indent scripts](#indent-scripts) + +**Namespace**: `html` + +**Key**: `indent_scripts` + +**Default**: `normal` + +**Type**: `string` + +**Enum**: `keep` `separate` `normal` + +**Supported Beautifiers**: [`JS Beautify`](#js-beautify) + +**Description**: + +[keep|separate|normal] (Supported by JS Beautify) + +**Example `.jsbeautifyrc` Configuration** + +```json +{ + "html": { + "indent_scripts": "normal" + } +} +``` + ##### [Indent size](#indent-size) **Namespace**: `html` @@ -11907,6 +13839,32 @@ Indentation size/length (Supported by JS Beautify, Pretty Diff) } ``` +##### [Max preserve newlines](#max-preserve-newlines) + +**Namespace**: `html` + +**Key**: `max_preserve_newlines` + +**Default**: `10` + +**Type**: `integer` + +**Supported Beautifiers**: [`JS Beautify`](#js-beautify) + +**Description**: + +Number of line-breaks to be preserved in one chunk (Supported by JS Beautify) + +**Example `.jsbeautifyrc` Configuration** + +```json +{ + "html": { + "max_preserve_newlines": 10 + } +} +``` + ##### [Preserve newlines](#preserve-newlines) **Namespace**: `html` @@ -11933,6 +13891,155 @@ Preserve line-breaks (Supported by JS Beautify, Pretty Diff) } ``` +##### [Unformatted](#unformatted) + +**Namespace**: `html` + +**Key**: `unformatted` + +**Default**: `a,abbr,area,audio,b,bdi,bdo,br,button,canvas,cite,code,data,datalist,del,dfn,em,embed,i,iframe,img,input,ins,kbd,keygen,label,map,mark,math,meter,noscript,object,output,progress,q,ruby,s,samp,select,small,span,strong,sub,sup,svg,template,textarea,time,u,var,video,wbr,text,acronym,address,big,dt,ins,small,strike,tt,pre,h1,h2,h3,h4,h5,h6` + +**Type**: `array` + +**Supported Beautifiers**: [`JS Beautify`](#js-beautify) + +**Description**: + +List of tags (defaults to inline) that should not be reformatted (Supported by JS Beautify) + +**Example `.jsbeautifyrc` Configuration** + +```json +{ + "html": { + "unformatted": [ + "a", + "abbr", + "area", + "audio", + "b", + "bdi", + "bdo", + "br", + "button", + "canvas", + "cite", + "code", + "data", + "datalist", + "del", + "dfn", + "em", + "embed", + "i", + "iframe", + "img", + "input", + "ins", + "kbd", + "keygen", + "label", + "map", + "mark", + "math", + "meter", + "noscript", + "object", + "output", + "progress", + "q", + "ruby", + "s", + "samp", + "select", + "small", + "span", + "strong", + "sub", + "sup", + "svg", + "template", + "textarea", + "time", + "u", + "var", + "video", + "wbr", + "text", + "acronym", + "address", + "big", + "dt", + "ins", + "small", + "strike", + "tt", + "pre", + "h1", + "h2", + "h3", + "h4", + "h5", + "h6" + ] + } +} +``` + +##### [Wrap attributes](#wrap-attributes) + +**Namespace**: `html` + +**Key**: `wrap_attributes` + +**Default**: `auto` + +**Type**: `string` + +**Enum**: `auto` `force` + +**Supported Beautifiers**: [`JS Beautify`](#js-beautify) + +**Description**: + +Wrap attributes to new lines [auto|force] (Supported by JS Beautify) + +**Example `.jsbeautifyrc` Configuration** + +```json +{ + "html": { + "wrap_attributes": "auto" + } +} +``` + +##### [Wrap attributes indent size](#wrap-attributes-indent-size) + +**Namespace**: `html` + +**Key**: `wrap_attributes_indent_size` + +**Default**: `4` + +**Type**: `integer` + +**Supported Beautifiers**: [`JS Beautify`](#js-beautify) + +**Description**: + +Indent wrapped attributes to after N characters (Supported by JS Beautify) + +**Example `.jsbeautifyrc` Configuration** + +```json +{ + "html": { + "wrap_attributes_indent_size": 4 + } +} +``` + ##### [Wrap line length](#wrap-line-length) **Namespace**: `html` @@ -12670,34 +14777,6 @@ If a terminating comma should be inserted into arrays, object literals, and dest } ``` -##### [End of line](#end-of-line) - -**Namespace**: `js` - -**Key**: `end_of_line` - -**Default**: `System Default` - -**Type**: `string` - -**Enum**: `CRLF` `LF` `System Default` - -**Supported Beautifiers**: [`Coffee Formatter`](#coffee-formatter) - -**Description**: - -Override EOL from line-ending-selector (Supported by Coffee Formatter) - -**Example `.jsbeautifyrc` Configuration** - -```json -{ - "js": { - "end_of_line": "System Default" - } -} -``` - ### Fortran Beautifier @@ -13014,30 +15093,577 @@ End output with newline (Supported by JS Beautify) } ``` -##### [End of line](#end-of-line) +##### [Indent level](#indent-level) **Namespace**: `js` -**Key**: `end_of_line` +**Key**: `indent_level` -**Default**: `System Default` +**Type**: `integer` -**Type**: `string` - -**Enum**: `CRLF` `LF` `System Default` - -**Supported Beautifiers**: [`JS Beautify`](#js-beautify) [`Pretty Diff`](#pretty-diff) +**Supported Beautifiers**: [`JS Beautify`](#js-beautify) **Description**: -Override EOL from line-ending-selector (Supported by JS Beautify, Pretty Diff) +Initial indentation level (Supported by JS Beautify) **Example `.jsbeautifyrc` Configuration** ```json { "js": { - "end_of_line": "System Default" + "indent_level": 0 + } +} +``` + +##### [Indent with tabs](#indent-with-tabs) + +**Namespace**: `js` + +**Key**: `indent_with_tabs` + +**Type**: `boolean` + +**Supported Beautifiers**: [`JS Beautify`](#js-beautify) [`Pretty Diff`](#pretty-diff) + +**Description**: + +Indentation uses tabs, overrides `Indent Size` and `Indent Char` (Supported by JS Beautify, Pretty Diff) + +**Example `.jsbeautifyrc` Configuration** + +```json +{ + "js": { + "indent_with_tabs": false + } +} +``` + +##### [Max preserve newlines](#max-preserve-newlines) + +**Namespace**: `html` + +**Key**: `max_preserve_newlines` + +**Default**: `10` + +**Type**: `integer` + +**Supported Beautifiers**: [`JS Beautify`](#js-beautify) + +**Description**: + +Number of line-breaks to be preserved in one chunk (Supported by JS Beautify) + +**Example `.jsbeautifyrc` Configuration** + +```json +{ + "html": { + "max_preserve_newlines": 10 + } +} +``` + +##### [Space in paren](#space-in-paren) + +**Namespace**: `js` + +**Key**: `space_in_paren` + +**Type**: `boolean` + +**Supported Beautifiers**: [`JS Beautify`](#js-beautify) [`Pretty Diff`](#pretty-diff) + +**Description**: + +Add padding spaces within paren, ie. f( a, b ) (Supported by JS Beautify, Pretty Diff) + +**Example `.jsbeautifyrc` Configuration** + +```json +{ + "js": { + "space_in_paren": false + } +} +``` + +##### [Jslint happy](#jslint-happy) + +**Namespace**: `js` + +**Key**: `jslint_happy` + +**Type**: `boolean` + +**Supported Beautifiers**: [`JS Beautify`](#js-beautify) + +**Description**: + +Enable jslint-stricter mode (Supported by JS Beautify) + +**Example `.jsbeautifyrc` Configuration** + +```json +{ + "js": { + "jslint_happy": false + } +} +``` + +##### [Space after anon function](#space-after-anon-function) + +**Namespace**: `js` + +**Key**: `space_after_anon_function` + +**Type**: `boolean` + +**Supported Beautifiers**: [`JS Beautify`](#js-beautify) [`Pretty Diff`](#pretty-diff) + +**Description**: + +Add a space before an anonymous function's parens, ie. function () (Supported by JS Beautify, Pretty Diff) + +**Example `.jsbeautifyrc` Configuration** + +```json +{ + "js": { + "space_after_anon_function": false + } +} +``` + +##### [Brace style](#brace-style) + +**Namespace**: `html` + +**Key**: `brace_style` + +**Default**: `collapse` + +**Type**: `string` + +**Enum**: `collapse` `expand` `end-expand` `none` + +**Supported Beautifiers**: [`JS Beautify`](#js-beautify) + +**Description**: + +[collapse|expand|end-expand|none] (Supported by JS Beautify) + +**Example `.jsbeautifyrc` Configuration** + +```json +{ + "html": { + "brace_style": "collapse" + } +} +``` + +##### [Break chained methods](#break-chained-methods) + +**Namespace**: `js` + +**Key**: `break_chained_methods` + +**Type**: `boolean` + +**Supported Beautifiers**: [`JS Beautify`](#js-beautify) [`Pretty Diff`](#pretty-diff) + +**Description**: + +Break chained method calls across subsequent lines (Supported by JS Beautify, Pretty Diff) + +**Example `.jsbeautifyrc` Configuration** + +```json +{ + "js": { + "break_chained_methods": false + } +} +``` + +##### [Keep array indentation](#keep-array-indentation) + +**Namespace**: `js` + +**Key**: `keep_array_indentation` + +**Type**: `boolean` + +**Supported Beautifiers**: [`JS Beautify`](#js-beautify) + +**Description**: + +Preserve array indentation (Supported by JS Beautify) + +**Example `.jsbeautifyrc` Configuration** + +```json +{ + "js": { + "keep_array_indentation": false + } +} +``` + +##### [Keep function indentation](#keep-function-indentation) + +**Namespace**: `js` + +**Key**: `keep_function_indentation` + +**Type**: `boolean` + +**Supported Beautifiers**: [`JS Beautify`](#js-beautify) + +**Description**: + + (Supported by JS Beautify) + +**Example `.jsbeautifyrc` Configuration** + +```json +{ + "js": { + "keep_function_indentation": false + } +} +``` + +##### [Space before conditional](#space-before-conditional) + +**Namespace**: `js` + +**Key**: `space_before_conditional` + +**Default**: `true` + +**Type**: `boolean` + +**Supported Beautifiers**: [`JS Beautify`](#js-beautify) + +**Description**: + + (Supported by JS Beautify) + +**Example `.jsbeautifyrc` Configuration** + +```json +{ + "js": { + "space_before_conditional": true + } +} +``` + +##### [Eval code](#eval-code) + +**Namespace**: `js` + +**Key**: `eval_code` + +**Type**: `boolean` + +**Supported Beautifiers**: [`JS Beautify`](#js-beautify) + +**Description**: + + (Supported by JS Beautify) + +**Example `.jsbeautifyrc` Configuration** + +```json +{ + "js": { + "eval_code": false + } +} +``` + +##### [Unescape strings](#unescape-strings) + +**Namespace**: `js` + +**Key**: `unescape_strings` + +**Type**: `boolean` + +**Supported Beautifiers**: [`JS Beautify`](#js-beautify) + +**Description**: + +Decode printable characters encoded in xNN notation (Supported by JS Beautify) + +**Example `.jsbeautifyrc` Configuration** + +```json +{ + "js": { + "unescape_strings": false + } +} +``` + +##### [End with comma](#end-with-comma) + +**Namespace**: `js` + +**Key**: `end_with_comma` + +**Type**: `boolean` + +**Supported Beautifiers**: [`JS Beautify`](#js-beautify) [`Pretty Diff`](#pretty-diff) + +**Description**: + +If a terminating comma should be inserted into arrays, object literals, and destructured objects. (Supported by JS Beautify, Pretty Diff) + +**Example `.jsbeautifyrc` Configuration** + +```json +{ + "js": { + "end_with_comma": false + } +} +``` + +##### [Indent inner html](#indent-inner-html) + +**Namespace**: `html` + +**Key**: `indent_inner_html` + +**Type**: `boolean` + +**Supported Beautifiers**: [`JS Beautify`](#js-beautify) + +**Description**: + +Indent and sections. (Supported by JS Beautify) + +**Example `.jsbeautifyrc` Configuration** + +```json +{ + "html": { + "indent_inner_html": false + } +} +``` + +##### [Indent scripts](#indent-scripts) + +**Namespace**: `html` + +**Key**: `indent_scripts` + +**Default**: `normal` + +**Type**: `string` + +**Enum**: `keep` `separate` `normal` + +**Supported Beautifiers**: [`JS Beautify`](#js-beautify) + +**Description**: + +[keep|separate|normal] (Supported by JS Beautify) + +**Example `.jsbeautifyrc` Configuration** + +```json +{ + "html": { + "indent_scripts": "normal" + } +} +``` + +##### [Wrap attributes](#wrap-attributes) + +**Namespace**: `html` + +**Key**: `wrap_attributes` + +**Default**: `auto` + +**Type**: `string` + +**Enum**: `auto` `force` + +**Supported Beautifiers**: [`JS Beautify`](#js-beautify) + +**Description**: + +Wrap attributes to new lines [auto|force] (Supported by JS Beautify) + +**Example `.jsbeautifyrc` Configuration** + +```json +{ + "html": { + "wrap_attributes": "auto" + } +} +``` + +##### [Wrap attributes indent size](#wrap-attributes-indent-size) + +**Namespace**: `html` + +**Key**: `wrap_attributes_indent_size` + +**Default**: `4` + +**Type**: `integer` + +**Supported Beautifiers**: [`JS Beautify`](#js-beautify) + +**Description**: + +Indent wrapped attributes to after N characters (Supported by JS Beautify) + +**Example `.jsbeautifyrc` Configuration** + +```json +{ + "html": { + "wrap_attributes_indent_size": 4 + } +} +``` + +##### [Unformatted](#unformatted) + +**Namespace**: `html` + +**Key**: `unformatted` + +**Default**: `a,abbr,area,audio,b,bdi,bdo,br,button,canvas,cite,code,data,datalist,del,dfn,em,embed,i,iframe,img,input,ins,kbd,keygen,label,map,mark,math,meter,noscript,object,output,progress,q,ruby,s,samp,select,small,span,strong,sub,sup,svg,template,textarea,time,u,var,video,wbr,text,acronym,address,big,dt,ins,small,strike,tt,pre,h1,h2,h3,h4,h5,h6` + +**Type**: `array` + +**Supported Beautifiers**: [`JS Beautify`](#js-beautify) + +**Description**: + +List of tags (defaults to inline) that should not be reformatted (Supported by JS Beautify) + +**Example `.jsbeautifyrc` Configuration** + +```json +{ + "html": { + "unformatted": [ + "a", + "abbr", + "area", + "audio", + "b", + "bdi", + "bdo", + "br", + "button", + "canvas", + "cite", + "code", + "data", + "datalist", + "del", + "dfn", + "em", + "embed", + "i", + "iframe", + "img", + "input", + "ins", + "kbd", + "keygen", + "label", + "map", + "mark", + "math", + "meter", + "noscript", + "object", + "output", + "progress", + "q", + "ruby", + "s", + "samp", + "select", + "small", + "span", + "strong", + "sub", + "sup", + "svg", + "template", + "textarea", + "time", + "u", + "var", + "video", + "wbr", + "text", + "acronym", + "address", + "big", + "dt", + "ins", + "small", + "strike", + "tt", + "pre", + "h1", + "h2", + "h3", + "h4", + "h5", + "h6" + ] + } +} +``` + +##### [Extra liners](#extra-liners) + +**Namespace**: `html` + +**Key**: `extra_liners` + +**Default**: `head,body,/html` + +**Type**: `array` + +**Supported Beautifiers**: [`JS Beautify`](#js-beautify) + +**Description**: + +List of tags (defaults to [head,body,/html] that should have an extra newline before them. (Supported by JS Beautify) + +**Example `.jsbeautifyrc` Configuration** + +```json +{ + "html": { + "extra_liners": [ + "head", + "body", + "/html" + ] } } ``` @@ -14226,34 +16852,6 @@ If a terminating comma should be inserted into arrays, object literals, and dest } ``` -##### [End of line](#end-of-line) - -**Namespace**: `js` - -**Key**: `end_of_line` - -**Default**: `System Default` - -**Type**: `string` - -**Enum**: `CRLF` `LF` `System Default` - -**Supported Beautifiers**: [`Pretty Diff`](#pretty-diff) - -**Description**: - -Override EOL from line-ending-selector (Supported by Pretty Diff) - -**Example `.jsbeautifyrc` Configuration** - -```json -{ - "js": { - "end_of_line": "System Default" - } -} -``` - ### Pug Beautify @@ -14971,34 +17569,6 @@ If a terminating comma should be inserted into arrays, object literals, and dest } ``` -##### [End of line](#end-of-line) - -**Namespace**: `js` - -**Key**: `end_of_line` - -**Default**: `System Default` - -**Type**: `string` - -**Enum**: `CRLF` `LF` `System Default` - -**Supported Beautifiers**: [`TypeScript Formatter`](#typescript-formatter) - -**Description**: - -Override EOL from line-ending-selector (Supported by TypeScript Formatter) - -**Example `.jsbeautifyrc` Configuration** - -```json -{ - "js": { - "end_of_line": "System Default" - } -} -``` - ### Uncrustify @@ -15501,34 +18071,6 @@ If a terminating comma should be inserted into arrays, object literals, and dest } ``` -##### [End of line](#end-of-line) - -**Namespace**: `js` - -**Key**: `end_of_line` - -**Default**: `System Default` - -**Type**: `string` - -**Enum**: `CRLF` `LF` `System Default` - -**Supported Beautifiers**: [`Vue Beautifier`](#vue-beautifier) - -**Description**: - -Override EOL from line-ending-selector (Supported by Vue Beautifier) - -**Example `.jsbeautifyrc` Configuration** - -```json -{ - "js": { - "end_of_line": "System Default" - } -} -``` - ##### [Indent inner html](#indent-inner-html) **Namespace**: `html` diff --git a/src/beautifiers/beautifier.coffee b/src/beautifiers/beautifier.coffee index c4b6ec0..e369ac6 100644 --- a/src/beautifiers/beautifier.coffee +++ b/src/beautifiers/beautifier.coffee @@ -97,26 +97,6 @@ module.exports = class Beautifier startDir.pop() return null - # Retrieves the default line ending based upon the Atom configuration - # `line-ending-selector.defaultLineEnding`. If the Atom configuration - # indicates "OS Default", the `process.platform` is queried, returning - # CRLF for Windows systems and LF for all other systems. - # Code modified from atom/line-ending-selector - # returns: The correct line-ending character sequence based upon the Atom - # configuration, or `null` if the Atom line ending configuration was not - # recognized. - # see: https://github.com/atom/line-ending-selector/blob/master/lib/main.js - getDefaultLineEnding: (crlf,lf) -> - switch atom.config.get('line-ending-selector.defaultLineEnding') - when 'LF' - return lf - when 'CRLF' - return crlf - when 'OS Default' - return if process.platform is 'win32' then crlf else lf - else - return lf - ### If platform is Windows ### diff --git a/src/beautifiers/js-beautify.coffee b/src/beautifiers/js-beautify.coffee index 96f15c3..7092e23 100644 --- a/src/beautifiers/js-beautify.coffee +++ b/src/beautifiers/js-beautify.coffee @@ -6,15 +6,6 @@ module.exports = class JSBeautify extends Beautifier link: "https://github.com/beautify-web/js-beautify" options: { - _: - eol: ['end_of_line', (end_of_line) -> - if (end_of_line == 'CRLF') - '\r\n' - else if (end_of_line == 'LF') - '\n' - else - null - ] HTML: true XML: true Handlebars: true @@ -34,10 +25,11 @@ module.exports = class JSBeautify extends Beautifier } beautify: (text, language, options) -> - @verbose("JS Beautify language #{language}") @info("JS Beautify Options: #{JSON.stringify(options, null, 4)}") - options.eol = options.eol ? @getDefaultLineEnding('\r\n','\n') + #TODO reconsider handling of EOL once js-beautify adds EOL detection + #see https://github.com/beautify-web/js-beautify/issues/899 + options.eol = getDefaultLineEnding() ? options.eol #fixes issue #707 return new @Promise((resolve, reject) => try switch language @@ -66,3 +58,23 @@ module.exports = class JSBeautify extends Beautifier reject(err) ) + + # Retrieves the default line ending based upon the Atom configuration + # `line-ending-selector.defaultLineEnding`. If the Atom configuration + # indicates "OS Default", the `process.platform` is queried, returning + # CRLF for Windows systems and LF for all other systems. + # Code modified from atom/line-ending-selector + # returns: The correct line-ending character sequence based upon the Atom + # configuration, or `null` if the Atom line ending configuration was not + # recognized. + # see: https://github.com/atom/line-ending-selector/blob/master/lib/main.js + getDefaultLineEnding= -> + switch atom.config.get('line-ending-selector.defaultLineEnding') + when 'LF' + return '\n' + when 'CRLF' + return '\r\n' + when 'OS Default' + return if process.platform is 'win32' then '\r\n' else '\n' + else + return null diff --git a/src/beautifiers/prettydiff.coffee b/src/beautifiers/prettydiff.coffee index 37c040a..2be957e 100644 --- a/src/beautifiers/prettydiff.coffee +++ b/src/beautifiers/prettydiff.coffee @@ -42,14 +42,6 @@ module.exports = class PrettyDiff extends Beautifier ] ternaryline: "preserve_ternary_lines" bracepadding: "space_in_paren" - crlf: ['end_of_line', (end_of_line) -> - if (end_of_line == 'CRLF') - true - else if (end_of_line == 'LF') - false - else - null - ] # Apply language-specific options CSV: true Coldfusion: true @@ -78,7 +70,6 @@ module.exports = class PrettyDiff extends Beautifier beautify: (text, language, options) -> - options.crlf = options.crlf ? @getDefaultLineEnding(true,false) return new @Promise((resolve, reject) => prettydiff = require("prettydiff") _ = require('lodash') diff --git a/src/languages/javascript.coffee b/src/languages/javascript.coffee index e5c2892..49c7a34 100644 --- a/src/languages/javascript.coffee +++ b/src/languages/javascript.coffee @@ -111,10 +111,5 @@ module.exports = { default: false description: "If a terminating comma should be inserted into \ arrays, object literals, and destructured objects." - end_of_line: - type: 'string' - default: "System Default" - enum: ["CRLF","LF","System Default"] - description: "Override EOL from line-ending-selector" } From c7d20d0c10d4b301add6d8dedd52ab4c435a9ed5 Mon Sep 17 00:00:00 2001 From: Deforder Date: Sat, 14 Jan 2017 15:58:01 +0700 Subject: [PATCH 3/5] Updated change without Docs --- src/beautifiers/beautifier.coffee | 19 +++++++++++++++++++ src/beautifiers/js-beautify.coffee | 13 ++++++++++--- src/beautifiers/prettydiff.coffee | 9 +++++++++ src/languages/javascript.coffee | 6 +++++- 4 files changed, 43 insertions(+), 4 deletions(-) diff --git a/src/beautifiers/beautifier.coffee b/src/beautifiers/beautifier.coffee index e369ac6..187bd69 100644 --- a/src/beautifiers/beautifier.coffee +++ b/src/beautifiers/beautifier.coffee @@ -97,6 +97,25 @@ module.exports = class Beautifier startDir.pop() return null + # Retrieves the default line ending based upon the Atom configuration + # `line-ending-selector.defaultLineEnding`. If the Atom configuration + # indicates "OS Default", the `process.platform` is queried, returning + # CRLF for Windows systems and LF for all other systems. + # Code modified from atom/line-ending-selector + # returns: The correct line-ending character sequence based upon the Atom + # configuration, or `null` if the Atom line ending configuration was not + # recognized. + # see: https://github.com/atom/line-ending-selector/blob/master/lib/main.js + getDefaultLineEnding: (crlf,lf) -> + switch atom.config.get('line-ending-selector.defaultLineEnding') + when 'LF' + return lf + when 'CRLF' + return crlf + when 'OS Default' + return if process.platform is 'win32' then crlf else lf + else + return lf ### If platform is Windows ### diff --git a/src/beautifiers/js-beautify.coffee b/src/beautifiers/js-beautify.coffee index 7092e23..fe9c464 100644 --- a/src/beautifiers/js-beautify.coffee +++ b/src/beautifiers/js-beautify.coffee @@ -6,6 +6,15 @@ module.exports = class JSBeautify extends Beautifier link: "https://github.com/beautify-web/js-beautify" options: { + _: + eol: ['end_of_line', (end_of_line) -> + if (end_of_line == 'CRLF') + '\r\n' + else if (end_of_line == 'LF') + '\n' + else + null + ] HTML: true XML: true Handlebars: true @@ -27,9 +36,7 @@ module.exports = class JSBeautify extends Beautifier beautify: (text, language, options) -> @verbose("JS Beautify language #{language}") @info("JS Beautify Options: #{JSON.stringify(options, null, 4)}") - #TODO reconsider handling of EOL once js-beautify adds EOL detection - #see https://github.com/beautify-web/js-beautify/issues/899 - options.eol = getDefaultLineEnding() ? options.eol #fixes issue #707 + options.eol = options.eol ? @getDefaultLineEnding('\r\n','\n') return new @Promise((resolve, reject) => try switch language diff --git a/src/beautifiers/prettydiff.coffee b/src/beautifiers/prettydiff.coffee index 2be957e..37c040a 100644 --- a/src/beautifiers/prettydiff.coffee +++ b/src/beautifiers/prettydiff.coffee @@ -42,6 +42,14 @@ module.exports = class PrettyDiff extends Beautifier ] ternaryline: "preserve_ternary_lines" bracepadding: "space_in_paren" + crlf: ['end_of_line', (end_of_line) -> + if (end_of_line == 'CRLF') + true + else if (end_of_line == 'LF') + false + else + null + ] # Apply language-specific options CSV: true Coldfusion: true @@ -70,6 +78,7 @@ module.exports = class PrettyDiff extends Beautifier beautify: (text, language, options) -> + options.crlf = options.crlf ? @getDefaultLineEnding(true,false) return new @Promise((resolve, reject) => prettydiff = require("prettydiff") _ = require('lodash') diff --git a/src/languages/javascript.coffee b/src/languages/javascript.coffee index 49c7a34..a8b2e7b 100644 --- a/src/languages/javascript.coffee +++ b/src/languages/javascript.coffee @@ -28,7 +28,6 @@ module.exports = { defaultBeautifier: "JS Beautify" ### - ### options: # JavaScript @@ -111,5 +110,10 @@ module.exports = { default: false description: "If a terminating comma should be inserted into \ arrays, object literals, and destructured objects." + end_of_line: + type: 'string' + default: "System Default" + enum: ["CRLF","LF","System Default"] + description: "Override EOL from line-ending-selector" } From fa266a2e26a162830fe13d3d1cd5ee4aa6908fa6 Mon Sep 17 00:00:00 2001 From: Deforder Date: Sat, 14 Jan 2017 18:09:57 +0700 Subject: [PATCH 4/5] Removed unuse function --- src/beautifiers/js-beautify.coffee | 20 -------------------- 1 file changed, 20 deletions(-) diff --git a/src/beautifiers/js-beautify.coffee b/src/beautifiers/js-beautify.coffee index fe9c464..d2119ab 100644 --- a/src/beautifiers/js-beautify.coffee +++ b/src/beautifiers/js-beautify.coffee @@ -65,23 +65,3 @@ module.exports = class JSBeautify extends Beautifier reject(err) ) - - # Retrieves the default line ending based upon the Atom configuration - # `line-ending-selector.defaultLineEnding`. If the Atom configuration - # indicates "OS Default", the `process.platform` is queried, returning - # CRLF for Windows systems and LF for all other systems. - # Code modified from atom/line-ending-selector - # returns: The correct line-ending character sequence based upon the Atom - # configuration, or `null` if the Atom line ending configuration was not - # recognized. - # see: https://github.com/atom/line-ending-selector/blob/master/lib/main.js - getDefaultLineEnding= -> - switch atom.config.get('line-ending-selector.defaultLineEnding') - when 'LF' - return '\n' - when 'CRLF' - return '\r\n' - when 'OS Default' - return if process.platform is 'win32' then '\r\n' else '\n' - else - return null From 77da64f4f02d5823d1238453c71a67e79e6bb8bf Mon Sep 17 00:00:00 2001 From: Deforder Date: Tue, 24 Jan 2017 21:26:19 +0700 Subject: [PATCH 5/5] Change logic to prevent eol feature override setting value New logic + document (only insertion) --- docs/options.md | 315 +++++++++++++++++++++++++++++ src/beautifiers/beautifier.coffee | 9 +- src/beautifiers/js-beautify.coffee | 11 +- src/beautifiers/prettydiff.coffee | 11 +- 4 files changed, 323 insertions(+), 23 deletions(-) diff --git a/docs/options.md b/docs/options.md index 6bb63b3..3893805 100644 --- a/docs/options.md +++ b/docs/options.md @@ -766,6 +766,7 @@ Automatically beautify Clojure files on save | `beautify_on_save` | :white_check_mark: | :white_check_mark: | | `brace_style` | :white_check_mark: | :x: | | `break_chained_methods` | :white_check_mark: | :x: | +| `end_of_line` | :white_check_mark: | :x: | | `end_with_comma` | :white_check_mark: | :x: | | `end_with_newline` | :white_check_mark: | :x: | | `eval_code` | :white_check_mark: | :x: | @@ -895,6 +896,34 @@ Break chained method calls across subsequent lines (Supported by Coffee Formatte } ``` +##### [End of line](#end-of-line) + +**Namespace**: `js` + +**Key**: `end_of_line` + +**Default**: `System Default` + +**Type**: `string` + +**Enum**: `CRLF` `LF` `System Default` + +**Supported Beautifiers**: [`Coffee Formatter`](#coffee-formatter) + +**Description**: + +Override EOL from line-ending-selector (Supported by Coffee Formatter) + +**Example `.jsbeautifyrc` Configuration** + +```json +{ + "js": { + "end_of_line": "System Default" + } +} +``` + ##### [End with comma](#end-with-comma) **Namespace**: `js` @@ -2179,6 +2208,7 @@ Path to uncrustify config file. i.e. uncrustify.cfg (Supported by Uncrustify) | `beautify_on_save` | :white_check_mark: | :white_check_mark: | | `brace_style` | :white_check_mark: | :x: | | `break_chained_methods` | :white_check_mark: | :white_check_mark: | +| `end_of_line` | :white_check_mark: | :x: | | `end_with_comma` | :white_check_mark: | :white_check_mark: | | `end_with_newline` | :white_check_mark: | :x: | | `eval_code` | :white_check_mark: | :x: | @@ -2314,6 +2344,34 @@ Break chained method calls across subsequent lines (Supported by JS Beautify, Pr } ``` +##### [End of line](#end-of-line) + +**Namespace**: `js` + +**Key**: `end_of_line` + +**Default**: `System Default` + +**Type**: `string` + +**Enum**: `CRLF` `LF` `System Default` + +**Supported Beautifiers**: [`JS Beautify`](#js-beautify) + +**Description**: + +Override EOL from line-ending-selector (Supported by JS Beautify) + +**Example `.jsbeautifyrc` Configuration** + +```json +{ + "js": { + "end_of_line": "System Default" + } +} +``` + ##### [End with comma](#end-with-comma) **Namespace**: `js` @@ -4972,6 +5030,7 @@ Path to uncrustify config file. i.e. uncrustify.cfg (Supported by Uncrustify) | `beautify_on_save` | :white_check_mark: | :white_check_mark: | :white_check_mark: | | `brace_style` | :white_check_mark: | :x: | :x: | | `break_chained_methods` | :white_check_mark: | :x: | :white_check_mark: | +| `end_of_line` | :white_check_mark: | :x: | :x: | | `end_with_comma` | :white_check_mark: | :x: | :white_check_mark: | | `end_with_newline` | :white_check_mark: | :x: | :x: | | `eval_code` | :white_check_mark: | :x: | :x: | @@ -5101,6 +5160,34 @@ Break chained method calls across subsequent lines (Supported by JS Beautify, Pr } ``` +##### [End of line](#end-of-line) + +**Namespace**: `js` + +**Key**: `end_of_line` + +**Default**: `System Default` + +**Type**: `string` + +**Enum**: `CRLF` `LF` `System Default` + +**Supported Beautifiers**: [`JS Beautify`](#js-beautify) + +**Description**: + +Override EOL from line-ending-selector (Supported by JS Beautify) + +**Example `.jsbeautifyrc` Configuration** + +```json +{ + "js": { + "end_of_line": "System Default" + } +} +``` + ##### [End with comma](#end-with-comma) **Namespace**: `js` @@ -5530,6 +5617,7 @@ Wrap lines at next opportunity after N characters (Supported by JS Beautify, Pre | `beautify_on_save` | :white_check_mark: | :white_check_mark: | | `brace_style` | :white_check_mark: | :x: | | `break_chained_methods` | :white_check_mark: | :white_check_mark: | +| `end_of_line` | :white_check_mark: | :x: | | `end_with_comma` | :white_check_mark: | :white_check_mark: | | `end_with_newline` | :white_check_mark: | :x: | | `eval_code` | :white_check_mark: | :x: | @@ -5659,6 +5747,34 @@ Break chained method calls across subsequent lines (Supported by JS Beautify, Pr } ``` +##### [End of line](#end-of-line) + +**Namespace**: `js` + +**Key**: `end_of_line` + +**Default**: `System Default` + +**Type**: `string` + +**Enum**: `CRLF` `LF` `System Default` + +**Supported Beautifiers**: [`JS Beautify`](#js-beautify) + +**Description**: + +Override EOL from line-ending-selector (Supported by JS Beautify) + +**Example `.jsbeautifyrc` Configuration** + +```json +{ + "js": { + "end_of_line": "System Default" + } +} +``` + ##### [End with comma](#end-with-comma) **Namespace**: `js` @@ -6088,6 +6204,7 @@ Wrap lines at next opportunity after N characters (Supported by JS Beautify, Pre | `beautify_on_save` | :white_check_mark: | :white_check_mark: | | `brace_style` | :white_check_mark: | :x: | | `break_chained_methods` | :white_check_mark: | :white_check_mark: | +| `end_of_line` | :white_check_mark: | :x: | | `end_with_comma` | :white_check_mark: | :white_check_mark: | | `end_with_newline` | :white_check_mark: | :x: | | `eval_code` | :white_check_mark: | :x: | @@ -6217,6 +6334,34 @@ Break chained method calls across subsequent lines (Supported by JS Beautify, Pr } ``` +##### [End of line](#end-of-line) + +**Namespace**: `js` + +**Key**: `end_of_line` + +**Default**: `System Default` + +**Type**: `string` + +**Enum**: `CRLF` `LF` `System Default` + +**Supported Beautifiers**: [`JS Beautify`](#js-beautify) + +**Description**: + +Override EOL from line-ending-selector (Supported by JS Beautify) + +**Example `.jsbeautifyrc` Configuration** + +```json +{ + "js": { + "end_of_line": "System Default" + } +} +``` + ##### [End with comma](#end-with-comma) **Namespace**: `js` @@ -11779,6 +11924,7 @@ Maximum characters per line (0 disables) (Supported by Pretty Diff) | `beautify_on_save` | :white_check_mark: | | `brace_style` | :white_check_mark: | | `break_chained_methods` | :white_check_mark: | +| `end_of_line` | :white_check_mark: | | `end_with_comma` | :white_check_mark: | | `end_with_newline` | :white_check_mark: | | `eval_code` | :white_check_mark: | @@ -11908,6 +12054,34 @@ Break chained method calls across subsequent lines (Supported by TypeScript Form } ``` +##### [End of line](#end-of-line) + +**Namespace**: `js` + +**Key**: `end_of_line` + +**Default**: `System Default` + +**Type**: `string` + +**Enum**: `CRLF` `LF` `System Default` + +**Supported Beautifiers**: [`TypeScript Formatter`](#typescript-formatter) + +**Description**: + +Override EOL from line-ending-selector (Supported by TypeScript Formatter) + +**Example `.jsbeautifyrc` Configuration** + +```json +{ + "js": { + "end_of_line": "System Default" + } +} +``` + ##### [End with comma](#end-with-comma) **Namespace**: `js` @@ -12785,6 +12959,7 @@ Maximum characters per line (0 disables) (Supported by Pretty Diff) | `beautify_on_save` | :white_check_mark: | | `brace_style` | :white_check_mark: | | `break_chained_methods` | :white_check_mark: | +| `end_of_line` | :white_check_mark: | | `end_with_comma` | :white_check_mark: | | `end_with_newline` | :white_check_mark: | | `eval_code` | :white_check_mark: | @@ -12920,6 +13095,34 @@ Break chained method calls across subsequent lines (Supported by Vue Beautifier) } ``` +##### [End of line](#end-of-line) + +**Namespace**: `js` + +**Key**: `end_of_line` + +**Default**: `System Default` + +**Type**: `string` + +**Enum**: `CRLF` `LF` `System Default` + +**Supported Beautifiers**: [`Vue Beautifier`](#vue-beautifier) + +**Description**: + +Override EOL from line-ending-selector (Supported by Vue Beautifier) + +**Example `.jsbeautifyrc` Configuration** + +```json +{ + "js": { + "end_of_line": "System Default" + } +} +``` + ##### [End with comma](#end-with-comma) **Namespace**: `js` @@ -14777,6 +14980,34 @@ If a terminating comma should be inserted into arrays, object literals, and dest } ``` +##### [End of line](#end-of-line) + +**Namespace**: `js` + +**Key**: `end_of_line` + +**Default**: `System Default` + +**Type**: `string` + +**Enum**: `CRLF` `LF` `System Default` + +**Supported Beautifiers**: [`Coffee Formatter`](#coffee-formatter) + +**Description**: + +Override EOL from line-ending-selector (Supported by Coffee Formatter) + +**Example `.jsbeautifyrc` Configuration** + +```json +{ + "js": { + "end_of_line": "System Default" + } +} +``` + ### Fortran Beautifier @@ -15437,6 +15668,34 @@ If a terminating comma should be inserted into arrays, object literals, and dest } ``` +##### [End of line](#end-of-line) + +**Namespace**: `js` + +**Key**: `end_of_line` + +**Default**: `System Default` + +**Type**: `string` + +**Enum**: `CRLF` `LF` `System Default` + +**Supported Beautifiers**: [`JS Beautify`](#js-beautify) + +**Description**: + +Override EOL from line-ending-selector (Supported by JS Beautify) + +**Example `.jsbeautifyrc` Configuration** + +```json +{ + "js": { + "end_of_line": "System Default" + } +} +``` + ##### [Indent inner html](#indent-inner-html) **Namespace**: `html` @@ -17569,6 +17828,34 @@ If a terminating comma should be inserted into arrays, object literals, and dest } ``` +##### [End of line](#end-of-line) + +**Namespace**: `js` + +**Key**: `end_of_line` + +**Default**: `System Default` + +**Type**: `string` + +**Enum**: `CRLF` `LF` `System Default` + +**Supported Beautifiers**: [`TypeScript Formatter`](#typescript-formatter) + +**Description**: + +Override EOL from line-ending-selector (Supported by TypeScript Formatter) + +**Example `.jsbeautifyrc` Configuration** + +```json +{ + "js": { + "end_of_line": "System Default" + } +} +``` + ### Uncrustify @@ -18071,6 +18358,34 @@ If a terminating comma should be inserted into arrays, object literals, and dest } ``` +##### [End of line](#end-of-line) + +**Namespace**: `js` + +**Key**: `end_of_line` + +**Default**: `System Default` + +**Type**: `string` + +**Enum**: `CRLF` `LF` `System Default` + +**Supported Beautifiers**: [`Vue Beautifier`](#vue-beautifier) + +**Description**: + +Override EOL from line-ending-selector (Supported by Vue Beautifier) + +**Example `.jsbeautifyrc` Configuration** + +```json +{ + "js": { + "end_of_line": "System Default" + } +} +``` + ##### [Indent inner html](#indent-inner-html) **Namespace**: `html` diff --git a/src/beautifiers/beautifier.coffee b/src/beautifiers/beautifier.coffee index 187bd69..d42253d 100644 --- a/src/beautifiers/beautifier.coffee +++ b/src/beautifiers/beautifier.coffee @@ -97,7 +97,7 @@ module.exports = class Beautifier startDir.pop() return null - # Retrieves the default line ending based upon the Atom configuration +# Retrieves the default line ending based upon the Atom configuration # `line-ending-selector.defaultLineEnding`. If the Atom configuration # indicates "OS Default", the `process.platform` is queried, returning # CRLF for Windows systems and LF for all other systems. @@ -106,8 +106,10 @@ module.exports = class Beautifier # configuration, or `null` if the Atom line ending configuration was not # recognized. # see: https://github.com/atom/line-ending-selector/blob/master/lib/main.js - getDefaultLineEnding: (crlf,lf) -> - switch atom.config.get('line-ending-selector.defaultLineEnding') + getDefaultLineEnding: (crlf,lf,optionEol) -> + if (!optionEol || optionEol == 'System Default') + optionEol = atom.config.get('line-ending-selector.defaultLineEnding') + switch optionEol when 'LF' return lf when 'CRLF' @@ -116,6 +118,7 @@ module.exports = class Beautifier return if process.platform is 'win32' then crlf else lf else return lf + ### If platform is Windows ### diff --git a/src/beautifiers/js-beautify.coffee b/src/beautifiers/js-beautify.coffee index d2119ab..d84fda5 100644 --- a/src/beautifiers/js-beautify.coffee +++ b/src/beautifiers/js-beautify.coffee @@ -6,15 +6,6 @@ module.exports = class JSBeautify extends Beautifier link: "https://github.com/beautify-web/js-beautify" options: { - _: - eol: ['end_of_line', (end_of_line) -> - if (end_of_line == 'CRLF') - '\r\n' - else if (end_of_line == 'LF') - '\n' - else - null - ] HTML: true XML: true Handlebars: true @@ -36,7 +27,7 @@ module.exports = class JSBeautify extends Beautifier beautify: (text, language, options) -> @verbose("JS Beautify language #{language}") @info("JS Beautify Options: #{JSON.stringify(options, null, 4)}") - options.eol = options.eol ? @getDefaultLineEnding('\r\n','\n') + options.eol = @getDefaultLineEnding('\r\n','\n',options.end_of_line) return new @Promise((resolve, reject) => try switch language diff --git a/src/beautifiers/prettydiff.coffee b/src/beautifiers/prettydiff.coffee index 37c040a..104494c 100644 --- a/src/beautifiers/prettydiff.coffee +++ b/src/beautifiers/prettydiff.coffee @@ -42,14 +42,6 @@ module.exports = class PrettyDiff extends Beautifier ] ternaryline: "preserve_ternary_lines" bracepadding: "space_in_paren" - crlf: ['end_of_line', (end_of_line) -> - if (end_of_line == 'CRLF') - true - else if (end_of_line == 'LF') - false - else - null - ] # Apply language-specific options CSV: true Coldfusion: true @@ -77,8 +69,7 @@ module.exports = class PrettyDiff extends Beautifier } beautify: (text, language, options) -> - - options.crlf = options.crlf ? @getDefaultLineEnding(true,false) + options.crlf = @getDefaultLineEnding(true,false,options.end_of_line) return new @Promise((resolve, reject) => prettydiff = require("prettydiff") _ = require('lodash')