Using Prettier to format your JavaScript code

What does Prettier do?

foo( 
reallyLongArg(),
omgSoManyParameters(),
IShouldRefactorThis(),
isThereSeriouslyAnotherOne()
);

But I already have ESLint!

What about Editorconfig?

How do I set it up?

  • Editor plugins
  • CLI
  • Pre-commit hooks

For editors

For projects

"scripts": { "precommit": "pretty-quick --staged" }
"scripts": {
"precommit": "lint-staged",
"lint-staged": {
"*.{ts,js,css,json}": [ "prettier --write", "git add" ]
}
}

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
saransh kataria

saransh kataria

For over and over, I have failed & in the process of losing it all, I realized that I might actually win.