Skip to content

Issue #144/pre commit implementation #150

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

Conversation

shashi-sah2003
Copy link

@shashi-sah2003 shashi-sah2003 commented Apr 28, 2025


name: Pull Request
about: Submit changes to the project for review and inclusion

NOTE: It is requested to everyone to do npm install after this merge.

Description

I have implemented pre-commit hooks for this repo using husky so that it can check linting and prettier before committing into codebase

Related Issue

Fixes #144

Changes Made

  • installed husky
  • added lint-staged in package.json for triggering of npx lint-staged

Testing Performed

Tested locally with bad formatting and it works perfect

@shashi-sah2003
Copy link
Author

hey @sa-fw-an @pikurasa pls review this pr

@sa-fw-an
Copy link
Member

@shashi-sah2003 There are two errors in this PR:

  1. Each time I run npm i, the package-lock.json file is modified, which should not happen.
  2. The files aren’t being linted, and no warning is shown before committing when linting fails. This was the sole purpose of this PR.

Please address these issues :)

@shashi-sah2003
Copy link
Author

@shashi-sah2003 There are two errors in this PR:

  1. Each time I run npm i, the package-lock.json file is modified, which should not happen.
  2. The files aren’t being linted, and no warning is shown before committing when linting fails. This was the sole purpose of this PR.

Please address these issues :)

  1. The first issue which you are mentioning was happening before this PR as well.
  2. also make sure the file, whichever you are testing with, is in the below mentioned path.
    image

@sa-fw-an
Copy link
Member

sa-fw-an commented Apr 29, 2025

  1. No, it did not and still not happening with the code on main branch.
  2. Yes it was inside src folder

Please fix them

@shashi-sah2003
Copy link
Author

image

when running npm i the changes in package-lock.json is not happening on my end

image

running the below code at src/pages/badcomponent.tsx

function    BadComponent(   ){
    const message="badly formatted"
return(
    <div className='wrong-quotes'>
            {message}
    </div>
)}
export default BadComponent

maybe the second issue is happening on your end because you are trying to commit from root of src directory but according to above mentioned configuration it should be inside subfolder of src directory.

@sa-fw-an
Copy link
Member

sa-fw-an commented May 1, 2025

I tried and still facing the same issue

@omsuneri
Copy link
Member

omsuneri commented May 1, 2025

@shashi-sah2003 please resolve conflicts with the upstream/main

@shashi-sah2003
Copy link
Author

hey @omsuneri I have resolved the conflict

@shashi-sah2003
Copy link
Author

I tried and still facing the same issue

hey @sa-fw-an it's really frustrating that you weren't able to reproduce. Could you pls give me your file for which you are trying to fail linting?

@sa-fw-an sa-fw-an closed this May 21, 2025
@sa-fw-an
Copy link
Member

Please open a new PR with Proper Implementation.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add Pre-commit Hooks for Code Quality Enforcement
3 participants