{
+ 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 8898cdd..af5e4da 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",
@@ -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/packages.config b/packages.config
new file mode 100644
index 0000000..0c544bc
--- /dev/null
+++ b/packages.config
@@ -0,0 +1,9 @@
+
+
+
+
+
+
+
+
+
diff --git a/requirements.txt b/requirements.txt
new file mode 100644
index 0000000..e3d1477
--- /dev/null
+++ b/requirements.txt
@@ -0,0 +1,4 @@
+autopep8
+isort
+sqlparse
+beautysh
diff --git a/src/beautifiers/typescript-formatter.coffee b/src/beautifiers/typescript-formatter.coffee
index 1a0f204..a5081ea 100644
--- a/src/beautifiers/typescript-formatter.coffee
+++ b/src/beautifiers/typescript-formatter.coffee
@@ -6,13 +6,14 @@ module.exports = class TypeScriptFormatter extends Beautifier
link: "https://github.com/vvakame/typescript-formatter"
options: {
TypeScript: true
+ TSX: true
}
beautify: (text, language, options) ->
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)
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 d9b70d9..5e0eab7 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",