Skip to content

Try prettier formatting

Eric Eastwood requested to merge try-prettier into develop

Try prettier formatting



npm run prettier -- --check "**/*.js"

npm run prettier -- --write "**/*.js"

Issue to re-use some of the GitLab Prettier nice scripts, https://gitlab.com/gitlab-org/gitlab-ce/issues/57010

Editor setup

There is a small section about this in the GitLab docs https://docs.gitlab.com/ee/development/new_fe_guide/style/prettier.html

But the break-through for me in Atom (prettier-atom) was turning off Only format if prettier is found in your project's dependencies. This is because we have nested modules in the app modules/* which have their own package.json and when I was saving, it wouldn't format anything.

It does seem to work to have Only format if a Prettier config is found enabled and a .prettierrc in the root directory though.

Related to https://github.com/prettier/prettier-atom/issues/434

Here is a screenshot of my full prettier-atom config/settings,


My testing snippet,

	console.log("awefewa"+'awefawfe')
		1 + 31;
  let num = Math.floor (Math.random() * 1E+7).toString().replace(/\.\d+/ig, "")
Edited by 🤖 GitLab Bot 🤖

Merge request reports