Enforce Prettier Format; Format All #181
Open
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
When pulling in a few patches (first, second), I was encountering merge conflicts because both do significant auto-formatting. This patch makes a few changes:
import {Thing} from package
, which having the pre-commit hooks installed would fix)yarn lint:prettier
target and running itconcurrently
withyarn lint:all
prettier --ignore-path .gitignore --write .
lint-staged
configTogether, this should make sure future patches are much smaller.
I chose to use
--ignore-path
to set the.gitignore
as the.prettierignore
. This is a tradeoff. Editors are not aware of this option, as it is set in thepackage.json
scripts and not in the prettier config (prettier/prettier#8192). Since Prettier 3 is not released, stable Prettier can't have multiple ignore paths (prettier/prettier#14332). Since there is no.prettierignore
in this project, I figured having just the one set to.gitignore
should be fine.(The alternative, which we do, is duplicating all of
.gitignore
in.prettierignore
, and then having additional things that we want checked into git but not linted also specified in.prettierignore
. This is very annoying to me, and I hope prettier/prettier#8192 is done so we can have.gitignore
and a non-duplicated.prettierignore
set as ignore files in config and auto-picked up by editors and CLIprettier
.)The only significant changes made are in
README.md
andpackage.json
-- everything else is formatting, and isolated to a formatting commit.