Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore(prettier): add prettier for auto-spacing, husky to enforce #63

merged 1 commit into from Apr 11, 2021


Copy link

@mikehardy mikehardy commented Apr 5, 2021

Hi there!

You mentioned #62 was too much for one PR, so I'm splitting it up.

Formatting changes obviously perturb any visual review of any code so I'm doing those first.

There are zero functional changes in the code in this PR. It is all spacing, nothing else.

Discussions of formatting frequently devolve to strong opinions about how things should be formatted, I want to be 100% clear here that I do not actually care about how things are formatted at all, just as a developer and repo maintainer I want consistent formatting.

So I just took the github actions repo prettier as a hopefully non-controversial baseline, and then added husky (for local enforcement) and a github workflow (for CI enforcement).

It follows then that if any specific choice here is not something you like, great! I'll tweak the .prettierrc.json until it has things the way you like.

.husky/.gitignore Show resolved Hide resolved
.husky/pre-commit Show resolved Hide resolved
.prettierrc.json Outdated Show resolved Hide resolved
package.json Outdated Show resolved Hide resolved
@mikehardy mikehardy force-pushed the prettier branch 2 times, most recently from 0a97c72 to 30eb876 Compare Apr 11, 2021
The prettier config was adapted from the official GitHub Actions repo,
bent to fit the prevailing style (where possible) already in the project

The intent is not to be controversial or argue about whitespace, it is just
to have a consistent easy-to-verify style specifically to avoid all arguments
about whitespace. If anything in here is objectionable, just name the setting
to alter and I can edit / re-format / re-push

chore: add husky and hook build/format/lint checks to pre-commit

This enforces the same checks locally that will execute in CI

With this, everyone should have a clean / consistent dev environment,
and it will be clear to contributors if they submit code that is not valid

Additionally, after doing the build it adds the dist/index.js output to the
commit list so contributors can't forget to commit it

lint(prettier): trailingComma preferred as all vs none

Co-authored-by: Steven <>
styfle approved these changes Apr 11, 2021
Copy link

@styfle styfle left a comment

Great work, thanks! 🏅

@styfle styfle merged commit 3079606 into styfle:main Apr 11, 2021
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
None yet
None yet

Successfully merging this pull request may close these issues.

None yet

2 participants