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?
I've used typescript for several years, I think there's very few downsides to it but from my experience it does decrease contributions.
That's a good and interesting point. Think we should be very careful about doing anything that reduces contributor-friendliness
+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.
I'm definitely a +1 for typescript, I'd also be willing to help with a majority of the conversion.
I evaluated both TS and flow half a year ago, I went with flow for the following reasons:
Also 👍 for using prettier, wanted to try it for some time, didn’t get around to it yet.
@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.
+💯 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.
+1 to typescript
vscode + typescript makes frontend dev a breeze.
@dyu This is only for the compiler, this issue is not talking about adding typescript for components.
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).
@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.
@dyu That doesn't work, as components have to explicitly export an object right now.
Prettier now supports TypeScript, so we can port everything over and maybe add a prebuild hook that runs it automatically when files change.
we can close this now
@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...)
@mindplay-dk This is only for the compiler, this issue is not talking about adding typescript for components.
Most helpful comment
I've used typescript for several years, I think there's very few downsides to it but from my experience it does decrease contributions.