Added some new files and folders to the ignore list of both Prettier and Eslint
Moved lint-staged rules from package.json to .lintstagedrc.cjs to declutter package.json a bit.
Changed lint-staged's rules so the globs are run sequentially instead of in parallel to avoid race conditions (i.e.: Prettier trying to format a .tsx file at the same time that ESLINT or StyleLint).
Limited lint-staged's rules to only apply to .ts and .tsx files. I don't think we're using extensions like .js, .jsx, css, etc. inside of the src folder, but let me know if that's not the case. I'm not sure but maybe we should do something about the html, js, md, files (and other formats) in the root directory though (i.e.: can we commit a broken index.html file? maybe?).
Note: I don't know why we're using the tsc / tsc-files thing, is it because of the Vercel builds errors being different from the local version's? It seems kind of redundant, but I don't know. Maybe there's an alternative, idk.
Steps:
Checkout the fix-husky-lint-staged branch.
Run pnpm i so your dependencies are synched.
"Un-format" two or more ts or tsx files (i.e.: add a few empty lines, use the wrong type of quotes, etc., break some things Prettier would normally fix), and save them without formatting. Stage one file and commit. The staged file should end up formatted by Prettier, but not the unstaged files.
Now introduce some errors to the files (i.e.: wrong imports, badly written component names, add spaces to function or const names, etc., things ESLINT would normally try to fix or complain about), and save the files without formatting so they aren't fixed by your IDE. Stage one file but not the others, and commit. lint-staged should run only against the staged file and complain about it but not the others. Now leave the unstaged files with errors alone, and try to commit a file with some changes but no errors. lint-staged should check the staged file but no complaints should arise about the unstaged broken files.
Discard all the changes.
Break some test in some way and stage and commit some other valid file. Nothing should happen.
Now stage and commit the broken test. You should see some kind of error.
I think that's it, I couldn't think of something else.
If it's taking more than usual to commit I think the culprit could be tsc-files, otherwise I don't know.
Type of change:
[ ] New feature
[x] Bug fix
[ ] Breaking change
[ ] Enhancement
[ ] Refactoring
[ ] Chore
How Has This Been Tested?
[x] Manual testing
[ ] Automated tests
[ ] Other (explain)
Remember to check that:
Your code follows the style guidelines of this project
You have performed a self-review of your code
You have commented your code in hard-to-understand areas
You have made corresponding changes to the documentation
Description:
husky
lint-staged
lint-staged
rules frompackage.json
to.lintstagedrc.cjs
to declutterpackage.json
a bit.lint-staged
's rules so the globs are run sequentially instead of in parallel to avoid race conditions (i.e.: Prettier trying to format a.tsx
file at the same time that ESLINT or StyleLint).lint-staged
's rules to only apply to.ts
and.tsx
files. I don't think we're using extensions like.js
,.jsx
,css
, etc. inside of thesrc
folder, but let me know if that's not the case. I'm not sure but maybe we should do something about the html, js, md, files (and other formats) in the root directory though (i.e.: can we commit a brokenindex.html
file? maybe?).Note: I don't know why we're using the tsc / tsc-files thing, is it because of the Vercel builds errors being different from the local version's? It seems kind of redundant, but I don't know. Maybe there's an alternative, idk.
Steps:
fix-husky-lint-staged
branch.pnpm i
so your dependencies are synched.lint-staged
should run only against the staged file and complain about it but not the others. Now leave the unstaged files with errors alone, and try to commit a file with some changes but no errors.lint-staged
should check the staged file but no complaints should arise about the unstaged broken files.I think that's it, I couldn't think of something else.
If it's taking more than usual to commit I think the culprit could be
tsc-files
, otherwise I don't know.Type of change:
How Has This Been Tested?
Remember to check that: