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 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