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

npx mrm lint-staged does not work after husky v5+ #952

Closed
AnujPancholi opened this issue Feb 16, 2021 · 6 comments · Fixed by #960
Closed

npx mrm lint-staged does not work after husky v5+ #952

AnujPancholi opened this issue Feb 16, 2021 · 6 comments · Fixed by #960

Comments

@AnujPancholi
Copy link

AnujPancholi commented Feb 16, 2021

Description

Steps to reproduce

  1. In your npm project, run npx mrm lint-staged
  2. Perform a git commit and you will notice that the hook did not run

Debug Logs

Debug logs irrelevant, this is an issue with the script npx mrm lint-staged.

expand to view

Environment

  • OS: Ubuntu 20.04.1
  • Node.js: 12.18.3
  • lint-staged: 10.5.4

Interim fix:

Had to do a manual downgrade to husky v4:

npm i -D husky@4

Then it worked:

image

@Pezmc
Copy link

Pezmc commented Feb 18, 2021

I opened an issue on the mrm repo: sapegin/mrm#145

For this repo the possible fixes are:

  • Update the readme to suggest using mrm + a manual downgrade
  • Temporarily remove references to mrm
  • Add docs for both husky 5 and husky 4

Upstream the two proposed fixes are:

  • Only install husky 4.0
  • Support both both husky 5 and 4 and ask the user what they would prefer

Please note there are license complications with Husky 5 right now (it's no longer MIT and sponsorship is required for non open source usage), if you're a closed source project you should be sponsoring or sticking with 4.x. typicode/husky#857

Edit: There's now an upstream fix proposed sapegin/mrm#146, lint-staged should still consider updating the docs with information for husky 5!

jcfranco added a commit to Esri/calcite-design-system that referenced this issue Feb 25, 2021
* downgrades husky to v4 - lint-staged/lint-staged#952
* excludes husky from dependency-updating script in the meantime
jcfranco added a commit to Esri/calcite-design-system that referenced this issue Feb 25, 2021
* downgrades husky to v4 - lint-staged/lint-staged#952
* excludes husky from dependency-updating script in the meantime
@alifarooq0
Copy link

Are there any plans to make lint-staged compatible with husky v5?

@iiroj
Copy link
Member

iiroj commented Mar 7, 2021

@ali-farooq0 lint-staged itself works fine with husky v5. The mrm setup script is not really part of the project, and just helps set up a configuration.

@alifarooq0
Copy link

@iiroj
Gotcha. I couldn't find any documentation to set it up with husky v5. With Husky v5 they've moved execution from the package.json to a stand-alone pre-commit file. What's the best way to invoke lint-stage from it? using npx?
https://typicode.github.io/husky/#/?id=add-a-hook

@iiroj
Copy link
Member

iiroj commented Mar 7, 2021

I would go with the example at Automatic (recommended):

npx husky add .husky/pre-commit 'npx --no-install lint-staged'

Personally I have not had success with upgrading to Husky v5 due to numerous issues, so I've stayed at v4...

@alifarooq0
Copy link

Will give that a shot. Thanks!

Yeah for now I've decided to do the same :D

@iiroj iiroj linked a pull request Apr 1, 2021 that will close this issue
@iiroj iiroj closed this as completed in #960 Apr 2, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging a pull request may close this issue.

4 participants