Skip to content

Conversation

@wbobeirne
Copy link
Member

No issue related

Description

Runs prettier across the codebase, and enforces it with a precommit hook via husky as well as checks against it in CI.

I'm not 100% wild about all of its changes, some lines have gotten more verbose (Object arguments, "flat" style arrays) while others are a little more obfuscated (Ternaries, components that came right up against char limit that got flattened) but I think consistency is king here. It'll make submitting PRs much less of a hassle if there are significant code style changes, or the user's own formatter ran amok.

I'll leave this open for a bit in case anyone has any strong opinions about some of the changes.

Steps to Test

  1. Write ill-formatted code
  2. Commit said code
  3. Confirm it's now correctly formatted

@wbobeirne wbobeirne requested a review from jamaljsr April 26, 2019 16:28
@jamaljsr
Copy link
Collaborator

#winning

Sometimes prettier does things I don’t like but i certainly prefer consistency over personal preferences when it comes to code style in a team environment. For an open source repo, its a must-have. Great addition to the project

Copy link
Collaborator

@jamaljsr jamaljsr left a comment

Choose a reason for hiding this comment

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

I just tested the commit hook to confirm that it would fix incorrectly formatted code.

I was unable to get the pre-commit hook to run until I added the following to package.json

  "husky": {
    "hooks": {
      "pre-commit": "pretty-quick --staged"
    }
  },

@wbobeirne
Copy link
Member Author

Glad you're into it! Thanks for the catch, too. I think I had an old version of husky in my node_modules that was keyed off of the style. Updated with yours.

@wbobeirne wbobeirne merged commit 5972c6c into develop Apr 28, 2019
@wbobeirne wbobeirne deleted the prettier branch April 28, 2019 17:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants