From 608846408d58eba2f62cde0b28f8bcf7f28fb409 Mon Sep 17 00:00:00 2001 From: Malte Brodersen Date: Mon, 9 Oct 2017 21:39:54 +0200 Subject: [PATCH 01/25] add terraform --- src/beautifiers/index.coffee | 1 + src/beautifiers/terraformfmt.coffee | 24 +++++++++++++++ src/languages/index.coffee | 1 + src/languages/terraform.coffee | 20 +++++++++++++ src/options.json | 46 +++++++++++++++++++++++++++-- 5 files changed, 89 insertions(+), 3 deletions(-) create mode 100644 src/beautifiers/terraformfmt.coffee create mode 100644 src/languages/terraform.coffee diff --git a/src/beautifiers/index.coffee b/src/beautifiers/index.coffee index b3e630c..6d14410 100644 --- a/src/beautifiers/index.coffee +++ b/src/beautifiers/index.coffee @@ -80,6 +80,7 @@ module.exports = class Beautifiers extends EventEmitter 'marko-beautifier' 'formatR' 'beautysh' + 'terraform' ] ### diff --git a/src/beautifiers/terraformfmt.coffee b/src/beautifiers/terraformfmt.coffee new file mode 100644 index 0000000..fd08d02 --- /dev/null +++ b/src/beautifiers/terraformfmt.coffee @@ -0,0 +1,24 @@ +### +Requires terraform installed +### + +"use strict" +Beautifier = require('./beautifier') + +module.exports = class Terraformfmt extends Beautifier + name: "terraformfmt" + link: "https://www.terraform.io/docs/commands/fmt.html" + isPreInstalled: false + + options: { + Terraform: true + } + + beautify: (text, language, options) -> + @run("terraform", [ + "fmt" + tempFile = @tempFile("input", text) + ]) + .then(=> + @readFile(tempFile) + ) diff --git a/src/languages/index.coffee b/src/languages/index.coffee index 9ea2e36..7cc1e5c 100644 --- a/src/languages/index.coffee +++ b/src/languages/index.coffee @@ -77,6 +77,7 @@ module.exports = class Languages "xml" "xtemplate" "yaml" + "terraform" ] ### diff --git a/src/languages/terraform.coffee b/src/languages/terraform.coffee new file mode 100644 index 0000000..16ad848 --- /dev/null +++ b/src/languages/terraform.coffee @@ -0,0 +1,20 @@ +module.exports = { + + name: "Terraform" + namespace: "terraform" + fallback: ['js'] + + ### + Supported Grammars + ### + grammars: [ + "Terraform" + ] + + ### + Supported extensions + ### + extensions: [ + "tf" + ] +} diff --git a/src/options.json b/src/options.json index 8767e0d..de2872e 100644 --- a/src/options.json +++ b/src/options.json @@ -4578,8 +4578,7 @@ "Lua" ], "extensions": [ - "lua", - "ttslua" + "lua" ], "properties": { "end_of_line": { @@ -6517,6 +6516,47 @@ "description": "Automatically beautify Rust files on save" } } + }, + "terraform": { + "title": "Terraform", + "type": "object", + "description": "Options for language Terraform", + "collapsed": true, + "beautifiers": [ + "terraformfmt" + ], + "grammars": [ + "Terraform" + ], + "extensions": [ + "tf" + ], + "properties": { + "disabled": { + "title": "Disable Beautifying Language", + "order": -3, + "type": "boolean", + "default": false, + "description": "Disable Rust Beautification" + }, + "default_beautifier": { + "title": "Default Beautifier", + "order": -2, + "type": "string", + "default": "terraformfmt", + "description": "Default Beautifier to be used for Terraform", + "enum": [ + "terraformfmt" + ] + }, + "beautify_on_save": { + "title": "Beautify On Save", + "order": -1, + "type": "boolean", + "default": false, + "description": "Automatically beautify Terraform files on save" + } + } }, "sass": { "title": "Sass", @@ -9377,4 +9417,4 @@ } } } -} \ No newline at end of file +} From 70ae361b7a4604f8a0dd7d86c164d1c2317ecb20 Mon Sep 17 00:00:00 2001 From: Malte Brodersen Date: Mon, 9 Oct 2017 21:45:21 +0200 Subject: [PATCH 02/25] remove uneeded diffs --- src/options.json | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/options.json b/src/options.json index de2872e..3d379dd 100644 --- a/src/options.json +++ b/src/options.json @@ -7229,7 +7229,8 @@ "TSS" ], "extensions": [ - "tss" + "lua", + "ttslua" ], "properties": { "indent_size": { @@ -9417,4 +9418,4 @@ } } } -} +} \ No newline at end of file From e5a38e388a260f8a5efce8ce1cb56b156209a8b4 Mon Sep 17 00:00:00 2001 From: Malte Brodersen Date: Mon, 9 Oct 2017 21:48:05 +0200 Subject: [PATCH 03/25] remove uneeded diffs --- src/options.json | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/options.json b/src/options.json index 3d379dd..6f0e95a 100644 --- a/src/options.json +++ b/src/options.json @@ -4578,7 +4578,8 @@ "Lua" ], "extensions": [ - "lua" + "lua", + "ttslua" ], "properties": { "end_of_line": { @@ -7229,8 +7230,7 @@ "TSS" ], "extensions": [ - "lua", - "ttslua" + "tss" ], "properties": { "indent_size": { From b95ad76d97e0866aa110253d24a0b6cc99b032e3 Mon Sep 17 00:00:00 2001 From: Malte Brodersen Date: Mon, 9 Oct 2017 21:51:07 +0200 Subject: [PATCH 04/25] add changelog --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index afa5999..d6c6177 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,4 +1,5 @@ # Next +- See [](). Add support for Terraform fmt. - See [#881](https://github.com/Glavin001/atom-beautify/issues/881). Update to Prettydiff version 2! - ... From cc08dbd6c6b907a1a739793c37a94f896ca11b9b Mon Sep 17 00:00:00 2001 From: Malte Brodersen Date: Mon, 9 Oct 2017 22:09:06 +0200 Subject: [PATCH 05/25] run docs --- README.md | 2 + docs/options.md | 1088 ++++++++++++++++++++++++++++++++++ package.json | 9 +- src/beautifiers/index.coffee | 2 +- src/options.json | 375 ++++++++++-- 5 files changed, 1431 insertions(+), 45 deletions(-) diff --git a/README.md b/README.md index c33233e..e0e249b 100644 --- a/README.md +++ b/README.md @@ -111,6 +111,7 @@ Some of the supported beautifiers are developed for Node.js and are automaticall | SassConvert | :warning: 1 executable | :white_check_mark: :100:% of executables | :whale: With [Docker](https://www.docker.com/):
1. Install [SassConvert (`sass-convert`)](http://sass-lang.com/documentation/file.SASS_REFERENCE.html#syntax) with `docker pull unibeautify/sass-convert`

:bookmark_tabs: Manually:
1. Install [SassConvert (`sass-convert`)](http://sass-lang.com/documentation/file.SASS_REFERENCE.html#syntax) by following http://sass-lang.com/documentation/file.SASS_REFERENCE.html#syntax
| | sqlformat | :warning: Manual installation | :construction: Not an executable | :page_facing_up: Go to https://github.com/andialbrecht/sqlparse and follow the instructions. | | stylish-haskell | :warning: Manual installation | :construction: Not an executable | :page_facing_up: Go to https://github.com/jaspervdj/stylish-haskell and follow the instructions. | +| terraformfmt | :warning: Manual installation | :construction: Not an executable | :page_facing_up: Go to https://www.terraform.io/docs/commands/fmt.html and follow the instructions. | | Tidy Markdown | :white_check_mark: | :ok_hand: Not necessary | :smiley: Nothing! | | TypeScript Formatter | :white_check_mark: | :ok_hand: Not necessary | :smiley: Nothing! | | Uncrustify | :warning: 1 executable | :white_check_mark: :100:% of executables | :whale: With [Docker](https://www.docker.com/):
1. Install [Uncrustify (`uncrustify`)](http://uncrustify.sourceforge.net/) with `docker pull unibeautify/uncrustify`

:bookmark_tabs: Manually:
1. Install [Uncrustify (`uncrustify`)](http://uncrustify.sourceforge.net/) by following https://github.com/uncrustify/uncrustify
| @@ -178,6 +179,7 @@ See [all supported options in the documentation at `docs/options.md`](docs/opti | SQL | `SQL (Rails)`, `SQL` |`.sql` | **[`sqlformat`](https://github.com/andialbrecht/sqlparse)** | | SVG | `SVG` |`.svg` | **[`Pretty Diff`](https://github.com/prettydiff/prettydiff)** | | Swig | `HTML (Swig)`, `SWIG` |`.swig` | **[`Pretty Diff`](https://github.com/prettydiff/prettydiff)** | +| Terraform | `Terraform` |`.tf` | **[`terraformfmt`](https://www.terraform.io/docs/commands/fmt.html)** | | TSS | `TSS` |`.tss` | **[`Pretty Diff`](https://github.com/prettydiff/prettydiff)** | | Twig | `HTML (Twig)` |`.twig` | **[`Pretty Diff`](https://github.com/prettydiff/prettydiff)** | | TypeScript | `TypeScript` |`.ts` | **[`TypeScript Formatter`](https://github.com/vvakame/typescript-formatter)** | diff --git a/docs/options.md b/docs/options.md index 19e54ff..cd2a64e 100644 --- a/docs/options.md +++ b/docs/options.md @@ -12171,6 +12171,593 @@ Maximum characters per line (0 disables) (Supported by Pretty Diff) } ``` +#### [Terraform](#terraform) + +**Supported Beautifiers**: [`terraformfmt`](#terraformfmt) + +| Option | terraformfmt | +| --- | --- | +| `disabled` | :white_check_mark: | +| `default_beautifier` | :white_check_mark: | +| `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: | +| `indent_char` | :white_check_mark: | +| `indent_level` | :white_check_mark: | +| `indent_size` | :white_check_mark: | +| `indent_with_tabs` | :white_check_mark: | +| `jslint_happy` | :white_check_mark: | +| `keep_array_indentation` | :white_check_mark: | +| `keep_function_indentation` | :white_check_mark: | +| `max_preserve_newlines` | :white_check_mark: | +| `preserve_newlines` | :white_check_mark: | +| `space_after_anon_function` | :white_check_mark: | +| `space_before_conditional` | :white_check_mark: | +| `space_in_paren` | :white_check_mark: | +| `unescape_strings` | :white_check_mark: | +| `wrap_line_length` | :white_check_mark: | + +**Description**: + +Options for language Terraform + +##### [Disable Beautifying Language](#disable-beautifying-language) + +**Important**: This option is only configurable from within Atom Beautify's setting panel. + +**Type**: `boolean` + +**Description**: + +Disable Terraform Beautification + +**How to Configure** + +1. You can open the [Settings View](https://github.com/atom/settings-view) by navigating to +*Edit > Preferences (Linux)*, *Atom > Preferences (OS X)*, or *File > Preferences (Windows)*. +2. Go into *Packages* and search for "*Atom Beautify*" package. +3. Find the option "*Disable Beautifying Language*" and change it to your desired configuration. + +##### [Default Beautifier](#default-beautifier) + +**Important**: This option is only configurable from within Atom Beautify's setting panel. + +**Default**: `terraformfmt` + +**Type**: `string` + +**Enum**: `terraformfmt` + +**Description**: + +Default Beautifier to be used for Terraform + +**How to Configure** + +1. You can open the [Settings View](https://github.com/atom/settings-view) by navigating to +*Edit > Preferences (Linux)*, *Atom > Preferences (OS X)*, or *File > Preferences (Windows)*. +2. Go into *Packages* and search for "*Atom Beautify*" package. +3. Find the option "*Default Beautifier*" and change it to your desired configuration. + +##### [Beautify On Save](#beautify-on-save) + +**Important**: This option is only configurable from within Atom Beautify's setting panel. + +**Type**: `boolean` + +**Description**: + +Automatically beautify Terraform files on save + +**How to Configure** + +1. You can open the [Settings View](https://github.com/atom/settings-view) by navigating to +*Edit > Preferences (Linux)*, *Atom > Preferences (OS X)*, or *File > Preferences (Windows)*. +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**: [`terraformfmt`](#terraformfmt) + +**Description**: + +[collapse|collapse-preserve-inline|expand|end-expand|none] (Supported by terraformfmt) + +**Example `.jsbeautifyrc` Configuration** + +```json +{ + "js": { + "brace_style": "collapse" + } +} +``` + +##### [Break chained methods](#break-chained-methods) + +**Namespace**: `js` + +**Key**: `break_chained_methods` + +**Type**: `boolean` + +**Supported Beautifiers**: [`terraformfmt`](#terraformfmt) + +**Description**: + +Break chained method calls across subsequent lines (Supported by terraformfmt) + +**Example `.jsbeautifyrc` Configuration** + +```json +{ + "js": { + "break_chained_methods": false + } +} +``` + +##### [End of line](#end-of-line) + +**Namespace**: `js` + +**Key**: `end_of_line` + +**Default**: `System Default` + +**Type**: `string` + +**Enum**: `CRLF` `LF` `System Default` + +**Supported Beautifiers**: [`terraformfmt`](#terraformfmt) + +**Description**: + +Override EOL from line-ending-selector (Supported by terraformfmt) + +**Example `.jsbeautifyrc` Configuration** + +```json +{ + "js": { + "end_of_line": "System Default" + } +} +``` + +##### [End with comma](#end-with-comma) + +**Namespace**: `js` + +**Key**: `end_with_comma` + +**Type**: `boolean` + +**Supported Beautifiers**: [`terraformfmt`](#terraformfmt) + +**Description**: + +If a terminating comma should be inserted into arrays, object literals, and destructured objects. (Supported by terraformfmt) + +**Example `.jsbeautifyrc` Configuration** + +```json +{ + "js": { + "end_with_comma": false + } +} +``` + +##### [End with newline](#end-with-newline) + +**Namespace**: `js` + +**Key**: `end_with_newline` + +**Type**: `boolean` + +**Supported Beautifiers**: [`terraformfmt`](#terraformfmt) + +**Description**: + +End output with newline (Supported by terraformfmt) + +**Example `.jsbeautifyrc` Configuration** + +```json +{ + "js": { + "end_with_newline": false + } +} +``` + +##### [Eval code](#eval-code) + +**Namespace**: `js` + +**Key**: `eval_code` + +**Type**: `boolean` + +**Supported Beautifiers**: [`terraformfmt`](#terraformfmt) + +**Description**: + + (Supported by terraformfmt) + +**Example `.jsbeautifyrc` Configuration** + +```json +{ + "js": { + "eval_code": false + } +} +``` + +##### [Indent char](#indent-char) + +**Namespace**: `js` + +**Key**: `indent_char` + +**Default**: ` ` + +**Type**: `string` + +**Supported Beautifiers**: [`terraformfmt`](#terraformfmt) + +**Description**: + +Indentation character (Supported by terraformfmt) + +**Example `.jsbeautifyrc` Configuration** + +```json +{ + "js": { + "indent_char": " " + } +} +``` + +##### [Indent level](#indent-level) + +**Namespace**: `js` + +**Key**: `indent_level` + +**Type**: `integer` + +**Supported Beautifiers**: [`terraformfmt`](#terraformfmt) + +**Description**: + +Initial indentation level (Supported by terraformfmt) + +**Example `.jsbeautifyrc` Configuration** + +```json +{ + "js": { + "indent_level": 0 + } +} +``` + +##### [Indent size](#indent-size) + +**Namespace**: `js` + +**Key**: `indent_size` + +**Default**: `4` + +**Type**: `integer` + +**Supported Beautifiers**: [`terraformfmt`](#terraformfmt) + +**Description**: + +Indentation size/length (Supported by terraformfmt) + +**Example `.jsbeautifyrc` Configuration** + +```json +{ + "js": { + "indent_size": 4 + } +} +``` + +##### [Indent with tabs](#indent-with-tabs) + +**Namespace**: `js` + +**Key**: `indent_with_tabs` + +**Type**: `boolean` + +**Supported Beautifiers**: [`terraformfmt`](#terraformfmt) + +**Description**: + +Indentation uses tabs, overrides `Indent Size` and `Indent Char` (Supported by terraformfmt) + +**Example `.jsbeautifyrc` Configuration** + +```json +{ + "js": { + "indent_with_tabs": false + } +} +``` + +##### [Jslint happy](#jslint-happy) + +**Namespace**: `js` + +**Key**: `jslint_happy` + +**Type**: `boolean` + +**Supported Beautifiers**: [`terraformfmt`](#terraformfmt) + +**Description**: + +Enable jslint-stricter mode (Supported by terraformfmt) + +**Example `.jsbeautifyrc` Configuration** + +```json +{ + "js": { + "jslint_happy": false + } +} +``` + +##### [Keep array indentation](#keep-array-indentation) + +**Namespace**: `js` + +**Key**: `keep_array_indentation` + +**Type**: `boolean` + +**Supported Beautifiers**: [`terraformfmt`](#terraformfmt) + +**Description**: + +Preserve array indentation (Supported by terraformfmt) + +**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**: [`terraformfmt`](#terraformfmt) + +**Description**: + + (Supported by terraformfmt) + +**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**: [`terraformfmt`](#terraformfmt) + +**Description**: + +Number of line-breaks to be preserved in one chunk (Supported by terraformfmt) + +**Example `.jsbeautifyrc` Configuration** + +```json +{ + "js": { + "max_preserve_newlines": 10 + } +} +``` + +##### [Preserve newlines](#preserve-newlines) + +**Namespace**: `js` + +**Key**: `preserve_newlines` + +**Default**: `true` + +**Type**: `boolean` + +**Supported Beautifiers**: [`terraformfmt`](#terraformfmt) + +**Description**: + +Preserve line-breaks (Supported by terraformfmt) + +**Example `.jsbeautifyrc` Configuration** + +```json +{ + "js": { + "preserve_newlines": true + } +} +``` + +##### [Space after anon function](#space-after-anon-function) + +**Namespace**: `js` + +**Key**: `space_after_anon_function` + +**Type**: `boolean` + +**Supported Beautifiers**: [`terraformfmt`](#terraformfmt) + +**Description**: + +Add a space before an anonymous function's parens, ie. function () (Supported by terraformfmt) + +**Example `.jsbeautifyrc` Configuration** + +```json +{ + "js": { + "space_after_anon_function": false + } +} +``` + +##### [Space before conditional](#space-before-conditional) + +**Namespace**: `js` + +**Key**: `space_before_conditional` + +**Default**: `true` + +**Type**: `boolean` + +**Supported Beautifiers**: [`terraformfmt`](#terraformfmt) + +**Description**: + + (Supported by terraformfmt) + +**Example `.jsbeautifyrc` Configuration** + +```json +{ + "js": { + "space_before_conditional": true + } +} +``` + +##### [Space in paren](#space-in-paren) + +**Namespace**: `js` + +**Key**: `space_in_paren` + +**Type**: `boolean` + +**Supported Beautifiers**: [`terraformfmt`](#terraformfmt) + +**Description**: + +Add padding spaces within paren, ie. f( a, b ) (Supported by terraformfmt) + +**Example `.jsbeautifyrc` Configuration** + +```json +{ + "js": { + "space_in_paren": false + } +} +``` + +##### [Unescape strings](#unescape-strings) + +**Namespace**: `js` + +**Key**: `unescape_strings` + +**Type**: `boolean` + +**Supported Beautifiers**: [`terraformfmt`](#terraformfmt) + +**Description**: + +Decode printable characters encoded in xNN notation (Supported by terraformfmt) + +**Example `.jsbeautifyrc` Configuration** + +```json +{ + "js": { + "unescape_strings": false + } +} +``` + +##### [Wrap line length](#wrap-line-length) + +**Namespace**: `js` + +**Key**: `wrap_line_length` + +**Type**: `integer` + +**Supported Beautifiers**: [`terraformfmt`](#terraformfmt) + +**Description**: + +Wrap lines at next opportunity after N characters (Supported by terraformfmt) + +**Example `.jsbeautifyrc` Configuration** + +```json +{ + "js": { + "wrap_line_length": 0 + } +} +``` + #### [TSS](#tss) **Supported Beautifiers**: [`Pretty Diff`](#pretty-diff) @@ -20554,3 +21141,504 @@ Change case of identifiers (Supported by sqlformat) ``` +### terraformfmt + +##### [Indent size](#indent-size) + +**Namespace**: `js` + +**Key**: `indent_size` + +**Default**: `4` + +**Type**: `integer` + +**Supported Beautifiers**: [`terraformfmt`](#terraformfmt) + +**Description**: + +Indentation size/length (Supported by terraformfmt) + +**Example `.jsbeautifyrc` Configuration** + +```json +{ + "js": { + "indent_size": 4 + } +} +``` + +##### [Indent char](#indent-char) + +**Namespace**: `js` + +**Key**: `indent_char` + +**Default**: ` ` + +**Type**: `string` + +**Supported Beautifiers**: [`terraformfmt`](#terraformfmt) + +**Description**: + +Indentation character (Supported by terraformfmt) + +**Example `.jsbeautifyrc` Configuration** + +```json +{ + "js": { + "indent_char": " " + } +} +``` + +##### [Indent level](#indent-level) + +**Namespace**: `js` + +**Key**: `indent_level` + +**Type**: `integer` + +**Supported Beautifiers**: [`terraformfmt`](#terraformfmt) + +**Description**: + +Initial indentation level (Supported by terraformfmt) + +**Example `.jsbeautifyrc` Configuration** + +```json +{ + "js": { + "indent_level": 0 + } +} +``` + +##### [Indent with tabs](#indent-with-tabs) + +**Namespace**: `js` + +**Key**: `indent_with_tabs` + +**Type**: `boolean` + +**Supported Beautifiers**: [`terraformfmt`](#terraformfmt) + +**Description**: + +Indentation uses tabs, overrides `Indent Size` and `Indent Char` (Supported by terraformfmt) + +**Example `.jsbeautifyrc` Configuration** + +```json +{ + "js": { + "indent_with_tabs": false + } +} +``` + +##### [Preserve newlines](#preserve-newlines) + +**Namespace**: `js` + +**Key**: `preserve_newlines` + +**Default**: `true` + +**Type**: `boolean` + +**Supported Beautifiers**: [`terraformfmt`](#terraformfmt) + +**Description**: + +Preserve line-breaks (Supported by terraformfmt) + +**Example `.jsbeautifyrc` Configuration** + +```json +{ + "js": { + "preserve_newlines": true + } +} +``` + +##### [Max preserve newlines](#max-preserve-newlines) + +**Namespace**: `js` + +**Key**: `max_preserve_newlines` + +**Default**: `10` + +**Type**: `integer` + +**Supported Beautifiers**: [`terraformfmt`](#terraformfmt) + +**Description**: + +Number of line-breaks to be preserved in one chunk (Supported by terraformfmt) + +**Example `.jsbeautifyrc` Configuration** + +```json +{ + "js": { + "max_preserve_newlines": 10 + } +} +``` + +##### [Space in paren](#space-in-paren) + +**Namespace**: `js` + +**Key**: `space_in_paren` + +**Type**: `boolean` + +**Supported Beautifiers**: [`terraformfmt`](#terraformfmt) + +**Description**: + +Add padding spaces within paren, ie. f( a, b ) (Supported by terraformfmt) + +**Example `.jsbeautifyrc` Configuration** + +```json +{ + "js": { + "space_in_paren": false + } +} +``` + +##### [Jslint happy](#jslint-happy) + +**Namespace**: `js` + +**Key**: `jslint_happy` + +**Type**: `boolean` + +**Supported Beautifiers**: [`terraformfmt`](#terraformfmt) + +**Description**: + +Enable jslint-stricter mode (Supported by terraformfmt) + +**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**: [`terraformfmt`](#terraformfmt) + +**Description**: + +Add a space before an anonymous function's parens, ie. function () (Supported by terraformfmt) + +**Example `.jsbeautifyrc` Configuration** + +```json +{ + "js": { + "space_after_anon_function": false + } +} +``` + +##### [Brace style](#brace-style) + +**Namespace**: `js` + +**Key**: `brace_style` + +**Default**: `collapse` + +**Type**: `string` + +**Enum**: `collapse` `collapse-preserve-inline` `expand` `end-expand` `none` + +**Supported Beautifiers**: [`terraformfmt`](#terraformfmt) + +**Description**: + +[collapse|collapse-preserve-inline|expand|end-expand|none] (Supported by terraformfmt) + +**Example `.jsbeautifyrc` Configuration** + +```json +{ + "js": { + "brace_style": "collapse" + } +} +``` + +##### [Break chained methods](#break-chained-methods) + +**Namespace**: `js` + +**Key**: `break_chained_methods` + +**Type**: `boolean` + +**Supported Beautifiers**: [`terraformfmt`](#terraformfmt) + +**Description**: + +Break chained method calls across subsequent lines (Supported by terraformfmt) + +**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**: [`terraformfmt`](#terraformfmt) + +**Description**: + +Preserve array indentation (Supported by terraformfmt) + +**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**: [`terraformfmt`](#terraformfmt) + +**Description**: + + (Supported by terraformfmt) + +**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**: [`terraformfmt`](#terraformfmt) + +**Description**: + + (Supported by terraformfmt) + +**Example `.jsbeautifyrc` Configuration** + +```json +{ + "js": { + "space_before_conditional": true + } +} +``` + +##### [Eval code](#eval-code) + +**Namespace**: `js` + +**Key**: `eval_code` + +**Type**: `boolean` + +**Supported Beautifiers**: [`terraformfmt`](#terraformfmt) + +**Description**: + + (Supported by terraformfmt) + +**Example `.jsbeautifyrc` Configuration** + +```json +{ + "js": { + "eval_code": false + } +} +``` + +##### [Unescape strings](#unescape-strings) + +**Namespace**: `js` + +**Key**: `unescape_strings` + +**Type**: `boolean` + +**Supported Beautifiers**: [`terraformfmt`](#terraformfmt) + +**Description**: + +Decode printable characters encoded in xNN notation (Supported by terraformfmt) + +**Example `.jsbeautifyrc` Configuration** + +```json +{ + "js": { + "unescape_strings": false + } +} +``` + +##### [Wrap line length](#wrap-line-length) + +**Namespace**: `js` + +**Key**: `wrap_line_length` + +**Type**: `integer` + +**Supported Beautifiers**: [`terraformfmt`](#terraformfmt) + +**Description**: + +Wrap lines at next opportunity after N characters (Supported by terraformfmt) + +**Example `.jsbeautifyrc` Configuration** + +```json +{ + "js": { + "wrap_line_length": 0 + } +} +``` + +##### [End with newline](#end-with-newline) + +**Namespace**: `js` + +**Key**: `end_with_newline` + +**Type**: `boolean` + +**Supported Beautifiers**: [`terraformfmt`](#terraformfmt) + +**Description**: + +End output with newline (Supported by terraformfmt) + +**Example `.jsbeautifyrc` Configuration** + +```json +{ + "js": { + "end_with_newline": false + } +} +``` + +##### [End with comma](#end-with-comma) + +**Namespace**: `js` + +**Key**: `end_with_comma` + +**Type**: `boolean` + +**Supported Beautifiers**: [`terraformfmt`](#terraformfmt) + +**Description**: + +If a terminating comma should be inserted into arrays, object literals, and destructured objects. (Supported by terraformfmt) + +**Example `.jsbeautifyrc` Configuration** + +```json +{ + "js": { + "end_with_comma": false + } +} +``` + +##### [End of line](#end-of-line) + +**Namespace**: `js` + +**Key**: `end_of_line` + +**Default**: `System Default` + +**Type**: `string` + +**Enum**: `CRLF` `LF` `System Default` + +**Supported Beautifiers**: [`terraformfmt`](#terraformfmt) + +**Description**: + +Override EOL from line-ending-selector (Supported by terraformfmt) + +**Example `.jsbeautifyrc` Configuration** + +```json +{ + "js": { + "end_of_line": "System Default" + } +} +``` + + diff --git a/package.json b/package.json index 0b76590..53c3507 100644 --- a/package.json +++ b/package.json @@ -271,7 +271,8 @@ "atom-beautify:beautify-language-visualforce", "atom-beautify:beautify-language-xml", "atom-beautify:beautify-language-xtemplate", - "atom-beautify:beautify-language-yaml" + "atom-beautify:beautify-language-yaml", + "atom-beautify:beautify-language-terraform" ], ".tree-view .file .name": [ "atom-beautify:beautify-file" @@ -404,7 +405,9 @@ "nginx beautify", "golang template", "align-yaml", - "goimports" + "goimports", + "terraform", + "terraformfmt" ], "devDependencies": { "coffeelint": "1.16.0" @@ -441,4 +444,4 @@ "prettydiff2" ] } -} +} \ No newline at end of file diff --git a/src/beautifiers/index.coffee b/src/beautifiers/index.coffee index 6d14410..cc3f237 100644 --- a/src/beautifiers/index.coffee +++ b/src/beautifiers/index.coffee @@ -80,7 +80,7 @@ module.exports = class Beautifiers extends EventEmitter 'marko-beautifier' 'formatR' 'beautysh' - 'terraform' + 'terraformfmt' ] ### diff --git a/src/options.json b/src/options.json index 6f0e95a..3988bb1 100644 --- a/src/options.json +++ b/src/options.json @@ -6517,47 +6517,6 @@ "description": "Automatically beautify Rust files on save" } } - }, - "terraform": { - "title": "Terraform", - "type": "object", - "description": "Options for language Terraform", - "collapsed": true, - "beautifiers": [ - "terraformfmt" - ], - "grammars": [ - "Terraform" - ], - "extensions": [ - "tf" - ], - "properties": { - "disabled": { - "title": "Disable Beautifying Language", - "order": -3, - "type": "boolean", - "default": false, - "description": "Disable Rust Beautification" - }, - "default_beautifier": { - "title": "Default Beautifier", - "order": -2, - "type": "string", - "default": "terraformfmt", - "description": "Default Beautifier to be used for Terraform", - "enum": [ - "terraformfmt" - ] - }, - "beautify_on_save": { - "title": "Beautify On Save", - "order": -1, - "type": "boolean", - "default": false, - "description": "Automatically beautify Terraform files on save" - } - } }, "sass": { "title": "Sass", @@ -9169,6 +9128,340 @@ } } }, + "terraform": { + "title": "Terraform", + "type": "object", + "description": "Options for language Terraform", + "collapsed": true, + "beautifiers": [ + "terraformfmt" + ], + "grammars": [ + "Terraform" + ], + "extensions": [ + "tf" + ], + "properties": { + "indent_size": { + "type": "integer", + "default": null, + "minimum": 0, + "description": "Indentation size/length (Supported by terraformfmt)", + "title": "Indent size", + "beautifiers": [ + "terraformfmt" + ], + "key": "indent_size", + "language": { + "name": "JavaScript", + "namespace": "js" + } + }, + "indent_char": { + "type": "string", + "default": null, + "description": "Indentation character (Supported by terraformfmt)", + "title": "Indent char", + "beautifiers": [ + "terraformfmt" + ], + "key": "indent_char", + "language": { + "name": "JavaScript", + "namespace": "js" + } + }, + "indent_level": { + "type": "integer", + "default": 0, + "description": "Initial indentation level (Supported by terraformfmt)", + "title": "Indent level", + "beautifiers": [ + "terraformfmt" + ], + "key": "indent_level", + "language": { + "name": "JavaScript", + "namespace": "js" + } + }, + "indent_with_tabs": { + "type": "boolean", + "default": null, + "description": "Indentation uses tabs, overrides `Indent Size` and `Indent Char` (Supported by terraformfmt)", + "title": "Indent with tabs", + "beautifiers": [ + "terraformfmt" + ], + "key": "indent_with_tabs", + "language": { + "name": "JavaScript", + "namespace": "js" + } + }, + "preserve_newlines": { + "type": "boolean", + "default": true, + "description": "Preserve line-breaks (Supported by terraformfmt)", + "title": "Preserve newlines", + "beautifiers": [ + "terraformfmt" + ], + "key": "preserve_newlines", + "language": { + "name": "JavaScript", + "namespace": "js" + } + }, + "max_preserve_newlines": { + "type": "integer", + "default": 10, + "description": "Number of line-breaks to be preserved in one chunk (Supported by terraformfmt)", + "title": "Max preserve newlines", + "beautifiers": [ + "terraformfmt" + ], + "key": "max_preserve_newlines", + "language": { + "name": "JavaScript", + "namespace": "js" + } + }, + "space_in_paren": { + "type": "boolean", + "default": false, + "description": "Add padding spaces within paren, ie. f( a, b ) (Supported by terraformfmt)", + "title": "Space in paren", + "beautifiers": [ + "terraformfmt" + ], + "key": "space_in_paren", + "language": { + "name": "JavaScript", + "namespace": "js" + } + }, + "jslint_happy": { + "type": "boolean", + "default": false, + "description": "Enable jslint-stricter mode (Supported by terraformfmt)", + "title": "Jslint happy", + "beautifiers": [ + "terraformfmt" + ], + "key": "jslint_happy", + "language": { + "name": "JavaScript", + "namespace": "js" + } + }, + "space_after_anon_function": { + "type": "boolean", + "default": false, + "description": "Add a space before an anonymous function's parens, ie. function () (Supported by terraformfmt)", + "title": "Space after anon function", + "beautifiers": [ + "terraformfmt" + ], + "key": "space_after_anon_function", + "language": { + "name": "JavaScript", + "namespace": "js" + } + }, + "brace_style": { + "type": "string", + "default": "collapse", + "enum": [ + "collapse", + "collapse-preserve-inline", + "expand", + "end-expand", + "none" + ], + "description": "[collapse|collapse-preserve-inline|expand|end-expand|none] (Supported by terraformfmt)", + "title": "Brace style", + "beautifiers": [ + "terraformfmt" + ], + "key": "brace_style", + "language": { + "name": "JavaScript", + "namespace": "js" + } + }, + "break_chained_methods": { + "type": "boolean", + "default": false, + "description": "Break chained method calls across subsequent lines (Supported by terraformfmt)", + "title": "Break chained methods", + "beautifiers": [ + "terraformfmt" + ], + "key": "break_chained_methods", + "language": { + "name": "JavaScript", + "namespace": "js" + } + }, + "keep_array_indentation": { + "type": "boolean", + "default": false, + "description": "Preserve array indentation (Supported by terraformfmt)", + "title": "Keep array indentation", + "beautifiers": [ + "terraformfmt" + ], + "key": "keep_array_indentation", + "language": { + "name": "JavaScript", + "namespace": "js" + } + }, + "keep_function_indentation": { + "type": "boolean", + "default": false, + "description": " (Supported by terraformfmt)", + "title": "Keep function indentation", + "beautifiers": [ + "terraformfmt" + ], + "key": "keep_function_indentation", + "language": { + "name": "JavaScript", + "namespace": "js" + } + }, + "space_before_conditional": { + "type": "boolean", + "default": true, + "description": " (Supported by terraformfmt)", + "title": "Space before conditional", + "beautifiers": [ + "terraformfmt" + ], + "key": "space_before_conditional", + "language": { + "name": "JavaScript", + "namespace": "js" + } + }, + "eval_code": { + "type": "boolean", + "default": false, + "description": " (Supported by terraformfmt)", + "title": "Eval code", + "beautifiers": [ + "terraformfmt" + ], + "key": "eval_code", + "language": { + "name": "JavaScript", + "namespace": "js" + } + }, + "unescape_strings": { + "type": "boolean", + "default": false, + "description": "Decode printable characters encoded in xNN notation (Supported by terraformfmt)", + "title": "Unescape strings", + "beautifiers": [ + "terraformfmt" + ], + "key": "unescape_strings", + "language": { + "name": "JavaScript", + "namespace": "js" + } + }, + "wrap_line_length": { + "type": "integer", + "default": 0, + "description": "Wrap lines at next opportunity after N characters (Supported by terraformfmt)", + "title": "Wrap line length", + "beautifiers": [ + "terraformfmt" + ], + "key": "wrap_line_length", + "language": { + "name": "JavaScript", + "namespace": "js" + } + }, + "end_with_newline": { + "type": "boolean", + "default": false, + "description": "End output with newline (Supported by terraformfmt)", + "title": "End with newline", + "beautifiers": [ + "terraformfmt" + ], + "key": "end_with_newline", + "language": { + "name": "JavaScript", + "namespace": "js" + } + }, + "end_with_comma": { + "type": "boolean", + "default": false, + "description": "If a terminating comma should be inserted into arrays, object literals, and destructured objects. (Supported by terraformfmt)", + "title": "End with comma", + "beautifiers": [ + "terraformfmt" + ], + "key": "end_with_comma", + "language": { + "name": "JavaScript", + "namespace": "js" + } + }, + "end_of_line": { + "type": "string", + "default": "System Default", + "enum": [ + "CRLF", + "LF", + "System Default" + ], + "description": "Override EOL from line-ending-selector (Supported by terraformfmt)", + "title": "End of line", + "beautifiers": [ + "terraformfmt" + ], + "key": "end_of_line", + "language": { + "name": "JavaScript", + "namespace": "js" + } + }, + "disabled": { + "title": "Disable Beautifying Language", + "order": -3, + "type": "boolean", + "default": false, + "description": "Disable Terraform Beautification" + }, + "default_beautifier": { + "title": "Default Beautifier", + "order": -2, + "type": "string", + "default": "terraformfmt", + "description": "Default Beautifier to be used for Terraform", + "enum": [ + "terraformfmt" + ] + }, + "beautify_on_save": { + "title": "Beautify On Save", + "order": -1, + "type": "boolean", + "default": false, + "description": "Automatically beautify Terraform files on save" + } + } + }, "executables": { "title": "Executables", "type": "object", From 30d2264229e3325c8bcedff968560e5459ef5d79 Mon Sep 17 00:00:00 2001 From: Malte Brodersen Date: Mon, 9 Oct 2017 22:20:02 +0200 Subject: [PATCH 06/25] fix space --- src/beautifiers/terraformfmt.coffee | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/beautifiers/terraformfmt.coffee b/src/beautifiers/terraformfmt.coffee index fd08d02..9cd6d2e 100644 --- a/src/beautifiers/terraformfmt.coffee +++ b/src/beautifiers/terraformfmt.coffee @@ -20,5 +20,5 @@ module.exports = class Terraformfmt extends Beautifier tempFile = @tempFile("input", text) ]) .then(=> - @readFile(tempFile) + @readFile(tempFile) ) From 34b09fdd69491fc3b1960279e8f6622b71284cce Mon Sep 17 00:00:00 2001 From: Malte Brodersen Date: Tue, 10 Oct 2017 16:49:52 +0200 Subject: [PATCH 07/25] update options --- src/beautifiers/terraformfmt.coffee | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/beautifiers/terraformfmt.coffee b/src/beautifiers/terraformfmt.coffee index 9cd6d2e..6075f4e 100644 --- a/src/beautifiers/terraformfmt.coffee +++ b/src/beautifiers/terraformfmt.coffee @@ -11,7 +11,7 @@ module.exports = class Terraformfmt extends Beautifier isPreInstalled: false options: { - Terraform: true + Terraform: false } beautify: (text, language, options) -> From 0b3a8ba1407621d83d9122a55b1b670696e201f7 Mon Sep 17 00:00:00 2001 From: Malte Brodersen Date: Tue, 10 Oct 2017 16:50:04 +0200 Subject: [PATCH 08/25] update docs --- docs/add-languages-and-beautifiers.md | 2 -- 1 file changed, 2 deletions(-) diff --git a/docs/add-languages-and-beautifiers.md b/docs/add-languages-and-beautifiers.md index b702f91..5d9e053 100644 --- a/docs/add-languages-and-beautifiers.md +++ b/docs/add-languages-and-beautifiers.md @@ -11,8 +11,6 @@ You can use [`codo`](https://github.com/coffeedoc/codo) to build your own docume After you make a change to language or beautifier `options` you will need to update the `options.json` file that is created on install. ```bash -# Update src/options.json file to have new/changed options -npm run postinstall # Update documentation to include information about those options npm run docs ``` From eeb65ea10602b3480f4baaf7ac7917da9281d446 Mon Sep 17 00:00:00 2001 From: Malte Brodersen Date: Tue, 10 Oct 2017 16:50:18 +0200 Subject: [PATCH 09/25] update changelog --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index d6c6177..3bf9b53 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,5 @@ # Next -- See [](). Add support for Terraform fmt. +- See [#645](https://github.com/Glavin001/atom-beautify/issues/645). Add support for Terraform fmt. - See [#881](https://github.com/Glavin001/atom-beautify/issues/881). Update to Prettydiff version 2! - ... From 11f35715384fce2c8c8393d4ea8c53f2ec320d83 Mon Sep 17 00:00:00 2001 From: Malte Brodersen Date: Tue, 10 Oct 2017 16:51:13 +0200 Subject: [PATCH 10/25] rerun create docs --- docs/options.md | 1019 ---------------------------------------------- src/options.json | 293 ------------- 2 files changed, 1312 deletions(-) diff --git a/docs/options.md b/docs/options.md index cd2a64e..c94bbbd 100644 --- a/docs/options.md +++ b/docs/options.md @@ -12180,26 +12180,6 @@ Maximum characters per line (0 disables) (Supported by Pretty Diff) | `disabled` | :white_check_mark: | | `default_beautifier` | :white_check_mark: | | `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: | -| `indent_char` | :white_check_mark: | -| `indent_level` | :white_check_mark: | -| `indent_size` | :white_check_mark: | -| `indent_with_tabs` | :white_check_mark: | -| `jslint_happy` | :white_check_mark: | -| `keep_array_indentation` | :white_check_mark: | -| `keep_function_indentation` | :white_check_mark: | -| `max_preserve_newlines` | :white_check_mark: | -| `preserve_newlines` | :white_check_mark: | -| `space_after_anon_function` | :white_check_mark: | -| `space_before_conditional` | :white_check_mark: | -| `space_in_paren` | :white_check_mark: | -| `unescape_strings` | :white_check_mark: | -| `wrap_line_length` | :white_check_mark: | **Description**: @@ -12260,504 +12240,6 @@ Automatically beautify Terraform 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**: [`terraformfmt`](#terraformfmt) - -**Description**: - -[collapse|collapse-preserve-inline|expand|end-expand|none] (Supported by terraformfmt) - -**Example `.jsbeautifyrc` Configuration** - -```json -{ - "js": { - "brace_style": "collapse" - } -} -``` - -##### [Break chained methods](#break-chained-methods) - -**Namespace**: `js` - -**Key**: `break_chained_methods` - -**Type**: `boolean` - -**Supported Beautifiers**: [`terraformfmt`](#terraformfmt) - -**Description**: - -Break chained method calls across subsequent lines (Supported by terraformfmt) - -**Example `.jsbeautifyrc` Configuration** - -```json -{ - "js": { - "break_chained_methods": false - } -} -``` - -##### [End of line](#end-of-line) - -**Namespace**: `js` - -**Key**: `end_of_line` - -**Default**: `System Default` - -**Type**: `string` - -**Enum**: `CRLF` `LF` `System Default` - -**Supported Beautifiers**: [`terraformfmt`](#terraformfmt) - -**Description**: - -Override EOL from line-ending-selector (Supported by terraformfmt) - -**Example `.jsbeautifyrc` Configuration** - -```json -{ - "js": { - "end_of_line": "System Default" - } -} -``` - -##### [End with comma](#end-with-comma) - -**Namespace**: `js` - -**Key**: `end_with_comma` - -**Type**: `boolean` - -**Supported Beautifiers**: [`terraformfmt`](#terraformfmt) - -**Description**: - -If a terminating comma should be inserted into arrays, object literals, and destructured objects. (Supported by terraformfmt) - -**Example `.jsbeautifyrc` Configuration** - -```json -{ - "js": { - "end_with_comma": false - } -} -``` - -##### [End with newline](#end-with-newline) - -**Namespace**: `js` - -**Key**: `end_with_newline` - -**Type**: `boolean` - -**Supported Beautifiers**: [`terraformfmt`](#terraformfmt) - -**Description**: - -End output with newline (Supported by terraformfmt) - -**Example `.jsbeautifyrc` Configuration** - -```json -{ - "js": { - "end_with_newline": false - } -} -``` - -##### [Eval code](#eval-code) - -**Namespace**: `js` - -**Key**: `eval_code` - -**Type**: `boolean` - -**Supported Beautifiers**: [`terraformfmt`](#terraformfmt) - -**Description**: - - (Supported by terraformfmt) - -**Example `.jsbeautifyrc` Configuration** - -```json -{ - "js": { - "eval_code": false - } -} -``` - -##### [Indent char](#indent-char) - -**Namespace**: `js` - -**Key**: `indent_char` - -**Default**: ` ` - -**Type**: `string` - -**Supported Beautifiers**: [`terraformfmt`](#terraformfmt) - -**Description**: - -Indentation character (Supported by terraformfmt) - -**Example `.jsbeautifyrc` Configuration** - -```json -{ - "js": { - "indent_char": " " - } -} -``` - -##### [Indent level](#indent-level) - -**Namespace**: `js` - -**Key**: `indent_level` - -**Type**: `integer` - -**Supported Beautifiers**: [`terraformfmt`](#terraformfmt) - -**Description**: - -Initial indentation level (Supported by terraformfmt) - -**Example `.jsbeautifyrc` Configuration** - -```json -{ - "js": { - "indent_level": 0 - } -} -``` - -##### [Indent size](#indent-size) - -**Namespace**: `js` - -**Key**: `indent_size` - -**Default**: `4` - -**Type**: `integer` - -**Supported Beautifiers**: [`terraformfmt`](#terraformfmt) - -**Description**: - -Indentation size/length (Supported by terraformfmt) - -**Example `.jsbeautifyrc` Configuration** - -```json -{ - "js": { - "indent_size": 4 - } -} -``` - -##### [Indent with tabs](#indent-with-tabs) - -**Namespace**: `js` - -**Key**: `indent_with_tabs` - -**Type**: `boolean` - -**Supported Beautifiers**: [`terraformfmt`](#terraformfmt) - -**Description**: - -Indentation uses tabs, overrides `Indent Size` and `Indent Char` (Supported by terraformfmt) - -**Example `.jsbeautifyrc` Configuration** - -```json -{ - "js": { - "indent_with_tabs": false - } -} -``` - -##### [Jslint happy](#jslint-happy) - -**Namespace**: `js` - -**Key**: `jslint_happy` - -**Type**: `boolean` - -**Supported Beautifiers**: [`terraformfmt`](#terraformfmt) - -**Description**: - -Enable jslint-stricter mode (Supported by terraformfmt) - -**Example `.jsbeautifyrc` Configuration** - -```json -{ - "js": { - "jslint_happy": false - } -} -``` - -##### [Keep array indentation](#keep-array-indentation) - -**Namespace**: `js` - -**Key**: `keep_array_indentation` - -**Type**: `boolean` - -**Supported Beautifiers**: [`terraformfmt`](#terraformfmt) - -**Description**: - -Preserve array indentation (Supported by terraformfmt) - -**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**: [`terraformfmt`](#terraformfmt) - -**Description**: - - (Supported by terraformfmt) - -**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**: [`terraformfmt`](#terraformfmt) - -**Description**: - -Number of line-breaks to be preserved in one chunk (Supported by terraformfmt) - -**Example `.jsbeautifyrc` Configuration** - -```json -{ - "js": { - "max_preserve_newlines": 10 - } -} -``` - -##### [Preserve newlines](#preserve-newlines) - -**Namespace**: `js` - -**Key**: `preserve_newlines` - -**Default**: `true` - -**Type**: `boolean` - -**Supported Beautifiers**: [`terraformfmt`](#terraformfmt) - -**Description**: - -Preserve line-breaks (Supported by terraformfmt) - -**Example `.jsbeautifyrc` Configuration** - -```json -{ - "js": { - "preserve_newlines": true - } -} -``` - -##### [Space after anon function](#space-after-anon-function) - -**Namespace**: `js` - -**Key**: `space_after_anon_function` - -**Type**: `boolean` - -**Supported Beautifiers**: [`terraformfmt`](#terraformfmt) - -**Description**: - -Add a space before an anonymous function's parens, ie. function () (Supported by terraformfmt) - -**Example `.jsbeautifyrc` Configuration** - -```json -{ - "js": { - "space_after_anon_function": false - } -} -``` - -##### [Space before conditional](#space-before-conditional) - -**Namespace**: `js` - -**Key**: `space_before_conditional` - -**Default**: `true` - -**Type**: `boolean` - -**Supported Beautifiers**: [`terraformfmt`](#terraformfmt) - -**Description**: - - (Supported by terraformfmt) - -**Example `.jsbeautifyrc` Configuration** - -```json -{ - "js": { - "space_before_conditional": true - } -} -``` - -##### [Space in paren](#space-in-paren) - -**Namespace**: `js` - -**Key**: `space_in_paren` - -**Type**: `boolean` - -**Supported Beautifiers**: [`terraformfmt`](#terraformfmt) - -**Description**: - -Add padding spaces within paren, ie. f( a, b ) (Supported by terraformfmt) - -**Example `.jsbeautifyrc` Configuration** - -```json -{ - "js": { - "space_in_paren": false - } -} -``` - -##### [Unescape strings](#unescape-strings) - -**Namespace**: `js` - -**Key**: `unescape_strings` - -**Type**: `boolean` - -**Supported Beautifiers**: [`terraformfmt`](#terraformfmt) - -**Description**: - -Decode printable characters encoded in xNN notation (Supported by terraformfmt) - -**Example `.jsbeautifyrc` Configuration** - -```json -{ - "js": { - "unescape_strings": false - } -} -``` - -##### [Wrap line length](#wrap-line-length) - -**Namespace**: `js` - -**Key**: `wrap_line_length` - -**Type**: `integer` - -**Supported Beautifiers**: [`terraformfmt`](#terraformfmt) - -**Description**: - -Wrap lines at next opportunity after N characters (Supported by terraformfmt) - -**Example `.jsbeautifyrc` Configuration** - -```json -{ - "js": { - "wrap_line_length": 0 - } -} -``` - #### [TSS](#tss) **Supported Beautifiers**: [`Pretty Diff`](#pretty-diff) @@ -21141,504 +20623,3 @@ Change case of identifiers (Supported by sqlformat) ``` -### terraformfmt - -##### [Indent size](#indent-size) - -**Namespace**: `js` - -**Key**: `indent_size` - -**Default**: `4` - -**Type**: `integer` - -**Supported Beautifiers**: [`terraformfmt`](#terraformfmt) - -**Description**: - -Indentation size/length (Supported by terraformfmt) - -**Example `.jsbeautifyrc` Configuration** - -```json -{ - "js": { - "indent_size": 4 - } -} -``` - -##### [Indent char](#indent-char) - -**Namespace**: `js` - -**Key**: `indent_char` - -**Default**: ` ` - -**Type**: `string` - -**Supported Beautifiers**: [`terraformfmt`](#terraformfmt) - -**Description**: - -Indentation character (Supported by terraformfmt) - -**Example `.jsbeautifyrc` Configuration** - -```json -{ - "js": { - "indent_char": " " - } -} -``` - -##### [Indent level](#indent-level) - -**Namespace**: `js` - -**Key**: `indent_level` - -**Type**: `integer` - -**Supported Beautifiers**: [`terraformfmt`](#terraformfmt) - -**Description**: - -Initial indentation level (Supported by terraformfmt) - -**Example `.jsbeautifyrc` Configuration** - -```json -{ - "js": { - "indent_level": 0 - } -} -``` - -##### [Indent with tabs](#indent-with-tabs) - -**Namespace**: `js` - -**Key**: `indent_with_tabs` - -**Type**: `boolean` - -**Supported Beautifiers**: [`terraformfmt`](#terraformfmt) - -**Description**: - -Indentation uses tabs, overrides `Indent Size` and `Indent Char` (Supported by terraformfmt) - -**Example `.jsbeautifyrc` Configuration** - -```json -{ - "js": { - "indent_with_tabs": false - } -} -``` - -##### [Preserve newlines](#preserve-newlines) - -**Namespace**: `js` - -**Key**: `preserve_newlines` - -**Default**: `true` - -**Type**: `boolean` - -**Supported Beautifiers**: [`terraformfmt`](#terraformfmt) - -**Description**: - -Preserve line-breaks (Supported by terraformfmt) - -**Example `.jsbeautifyrc` Configuration** - -```json -{ - "js": { - "preserve_newlines": true - } -} -``` - -##### [Max preserve newlines](#max-preserve-newlines) - -**Namespace**: `js` - -**Key**: `max_preserve_newlines` - -**Default**: `10` - -**Type**: `integer` - -**Supported Beautifiers**: [`terraformfmt`](#terraformfmt) - -**Description**: - -Number of line-breaks to be preserved in one chunk (Supported by terraformfmt) - -**Example `.jsbeautifyrc` Configuration** - -```json -{ - "js": { - "max_preserve_newlines": 10 - } -} -``` - -##### [Space in paren](#space-in-paren) - -**Namespace**: `js` - -**Key**: `space_in_paren` - -**Type**: `boolean` - -**Supported Beautifiers**: [`terraformfmt`](#terraformfmt) - -**Description**: - -Add padding spaces within paren, ie. f( a, b ) (Supported by terraformfmt) - -**Example `.jsbeautifyrc` Configuration** - -```json -{ - "js": { - "space_in_paren": false - } -} -``` - -##### [Jslint happy](#jslint-happy) - -**Namespace**: `js` - -**Key**: `jslint_happy` - -**Type**: `boolean` - -**Supported Beautifiers**: [`terraformfmt`](#terraformfmt) - -**Description**: - -Enable jslint-stricter mode (Supported by terraformfmt) - -**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**: [`terraformfmt`](#terraformfmt) - -**Description**: - -Add a space before an anonymous function's parens, ie. function () (Supported by terraformfmt) - -**Example `.jsbeautifyrc` Configuration** - -```json -{ - "js": { - "space_after_anon_function": false - } -} -``` - -##### [Brace style](#brace-style) - -**Namespace**: `js` - -**Key**: `brace_style` - -**Default**: `collapse` - -**Type**: `string` - -**Enum**: `collapse` `collapse-preserve-inline` `expand` `end-expand` `none` - -**Supported Beautifiers**: [`terraformfmt`](#terraformfmt) - -**Description**: - -[collapse|collapse-preserve-inline|expand|end-expand|none] (Supported by terraformfmt) - -**Example `.jsbeautifyrc` Configuration** - -```json -{ - "js": { - "brace_style": "collapse" - } -} -``` - -##### [Break chained methods](#break-chained-methods) - -**Namespace**: `js` - -**Key**: `break_chained_methods` - -**Type**: `boolean` - -**Supported Beautifiers**: [`terraformfmt`](#terraformfmt) - -**Description**: - -Break chained method calls across subsequent lines (Supported by terraformfmt) - -**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**: [`terraformfmt`](#terraformfmt) - -**Description**: - -Preserve array indentation (Supported by terraformfmt) - -**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**: [`terraformfmt`](#terraformfmt) - -**Description**: - - (Supported by terraformfmt) - -**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**: [`terraformfmt`](#terraformfmt) - -**Description**: - - (Supported by terraformfmt) - -**Example `.jsbeautifyrc` Configuration** - -```json -{ - "js": { - "space_before_conditional": true - } -} -``` - -##### [Eval code](#eval-code) - -**Namespace**: `js` - -**Key**: `eval_code` - -**Type**: `boolean` - -**Supported Beautifiers**: [`terraformfmt`](#terraformfmt) - -**Description**: - - (Supported by terraformfmt) - -**Example `.jsbeautifyrc` Configuration** - -```json -{ - "js": { - "eval_code": false - } -} -``` - -##### [Unescape strings](#unescape-strings) - -**Namespace**: `js` - -**Key**: `unescape_strings` - -**Type**: `boolean` - -**Supported Beautifiers**: [`terraformfmt`](#terraformfmt) - -**Description**: - -Decode printable characters encoded in xNN notation (Supported by terraformfmt) - -**Example `.jsbeautifyrc` Configuration** - -```json -{ - "js": { - "unescape_strings": false - } -} -``` - -##### [Wrap line length](#wrap-line-length) - -**Namespace**: `js` - -**Key**: `wrap_line_length` - -**Type**: `integer` - -**Supported Beautifiers**: [`terraformfmt`](#terraformfmt) - -**Description**: - -Wrap lines at next opportunity after N characters (Supported by terraformfmt) - -**Example `.jsbeautifyrc` Configuration** - -```json -{ - "js": { - "wrap_line_length": 0 - } -} -``` - -##### [End with newline](#end-with-newline) - -**Namespace**: `js` - -**Key**: `end_with_newline` - -**Type**: `boolean` - -**Supported Beautifiers**: [`terraformfmt`](#terraformfmt) - -**Description**: - -End output with newline (Supported by terraformfmt) - -**Example `.jsbeautifyrc` Configuration** - -```json -{ - "js": { - "end_with_newline": false - } -} -``` - -##### [End with comma](#end-with-comma) - -**Namespace**: `js` - -**Key**: `end_with_comma` - -**Type**: `boolean` - -**Supported Beautifiers**: [`terraformfmt`](#terraformfmt) - -**Description**: - -If a terminating comma should be inserted into arrays, object literals, and destructured objects. (Supported by terraformfmt) - -**Example `.jsbeautifyrc` Configuration** - -```json -{ - "js": { - "end_with_comma": false - } -} -``` - -##### [End of line](#end-of-line) - -**Namespace**: `js` - -**Key**: `end_of_line` - -**Default**: `System Default` - -**Type**: `string` - -**Enum**: `CRLF` `LF` `System Default` - -**Supported Beautifiers**: [`terraformfmt`](#terraformfmt) - -**Description**: - -Override EOL from line-ending-selector (Supported by terraformfmt) - -**Example `.jsbeautifyrc` Configuration** - -```json -{ - "js": { - "end_of_line": "System Default" - } -} -``` - - diff --git a/src/options.json b/src/options.json index 3988bb1..0bae288 100644 --- a/src/options.json +++ b/src/options.json @@ -9143,299 +9143,6 @@ "tf" ], "properties": { - "indent_size": { - "type": "integer", - "default": null, - "minimum": 0, - "description": "Indentation size/length (Supported by terraformfmt)", - "title": "Indent size", - "beautifiers": [ - "terraformfmt" - ], - "key": "indent_size", - "language": { - "name": "JavaScript", - "namespace": "js" - } - }, - "indent_char": { - "type": "string", - "default": null, - "description": "Indentation character (Supported by terraformfmt)", - "title": "Indent char", - "beautifiers": [ - "terraformfmt" - ], - "key": "indent_char", - "language": { - "name": "JavaScript", - "namespace": "js" - } - }, - "indent_level": { - "type": "integer", - "default": 0, - "description": "Initial indentation level (Supported by terraformfmt)", - "title": "Indent level", - "beautifiers": [ - "terraformfmt" - ], - "key": "indent_level", - "language": { - "name": "JavaScript", - "namespace": "js" - } - }, - "indent_with_tabs": { - "type": "boolean", - "default": null, - "description": "Indentation uses tabs, overrides `Indent Size` and `Indent Char` (Supported by terraformfmt)", - "title": "Indent with tabs", - "beautifiers": [ - "terraformfmt" - ], - "key": "indent_with_tabs", - "language": { - "name": "JavaScript", - "namespace": "js" - } - }, - "preserve_newlines": { - "type": "boolean", - "default": true, - "description": "Preserve line-breaks (Supported by terraformfmt)", - "title": "Preserve newlines", - "beautifiers": [ - "terraformfmt" - ], - "key": "preserve_newlines", - "language": { - "name": "JavaScript", - "namespace": "js" - } - }, - "max_preserve_newlines": { - "type": "integer", - "default": 10, - "description": "Number of line-breaks to be preserved in one chunk (Supported by terraformfmt)", - "title": "Max preserve newlines", - "beautifiers": [ - "terraformfmt" - ], - "key": "max_preserve_newlines", - "language": { - "name": "JavaScript", - "namespace": "js" - } - }, - "space_in_paren": { - "type": "boolean", - "default": false, - "description": "Add padding spaces within paren, ie. f( a, b ) (Supported by terraformfmt)", - "title": "Space in paren", - "beautifiers": [ - "terraformfmt" - ], - "key": "space_in_paren", - "language": { - "name": "JavaScript", - "namespace": "js" - } - }, - "jslint_happy": { - "type": "boolean", - "default": false, - "description": "Enable jslint-stricter mode (Supported by terraformfmt)", - "title": "Jslint happy", - "beautifiers": [ - "terraformfmt" - ], - "key": "jslint_happy", - "language": { - "name": "JavaScript", - "namespace": "js" - } - }, - "space_after_anon_function": { - "type": "boolean", - "default": false, - "description": "Add a space before an anonymous function's parens, ie. function () (Supported by terraformfmt)", - "title": "Space after anon function", - "beautifiers": [ - "terraformfmt" - ], - "key": "space_after_anon_function", - "language": { - "name": "JavaScript", - "namespace": "js" - } - }, - "brace_style": { - "type": "string", - "default": "collapse", - "enum": [ - "collapse", - "collapse-preserve-inline", - "expand", - "end-expand", - "none" - ], - "description": "[collapse|collapse-preserve-inline|expand|end-expand|none] (Supported by terraformfmt)", - "title": "Brace style", - "beautifiers": [ - "terraformfmt" - ], - "key": "brace_style", - "language": { - "name": "JavaScript", - "namespace": "js" - } - }, - "break_chained_methods": { - "type": "boolean", - "default": false, - "description": "Break chained method calls across subsequent lines (Supported by terraformfmt)", - "title": "Break chained methods", - "beautifiers": [ - "terraformfmt" - ], - "key": "break_chained_methods", - "language": { - "name": "JavaScript", - "namespace": "js" - } - }, - "keep_array_indentation": { - "type": "boolean", - "default": false, - "description": "Preserve array indentation (Supported by terraformfmt)", - "title": "Keep array indentation", - "beautifiers": [ - "terraformfmt" - ], - "key": "keep_array_indentation", - "language": { - "name": "JavaScript", - "namespace": "js" - } - }, - "keep_function_indentation": { - "type": "boolean", - "default": false, - "description": " (Supported by terraformfmt)", - "title": "Keep function indentation", - "beautifiers": [ - "terraformfmt" - ], - "key": "keep_function_indentation", - "language": { - "name": "JavaScript", - "namespace": "js" - } - }, - "space_before_conditional": { - "type": "boolean", - "default": true, - "description": " (Supported by terraformfmt)", - "title": "Space before conditional", - "beautifiers": [ - "terraformfmt" - ], - "key": "space_before_conditional", - "language": { - "name": "JavaScript", - "namespace": "js" - } - }, - "eval_code": { - "type": "boolean", - "default": false, - "description": " (Supported by terraformfmt)", - "title": "Eval code", - "beautifiers": [ - "terraformfmt" - ], - "key": "eval_code", - "language": { - "name": "JavaScript", - "namespace": "js" - } - }, - "unescape_strings": { - "type": "boolean", - "default": false, - "description": "Decode printable characters encoded in xNN notation (Supported by terraformfmt)", - "title": "Unescape strings", - "beautifiers": [ - "terraformfmt" - ], - "key": "unescape_strings", - "language": { - "name": "JavaScript", - "namespace": "js" - } - }, - "wrap_line_length": { - "type": "integer", - "default": 0, - "description": "Wrap lines at next opportunity after N characters (Supported by terraformfmt)", - "title": "Wrap line length", - "beautifiers": [ - "terraformfmt" - ], - "key": "wrap_line_length", - "language": { - "name": "JavaScript", - "namespace": "js" - } - }, - "end_with_newline": { - "type": "boolean", - "default": false, - "description": "End output with newline (Supported by terraformfmt)", - "title": "End with newline", - "beautifiers": [ - "terraformfmt" - ], - "key": "end_with_newline", - "language": { - "name": "JavaScript", - "namespace": "js" - } - }, - "end_with_comma": { - "type": "boolean", - "default": false, - "description": "If a terminating comma should be inserted into arrays, object literals, and destructured objects. (Supported by terraformfmt)", - "title": "End with comma", - "beautifiers": [ - "terraformfmt" - ], - "key": "end_with_comma", - "language": { - "name": "JavaScript", - "namespace": "js" - } - }, - "end_of_line": { - "type": "string", - "default": "System Default", - "enum": [ - "CRLF", - "LF", - "System Default" - ], - "description": "Override EOL from line-ending-selector (Supported by terraformfmt)", - "title": "End of line", - "beautifiers": [ - "terraformfmt" - ], - "key": "end_of_line", - "language": { - "name": "JavaScript", - "namespace": "js" - } - }, "disabled": { "title": "Disable Beautifying Language", "order": -3, From fcb15dc55265e02d999d9897212f99ac3574c014 Mon Sep 17 00:00:00 2001 From: Malte Brodersen Date: Tue, 10 Oct 2017 16:57:18 +0200 Subject: [PATCH 11/25] add example --- .../terraform/expected/test.tf | 18 ++++++++++++++++ .../terraform/original/test.tf | 21 +++++++++++++++++++ 2 files changed, 39 insertions(+) create mode 100644 examples/simple-jsbeautifyrc/terraform/expected/test.tf create mode 100644 examples/simple-jsbeautifyrc/terraform/original/test.tf diff --git a/examples/simple-jsbeautifyrc/terraform/expected/test.tf b/examples/simple-jsbeautifyrc/terraform/expected/test.tf new file mode 100644 index 0000000..5f855b3 --- /dev/null +++ b/examples/simple-jsbeautifyrc/terraform/expected/test.tf @@ -0,0 +1,18 @@ +resource "aws_db_instance" "wordpress" { + # worng spaces # to much spaces + + allocated_storage = 10 + storage_type = "gp2" + engine = "mariadb" + engine_version = "10.0.24" + + instance_class = "db.t2.micro" + identifier = "db-${var.env}" + name = "wordpress" + + username = "wordpress" + password = "${var.wordpress_db_pass}" + db_subnet_group_name = "${aws_db_subnet_group.default.name}" + vpc_security_group_ids = ["${aws_security_group.RuleWebServerIn.id}"] + apply_immediately = true +} diff --git a/examples/simple-jsbeautifyrc/terraform/original/test.tf b/examples/simple-jsbeautifyrc/terraform/original/test.tf new file mode 100644 index 0000000..702bfe8 --- /dev/null +++ b/examples/simple-jsbeautifyrc/terraform/original/test.tf @@ -0,0 +1,21 @@ +resource "aws_db_instance" "wordpress" { + # worng spaces + # to much spaces + + allocated_storage = 10 + storage_type = "gp2" + engine = "mariadb" + engine_version = "10.0.24" + +instance_class = "db.t2.micro" + identifier = "db-${var.env}" + name = "wordpress" + + + + username = "wordpress" + password = "${var.wordpress_db_pass}" + db_subnet_group_name = "${aws_db_subnet_group.default.name}" + vpc_security_group_ids = ["${aws_security_group.RuleWebServerIn.id}"] + apply_immediately = true +} From 91f7adb82477bf997f1c158d3f206c23dee5da4b Mon Sep 17 00:00:00 2001 From: Malte Brodersen Date: Tue, 10 Oct 2017 17:36:29 +0200 Subject: [PATCH 12/25] update to run --- README.md | 2 +- docs/options.md | 17 +++++++++++++++++ src/beautifiers/terraformfmt.coffee | 21 ++++++++++++++++++--- src/options.json | 16 ++++++++++++++++ 4 files changed, 52 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index e0e249b..d76353f 100644 --- a/README.md +++ b/README.md @@ -111,7 +111,7 @@ Some of the supported beautifiers are developed for Node.js and are automaticall | SassConvert | :warning: 1 executable | :white_check_mark: :100:% of executables | :whale: With [Docker](https://www.docker.com/):
1. Install [SassConvert (`sass-convert`)](http://sass-lang.com/documentation/file.SASS_REFERENCE.html#syntax) with `docker pull unibeautify/sass-convert`

:bookmark_tabs: Manually:
1. Install [SassConvert (`sass-convert`)](http://sass-lang.com/documentation/file.SASS_REFERENCE.html#syntax) by following http://sass-lang.com/documentation/file.SASS_REFERENCE.html#syntax
| | sqlformat | :warning: Manual installation | :construction: Not an executable | :page_facing_up: Go to https://github.com/andialbrecht/sqlparse and follow the instructions. | | stylish-haskell | :warning: Manual installation | :construction: Not an executable | :page_facing_up: Go to https://github.com/jaspervdj/stylish-haskell and follow the instructions. | -| terraformfmt | :warning: Manual installation | :construction: Not an executable | :page_facing_up: Go to https://www.terraform.io/docs/commands/fmt.html and follow the instructions. | +| terraformfmt | :warning: 1 executable | :white_check_mark: :100:% of executables | :whale: With [Docker](https://www.docker.com/):
1. Install [Terraform (`terraform`)](https://www.terraform.io) with `docker pull hashicorp/terraform`

:bookmark_tabs: Manually:
1. Install [Terraform (`terraform`)](https://www.terraform.io) by following https://www.terraform.io
| | Tidy Markdown | :white_check_mark: | :ok_hand: Not necessary | :smiley: Nothing! | | TypeScript Formatter | :white_check_mark: | :ok_hand: Not necessary | :smiley: Nothing! | | Uncrustify | :warning: 1 executable | :white_check_mark: :100:% of executables | :whale: With [Docker](https://www.docker.com/):
1. Install [Uncrustify (`uncrustify`)](http://uncrustify.sourceforge.net/) with `docker pull unibeautify/uncrustify`

:bookmark_tabs: Manually:
1. Install [Uncrustify (`uncrustify`)](http://uncrustify.sourceforge.net/) by following https://github.com/uncrustify/uncrustify
| diff --git a/docs/options.md b/docs/options.md index c94bbbd..7f3311d 100644 --- a/docs/options.md +++ b/docs/options.md @@ -368,6 +368,23 @@ Options for SassConvert executable. 2. Go into *Packages* and search for "*Atom Beautify*" package. 3. Find the option "*SassConvert*" and change it to your desired configuration. +##### [Terraform](#terraform) + +**Important**: This option is only configurable from within Atom Beautify's setting panel. + +**Type**: `object` + +**Description**: + +Options for Terraform executable. + +**How to Configure** + +1. You can open the [Settings View](https://github.com/atom/settings-view) by navigating to +*Edit > Preferences (Linux)*, *Atom > Preferences (OS X)*, or *File > Preferences (Windows)*. +2. Go into *Packages* and search for "*Atom Beautify*" package. +3. Find the option "*Terraform*" and change it to your desired configuration. + ##### [Uncrustify](#uncrustify) **Important**: This option is only configurable from within Atom Beautify's setting panel. diff --git a/src/beautifiers/terraformfmt.coffee b/src/beautifiers/terraformfmt.coffee index 6075f4e..b6035d7 100644 --- a/src/beautifiers/terraformfmt.coffee +++ b/src/beautifiers/terraformfmt.coffee @@ -14,11 +14,26 @@ module.exports = class Terraformfmt extends Beautifier Terraform: false } + executables: [ + { + name: "Terraform" + cmd: "terraform" + homepage: "https://www.terraform.io" + installation: "https://www.terraform.io" + version: { + parse: (text) -> text.match(/Terraform v(\d+\.\d+\.\d+)/)[1] + } + docker: { + image: "hashicorp/terraform" + } + } + ] + beautify: (text, language, options) -> - @run("terraform", [ + @exe("terraform").run([ "fmt" tempFile = @tempFile("input", text) ]) .then(=> - @readFile(tempFile) - ) + @readFile(tempFile) + ) \ No newline at end of file diff --git a/src/options.json b/src/options.json index 0bae288..0eca25e 100644 --- a/src/options.json +++ b/src/options.json @@ -9415,6 +9415,22 @@ "description": "Absolute path to the \"beautysh\" executable's binary/script." } } + }, + "terraform": { + "key": "terraform", + "title": "Terraform", + "type": "object", + "collapsed": true, + "description": "Options for Terraform executable.", + "properties": { + "path": { + "key": "path", + "title": "Binary/Script Path", + "type": "string", + "default": "", + "description": "Absolute path to the \"terraform\" executable's binary/script." + } + } } } } From cf74a9821203b3e636cf307e47712d58b8bf9a9f Mon Sep 17 00:00:00 2001 From: Malte Brodersen Date: Tue, 10 Oct 2017 17:49:09 +0200 Subject: [PATCH 13/25] remove space --- src/beautifiers/terraformfmt.coffee | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/beautifiers/terraformfmt.coffee b/src/beautifiers/terraformfmt.coffee index b6035d7..5da6d6e 100644 --- a/src/beautifiers/terraformfmt.coffee +++ b/src/beautifiers/terraformfmt.coffee @@ -35,5 +35,5 @@ module.exports = class Terraformfmt extends Beautifier tempFile = @tempFile("input", text) ]) .then(=> - @readFile(tempFile) + @readFile(tempFile) ) \ No newline at end of file From b318eea93de5b4c347b93ce65eff5db92c5c26ac Mon Sep 17 00:00:00 2001 From: Malte Brodersen Date: Wed, 11 Oct 2017 20:39:29 +0200 Subject: [PATCH 14/25] add travis and appveyor requirements --- .travis.yml | 6 ++++++ appveyor.yml | 4 ++++ 2 files changed, 10 insertions(+) diff --git a/.travis.yml b/.travis.yml index fc65e27..b8f6995 100644 --- a/.travis.yml +++ b/.travis.yml @@ -185,4 +185,10 @@ before_install: pip install --user beautysh; else pip install beautysh; + fi + # terraform + - if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then + brew install terraform; + else + docker pull hashicorp/terraform; fi \ No newline at end of file diff --git a/appveyor.yml b/appveyor.yml index cbf5041..bf21dfb 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -98,6 +98,10 @@ install: - cinst emacs -y - where emacs + # terraform + - cinst terraform -y + - where terraform + # FIXME: Enable allowEmptyChecksums, until someone fixes the checksum issue of php - choco feature enable -n allowEmptyChecksums # PHP From 0d266384f66a3698817bf836fee4d20d78d7e6d5 Mon Sep 17 00:00:00 2001 From: Malte Brodersen Date: Wed, 11 Oct 2017 23:11:41 +0200 Subject: [PATCH 15/25] workarround for travis issue" --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index b8f6995..7dc233b 100644 --- a/.travis.yml +++ b/.travis.yml @@ -92,7 +92,7 @@ before_install: git clone --depth=1 https://github.com/Linuxbrew/brew.git ~/.linuxbrew || true; fi # Update Homebrew - # - brew update + - brew update - brew tap homebrew/dupes - brew tap homebrew/versions # Ruby language support From 452223264251a9674b4681b03e94927697066cdc Mon Sep 17 00:00:00 2001 From: Steven Zeck Date: Wed, 18 Oct 2017 18:44:52 -0500 Subject: [PATCH 16/25] Add Settings option to Atom Beautify menu to access package settings --- CHANGELOG.md | 1 + menus/atom-beautify.cson | 4 ++++ package.json | 1 + src/beautify.coffee | 4 ++++ 4 files changed, 10 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 171b381..e10169e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,7 @@ # Next - See [#881](https://github.com/Glavin001/atom-beautify/issues/881). Update to Prettydiff version 2! - Fix for [#1888](https://github.com/Glavin001/atom-beautify/issues/1888). Allow 0 for minor and patch versions of Docker +- Add Settings to atom-beautify in Packages menu [#1869](https://github.com/Glavin001/atom-beautify/issues/1869) - ... # v0.30.5 (2017-08-11) diff --git a/menus/atom-beautify.cson b/menus/atom-beautify.cson index fdfd781..a0d2d54 100644 --- a/menus/atom-beautify.cson +++ b/menus/atom-beautify.cson @@ -25,6 +25,10 @@ 'label': 'Debug' 'command': 'atom-beautify:help-debug-editor' } + { + 'label': 'Settings' + 'command': 'atom-beautify:open-settings' + } ] ] } diff --git a/package.json b/package.json index 17b14a7..b056e4e 100644 --- a/package.json +++ b/package.json @@ -208,6 +208,7 @@ "atom-workspace": [ "atom-beautify:help-debug-editor", "atom-beautify:beautify-editor", + "atom-beautify:open-settings", "atom-beautify:migrate-settings", "core:save", "core:save-as", diff --git a/src/beautify.coffee b/src/beautify.coffee index 55f568f..3a850a4 100644 --- a/src/beautify.coffee +++ b/src/beautify.coffee @@ -556,6 +556,9 @@ handleSaveEvent = -> ) plugin.subscriptions.add disposable +openSettings = -> + atom.workspace.open('atom://config/packages/atom-beautify') + getUnsupportedOptions = -> settings = atom.config.get('atom-beautify') schema = atom.config.getSchema('atom-beautify') @@ -622,6 +625,7 @@ plugin.activate = -> @subscriptions.add handleSaveEvent() @subscriptions.add atom.commands.add "atom-workspace", "atom-beautify:beautify-editor", beautify @subscriptions.add atom.commands.add "atom-workspace", "atom-beautify:help-debug-editor", debug + @subscriptions.add atom.commands.add "atom-workspace", "atom-beautify:open-settings", openSettings @subscriptions.add atom.commands.add ".tree-view .file .name", "atom-beautify:beautify-file", beautifyFile @subscriptions.add atom.commands.add ".tree-view .directory .name", "atom-beautify:beautify-directory", beautifyDirectory @subscriptions.add atom.commands.add "atom-workspace", "atom-beautify:migrate-settings", plugin.migrateSettings From bd310367feab5f58904fd49a2a8059d42380c1c5 Mon Sep 17 00:00:00 2001 From: Steven Zeck Date: Thu, 19 Oct 2017 18:39:55 -0500 Subject: [PATCH 17/25] Use Ruby 2.1.10 in Travis for Rubocop install error --- .travis.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.travis.yml b/.travis.yml index 873af00..ee7cc65 100644 --- a/.travis.yml +++ b/.travis.yml @@ -50,6 +50,7 @@ matrix: - os: osx env: - ATOM_CHANNEL=stable + rvm: 2.1.10 # - os: osx # env: # - ATOM_CHANNEL=beta From c3aaf8907efbdf97efb6c2c4ff2c51a707661518 Mon Sep 17 00:00:00 2001 From: Steven Zeck <8315038+szeck87@users.noreply.github.com> Date: Sun, 29 Oct 2017 16:37:22 -0500 Subject: [PATCH 18/25] Remove rvm update and comment out rubocop install --- .travis.yml | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/.travis.yml b/.travis.yml index ee7cc65..6b6f59b 100644 --- a/.travis.yml +++ b/.travis.yml @@ -50,7 +50,6 @@ matrix: - os: osx env: - ATOM_CHANNEL=stable - rvm: 2.1.10 # - os: osx # env: # - ATOM_CHANNEL=beta @@ -98,7 +97,7 @@ before_install: - brew tap homebrew/versions # Ruby language support # - gem install ruby-beautify --verbose - - gem install rubocop + # - gem install rubocop - gem install htmlbeautifier - gem install puppet-lint # Sass language support @@ -186,4 +185,4 @@ before_install: pip install --user beautysh; else pip install beautysh; - fi \ No newline at end of file + fi From 3ec28ea375f2d92b419accd1033f1ec32ee488e1 Mon Sep 17 00:00:00 2001 From: Steven Zeck <8315038+szeck87@users.noreply.github.com> Date: Sun, 29 Oct 2017 17:13:46 -0500 Subject: [PATCH 19/25] Remove isPreInstalled attribute --- src/beautifiers/terraformfmt.coffee | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/beautifiers/terraformfmt.coffee b/src/beautifiers/terraformfmt.coffee index 5da6d6e..f799898 100644 --- a/src/beautifiers/terraformfmt.coffee +++ b/src/beautifiers/terraformfmt.coffee @@ -8,7 +8,6 @@ Beautifier = require('./beautifier') module.exports = class Terraformfmt extends Beautifier name: "terraformfmt" link: "https://www.terraform.io/docs/commands/fmt.html" - isPreInstalled: false options: { Terraform: false @@ -36,4 +35,4 @@ module.exports = class Terraformfmt extends Beautifier ]) .then(=> @readFile(tempFile) - ) \ No newline at end of file + ) From 133ed83243aff39dfeaae2d648ff90836404784a Mon Sep 17 00:00:00 2001 From: Steven Zeck Date: Sun, 29 Oct 2017 17:41:20 -0500 Subject: [PATCH 20/25] Update readme template install steps and run npm run docs --- README-template.md | 2 +- README.md | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/README-template.md b/README-template.md index 5573201..1726007 100644 --- a/README-template.md +++ b/README-template.md @@ -45,7 +45,7 @@ Atom Package: https://atom.io/packages/atom-beautify apm install atom-beautify ``` -Or Settings/Preferences ➔ Packages ➔ Search for `atom-beautify` +Or Settings/Preferences ➔ Install ➔ Search for `atom-beautify` ### Important Notice: Analytics diff --git a/README.md b/README.md index c33233e..5cc6c8c 100644 --- a/README.md +++ b/README.md @@ -45,7 +45,7 @@ Atom Package: https://atom.io/packages/atom-beautify apm install atom-beautify ``` -Or Settings/Preferences ➔ Packages ➔ Search for `atom-beautify` +Or Settings/Preferences ➔ Install ➔ Search for `atom-beautify` ### Important Notice: Analytics From 19a2eb96ef24ea5c2c0ded243c9bf9015aa0fde6 Mon Sep 17 00:00:00 2001 From: Glavin Wiechert Date: Mon, 30 Oct 2017 02:01:18 -0300 Subject: [PATCH 21/25] Update CHANGELOG for v0.30.6 release --- CHANGELOG.md | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index f5941e6..6e79819 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,9 +1,14 @@ # Next +- ... + +# v0.30.6 (2017-10-30) - See [#645](https://github.com/Glavin001/atom-beautify/issues/645). Add support for Terraform fmt. - See [#881](https://github.com/Glavin001/atom-beautify/issues/881). Update to Prettydiff version 2! - Fix for [#1888](https://github.com/Glavin001/atom-beautify/issues/1888). Allow 0 for minor and patch versions of Docker -- Add Settings to atom-beautify in Packages menu [#1869](https://github.com/Glavin001/atom-beautify/issues/1869) -- ... +- Add Atom-Beautify package settings menu item to Packages menu [#1869](https://github.com/Glavin001/atom-beautify/issues/1869) +- Add `.ttslua` file extension to Lua language +- Fix [#1638]. Update TypeScript Formatter dependency +- Fix [#1833] `os.tmpDir` deprecation warning # v0.30.5 (2017-08-11) - Fix for [#1721](https://github.com/Glavin001/atom-beautify/issues/1721). Changes required due to TextBuffer.save becoming async in Atom 1.19 From 78db075f83dd71931d8827245de79b687ab5c7e1 Mon Sep 17 00:00:00 2001 From: Glavin Wiechert Date: Mon, 30 Oct 2017 02:01:39 -0300 Subject: [PATCH 22/25] Prepare 0.30.6 release --- package.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index 9e6aff3..394f8ce 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "atom-beautify", "main": "./src/beautify", - "version": "0.30.5", + "version": "0.30.6", "private": true, "description": "Beautify HTML, CSS, JavaScript, PHP, Python, Ruby, Java, C, C++, C#, Objective-C, CoffeeScript, TypeScript, Coldfusion, SQL, and more in Atom", "repository": { @@ -449,4 +449,4 @@ "prettydiff2" ] } -} \ No newline at end of file +} From 0f6c205047a7e705c2a695cf92673df87910fb90 Mon Sep 17 00:00:00 2001 From: Steven Zeck <8315038+szeck87@users.noreply.github.com> Date: Mon, 30 Oct 2017 23:16:47 -0500 Subject: [PATCH 23/25] Add stale.yml for Stale probot --- .github/stale.yml | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100644 .github/stale.yml diff --git a/.github/stale.yml b/.github/stale.yml new file mode 100644 index 0000000..32e4a6b --- /dev/null +++ b/.github/stale.yml @@ -0,0 +1,17 @@ +# Number of days of inactivity before an issue becomes stale +daysUntilStale: 60 +# Number of days of inactivity before a stale issue is closed +daysUntilClose: 7 +# Issues with these labels will never be considered stale +exemptLabels: + - high priority + - pending-publication +# Label to use when marking an issue as stale +staleLabel: stale +# Comment to post when marking an issue as stale. Set to `false` to disable +markComment: > + This issue has been automatically marked as stale because it has not had + recent activity. If this is still an issue, please add a comment. It will be closed if no further activity occurs. Thank you + for your contributions. +# Comment to post when closing a stale issue. Set to `false` to disable +closeComment: false From a50ffba3b15e2d268cc0e821274beb305fce5226 Mon Sep 17 00:00:00 2001 From: Steven Zeck <8315038+szeck87@users.noreply.github.com> Date: Fri, 3 Nov 2017 21:20:36 -0500 Subject: [PATCH 24/25] Update readme and troubleshooting (#1929) Add downloads badge, add link to contributing to readme. Add common issues section in troubleshooting --- README-template.md | 3 +++ README.md | 3 +++ docs/troubleshooting.md | 6 ++++++ 3 files changed, 12 insertions(+) diff --git a/README-template.md b/README-template.md index 1726007..911743d 100644 --- a/README-template.md +++ b/README-template.md @@ -1,4 +1,5 @@ # :lipstick: [{{package.name}}](https://github.com/Glavin001/atom-beautify) +[![apm](https://img.shields.io/apm/dm/atom-beautify.svg)](https://atom.io/packages/atom-beautify) [![Greenkeeper badge](https://badges.greenkeeper.io/Glavin001/atom-beautify.svg)](https://greenkeeper.io/) [![GitHub issues](https://img.shields.io/github/issues/Glavin001/atom-beautify.svg?style=flat-square)](https://github.com/Glavin001/atom-beautify/issues) [![GitHub stars](https://img.shields.io/github/stars/Glavin001/atom-beautify.svg?style=flat-square)](https://github.com/Glavin001/atom-beautify/stargazers) @@ -203,6 +204,8 @@ See [`docs/troubleshooting.md`](docs/troubleshooting.md). ## Contributing +See [`CONTRIBUTING.md`](CONTRIBUTING.md). + [See all contributors on GitHub](../../graphs/contributors). Please update the [CHANGELOG.md](CHANGELOG.md), diff --git a/README.md b/README.md index ee00544..c47e015 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,5 @@ # :lipstick: [atom-beautify](https://github.com/Glavin001/atom-beautify) +[![apm](https://img.shields.io/apm/dm/atom-beautify.svg)](https://atom.io/packages/atom-beautify) [![Greenkeeper badge](https://badges.greenkeeper.io/Glavin001/atom-beautify.svg)](https://greenkeeper.io/) [![GitHub issues](https://img.shields.io/github/issues/Glavin001/atom-beautify.svg?style=flat-square)](https://github.com/Glavin001/atom-beautify/issues) [![GitHub stars](https://img.shields.io/github/stars/Glavin001/atom-beautify.svg?style=flat-square)](https://github.com/Glavin001/atom-beautify/stargazers) @@ -318,6 +319,8 @@ See [`docs/troubleshooting.md`](docs/troubleshooting.md). ## Contributing +See [`CONTRIBUTING.md`](CONTRIBUTING.md). + [See all contributors on GitHub](../../graphs/contributors). Please update the [CHANGELOG.md](CHANGELOG.md), diff --git a/docs/troubleshooting.md b/docs/troubleshooting.md index df99d73..b01f828 100644 --- a/docs/troubleshooting.md +++ b/docs/troubleshooting.md @@ -16,3 +16,9 @@ The debugging results will be copied to your clipboard. 3. Create a file in your new Gist called `debug.md`. 4. Paste your debugging results from Atom beautify into `debug.md` file in your Gist. 5. Add a link to your Gist in your new Issue. + +## Common Issues + +> I receive an error when I try to install or update Atom Beautify + +Run `apm clean` from your terminal, then retry \ No newline at end of file From 3dd3a2b9e9f8b2f588c28e66e100171c94da3364 Mon Sep 17 00:00:00 2001 From: Steven Zeck <8315038+szeck87@users.noreply.github.com> Date: Fri, 3 Nov 2017 21:59:36 -0500 Subject: [PATCH 25/25] Update to exclude add language and beautifier --- .github/stale.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/stale.yml b/.github/stale.yml index 32e4a6b..f951363 100644 --- a/.github/stale.yml +++ b/.github/stale.yml @@ -6,6 +6,8 @@ daysUntilClose: 7 exemptLabels: - high priority - pending-publication + - add-language + - add-beautifier # Label to use when marking an issue as stale staleLabel: stale # Comment to post when marking an issue as stale. Set to `false` to disable