Skip to content

DSM-168: Prettier setup, CI step and frontend format#72

Merged
wtomaszewska merged 4 commits into
s3-browserfrom
feature/DSM-168-prettier-setup
Jun 3, 2026
Merged

DSM-168: Prettier setup, CI step and frontend format#72
wtomaszewska merged 4 commits into
s3-browserfrom
feature/DSM-168-prettier-setup

Conversation

@wtomaszewska

Copy link
Copy Markdown

Ticket DSM-168

Overview

This PR adds the Prettier code formatter to the repository, includes it in a CI task, and formats the entire frontend app (app/s3browser and app/javascript/entrypoints directories).

Prettier config

Prettier configuration is as follows:

{
  "trailingComma": "all", // default; adds a trailing comma to multi-line arrays, function parameters and calls
  "tabWidth": 2, // default
  "useTabs": false, // default
  "semi": true, // default; adds a semicolon at the end of every statement.
  "singleQuote": true, // use single quotes, jsx/tsx keeps double quotes to maintain HTML-like formatting 
  "printWidth": 100 // explained below
}

Some of these are Prettier defaults, but they were kept explicit for clarity, as we're testing the use of Prettier in our apps.

Print Width

Print width is probably the most discussed setting. Prettier docs recommend a width of 80; however, the team wanted to increase the width to prevent breaking up smaller pieces of code. Since printWidth is treated by Prettier as a rough length of the line, not max length, a limit too high causes Prettier to merge lines that would more naturally be broken up.

CI check

A Prettier check was added to an existing CI rake task. This is a check-only step (similar to how we use Rubocop in CI) and does not perform any actual formatting. Ideally, every developer should configure their code editor to format on save. We can also explore pre-commit hooks, though they can discourage frequent commits, which is worth avoiding.

Local Prettier settings

The following VSCode settings configure Prettier as the default formatter for .ts, .tsx, and .js files.

"[typescriptreact]": {
  "editor.defaultFormatter": "esbenp.prettier-vscode",
},
"[typescript]": {
  "editor.defaultFormatter": "esbenp.prettier-vscode",
},
"[javascript]": {
  "editor.defaultFormatter": "esbenp.prettier-vscode",
},
"editor.formatOnSave": true,

@wtomaszewska wtomaszewska requested a review from goldsmithb June 2, 2026 19:43

@goldsmithb goldsmithb left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks pretty! ✨ ✨

@wtomaszewska wtomaszewska merged commit 272ce9f into s3-browser Jun 3, 2026
1 check passed
@wtomaszewska wtomaszewska deleted the feature/DSM-168-prettier-setup branch June 3, 2026 14:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants