Fix typescript-formatter issues for TSX

This commit is contained in:
Steven Zeck 2018-02-06 13:52:25 -06:00
parent 25a9ee8699
commit 6c38d3df3f
2 changed files with 12 additions and 7 deletions

View File

@ -1,12 +1,12 @@
class Test extends React.Component<Foo> {
render() {
render() {
return (
<div className="class">
<h2 className="anotherClass">
<h2 className= "anotherClass">
{this.foo.bar}
</h2>
{this.foo.bar.children}
{this.foo.bar.children}
</div>
);
}
}
}

View File

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