prettier-react-tachyons icon indicating copy to clipboard operation
prettier-react-tachyons copied to clipboard

Support typescript files

Open marcofugaro opened this issue 6 years ago • 2 comments

Related to #10.

This now works both on typescript and javascript files.

Had to use estree-to-babel because the typescript parser returns an estree, which babel doesn't like.

I also upgraded both prettier and babel-traverse, as a consequence node.value.extra.raw became node.value.raw.

marcofugaro avatar Feb 22 '19 10:02 marcofugaro

This switches from the babylon parser to the typescript parser - while they both parse a specific subset of JavaScript, they don't accept the same inputs. I think this'll need to start exporting a languages array and having a different codepath for typescript vs javascript - assuming that it's possible to override default prettier parsers with plugins.

tmcw avatar Feb 22 '19 16:02 tmcw

So you're thinking of converting this to a prettier-plugin- following that guide?

If I understood correctly the users will be able to do

yarn add --dev prettier-plugin-react-tachyons

instead of

{
  "parser": "./node_modules/@observablehq/prettier-react-tachyons"
}

Will this work also in editors?

marcofugaro avatar Mar 07 '19 10:03 marcofugaro