A while ago I figured out how to format and prettify all JavaScript files in a project.

The guide worked for me at the time of writing.
Unfortunately, the current versions of babel-eslint and prettier-eslint-cli are both broken.

  1. Relative paths are broken with prettier-eslint-cli and eslint 6.7.0

prettier-eslint [ERROR]: There was trouble creating the ESLint CLIEngine.

There is a workaround for Linux and MacOS: inject $(pwd) before the file path. For example,

"format": "prettier-eslint \"$(pwd)/**/*.js\""
  1. Cannot find module babel-eslint

This is still an open issue on GitHub. Suggested fix: downgrade eslint to v4.x:

npm -g i eslint@4

That didn't work for me, though.

Further Reading