Describe the bug
For me, Husky ends up running npx lint-staged in ./.husky instead of in wp-content. Which means it is unable to find .lintstagedrc.json and then nothing is scanned.
Parent dir: /Users/<myuser>/Local Sites/<project>/app/public/wp-content
Scaffold path: ./.husky/_
So cd "${PARENT_DIR}/${SCAFFOLD_PATH}/.." resolves to /Users/<myuser>/Local Sites/<project>/app/public/wp-content/./.husky
If I add the following to pre-commit it works as expected.
if [ "$(basename "$PWD")" != "wp-content" ]; then
cd ..
fi
Steps to Reproduce
- Create a scaffold project.
- Create an intentionally bad commit like:
// Test file for pre-commit hook with linting errors
console.log("Testing Husky pre-commit hook");
let unused_variable = "this will cause linting errors";
function badFormatting( ){
console.log( "Poor formatting and unused variable" )
}
- Run git commit -m"test commit"
- In my case husky runs in the wrong folder and doesn't stop the commit.
Screenshots, screen recording, code snippet
No response
Environment information
- Device: Macbook Pro M4
- OS: Sequoia 15.5
WordPress information
This scaffold was adapted to work with VIP's scaffold.
Code of Conduct
Describe the bug
For me, Husky ends up running
npx lint-stagedin./.huskyinstead of inwp-content. Which means it is unable to find .lintstagedrc.json and then nothing is scanned.Parent dir:
/Users/<myuser>/Local Sites/<project>/app/public/wp-contentScaffold path:
./.husky/_So
cd "${PARENT_DIR}/${SCAFFOLD_PATH}/.."resolves to/Users/<myuser>/Local Sites/<project>/app/public/wp-content/./.huskyIf I add the following to pre-commit it works as expected.
Steps to Reproduce
Screenshots, screen recording, code snippet
No response
Environment information
WordPress information
This scaffold was adapted to work with VIP's scaffold.
Code of Conduct