Personally, I use TSLint with the tslint.autoFixOnSave VSCode setting, and couldn't be happier.
Prettier 1.0
11–20 of 78 posts
Re: Prettier 1.0
#12Re: Prettier 1.0
#13I can't overstate how freeing coding with prettier has been -- often I'd find myself quickly grokking something and once I finally got it to "work," make sure it was all styled properly. Since using prettier, these things are one-and-the-same, which is a tremendous gain.
If we were to implement prettier, and chose to use 2-space indents, for a simple example, how would a 4-space developer fare when they pulled down the Prettified code? Would they just set up their own config locally based on their own standards?
Re: Prettier 1.0
#14I believe there was an idea of adding it as a pre-commit hook, a second one as a manual step and another one as a post-commit amend.
Have we reached a consensus on that? Not up to date what they went with, what seems to be the best way to do this?
Re: Prettier 1.0
#15Prettier is a code formatter for JavaScript, like the hugely popular "gofmt". Highlights of the 1.0 announcement: - production-ready (and used, eg; React, Oculus, Cloudflare, etc) - --no-semi option - --use-tabs option - parens that help indicate precedence - many formatting improvements There are a ton of edge cases in this work that really matter (read through the announcement for a few). Speaking as a contributor,…
For example this: http://whitneyland.com/2017/04/first-in-the-world-to-display...
Re: Prettier 1.0
#16I'd like to hear how people are using it on teams. With some effort I got it working on save in emacs, but asking other people to please install more tooling is not always easy.
I do have some authority over package.json though. How would you make it just work for everyone (using atom, vim, etc...)
Re: Prettier 1.0
#17Edit: Oh here we go: https://github.com/prettier/prettier-atom
Re: Prettier 1.0
#18Prettier goes such a long way to enforcing standards on a language and ecosystem which otherwise has none or few. What standards do exist are frequently arbitrary, or enforced by legacy code at random companies. For example, the Airbnb JS style guide [1] recommends single quotes in JS, but double quotes for JSX properties. Why the difference? Why not stick with double quotes everywhere, as they are required in JSX bl…
The point about quotes comes up often. The important part for us is consistency at Airbnb. We use eslint to enforce and maintain the consistency. Would it be more consistent to treat strings the same everywhere? For some projects sure. We diverge from the community a bit in the sense that we treat JSX as not JS and we aim to be consistent about that. If your project treats JSX and JS the same then yes, we've certainly seen folks do this. As always, please do what works best for your team or project [1]. Forks encouraged.
I will say an added benefit of including a style guide in a project for large teams that may get lost jumping straight into prettier, has been helping our engineers become stronger javascript programmers in the process of learning our style guide. That's largely anecdotal evidence from my time at Airbnb and of course your mileage my vary.
Personally, I support the Prettier mission 100%. Easier consistency is huge. Removing barriers to contributing to open source projects is huge. PR reviews focused on what the code is doing vs painful style nits is huge. It's been great to see this come from the community and I look forward to seeing where the community takes it. Congrats to all of the contributors on the 1.0!
Re: Prettier 1.0
#19Prettier is a code formatter for JavaScript, like the hugely popular "gofmt". Highlights of the 1.0 announcement: - production-ready (and used, eg; React, Oculus, Cloudflare, etc) - --no-semi option - --use-tabs option - parens that help indicate precedence - many formatting improvements There are a ton of edge cases in this work that really matter (read through the announcement for a few). Speaking as a contributor,…
Can it handle escaped json string constants? For example this: http://whitneyland.com/2017/04/first-in-the-world-to-display...
Not sure exactly what you mean, but here's an example with JSON: https://prettier.github.io/prettier/#%7B%22content%22%3A%22x...
Prettier doesn't support JSON files per se (and doesn't currently plan to [0]), so you need to provide a leading `x = {...` or similar to ensure the { is parsed as an object instead of a block.
Re: Prettier 1.0
#20I really like it for personal stuff. I'd like to hear how people are using it on teams. With some effort I got it working on save in emacs, but asking other people to please install more tooling is not always easy. I do have some authority over package.json though. How would you make it just work for everyone (using atom, vim, etc...)
There are integrations for most editors (Atoms, Emacs, Vim, Neovim, VSCode, VS, Sublime Text, JetBrains):