question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Consider including a code formatter?

See original GitHub issue

I 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:closed
  • Created 7 years ago
  • Reactions:4
  • Comments:15 (11 by maintainers)

github_iconTop GitHub Comments

18reactions
gaearoncommented, Feb 11, 2017
9reactions
gaearoncommented, Jul 7, 2017

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.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Prettier · Opinionated Code Formatter
What is Prettier? An opinionated code formatter; Supports many languages; Integrates with most editors; Has few options ...
Read more >
Code Formatting and Code Comments - A Beginner's Guide to ...
Code formatting and code comments are the main ways to make code easier to read, maintain and troubleshoot. Learn the basics of code...
Read more >
Code Formatting | The IntelliJ IDEA Blog
The format of code is something all developers have an opinion on! With IntelliJ IDEA, a team can define their standards and have...
Read more >
Formatting your code is a waste of time - use Prettier instead
Prettier helps format our code, and also should help take the argument away from how our code is formatted in the first place...
Read more >
Clean Code: Formatting (Source code structure) | Nerd For Tech
Why does code formatting matter? Code formatting is about communication, and communication is the first order of business for the competent ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found