Consider including a code formatter?
See original GitHub issueI have not much experience with this in javascript. I know from languages like dart and go, that they ship a dartfmt
and gofmt
command, and I really find that super helpful.
Basically, it is a very opinionated automatic formatter for your code. So before I send a PR in any kind of Dart project, I always run that, so there are never any arguments about whitespace or whatever, because this is just the standard 95% of the people use.
So this is not about semicolons or whatever, but about whitespace. For example:
- using tabs or spaces
- how much spaces (tabs)
- how much is the max line length (80, 120, whatever)
- space after
if
or not, line-break after{}
, etc
I was wondering, if react-scripts could also ship a formatter. I have not much experience here. I normally just use webstorms formatter. But I’m sure similar tools as gofmt
exists in the ecosystem. I found this tool after searching on npm:
https://www.npmjs.com/package/esformatter
This is not something that create-react-app has to provide of course, but I like how opinionated create-react-app is, this could be something create-react-app could be opinionated about (and one less choice I have to make 😃 ).
Issue Analytics
- State:
- Created 7 years ago
- Reactions:4
- Comments:15 (11 by maintainers)
Top GitHub Comments
https://github.com/jlongster/prettier looks promising.
We’ve documented how to do it: https://github.com/facebookincubator/create-react-app/blob/master/packages/react-scripts/template/README.md#formatting-code-automatically
We might wait for more adoption and at some point add it by default.