Greetings all,
An update on auto-formatting our JS code with Prettier. It took some
weekend work by several of us (myself, with Magnus, Geoff, and Jorg
reviewing code, and Jorg landing the patches), but we got it done in
time for the next TB beta release as planned. Thanks to everyone for
helping make it happen!
I'll soon be updating our documentation with more details, and will post
an update when that is done.
In the meantime the main thing to know is that Prettier works with the
existing eslint setup, so to format a file using Prettier you use the
same command that you use for eslint. Namely, from the comm/ directory run:
../mach eslint path/to/a/file.js --fix
(Note that mach eslint
is a shortcut alias for mach lint -l eslint
.
You can also just use mach lint
.)
(You need to run this command from the comm/ directory because if you
run it from the parent mozilla-central/ directory then it will use the
mozilla-central config files for Prettier rather than those from comm/.)
You can also install a plugin to format files with Prettier in your text
editor (highly recommended).
If you have older in-progress patches they will need to be rebased on
trunk (moving from pre-Prettier to post-Prettier formatting) and this
will unfortunately take some special handling. I've written up some
notes about a way to do this if you are using hg "bookmarks" workflow
(what I use):
https://wiki.mozilla.org/Thunderbird/Rebasing_Patches_and_Prettier_Formatting
I assume something comparable will work for Mercurial Queues. Feel free
to add more to that wiki page.
More docs to come soon, thanks,
-Paul
P.S. For those wondering, Thunderbird is continuing to use 80 characters
per line and Calendar is continuing to use 100. That was the outcome of
discussions from last week.
P.P.S. The meta bug for this work:
https://bugzilla.mozilla.org/show_bug.cgi?id=1572047
--
Paul Morris
Thunderbird.net
On 03/09/2019 18:13, Paul Morris wrote:
An update on auto-formatting our JS code with Prettier. It took some
weekend work by several of us (myself, with Magnus, Geoff, and Jorg
reviewing code, and Jorg landing the patches), but we got it done in
time for the next TB beta release as planned. Thanks to everyone for
helping make it happen!
What's the plan for comm-esr68? I'm already suffering merge conflicts :/
On 9/3/19 12:22 PM, Jörg Knobloch wrote:
What's the plan for comm-esr68? I'm already suffering merge conflicts :/
It's on my plate to port the changes. The original plan was to do it at
the end of this week (following what was done for Firefox), but maybe we
can go ahead and do it sooner if it's already causing a lot of trouble.
Let's discuss at the team meeting today.
-Paul
Just a quick update that the adoption of Prettier for auto-formatting JS
is all done.
Here is where it is now documented, along with eslint:
https://developer.thunderbird.net/contributing/fixing-a-bug/lint-and-format-code
-Paul
--
Paul Morris
Thunderbird.net
Great work Paul, and everyone else involved in this.
The addition of the documentation is super helpful
Cheers,
On 2019-10-31 10:30, Paul Morris wrote:
Just a quick update that the adoption of Prettier for auto-formatting
JS is all done.
Here is where it is now documented, along with eslint:
https://developer.thunderbird.net/contributing/fixing-a-bug/lint-and-format-code
-Paul
--
Alessandro Castellani
Lead UX Architect
Thunderbird