Closed Bug 1562270 Opened 6 years ago Closed 5 years ago

Control files to prettier from config file instead

Categories

(developer.mozilla.org Graveyard :: Code Cleanup, enhancement, P3)

enhancement

Tracking

(Not tracked)

RESOLVED FIXED

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.

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.

Component: General → Code Cleanup
Keywords: in-triage
Priority: -- → P3
Whiteboard: [points=1]
Commit merged into master by Schalk Neethling (schalkneethling) Authored by Peter Bengtsson (peterbe)
Status: NEW → RESOLVED
Closed: 5 years ago
Resolution: --- → FIXED
Product: developer.mozilla.org → developer.mozilla.org Graveyard
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: