opened
chaance
username_0
- [x] Use a meaningful title for the pull request. Include the name of the package modified.
- [x] Test the change in your own code.
- [ ] Add or edit tests to reflect the change (run `yarn test`).
- [ ] Add or edit Storybook examples to reflect the change (run `yarn dev`).
- [ ] Add documentation to support any new features.

This pull request:

- [ ] Fixes a bug in an existing package
- [ ] Adds additional features/functionality to an existing package
- [ ] Updates documentation or example code
- [x] Other
Speed up pre-commit hooks with lint-staged
issue
created
benoitgrelard
username_1
@username_0 So the main speed-up is from the fact that we're only going to re-lint / typecheck the files that are being staged rather than the whole codebase?
comment
created
chaance
username_0
@username_1 See the comment I left in the config file; in order for `tsc` to work properly with `lint-staged` (and for our scripts to run cross platform) one of those keys we have to use the function syntax in a js config file. I kind of hate it too but I couldn't get it to work in package.json without running bash in the command, which wouldn't work on Windows and would exclude contributors. 😕
comment
created
chaance
username_0
Even better IMO!
comment
created
benoitgrelard
username_1
We can't really move this to pre-push hook right? otherwise how would the `--fix` work?
comment
created
chaance
username_0
@username_1 I'm thinking we could keep `prettier` and `eslint` in pre-commit. Those actually run pretty fast anyway when only executed on staged changes. `tsc` is significantly slower and I think we can move that to pre-push.
comment
created
chaance
username_0
@username_1 @username_2 Updated a bit. Per my comment above I kept `prretty-quick` and `eslint` in the pre-commit hook, runs only on staged files and is way faster now. `tsc` goes in pre-push because it was much slower, and that let me delete the config file and keep everything in `package.json`.
comment
created
jjenzz
username_2
🎉 :+1:
comment