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.

Prettier pre-commit hook

See original GitHub issue

Now that we’re using prettier to keep our formatting consistent, is there interest in a pre-commit hook to ensure all commits are Prettified? I’ve had great success with this in my day job, but I’m not sure how common this is on large open-source projects.

If this is something we want, which direction would we want to go in? There are a few options on the Prettier docs. I’ve always used the lint-staged with husky solution, but I’d like to hear thoughts on this.

I’m happy to pick this up myself if we want it implemented.

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:7 (7 by maintainers)

github_iconTop GitHub Comments

1reaction
mxstbrcommented, Dec 19, 2017

Yes yes yes yes! Let’s go lint-staged with husky.

0reactions
kittencommented, Dec 20, 2017

@lukebelliveau

I’m also having some issues between prettier and the flow-typed definitions:

I do not think we should run either prettier or eslint on the flow-typed/ folder

will check for conformance to prettier rules, eslint --fix will not do formatting nearly as well as running yarn prettier on the code - so it’s a bit different than actually running prettier.

I’ve left comments on your PR; actually the opposite will lead to problems. The plugin runs prettier after all other rules and the configs disable conflicting rules. so it actually works better together using the config + plugin

Read more comments on GitHub >

github_iconTop Results From Across the Web

Pre-commit Hook - Prettier
Pre-commit Hook ... You can use Prettier with a pre-commit tool. This can re-format your files that are marked as “staged” via git...
Read more >
Setting up Prettier and ESLint with pre-commit hook · GitHub
Setting up Prettier and ESLint with pre-commit hook · Initialize Git repository. git init · Create .gitignore file and add the following: ·...
Read more >
Using Prettier with Git Hooks for Formatting Consistency
By setting up a pre-commit Git Hook, we can run the Prettier command and ensure formatting consistency for all the developers working on...
Read more >
Configure Pre-commit Hook Prettier in your React Application ...
Prettier is a code formatted compatible with languages such as JavaScript, HTML, CSS, YAML, Markdown and GraphQL, and a lot more. It's also ......
Read more >
Pre-Commit hooks! (eg prettier) - Ahmedtoyib
A Pre-commit hook is run just before a commit is added to a new revision. They are mainly used to point out issues...
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