web-platform-tests / web-platform-tests/rfcs

Add .prettierrc to WPT

Open
#129 3 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
No language data
Stars
110
Forks
90
PR merge metrics
No merged PRs in 30d

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.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

The requested file is a root-level .prettierrc; start by reviewing the proposed options and the risk noted for ref tests. Done means the configuration supports HTML, CSS, and JS authoring without reformatting existing files, with files that should not be linted accounted for.

Written by the indexing model from the issue text.

Assessment

Tech stack
css, html, javascript
Domain
testing-qa, tooling
Issue type
Feature
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.