rushstack icon indicating copy to clipboard operation
rushstack copied to clipboard

Add @rushstack/prettier-git

Open dmichon-msft opened this issue 2 years ago • 3 comments
trafficstars

Summary

Implements a wrapper around prettier that formats either staged files, or files changed since a specified Git revision. Can also be run in CI mode with --check to error if any files modified since a specified Git revision do not match the formatting produced by prettier, in which case the diff will be rendered for each impacted file.

Details

This PR is parked here as a reference, I don't currently have plans to finish the cleanup work and get it checked in any time soon.

How it was tested

Impacted documentation

dmichon-msft avatar Dec 13 '22 01:12 dmichon-msft

CC @elliot-nelson

octogonz avatar Dec 13 '22 02:12 octogonz

It looks like this was already in motion -- just curious, what's the main difference between this tool and pretty-quick that motivated creating the new wrapper? (I guess question for @dmichon-msft )

elliot-nelson avatar Dec 13 '22 12:12 elliot-nelson

I wrote the code here a couple years ago now. The main motivations:

  1. Support for partially staged files. If you have a file with both staged and unstaged changes, rather than erroring out like pretty-quick does, it will format the staged version and write the result directly to the index, so that you can keep your unstaged changes unstaged.
  2. More customizability with respect to which files to operate on, namely the ability to format all files modified since some arbitrary Git revision

dmichon-msft avatar Dec 13 '22 19:12 dmichon-msft