Description
As per @vbelolapotkov comment in #1442:
@reykjalin it works fine on local machine, so we can merged it. However, I've noticed that our config runs all the files through the linter instead of staged files only. That makes hooks a bit slow.
To my understanding the issues is caused by two things:
- Transpilation required for .ts files
lint:js
command runs with.
as param.My suggestion is:
- Update lint-stages.config.js as per docs
'**/*.ts?(x)': () => 'tsc -p tsconfig.json --noEmit',
- Update lint staged command for js/jsx files to
"npx eslint"
rather thannpm run lint:js
.It works fine for js files, but I wasn't able to test it for ts files (somehow I didn't find any of them in this branch).
I also not sure if it will work for ts files when linting all of them withnpm run lint:js
.Anyway, it's fine to ship as is and solve the issues in its own PR.
Unfortunately, we can't really test the hooks for TypeScript until we merge some of those PRs 🙂
Proposed Solution
I've attached a patch that I think will solve the issue, but I haven't tried it. You can apply the patch by downloading it, unzipping the file, cd <wcpay_repo>
and git am <path_to_pach_file>
.