Skip to content

Add prettier #56

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
pronebird opened this issue Jun 22, 2018 · 3 comments
Closed

Add prettier #56

pronebird opened this issue Jun 22, 2018 · 3 comments

Comments

@pronebird
Copy link
Collaborator

pronebird commented Jun 22, 2018

Prettier while being an opinionated code formatter, still plays the important role in code QA and saves developers from wasting time beautifying their code and arguing about code style.

So let's add it sometime soon, these are scripts we use at Mullvad:

"format": "prettier --write 'app/**/*.js' 'test/**/*.js'",
"check-format": "prettier --list-different 'app/**/*.js' 'test/**/*.js'",

npm run check-format is used in Travis script to verify that the code was formatted, it will simply fail tests if the code is not formatted which should normally prevent the code from being merged to master until fixed by developer.

@jschr
Copy link
Owner

jschr commented Jun 22, 2018

+1! I may also suggest adding the pre-commit hook: https://prettier.io/docs/en/precommit.html

@pronebird
Copy link
Collaborator Author

Not sure how that works when staging hunks vs. entire files. But why not?

@jschr
Copy link
Owner

jschr commented Jun 22, 2018

I believe that is a current limitation. It will format the entire file when staging a hunk: lint-staged/lint-staged#62

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants