keyshade
keyshade copied to clipboard
chore: Lint and format only staged changes
User description
Description
This commit adds the package lint-staged. This package makes sure only staged changes are scanned for linting and formating instead of every file. I think when lint-staged is calling pnpm run lint it passes some file arguments. Since pnpm run lint calls turbo run lint this argument is getting passed directly resulting in an error as extra arguments get added to the tubro command. to prevent this we add '--' to signigy not to pass on further arguments.
I based this from a comment made by github user mehulkar whos explanation and solution helped me solve this problem. link here
Give a summary of the change that you have made
Changes are made to 2 files.
package.json root .husky/pre-commit
In the package.json a section is included for lint-staged. Within 2 commands are set so only lint and formating are run on staged commits and not the whole file. These commands where moved from the husky pre-commit file and replaced with pnpm run lint-staged. This calls the code under lint-staged in the package.json.
Fixes #195 [] issue 195 link here
This commit fixes the issue where all files got scanned for linting and formating which is very slow and it's better that only the staged files get scanned as they contain changes.
Dependencies
Mention any dependencies/packages used
lint-staged
Future Improvements
Mention any improvements to be done in future related to any file/feature
Mentions
Mention and tag the people
Screenshots of relevant screens
This screenshot below is what it looks like if you dont use lint-staged. I edited the pre-commit file and changed pnpm lint-staged to pnpm lint.
Add screenshots of relevant screens
Developer's checklist
- [ ] My PR follows the style guidelines of this project
- [ ] I have performed a self-check on my work
If changes are made in the code:
- [ x] I have followed the coding guidelines
- [x ] My changes in code generate no new warnings
- [ ] My changes are breaking another fix/feature of the project
- [ ] I have added test cases to show that my feature works
- [ ] I have added relevant screenshots in my PR
- [ x] There are no UI/UX issues
Documentation Update
- [ ] This PR requires an update to the documentation at docs.keyshade.xyz
- [x ] I have made the necessary updates to the documentation, or no documentation changes are required.
Type
enhancement, bug_fix
Description
- Integrated
lint-staged
inpackage.json
to ensure only staged files are linted and formatted, improving performance. - Updated the Husky pre-commit hook to use
lint-staged
, streamlining the pre-commit checks. - Added
lint-staged
todevDependencies
to manage the new dependency.
Changes walkthrough
Relevant files | |||
---|---|---|---|
Enhancement |
| ||
Configuration changes |
|
✨ PR-Agent usage: Comment
/help
on the PR to get a list of all available PR-Agent tools and their descriptions