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

Can't use lintHTML as a npm run script or as husky pre-commit step #457

Open
riobuenoDevelops opened this issue Jul 6, 2022 · 6 comments
Labels
bug Something isn't working

Comments

@riobuenoDevelops
Copy link

riobuenoDevelops commented Jul 6, 2022

Hi! I'm configuring lintHTML as a husky pre-commit step to check the HTML files but I'm getting the following error when husky try to run the command:

path should be a path.relative()d string, but got "/home/tania_work/Documents/Work/VertexStudio/Projects/vxr-medixlab/examples/index.html".

It works as expected when I run the command directly in the command line but it doesn't work with husky and even with npm run command as a script.

  • Directly from command line
    Screenshot from 2022-07-06 15-26-04

  • As husky step
    Screenshot from 2022-07-06 15-27-01

@riobuenoDevelops riobuenoDevelops changed the title Can't use lintHTML as a npm run script of as husky pre-commit step Can't use lintHTML as a npm run script or as husky pre-commit step Jul 7, 2022
@KamiKillertO KamiKillertO added the bug Something isn't working label Jul 7, 2022
@KamiKillertO
Copy link
Collaborator

@riobuenoDevelops Thanks for reporting. What version of LintHTML are you on?

@riobuenoDevelops
Copy link
Author

@KamiKillertO I'm using the latest version. 0.8.6

@KamiKillertO
Copy link
Collaborator

@riobuenoDevelops Is it possible to share your husky's config?

@riobuenoDevelops
Copy link
Author

@KamiKillertO sure, it's this
Screenshot from 2022-07-29 17-40-15

@KamiKillertO
Copy link
Collaborator

@riobuenoDevelops Thanks.
Sorry for the late answer, I've been really busy with the 0.9.0 release. I'll looks into your problem in the coming days

@KamiKillertO
Copy link
Collaborator

For the moment there's nothing I can do easily. A lot of code inherits from HTMLint still remains, preventing me from fixing that issue right now.
But the good news is that you can solve your problem easily. By default lint-staged send absolute paths to tasks, but there's an option to change that and instead provide relative paths to tasks.
You just need to update the way you call lint-staged in your commit hook.

npx lint-staged --relative

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants