Use Prettier to format JavaScript code
Categories
(Webtools Graveyard :: Pontoon, enhancement, P2)
Tracking
(Not tracked)
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.
Comment 1•5 years ago
|
||
I like break before else. I like consistent code style much more than that. :)
Updated•5 years ago
|
Comment 2•5 years ago
|
||
Updated•5 years ago
|
Updated•4 years ago
|
Description
•