Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve developer experience by automatically linting commits #1105

Closed
samayer12 opened this issue Aug 29, 2024 · 5 comments
Closed

Improve developer experience by automatically linting commits #1105

samayer12 opened this issue Aug 29, 2024 · 5 comments
Assignees
Labels
enhancement New feature or request good first issue Good for newcomers

Comments

@samayer12
Copy link
Collaborator

Is your feature request related to a problem? Please describe.

Contributors are directed to run npm run format:fix before committing to ensure code standards are met. This is fine, but we could completely automate that step by using a tool like Husky to enforce an automatic "lint on commit" that works out of the box without additional developer setup.

Describe the solution you'd like

  • Given husky & a pre-commit hook are configured
  • When a developer runs git commit
  • Then the linter is ran on changed files only

Describe alternatives you've considered

We could let contributors remember to run npm run format:fix, which will be caught by CI.

We could use some other git hook management tool, or provide more manual instructions to setup that workflow automation.

Additional context

Husky docs.

Implementation guide for using lint-staged as a pre-commit hook with Husky.

@samayer12 samayer12 added enhancement New feature or request good first issue Good for newcomers labels Aug 29, 2024
@itsarijitray
Copy link
Contributor

@samayer12 I would like to work on this

@cmwylie19
Copy link
Collaborator

Sounds good @itsarijitray , it is assigned to you. Let us know if you have any questions. Please also keep the command npm run format:fix since it is used in CI and other flows as well.

@itsarijitray
Copy link
Contributor

Sure. Thanks!!!

@itsarijitray
Copy link
Contributor

itsarijitray commented Aug 31, 2024

PR: #1160

@cmwylie19 @samayer12

btlghrants added a commit that referenced this issue Sep 20, 2024
## Description

This PR introduces a .husky pre-commit to lint codes before `git commit`
command.

The pre-commit hook executes the existing `npx lint-staged` script to
lint code.



## Related Issue

Relates to #1105

## Type of change

- [ ] Bug fix (non-breaking change which fixes an issue)
- [ ] New feature (non-breaking change which adds functionality)
- [x] Other (security config, docs update, etc)

## Checklist before merging
- [ ] Unit,
[Journey](https://github.com/defenseunicorns/pepr/tree/main/journey),
[E2E Tests](https://github.com/defenseunicorns/pepr-excellent-examples),
[docs](https://github.com/defenseunicorns/pepr/tree/main/docs),
[adr](https://github.com/defenseunicorns/pepr/tree/main/adr) added or
updated as needed
- [x] [Contributor Guide
Steps](https://docs.pepr.dev/main/contribute/#submitting-a-pull-request)
followed

Co-authored-by: Barrett <[email protected]>
@cmwylie19
Copy link
Collaborator

fixed and merged thanks @itsarijitray

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request good first issue Good for newcomers
Projects
Archived in project
Development

No branches or pull requests

3 participants