Control files to prettier from config file instead
Categories
(developer.mozilla.org Graveyard :: Code Cleanup, enhancement, P3)
Tracking
(Not tracked)
People
(Reporter: peterbe, Unassigned)
Details
(Keywords: in-triage, Whiteboard: [points=1])
Attachments
(2 files)
At the moment, when you npm install
you get node_modules/.bin/prettier
but if you attempt to use it, it will do it differently from how we dictate it in package.json
(which is also how it's done in CI).
Instead of "driving" which files to prettier from the scripts section in package.json
we should use .prettierignore
(or is it in .prettierrc
??) so you can do things like prettier --check
or prettier --fix
or prettier --list-different
from the root.
The big advantage with that is that your IDE (e.g. vscode) can respect that. Today, if I open kuma/static/js/auth.js
in vscode and hit Cmd-S it will format the file automatically. Sure, I can disable run-prettier-on-save but that means I need to remember to use the command line when I'm working on files in kuma/javascript/src/**
.
Ideally, I should be able to just run Cmd-S and if it should be formatted it gets formatted. If not, vscode should leave it alone.
Comment 1•6 years ago
|
||
This sounds like a great idea to me. The fact that we don't have it set up that way makes me worry that it wasn't obvious how to do it with .prettierrc. Maybe you can make it work with .prettierignore, though.
Updated•6 years ago
|
Comment 2•6 years ago
|
||
Comment 3•6 years ago
|
||
Reporter | ||
Updated•5 years ago
|
Updated•5 years ago
|
Description
•