Skip to content

feat(kiro): Create Prettier format on save hook#6872

Open
mfranzke wants to merge 2 commits into
mainfrom
feat-kiro-Create-Prettier-format-on-save-hook
Open

feat(kiro): Create Prettier format on save hook#6872
mfranzke wants to merge 2 commits into
mainfrom
feat-kiro-Create-Prettier-format-on-save-hook

Conversation

@mfranzke
Copy link
Copy Markdown
Collaborator

@mfranzke mfranzke commented Jun 2, 2026

Proposed changes

Adds a Prettier hook to format code on save.

Checklist

Code Quality

  • I have reviewed my own code (self-review)
  • I have reviewed my changes locally with an AI assistant (e.g. GitHub Copilot, Kiro, etc.)
  • No hardcoded values, magic numbers, or debug code left in

Validation

  • I have added/updated tests that cover my changes
  • I have tested across all relevant frameworks (React, Angular, Vue) if applicable

General

  • The PR title follows the conventional commits format (e.g. feat:, fix:, chore:)
  • If architecture, structure, or conventions changed inside a packages/* folder, the corresponding AGENTS.md has been updated

🔭🐙🐈 Test this branch here: https://design-system.deutschebahn.com/core-web/review/feat-kiro-Create-Prettier-format-on-save-hook

Adds a Prettier hook to format code on save.
@mfranzke mfranzke requested a review from Copilot June 2, 2026 13:00
@mfranzke mfranzke self-assigned this Jun 2, 2026
@mfranzke mfranzke added the 🍄🆙improvement New feature or request label Jun 2, 2026
@github-project-automation github-project-automation Bot moved this to 🏗 In progress in UX Engineering Team Backlog Jun 2, 2026
@changeset-bot
Copy link
Copy Markdown

changeset-bot Bot commented Jun 2, 2026

⚠️ No Changeset found

Latest commit: 068af69

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@mfranzke mfranzke moved this from 🏗 In progress to 🎁 Ready for review in UX Engineering Team Backlog Jun 2, 2026
@mfranzke mfranzke enabled auto-merge (squash) June 2, 2026 13:00
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Adds a Kiro hook intended to automatically run Prettier on files when they are saved, helping keep formatting consistent during development.

Changes:

  • Introduces a .kiro hook configuration to trigger prettier --write on file save.

Comment thread .kiro/hooks/prettier-format.kiro.hook
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
@nmerget
Copy link
Copy Markdown
Collaborator

nmerget commented Jun 2, 2026

Against hooks in the repo:

Tested it — extremely annoying in practice. fileEdit triggers on every single change, so in a batch of 10 edits, Kiro waits for the hook command 10 times.
The hooks are too "dumb" to be useful in a real workflow.
Redundant: Husky + Prettier + CI/CD already cover this. Kiro runs Prettier on commit anyway.
If the AI detects code style issues, it can fix them once at the end — no need for a hook on every file change.
Suggestion: Hooks belong as a personal preference on your own machine (~/.kiro/hooks/), not in the repo. Having a .kiro folder in the repo is still valuable — just without hooks.

@mfranzke
Copy link
Copy Markdown
Collaborator Author

mfranzke commented Jun 2, 2026

Against hooks in the repo:

Tested it — extremely annoying in practice. fileEdit triggers on every single change, so in a batch of 10 edits, Kiro waits for the hook command 10 times. The hooks are too "dumb" to be useful in a real workflow. Redundant: Husky + Prettier + CI/CD already cover this. Kiro runs Prettier on commit anyway. If the AI detects code style issues, it can fix them once at the end — no need for a hook on every file change. Suggestion: Hooks belong as a personal preference on your own machine (~/.kiro/hooks/), not in the repo. Having a .kiro folder in the repo is still valuable — just without hooks.

what's the cost of running prettier --write CHANGED_FILE, if this command takes around a small amount of milliseconds?
Plus that this isn't actually not a replacement/not redundant to any other hook like the Git hooks by husky, it's actually a hook to prettify a file changed by Kiro exactly in that moment, so that Kiro doesn't have to do this itself, and you could easily commit on the changes after a review in a perfectly prettified file previous to the checkin without any further prettifying needed.
And we could move that simple file operation based on that hook, which that mechanism is meant for, instead of adding this operation to an instruction/rule/whatever (no need to add it to context, as it's a simple file operation based on a trigger).

But I'll try it out first of all.

@mfranzke mfranzke moved this from 🎁 Ready for review to 🎶 Waiting for feedback in UX Engineering Team Backlog Jun 2, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

🍄🆙improvement New feature or request

Projects

Status: 🎶 Waiting for feedback

Development

Successfully merging this pull request may close these issues.

3 participants