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

Feature : Add husky githook for checking linting error, format fix and typecheck #322

Closed
aialok opened this issue Feb 20, 2024 · 8 comments · Fixed by #383
Closed

Feature : Add husky githook for checking linting error, format fix and typecheck #322

aialok opened this issue Feb 20, 2024 · 8 comments · Fixed by #383
Assignees
Labels
✨ Enhancement Indicates that the issue suggests an improvement or new feature. Priority: Low This issue can probably be picked up by anyone. Status: In Progress This issue is being worked on, and has someone assigned.

Comments

@aialok
Copy link
Collaborator

aialok commented Feb 20, 2024

Reason/Context:

  • Why we need this improvement?
    We need this improvement to ensure consistent code quality and prevent common errors before they are committed to the repository. This will help in maintaining a clean and error-free codebase.

  • How will this change help?
    This change will automate the process of checking for linting errors, formatting issues, and type checking before any commit is made. It will save time for developers and improve the overall quality of the codebase.

  • What is the motivation?
    The motivation behind this change is to enforce coding standards, ensure consistency across the codebase, and catch potential errors early in the development process.

Description:

  • What changes have to be introduced?
    We need to add Husky as a git hook manager and configure it to run linting, formatting, and type checking scripts before allowing commits. This involves adding necessary dependencies, configuring Husky in the package.json file, and defining the scripts to run.

  • Will this be a breaking change?
    This change should not be breaking unless there are significant conflicts with existing git hooks or if developers are not following linting, formatting, or type checking rules strictly.

  • How could it be implemented/designed?
    Implementation involves the following steps:

    1. Install necessary dependencies such as Husky, Prettier, eslint.
    2. Configure Husky in the package.json file to trigger hooks on specific git events (e.g., pre-commit).
    3. Define scripts to run linting, formatting, and type checking tasks in the package.json file.
    4. Test the setup by making changes to the code and verifying that the hooks are triggered correctly.

Do you think this work might require an Architectural Decision Record (ADR)? (significant or noteworthy)

@aialok aialok changed the title Feature : Add husky githook for checking linting error, format fix and typechekc Feature : Add husky githook for checking linting error, format fix and typecheck Feb 20, 2024
@aialok
Copy link
Collaborator Author

aialok commented Feb 21, 2024

If this is valid issue please assign this to me : )

@benjagm benjagm added ✨ Enhancement Indicates that the issue suggests an improvement or new feature. Priority: Low This issue can probably be picked up by anyone. Status: Triage This is the initial status for an issue that requires triage. labels Feb 21, 2024
@benjagm
Copy link
Collaborator

benjagm commented Feb 21, 2024

Please do check the corrent code of the website. There is actually some degree of eslint validation.

@benjagm benjagm added Status: In Progress This issue is being worked on, and has someone assigned. and removed Status: Triage This is the initial status for an issue that requires triage. labels Feb 21, 2024
@aialok
Copy link
Collaborator Author

aialok commented Feb 21, 2024

Please do check the corrent code of the website. There is actually some degree of eslint validation.

Sure, Thank You : )

@Relequestual
Copy link
Member

Currently the eslint config doesn't allow semicolons. We would want that. We didn't make the eslint config, and I haven't bothered to go check/fix it, or set up using prettier. I expect a number of the rules will be "blown away" when using prettier default rules.

@aialok
Copy link
Collaborator Author

aialok commented Feb 21, 2024

@Relequestual, could you please inform me about the types of files I should format using Prettier? I intend to format only .ts, .tsx, .js, and .jsx files.

@praveen-rikhari
Copy link
Contributor

As far as i understand husky does adds a layer of friction to first time contributors, to have the linter run for every commit they do while working on the project, but in the long run this does helps us to have clean commits, I am not sure how much this would be relevant as of now for the project

@aialok
Copy link
Collaborator Author

aialok commented Feb 22, 2024

As far as i understand husky does adds a layer of friction to first time contributors, to have the linter run for every commit they do while working on the project, but in the long run this does helps us to have clean commits, I am not sure how much this would be relevant as of now for the project

This will be highly relevant as our project is open source, and with the upcoming GSOC, we anticipate a flood of contributors. Setting up Husky with Prettier and ESLint will be beneficial and will lead to cleaner code. Different contributors write code in different styles, and Prettier will help in maintaining code quality and consistency throughout the project. Most open-source projects utilize these tools, so we are good to go.

@praveen-rikhari
Copy link
Contributor

praveen-rikhari commented Feb 22, 2024

Thanks @aialok, The question here is more of about the friction-> we always have the option to run prettier and linter on our code manually once we are done with all our commits, and even if we somehow forget to not run it the CI should take care of it, but i understand your point as well to have cleaner commits upfront. Maybe @Relequestual or @benjagm can guide us more here

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
✨ Enhancement Indicates that the issue suggests an improvement or new feature. Priority: Low This issue can probably be picked up by anyone. Status: In Progress This issue is being worked on, and has someone assigned.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants