Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adopt Prettier/TypeScript? #508

Closed
Rich-Harris opened this issue Apr 19, 2017 · 16 comments
Closed

Adopt Prettier/TypeScript? #508

Rich-Harris opened this issue Apr 19, 2017 · 16 comments
Labels

Comments

@Rich-Harris
Copy link
Member

Now that Prettier has reached 1.0, they've fixed the one reason I could never use it — it has a --use-tabs option!

Many years ago I adopted a coding style that was loosely based on the jQuery style guide, and while I do think the jQuery style tends to be more readable (liberal use of whitespace, etc) it has fallen out of fashion somewhat. In the interests of eliminating code style from the list of things contributors have to worry about, how do people feel about adopting Prettier? (Not totally sure how to rig it up so that it's fully automated, but I'm sure we can figure it out.)

I've also been tinkering with TypeScript a bit recently. Still haven't drunk the Kool-Aid but I'm less sceptical than I was. Does anyone have any strong opinions about whether we should be using it?

@PaulBGD
Copy link
Member

PaulBGD commented Apr 19, 2017

I've used typescript for several years, I think there's very few downsides to it but from my experience it does decrease contributions.

@Rich-Harris
Copy link
Member Author

That's a good and interesting point. Think we should be very careful about doing anything that reduces contributor-friendliness

@EliSnow
Copy link

EliSnow commented Apr 19, 2017

+1 for Typescript. I've been using it for the last 8-9 months and I've been amazed at how it has made my code more maintainable. I have had cases where refactoring function signatures required cascading changes in dozens of places in my code base and I was certain things would be broken even after resolving all the compile errors. To my utter surprise everything worked. Had I tried to make similar changes in the equivalent Javascript, no doubt I would have broken things. There are definitely other benefits I could speak of but code maintenance has been my favorite productivity gain thus far.

I say this as someone who has been writing Javascript, and loves doing it, for 10+ years.

@PaulBGD
Copy link
Member

PaulBGD commented Apr 20, 2017

I'm definitely a +1 for typescript, I'd also be willing to help with a majority of the conversion.

@Swatinem
Copy link
Member

I evaluated both TS and flow half a year ago, I went with flow for the following reasons:

  • it integrates easier into an existing babel setup
  • i kind of liked the vim plugin better than that of TS
  • using jsx/react with TS is a real pain. But since this is not a react codebase, its fine :-)
  • just general hypedness :-D

Also 👍 for using prettier, wanted to try it for some time, didn’t get around to it yet.

@marvinhagemeister
Copy link
Contributor

@Swatinem You should re-evaluate TS. The team made amazing progress in the last months. Point 1) + 3) are not valid anymore with TS 2.2 💯

Nonetheless, whatever the team chooses, either Flow or TS gets my vote. Type checking is a huge step up in developer ux in my opinion.

@zigomir
Copy link

zigomir commented Apr 26, 2017

+💯 on typescript :) Every version after 2.0 is so much goodness. Regarding prettier & typescript together there is this work in progress.

But as of today you can't get prettier & typescript to work together so here we might want to create a separate prettier issue. If you decide for TS I think it's more beneficial to go that route first and use prettier when support for TS lands.

@dyu
Copy link

dyu commented May 2, 2017

+1 to typescript
vscode + typescript makes frontend dev a breeze.

@PaulBGD
Copy link
Member

PaulBGD commented May 2, 2017

@dyu This is only for the compiler, this issue is not talking about adding typescript for components.

@feep
Copy link

feep commented May 6, 2017

TypeScript 2.3 can typecheck js files with JSDoc annotations.

https://blogs.msdn.microsoft.com/typescript/2017/04/27/announcing-typescript-2-3/
https://github.com/Microsoft/TypeScript/wiki/Type-Checking-JavaScript-Files

That way you can keep it js for contributors, and still get type checking for annotated files.

Cast my vote for typescript (either js with --checkJs or straight typescript).

@dyu
Copy link

dyu commented May 6, 2017

@PaulBGD Well, that would be nice to have too :-) I believe configuring buble with a typscript loader/plugin would work:

// inside MyComponent.html
<script>
export * from './MyComponent.ts';
</script>

@feep it is a lot more typing compared to using typestring directly.

@PaulBGD
Copy link
Member

PaulBGD commented May 6, 2017

@dyu That doesn't work, as components have to explicitly export an object right now.

@Rich-Harris
Copy link
Member Author

Prettier now supports TypeScript, so we can port everything over and maybe add a prebuild hook that runs it automatically when files change.

@Rich-Harris
Copy link
Member Author

we can close this now

@mindplay-dk
Copy link

@Rich-Harris is Typescript support documented anywhere? all I could find was a third-party boilerplate on github, and it was completely outdated.

(sorta related: how is IDE-support these days? how good is that third-party VS Code plugin? I saw in a video what you're working on with Sapper, but I'm not looking to build a PWA at the moment, just looking to use Svelte without losing the goodness of Typescript IDE support...)

@PaulBGD
Copy link
Member

PaulBGD commented Jun 28, 2018

@mindplay-dk This is only for the compiler, this issue is not talking about adding typescript for components.

@ghost ghost mentioned this issue Nov 20, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

9 participants