troyhunt / password-purgatory

Deliberately making password creation a true hell
157 stars 14 forks source link

Adjust formatting #6

Closed cpetta closed 2 years ago

cpetta commented 2 years ago

I realize that formatting is a highly subjective subject with lots of different opinions. This pull request is more of a proposal/suggestion for the sake of code readability. Since it doesn't fix anything, add any functionality, and is subject to opinion, I totally understand if you'd like to go a different direction.

troyhunt commented 2 years ago

Let me put the question to the masses: https://twitter.com/troyhunt/status/1506395329255514112

FWIW, current formatting is done via VS Code: https://code.visualstudio.com/docs/languages/html#_formatting

jroper commented 2 years ago

I would never accept a PR that "fixes" formatting in bulk like this if it doesn't also include something (a script, perhaps that runs as part of a GitHub action) that ensures the formatting stays fixed. I personally couldn't care less what the formatting is in any given language, as long as formatting is something that I never have to think about. Changing the format to someone else's opinion of what looks nice has no benefit to me. Changing the project so that formatting is done for me and I never need to think about it, now there's a PR worth accepting.

troyhunt commented 2 years ago

Alrighty, the masses have spoken and suggested code formatting with Prettier which I've just done in 52fd521.

Also agree with @jroper that tha

tag is out of place here.

Closing this PR, very happy for you to pick this up again @cpetta and add new stuff 😊

tjenkinson commented 2 years ago

In case it’s useful here’s an example of a prettier setup I’ve used this in a few places now and it works well

Husky for the hook: https://github.com/tjenkinson/redos-detector/blob/ba5dbf0e2ad0ffc1d3633a2d1f1c0765b78587df/package.json#L26

Husky runs lint-staged: https://github.com/tjenkinson/redos-detector/blob/ba5dbf0e2ad0ffc1d3633a2d1f1c0765b78587df/.husky/pre-commit#L5

lint-staged runs prettier on everything it supports in fix mode: https://github.com/tjenkinson/redos-detector/blob/ba5dbf0e2ad0ffc1d3633a2d1f1c0765b78587df/lint-staged.config.js (the eslint lines are unrelated)

ci enforces prettier: https://github.com/tjenkinson/redos-detector/blob/ba5dbf0e2ad0ffc1d3633a2d1f1c0765b78587df/.github/workflows/build.yml#L36

cpetta commented 2 years ago

Thanks for the feedback @troyhunt and @jroper 👍