Skip to content

Housekeeping: Format all tracked JS, TS and Markdown files with prettier - #5165

Merged
lmac-1 merged 1 commit into
mainfrom
format-with-prettier
Sep 14, 2026
Merged

lmac-1 merged 1 commit into
mainfrom
format-with-prettier

Conversation

@lmac-1

@lmac-1 lmac-1 commented Sep 10, 2026

Copy link
Copy Markdown
Contributor

Description

I noticed unexpected formatting changes in a recent PR: ChatInput.tsx and types/ai-assistant.ts were reformatted with no logic change. I couldn't drop them, because prettier runs when I commit and puts them straight back.

I asked Claude to run prettier across every tracked file it covers, so hopefully this can unite things in future PRs:

git ls-files -z | grep -zE '\.(js|ts|tsx|jsx|md)$' \
  | xargs -0 npx --prefix assets prettier --config .prettierrc \
    --ignore-path .prettierignore --write

That's the same prettier invocation as the pre-commit hook in config/dev.exs:176-180, over every tracked file rather than just the staged ones.

Validation steps

n/a: Formatting only, no behaviour change: line wrapping, union-type indentation, and trailing whitespace in a benchmarking sample.

Additional notes for the reviewer

I don't know how this drifted, and I'd rather we agree the process than guess.

  1. What is our prettier process? Nothing is written down: no mention of it in CLAUDE.md or CONTRIBUTING.md.
  2. What should run on commit, and is it running for everyone? The hook installs itself as a side effect of compiling in dev, so it's easy not to have.
  3. Should CI check formatting instead of, or as well as, the hook?
  4. Which file types should it cover? Today it's .js .ts .tsx .jsx .md. Adding json/css/yml would touch 21 more files, and some of those shouldn't be reformatted (test/fixtures/*.json, the generated priv/static/manifest.json, and priv/static/workflow-api.yaml, which prettier can't parse).

AI Usage

Please disclose whether you've used AI anywhere in this PR (it's cool, we just
want to know!):

  • I have used Claude Code
  • I have used another model
  • I have not used AI

You can read more details in our
Responsible AI Policy

Pre-submission checklist

  • I have performed an AI review of my code (we recommend using /review
    with Claude Code)
  • I have implemented and tested all related authorization policies.
    (e.g., :owner, :admin, :editor, :viewer)
  • I have updated the changelog.
  • I have ticked a box in "AI usage" in this PR

Prettier only runs over staged files at commit time, so files it had not
seen stayed unformatted. Formatting only, no behaviour change.
@github-project-automation github-project-automation Bot moved this to New Issues in Core Sep 10, 2026
@github-actions

Copy link
Copy Markdown

Security Review ✅

  • S0 (project scoping): N/A — PR is prettier-only whitespace/formatting across PROVISIONING.md, WORKERS.md, tooling/benchmarking/README.md, priv/runtime/logger.js, and tooling/benchmarking/sample_cold_chain_monitoring_script.js; no query or web-layer changes.
  • S1 (authorization): N/A — no controller, LiveView, or policy code touched.
  • S2 (audit trail): N/A — no writes to config resources; no Ecto.Multi or persistence changes.

@lmac-1
lmac-1 requested review from elias-ba and stuartc September 10, 2026 16:32
@lmac-1
lmac-1 force-pushed the format-with-prettier branch from 9984b8b to 5841ceb Compare September 10, 2026 16:33
@lmac-1
lmac-1 requested a review from midigofrank September 10, 2026 16:41
@codecov

codecov Bot commented Sep 10, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 90.9%. Comparing base (4ac9eac) to head (5841ceb).

Additional details and impacted files
@@           Coverage Diff           @@
##            main   #5165     +/-   ##
=======================================
- Coverage   90.9%   90.9%   -0.0%     
=======================================
  Files        425     425             
  Lines      21153   21153             
=======================================
- Hits       19228   19222      -6     
- Misses      1925    1931      +6     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@lmac-1

lmac-1 commented Sep 10, 2026

Copy link
Copy Markdown
Contributor Author

My proposal (from Slack):

  1. CI should check prettier. As I understand, the only thing running prettier is a git hook on each person's machine (which can be overridden or not installed)
  2. Keep the hook anyway (we shouldn't depend on it but it's useful)
  3. Write the command down once somewhere. It's buried in config/dev.exs and nowhere else. CI and the hook should refer to one place.
  4. Not sure if we should extend the file types. At the moment its .js, .ts , .tsx , .jsx and .md (which feels right?)

Question: can we also get the CI to run prettier automatically if it's not been run? Or is this expensive

@elias-ba elias-ba left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Rafet na

PS: this means it's beautiful / beautiful in Wolof

@lmac-1
lmac-1 merged commit bdede55 into main Sep 14, 2026
7 checks passed
@lmac-1
lmac-1 deleted the format-with-prettier branch September 14, 2026 17:38
@github-project-automation github-project-automation Bot moved this from New Issues to Done in Core Sep 14, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

3 participants