Page MenuHomePhabricator

Prettier is a pain when it comes to console error output
Closed, ResolvedPublic

Description

Different members of the Vue.js Migration team have lost several hours altogether on different patches when tracking down errors with Prettier in "linter:etc": "prettier ." given it doesn't provide any further output then the flawed filename.

For developer's sake, sanity and satisfaction we need to either find a way for better error output or a replacement.

Event Timeline

Given the current configuration of Prettier:

{
	"printWidth": 100,
	"tabWidth": 4,
	"useTabs": true,
	"proseWrap": "always",
	"overrides": [{ "files": ".pipeline/*.yaml", "options": { "tabWidth": 2 } }]
}

I wonder if the added value is worth the extra dependency.

But let's assume that we keep it and configure it correctly and would benefit from pre-commit hooks etc.:

Prettier option --check does not provide much more output:

[warn] readme.md
[warn] Code style issues found in the above file(s). Forgot to run Prettier?

It's a package not meant for linting, but for styled formatting and the path forward seems to be prettier --write . for our use case for a pre-commit hook.

Change 679992 had a related patch set uploaded (by VolkerE; author: VolkerE):

[wvui@master] [build] Make Prettier prettier and add `format:etc` script for staged files

https://gerrit.wikimedia.org/r/679992

Change 679992 merged by jenkins-bot:

[wvui@master] [build] Make Prettier prettier and add `format:etc` script for staged files

https://gerrit.wikimedia.org/r/679992

Change 682196 had a related patch set uploaded (by VolkerE; author: VolkerE):

[mediawiki/core@master] Update WVUI to v0.1.1

https://gerrit.wikimedia.org/r/682196

Change 682196 merged by jenkins-bot:

[mediawiki/core@master] Update WVUI to v0.1.1

https://gerrit.wikimedia.org/r/682196

Note in current config in @Catrope's words “[this] recent addition of Husky to WVUI breaks the git hook that adds the Change-Id to your commit messages automatically. I messed around a bit and eventually figured out that I could fix it with cp .git/hooks/commit-msg .husky/”

Volker_E claimed this task.
Volker_E moved this task from Doing to Done on the WVUI board.

Putting this on resolved. Another patch fixed the Husky issue and for now we gonna stay with Prettier with above patches merged and improved automatted formatting.