Skip to content

lint-staged & husky in monorepos#30

Merged
nikzaugg merged 7 commits intomasterfrom
prettier-config
Nov 19, 2019
Merged

lint-staged & husky in monorepos#30
nikzaugg merged 7 commits intomasterfrom
prettier-config

Conversation

@nikzaugg
Copy link
Collaborator

This pull request explained:

  • husky & lint-staged never worked correctly with our setup, nothing was formatted each time we committed. Even tough the pre-commit hook was fired it did not recognize any staged files.
  • best practice is to remove husky from the sub-repos and only install it at the top-level
  • this PR adds lerna https://github.com/lerna/lerna, the Nr. 1 tool to manage monorepos
  • lerna can call npm scripts in sub-repos simultaneously
  • the lerna.json holds some minor configs, most importantly the "packages":[ ... ], that tell where our repos are
  • added a top-level package.json with the husky hook pre-commit, which will then run the pre-commit command in each sub-repo
  • basically: if this is merged, then each time something is commited, the pre-commit script of every sub-repo is run

Copy link
Owner

@alexscheitlin alexscheitlin left a comment

Choose a reason for hiding this comment

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

Nice one, I didn't know that.

@nikzaugg nikzaugg merged commit b90fe8e into master Nov 19, 2019
@nikzaugg nikzaugg deleted the prettier-config branch November 19, 2019 07:47
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