Closed Bug 1615565 Opened 5 years ago Closed 5 years ago

Use Prettier to format JavaScript code

Categories

(Webtools Graveyard :: Pontoon, enhancement, P2)

enhancement

Tracking

(Not tracked)

RESOLVED FIXED

People

(Reporter: adrian, Assigned: abowler)

Details

Attachments

(1 file)

Same as we did for Python code with Black, we should automatically format JavaScript code in order to avoid endless conversations around code style, and to make the whole code base more readable and consistent.

Prettier is the standard tool to do that those days. Documentation: https://prettier.io/docs/en/index.html

Here's an example of running Prettier on the frontend folder: https://github.com/mozilla/pontoon/compare/master...adngdb:prettier?expand=1

Note that Prettier also covers CSS files, which is great. Note that Prettier puts else and catch blocks on the preceding closing bracket, which I hate. There's an issue about that, with a lot of traction, but it doesn't seem that there will be an option added anytime soon: https://github.com/prettier/prettier/issues/840

This bug covers gathering opinions from folks working on Pontoon regularly, then implementing the change is there is agreement.

I like break before else. I like consistent code style much more than that. :)

Priority: -- → P2
Assignee: nobody → abowler2
Status: NEW → RESOLVED
Closed: 5 years ago
Resolution: --- → FIXED
Product: Webtools → Webtools Graveyard
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: