Skip to content

#3469449: Format Cypress test files with Prettier

Let's include files under tests/src/Cypress/ when we format the UI codebase with Prettier. Here are the changes I'm proposing to make this happen:

  1. Modify the path passed to Prettier in the format script.
  2. Move .prettierrc.json to the project root. While this is not needed to make our format script work, with this change IDEs that developers set up to reformat code on save can automatically pick up the Prettier config from the project root.
  3. Consolidate the two .prettierignore files into one. With our approach to ignore all files, then explicitly allow the ones we want to format (more on this below) it's easier to control the config from a single place.

The approach to ignore all files by default, then allow only the ones we want to format was introduced in !172 (merged). The usual way to only include file types would be to include that as an argument in the format script, e.g. in our case it could be prettier "../{ui,tests/src/Cypress}/**/*.{js,jsx,ts,tsx,}, then we would only need to ignore things, but I still think the solution by !172 (merged) is solid, because this way even code editors with a Prettier plugin configured won't touch any files we don't want to include. So I left the same logic in place while consolidating the .prettierignore files.

Merge request reports

Loading