From eb4f9248f272879bf2469801d883190d95529c4f Mon Sep 17 00:00:00 2001 From: Steven Zeck Date: Sun, 21 Jan 2018 22:47:54 -0600 Subject: [PATCH 01/24] Updates editorconfig, season, semver, typescript, which, winston deps --- package.json | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/package.json b/package.json index 8898cdd..1ccfd89 100644 --- a/package.json +++ b/package.json @@ -166,7 +166,7 @@ "coffee-script": "^1.12.6", "csscomb": "^4.2.0", "diff": "^3.2.0", - "editorconfig": "^0.13.2", + "editorconfig": "^0.15.0", "eslint": "^4.0.0", "event-kit": "^2.3.0", "expand-home-dir": "0.0.3", @@ -186,19 +186,19 @@ "prettydiff2": "^2.2.7", "pug-beautify": "^0.1.1", "remark": "6.0.1", - "season": "6.0.0", - "semver": "^5.3.0", + "season": "^6.0.2", + "semver": "^5.5.0", "shell-env": "^0.3.0", "space-pen": "5.1.2", "strip-json-comments": "^2.0.1", "temp": "^0.8.3", "tidy-markdown": "2.0.3", - "typescript": "2.4.1", + "typescript": "^2.6.1", "typescript-formatter": "5.2.0", "underscore-plus": "^1.6.6", - "universal-analytics": "0.4.13", - "which": "1.2.14", - "winston": "2.3.1", + "universal-analytics": "^0.4.16", + "which": "^1.3.0", + "winston": "2.4.0", "yaml-front-matter": "3.4.0" }, "activationHooks": [ From 811e44e7c1744a320085fc8905ac7d181dcc0f5e Mon Sep 17 00:00:00 2001 From: Steven Zeck Date: Sun, 21 Jan 2018 22:55:40 -0600 Subject: [PATCH 02/24] Update js-beautify and marko-prettyprint deps --- package.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index 1ccfd89..36a94eb 100644 --- a/package.json +++ b/package.json @@ -173,11 +173,11 @@ "extend": "^3.0.1", "gherkin": "^2.12.2", "handlebars": "^4.0.10", - "js-beautify": "^1.6.14", + "js-beautify": "^1.7.5", "jscs": "^3.0.7", "lodash": "^4.17.4", "loophole": "^1.1.0", - "marko-prettyprint": "^1.3.6", + "marko-prettyprint": "^1.4.0", "nginxbeautify": "^2.0.1", "node-cljfmt": "0.5.3", "node-dir": "0.1.17", From 2cc7c2ee218d0204c5287cc312e6199511cf494c Mon Sep 17 00:00:00 2001 From: Steven Zeck Date: Sun, 21 Jan 2018 22:59:33 -0600 Subject: [PATCH 03/24] Add caret to Winston dep --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 36a94eb..be9aa97 100644 --- a/package.json +++ b/package.json @@ -198,7 +198,7 @@ "underscore-plus": "^1.6.6", "universal-analytics": "^0.4.16", "which": "^1.3.0", - "winston": "2.4.0", + "winston": "^2.4.0", "yaml-front-matter": "3.4.0" }, "activationHooks": [ From 2ef6dbbabbc1ae9c1853b82fcedd5cdf565809a3 Mon Sep 17 00:00:00 2001 From: Steven Zeck Date: Sun, 21 Jan 2018 23:05:51 -0600 Subject: [PATCH 04/24] Update typescript-formatter --- package.json | 2 +- src/beautifiers/typescript-formatter.coffee | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index 8898cdd..5a1734f 100644 --- a/package.json +++ b/package.json @@ -194,7 +194,7 @@ "temp": "^0.8.3", "tidy-markdown": "2.0.3", "typescript": "2.4.1", - "typescript-formatter": "5.2.0", + "typescript-formatter": "^7.0.0", "underscore-plus": "^1.6.6", "universal-analytics": "0.4.13", "which": "1.2.14", diff --git a/src/beautifiers/typescript-formatter.coffee b/src/beautifiers/typescript-formatter.coffee index 1a0f204..1cbfd8c 100644 --- a/src/beautifiers/typescript-formatter.coffee +++ b/src/beautifiers/typescript-formatter.coffee @@ -12,7 +12,7 @@ module.exports = class TypeScriptFormatter extends Beautifier return new @Promise((resolve, reject) => try - format = require("typescript-formatter/lib/formatter").default + format = require("typescript-formatter/lib/formatter").format formatterUtils = require("typescript-formatter/lib/utils") # @verbose('format', format, formatterUtils) From c2dd151147c308c46c3c59e48ce4430a63d7095b Mon Sep 17 00:00:00 2001 From: Steven Zeck Date: Mon, 22 Jan 2018 13:04:23 -0600 Subject: [PATCH 05/24] Update eslint --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index be9aa97..982c605 100644 --- a/package.json +++ b/package.json @@ -167,7 +167,7 @@ "csscomb": "^4.2.0", "diff": "^3.2.0", "editorconfig": "^0.15.0", - "eslint": "^4.0.0", + "eslint": "^4.16.0", "event-kit": "^2.3.0", "expand-home-dir": "0.0.3", "extend": "^3.0.1", From e359cd3eea0e34bf5831f18ce7340b580da88b1d Mon Sep 17 00:00:00 2001 From: Steven Zeck Date: Mon, 22 Jan 2018 13:18:47 -0600 Subject: [PATCH 06/24] Update minor versions of beautifiers, rest of non-beautifiers --- package.json | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/package.json b/package.json index 982c605..0018bb8 100644 --- a/package.json +++ b/package.json @@ -157,22 +157,22 @@ }, "dependencies": { "align-yaml": "^0.1.8", - "async": "^2.4.1", + "async": "^2.6.0", "atom-message-panel": "^1.3.0", "atom-space-pen-views": "^2.2.0", - "bluebird": "^3.5.0", + "bluebird": "^3.5.1", "coffee-fmt": "^0.12.0", "coffee-formatter": "^0.1.2", "coffee-script": "^1.12.6", "csscomb": "^4.2.0", - "diff": "^3.2.0", + "diff": "^3.4.0", "editorconfig": "^0.15.0", "eslint": "^4.16.0", - "event-kit": "^2.3.0", + "event-kit": "^2.4.0", "expand-home-dir": "0.0.3", "extend": "^3.0.1", "gherkin": "^2.12.2", - "handlebars": "^4.0.10", + "handlebars": "^4.0.11", "js-beautify": "^1.7.5", "jscs": "^3.0.7", "lodash": "^4.17.4", @@ -192,8 +192,8 @@ "space-pen": "5.1.2", "strip-json-comments": "^2.0.1", "temp": "^0.8.3", - "tidy-markdown": "2.0.3", - "typescript": "^2.6.1", + "tidy-markdown": "2.0.5", + "typescript": "^2.6.2", "typescript-formatter": "5.2.0", "underscore-plus": "^1.6.6", "universal-analytics": "^0.4.16", From cac600d88acb451963cffb3dbc4c669529b134e6 Mon Sep 17 00:00:00 2001 From: Steven Zeck Date: Mon, 22 Jan 2018 13:37:36 -0600 Subject: [PATCH 07/24] Revert tidy-markdown to 2.0.4 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 0018bb8..42f9559 100644 --- a/package.json +++ b/package.json @@ -192,7 +192,7 @@ "space-pen": "5.1.2", "strip-json-comments": "^2.0.1", "temp": "^0.8.3", - "tidy-markdown": "2.0.5", + "tidy-markdown": "2.0.4", "typescript": "^2.6.2", "typescript-formatter": "5.2.0", "underscore-plus": "^1.6.6", From 1987f7d81fbed61a21b4d3ccc967f63b2547cfdc Mon Sep 17 00:00:00 2001 From: Steven Zeck Date: Fri, 26 Jan 2018 13:28:23 -0600 Subject: [PATCH 08/24] Output gem info during build --- build-package.sh | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/build-package.sh b/build-package.sh index eaade9a..e32fc28 100644 --- a/build-package.sh +++ b/build-package.sh @@ -5,6 +5,10 @@ if [ "$TRAVIS_OS_NAME" != "osx" ]; then export DISPLAY=":99" fi +echo "Gem Info" +bundle info puppet-lint +bundle info sass + echo "Using Atom version:" "$ATOM_SCRIPT_NAME" -v echo "Using APM version:" From 5d0a33868470328dfd1fc9fb68499267a260d9a7 Mon Sep 17 00:00:00 2001 From: Glavin Wiechert Date: Sun, 28 Jan 2018 17:52:02 -0400 Subject: [PATCH 09/24] Change Unibeautify Bot to Unibeautify CI in README --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 2dde5f0..0a75b7a 100644 --- a/README.md +++ b/README.md @@ -8,7 +8,7 @@ [![Paypal Donations](https://www.paypalobjects.com/en_US/i/btn/btn_donate_SM.gif)](https://www.paypal.com/cgi-bin/webscr?cmd=_donations&business=X2RK5DKN6YXPJ&lc=CA&item_name=Atom%2dBeautify&item_number=atom%2dbeautify¤cy_code=CAD&bn=PP%2dDonationsBF%3abtn_donate_LG%2egif%3aNonHosted) [![Twitter URL](https://img.shields.io/twitter/url/http/shields.io.svg?style=social)](https://twitter.com/unibeautify) -**Sign up for Unibeautify Bot: [https://goo.gl/jmM4QN](https://goo.gl/jmM4QN)** +**Sign up for Unibeautify CI: [https://goo.gl/jmM4QN](https://goo.gl/jmM4QN)** **Help improve Atom-Beautify by completing the quick questionnaire: [https://goo.gl/iEHBNr](https://goo.gl/iEHBNr)** From 7ee1b193f786d0e26b69b734b30a5fb4281b4bdb Mon Sep 17 00:00:00 2001 From: Glavin Wiechert Date: Sun, 28 Jan 2018 17:52:31 -0400 Subject: [PATCH 10/24] Change Unibeautify Bot to Unibeautify CI in README-template --- README-template.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README-template.md b/README-template.md index ac4abb3..2d743ef 100644 --- a/README-template.md +++ b/README-template.md @@ -8,7 +8,7 @@ [![Paypal Donations](https://www.paypalobjects.com/en_US/i/btn/btn_donate_SM.gif)](https://www.paypal.com/cgi-bin/webscr?cmd=_donations&business=X2RK5DKN6YXPJ&lc=CA&item_name=Atom%2dBeautify&item_number=atom%2dbeautify¤cy_code=CAD&bn=PP%2dDonationsBF%3abtn_donate_LG%2egif%3aNonHosted) [![Twitter URL](https://img.shields.io/twitter/url/http/shields.io.svg?style=social)](https://twitter.com/unibeautify) -**Sign up for Unibeautify Bot: [https://goo.gl/jmM4QN](https://goo.gl/jmM4QN)** +**Sign up for Unibeautify CI: [https://goo.gl/jmM4QN](https://goo.gl/jmM4QN)** **Help improve Atom-Beautify by completing the quick questionnaire: [https://goo.gl/iEHBNr](https://goo.gl/iEHBNr)** From 328e21b1e6ab97e9cae2b0297e73957562346af0 Mon Sep 17 00:00:00 2001 From: Steven Zeck Date: Mon, 29 Jan 2018 17:47:33 -0600 Subject: [PATCH 11/24] Remove gem info --- build-package.sh | 4 ---- 1 file changed, 4 deletions(-) diff --git a/build-package.sh b/build-package.sh index e32fc28..eaade9a 100644 --- a/build-package.sh +++ b/build-package.sh @@ -5,10 +5,6 @@ if [ "$TRAVIS_OS_NAME" != "osx" ]; then export DISPLAY=":99" fi -echo "Gem Info" -bundle info puppet-lint -bundle info sass - echo "Using Atom version:" "$ATOM_SCRIPT_NAME" -v echo "Using APM version:" From aefb7794d669ad853490e005b1ea7b075c96f099 Mon Sep 17 00:00:00 2001 From: Steven Zeck Date: Tue, 30 Jan 2018 17:35:23 -0600 Subject: [PATCH 12/24] Add new language tsx, add tsx support to typescript-formatter --- README.md | 1 + docs/options.md | 69 +++++++++++++++++++ .../simple-jsbeautifyrc/tsx/expected/test.tsx | 12 ++++ .../simple-jsbeautifyrc/tsx/original/test.tsx | 12 ++++ package.json | 8 ++- src/beautifiers/typescript-formatter.coffee | 1 + src/languages/index.coffee | 1 + src/languages/tsx.coffee | 21 ++++++ src/options.json | 41 +++++++++++ 9 files changed, 163 insertions(+), 3 deletions(-) create mode 100644 examples/simple-jsbeautifyrc/tsx/expected/test.tsx create mode 100644 examples/simple-jsbeautifyrc/tsx/original/test.tsx create mode 100644 src/languages/tsx.coffee diff --git a/README.md b/README.md index 2dde5f0..4d6f0ae 100644 --- a/README.md +++ b/README.md @@ -199,6 +199,7 @@ See [all supported options in the documentation at `docs/options.md`](docs/opti | 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)** | +| TSX | `TypeScriptReact` |`.tsx` | **[`TypeScript Formatter`](https://github.com/vvakame/typescript-formatter)** | | Twig | `HTML (Twig)` |`.twig` | **[`Pretty Diff`](https://github.com/prettydiff/prettydiff)** | | TypeScript | `TypeScript` |`.ts` | **[`TypeScript Formatter`](https://github.com/vvakame/typescript-formatter)** | | UX Markup | `UX` |`.ux` | **[`Pretty Diff`](https://github.com/prettydiff/prettydiff)** | diff --git a/docs/options.md b/docs/options.md index 0ae2840..6047ede 100644 --- a/docs/options.md +++ b/docs/options.md @@ -12622,6 +12622,75 @@ Maximum amount of characters per line (0 = disable) (Supported by Pretty Diff) } ``` +#### [TSX](#tsx) + +**Supported Beautifiers**: [`TypeScript Formatter`](#typescript-formatter) + +| Option | TypeScript Formatter | +| --- | --- | +| `disabled` | :white_check_mark: | +| `default_beautifier` | :white_check_mark: | +| `beautify_on_save` | :white_check_mark: | + +**Description**: + +Options for language TSX + +##### [Disable Beautifying Language](#disable-beautifying-language) + +**Important**: This option is only configurable from within Atom Beautify's setting panel. + +**Type**: `boolean` + +**Description**: + +Disable TSX 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**: `TypeScript Formatter` + +**Type**: `string` + +**Enum**: `TypeScript Formatter` + +**Description**: + +Default Beautifier to be used for TSX + +**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 TSX 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. + #### [Twig](#twig) **Supported Beautifiers**: [`Pretty Diff`](#pretty-diff) diff --git a/examples/simple-jsbeautifyrc/tsx/expected/test.tsx b/examples/simple-jsbeautifyrc/tsx/expected/test.tsx new file mode 100644 index 0000000..273dd06 --- /dev/null +++ b/examples/simple-jsbeautifyrc/tsx/expected/test.tsx @@ -0,0 +1,12 @@ +class Test extends React.Component { + render() { + return ( +
+

+ { this.foo.bar } + < /h2> + { this.foo.bar.children } +

+ ); + } +} \ No newline at end of file diff --git a/examples/simple-jsbeautifyrc/tsx/original/test.tsx b/examples/simple-jsbeautifyrc/tsx/original/test.tsx new file mode 100644 index 0000000..a974f18 --- /dev/null +++ b/examples/simple-jsbeautifyrc/tsx/original/test.tsx @@ -0,0 +1,12 @@ +class Test extends React.Component { + render() { + return ( +
+

+ {this.foo.bar} +

+ {this.foo.bar.children} +
+ ); + } +} \ No newline at end of file diff --git a/package.json b/package.json index 5a1734f..af5e4da 100644 --- a/package.json +++ b/package.json @@ -277,7 +277,8 @@ "atom-beautify:beautify-language-xml", "atom-beautify:beautify-language-xtemplate", "atom-beautify:beautify-language-yaml", - "atom-beautify:beautify-language-terraform" + "atom-beautify:beautify-language-terraform", + "atom-beautify:beautify-language-tsx" ], ".tree-view .file .name": [ "atom-beautify:beautify-file" @@ -412,7 +413,8 @@ "align-yaml", "goimports", "terraform", - "terraformfmt" + "terraformfmt", + "tsx" ], "devDependencies": { "coffeelint": "1.16.0" @@ -449,4 +451,4 @@ "prettydiff2" ] } -} +} \ No newline at end of file diff --git a/src/beautifiers/typescript-formatter.coffee b/src/beautifiers/typescript-formatter.coffee index 1cbfd8c..a5081ea 100644 --- a/src/beautifiers/typescript-formatter.coffee +++ b/src/beautifiers/typescript-formatter.coffee @@ -6,6 +6,7 @@ module.exports = class TypeScriptFormatter extends Beautifier link: "https://github.com/vvakame/typescript-formatter" options: { TypeScript: true + TSX: true } beautify: (text, language, options) -> diff --git a/src/languages/index.coffee b/src/languages/index.coffee index 7cc1e5c..69c14a8 100644 --- a/src/languages/index.coffee +++ b/src/languages/index.coffee @@ -68,6 +68,7 @@ module.exports = class Languages "svg" "swig" "tss" + "tsx" "twig" "typescript" "ux_markup" diff --git a/src/languages/tsx.coffee b/src/languages/tsx.coffee new file mode 100644 index 0000000..7625b88 --- /dev/null +++ b/src/languages/tsx.coffee @@ -0,0 +1,21 @@ +module.exports = { + + name: "TSX" + namespace: "tsx" + fallback: ['ts'] + + ### + Supported Grammars + ### + grammars: [ + "TypeScriptReact" + ] + + ### + Supported extensions + ### + extensions: [ + "tsx" + ] + +} diff --git a/src/options.json b/src/options.json index 35bda1b..d545bd3 100644 --- a/src/options.json +++ b/src/options.json @@ -7365,6 +7365,47 @@ } } }, + "tsx": { + "title": "TSX", + "type": "object", + "description": "Options for language TSX", + "collapsed": true, + "beautifiers": [ + "TypeScript Formatter" + ], + "grammars": [ + "TypeScriptReact" + ], + "extensions": [ + "tsx" + ], + "properties": { + "disabled": { + "title": "Disable Beautifying Language", + "order": -3, + "type": "boolean", + "default": false, + "description": "Disable TSX Beautification" + }, + "default_beautifier": { + "title": "Default Beautifier", + "order": -2, + "type": "string", + "default": "TypeScript Formatter", + "description": "Default Beautifier to be used for TSX", + "enum": [ + "TypeScript Formatter" + ] + }, + "beautify_on_save": { + "title": "Beautify On Save", + "order": -1, + "type": "boolean", + "default": false, + "description": "Automatically beautify TSX files on save" + } + } + }, "twig": { "title": "Twig", "type": "object", From 6765faf09b9c7e29cb32e780de1d9c0003991e2e Mon Sep 17 00:00:00 2001 From: Steven Zeck Date: Wed, 31 Jan 2018 10:08:48 -0600 Subject: [PATCH 13/24] Update changelog --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 3284e8d..e51a050 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,6 @@ # Next - Fix [#1862](https://github.com/Glavin001/atom-beautify/issues/1862) Add support for ocp-indent as an executable +- See [#601](https://github.com/Glavin001/atom-beautify/issues/1862) Add support for tsx files # v0.30.9 (2017-11-22) - Fix [#1949](https://github.com/Glavin001/atom-beautify/issues/1949): Fix beautify on save when text has not changed. From 7107f00beb0f0f06004b8356a5f29c2121fbe76e Mon Sep 17 00:00:00 2001 From: Steven Zeck Date: Tue, 6 Feb 2018 10:32:09 -0600 Subject: [PATCH 14/24] Fix unit test for tsx --- examples/simple-jsbeautifyrc/tsx/expected/test.tsx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/examples/simple-jsbeautifyrc/tsx/expected/test.tsx b/examples/simple-jsbeautifyrc/tsx/expected/test.tsx index 273dd06..ced5af2 100644 --- a/examples/simple-jsbeautifyrc/tsx/expected/test.tsx +++ b/examples/simple-jsbeautifyrc/tsx/expected/test.tsx @@ -1,7 +1,7 @@ class Test extends React.Component { render() { return ( -
+

{ this.foo.bar } < /h2> @@ -9,4 +9,4 @@ class Test extends React.Component {

); } -} \ No newline at end of file +} From 25a9ee8699f520e952e4842c49c67d67563d0b73 Mon Sep 17 00:00:00 2001 From: Steven Zeck Date: Tue, 6 Feb 2018 11:29:14 -0600 Subject: [PATCH 15/24] Remove homebrew/science tap from build , as its deprecated --- Brewfile | 1 - 1 file changed, 1 deletion(-) diff --git a/Brewfile b/Brewfile index 486f415..16f2eb2 100644 --- a/Brewfile +++ b/Brewfile @@ -1,4 +1,3 @@ -tap 'homebrew/science' tap 'homebrew/php' tap 'caskroom/versions' brew 'uncrustify' From 6c38d3df3f8005ec64434a229bec6f5245f1910c Mon Sep 17 00:00:00 2001 From: Steven Zeck Date: Tue, 6 Feb 2018 13:52:25 -0600 Subject: [PATCH 16/24] Fix typescript-formatter issues for TSX --- examples/simple-jsbeautifyrc/tsx/original/test.tsx | 12 ++++++------ src/beautifiers/typescript-formatter.coffee | 7 ++++++- 2 files changed, 12 insertions(+), 7 deletions(-) diff --git a/examples/simple-jsbeautifyrc/tsx/original/test.tsx b/examples/simple-jsbeautifyrc/tsx/original/test.tsx index a974f18..5d2797f 100644 --- a/examples/simple-jsbeautifyrc/tsx/original/test.tsx +++ b/examples/simple-jsbeautifyrc/tsx/original/test.tsx @@ -1,12 +1,12 @@ class Test extends React.Component { - render() { +render() { return (
-

+

{this.foo.bar}

- {this.foo.bar.children} -
- ); - } +{this.foo.bar.children} +
+ ); +} } \ No newline at end of file diff --git a/src/beautifiers/typescript-formatter.coffee b/src/beautifiers/typescript-formatter.coffee index a5081ea..7ca7fd7 100644 --- a/src/beautifiers/typescript-formatter.coffee +++ b/src/beautifiers/typescript-formatter.coffee @@ -26,8 +26,13 @@ module.exports = class TypeScriptFormatter extends Beautifier opts.indentSize = options.indent_size opts.indentStyle = 'space' + if language is "TSX" + fileName = 'test.tsx' + else + fileName = '' + @verbose('typescript', text, opts) - result = format('', text, opts) + result = format(fileName, text, opts) @verbose(result) resolve result catch e From ea3361812433ddbbb2b35fa15e46f2c3b19c0e46 Mon Sep 17 00:00:00 2001 From: Steven Zeck Date: Tue, 6 Feb 2018 13:54:44 -0600 Subject: [PATCH 17/24] Fix expected output for TSX --- examples/simple-jsbeautifyrc/tsx/expected/test.tsx | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/examples/simple-jsbeautifyrc/tsx/expected/test.tsx b/examples/simple-jsbeautifyrc/tsx/expected/test.tsx index ced5af2..2619759 100644 --- a/examples/simple-jsbeautifyrc/tsx/expected/test.tsx +++ b/examples/simple-jsbeautifyrc/tsx/expected/test.tsx @@ -1,12 +1,12 @@ class Test extends React.Component { render() { return ( -
-

- { this.foo.bar } - < /h2> - { this.foo.bar.children } -

+
+

+ {this.foo.bar} +

+ {this.foo.bar.children} +
); } -} +} \ No newline at end of file From 3633b392d5add6971f3f941257bde5131413a97f Mon Sep 17 00:00:00 2001 From: Steven Zeck Date: Thu, 8 Feb 2018 16:58:02 -0600 Subject: [PATCH 18/24] Output path to debug Travis build issue --- build-package.sh | 2 ++ 1 file changed, 2 insertions(+) diff --git a/build-package.sh b/build-package.sh index eaade9a..0bd8feb 100644 --- a/build-package.sh +++ b/build-package.sh @@ -9,6 +9,8 @@ echo "Using Atom version:" "$ATOM_SCRIPT_NAME" -v echo "Using APM version:" "$APM_SCRIPT_NAME" -v +echo "Path:" +echo $PATH echo "Downloading package dependencies..." "$APM_SCRIPT_NAME" clean From 00aad9cd3ab658df5d3651a4d3d8335b33930efe Mon Sep 17 00:00:00 2001 From: Steven Zeck Date: Mon, 19 Feb 2018 11:23:43 -0600 Subject: [PATCH 19/24] Add react Atom package for proper JSX support --- atom-packages.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/atom-packages.txt b/atom-packages.txt index aa032ad..e7b6b1e 100644 --- a/atom-packages.txt +++ b/atom-packages.txt @@ -7,3 +7,4 @@ language-lua language-elm language-puppet fuse +react From 9b3d4adb1516d01cbc15e699aff9fd1921c5004d Mon Sep 17 00:00:00 2001 From: Steven Zeck Date: Mon, 19 Feb 2018 11:38:09 -0600 Subject: [PATCH 20/24] Add --yes for opam init step --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 07c27c2..dd8450a 100644 --- a/.travis.yml +++ b/.travis.yml @@ -82,7 +82,7 @@ before_install: # CoffeeScript - npm install coffee-formatter # OCaml - - opam init --auto-setup + - opam init --yes --auto-setup # Init environment variables for opam - if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then eval `opam config env`; From 76028d64d8488bbd00d8d7ed6429011772e481c9 Mon Sep 17 00:00:00 2001 From: Steven Zeck Date: Mon, 19 Feb 2018 11:54:05 -0600 Subject: [PATCH 21/24] Revert --yes addition to opam init --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index dd8450a..07c27c2 100644 --- a/.travis.yml +++ b/.travis.yml @@ -82,7 +82,7 @@ before_install: # CoffeeScript - npm install coffee-formatter # OCaml - - opam init --yes --auto-setup + - opam init --auto-setup # Init environment variables for opam - if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then eval `opam config env`; From 569f76271fd0b74d4b89bbd1ab14cec1346a46c3 Mon Sep 17 00:00:00 2001 From: Steven Zeck Date: Mon, 19 Feb 2018 12:13:23 -0600 Subject: [PATCH 22/24] Skip Ocaml test, comment out opam and ocp-indent installations for CI --- .travis.yml | 10 +++++----- .../ocaml/original/{js-pattern.ml => _js-pattern.ml} | 0 2 files changed, 5 insertions(+), 5 deletions(-) rename examples/nested-jsbeautifyrc/ocaml/original/{js-pattern.ml => _js-pattern.ml} (100%) diff --git a/.travis.yml b/.travis.yml index 07c27c2..14bd112 100644 --- a/.travis.yml +++ b/.travis.yml @@ -82,9 +82,9 @@ before_install: # CoffeeScript - npm install coffee-formatter # OCaml - - opam init --auto-setup + # - opam init --auto-setup # Init environment variables for opam - - if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then - eval `opam config env`; - fi - - opam install --yes ocp-indent + # - if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then + # eval `opam config env`; + # fi + # - opam install --yes ocp-indent diff --git a/examples/nested-jsbeautifyrc/ocaml/original/js-pattern.ml b/examples/nested-jsbeautifyrc/ocaml/original/_js-pattern.ml similarity index 100% rename from examples/nested-jsbeautifyrc/ocaml/original/js-pattern.ml rename to examples/nested-jsbeautifyrc/ocaml/original/_js-pattern.ml From 6a58d30f07a9350872b814b22e1cdbdad3565720 Mon Sep 17 00:00:00 2001 From: Steven Zeck Date: Mon, 19 Feb 2018 13:03:22 -0600 Subject: [PATCH 23/24] Add React package to test file --- spec/beautify-languages-spec.coffee | 1 + 1 file changed, 1 insertion(+) diff --git a/spec/beautify-languages-spec.coffee b/spec/beautify-languages-spec.coffee index 87204cc..4310acd 100644 --- a/spec/beautify-languages-spec.coffee +++ b/spec/beautify-languages-spec.coffee @@ -54,6 +54,7 @@ describe "BeautifyLanguages", -> dependentPackages = [ 'autocomplete-plus' 'fuse' + 'react' # 'linter' # 'atom-typescript' # it logs too much... ] From 6bc1afce29baa823d1800cefa5e562e661c74b0f Mon Sep 17 00:00:00 2001 From: Steven Zeck Date: Tue, 20 Feb 2018 10:20:42 -0600 Subject: [PATCH 24/24] Remove debug info from build-options --- build-package.sh | 2 -- 1 file changed, 2 deletions(-) diff --git a/build-package.sh b/build-package.sh index 0bd8feb..eaade9a 100644 --- a/build-package.sh +++ b/build-package.sh @@ -9,8 +9,6 @@ echo "Using Atom version:" "$ATOM_SCRIPT_NAME" -v echo "Using APM version:" "$APM_SCRIPT_NAME" -v -echo "Path:" -echo $PATH echo "Downloading package dependencies..." "$APM_SCRIPT_NAME" clean