Description
Summary
Tests throughout WPT are inconsistently formatted, which makes reading and editing them somewhat tedious.
Details
It would be nice to add a .prettierrc file, to support tidying HTML, CSS, and JS files directly through code editors.
It would be nice to place some variation of following into the root of WPT.
{
"endOfLine": "lf",
"printWidth": 80,
"tabWidth": 2,
"trailingComma": "es5"
}
However, the proposal is NOT to reformat all the files. Just to have the prettier file there for folks that want to use it when writing new tests (or want to update badly formatted tests).
This is also nice for when WPT gets ingested in downstream projects, which have their own coding conventions. It means that tests written downstream can still be formatted with Prettier.
Risks
Some files shouldn't be linted (e.g., ref test).
Re-Formatting files changes usually changes them entirely, which affects the commit history. This can be a little annoying, because then folks need to look back over the commit history to see what/when things were changed (and who to blame).
Not everyone has prettier (and it's yet another dependency). However, projects like Gecko do use it so there is some precedent.