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

Setup husky and lint-staged #69

Merged

Conversation

JulianaSau
Copy link
Contributor

@JulianaSau JulianaSau commented Oct 20, 2022

Summary

Fixes #66
Addresses #10

Automation of linting and code formatting to enforce a uniform code style for contributors on the repo

List of changes proposed in this PR (pull-request)

  • Install husky, lint-staged, prettier, eslint and their peer dependencies
  • Set up eslint and prettier rules
  • Configure husky and lint-staged to automate linting and formatting
  • Ran prettier --write to fix the existing code formatting errors
  • Ran eslint --fix to rectify the linting errors existing in the codebase

What should a reviewer concentrate their feedback on?

  • The prettier formatting rules
  • The eslint configurations
  • Everything looks ok?
  • Let me know if there's any change that i can remove or add to make this functionality work optimally

@sandygudie
Copy link
Member

sandygudie commented Oct 21, 2022

@JulianaSau well done on this 👏, it's great
Please can you configure the pre-commit to run Eslint and Prettier fix?
please let me know if you need clarity on this
thanks

@JulianaSau
Copy link
Contributor Author

JulianaSau commented Oct 21, 2022

@JulianaSau well done on this 👏, it's great Please can you configure the pre-commit to run Eslint and Prettier fix? please let me know if you need clarity on this thanks

Hi. Thank you for reviewing my pr
I included this bit of code in the lint-staged.config.js to automatically fix up the auto-fixable errors

module.exports = {
    '*.{js,jsx}': ['yarn lint'],
    '*.{js,json,css,jsx}': ['yarn format'],
  }

So the pre-commit hook runs the lint-staged scripts above, which is included in the package.json file. But these scripts only run on staged files

I've added format:check and lint:check scripts to check for code formatting and linting errors in the whole frontend project folder. I've also added format:fix and lint:fix scripts to fix code formatting and linting errors globally in the frontend folder

so for clarity, should the pre-commit also run the global checks or just on the staged files?

@sandygudie
Copy link
Member

sandygudie commented Oct 21, 2022

Yeah, the pre-commit should run only on staged files.
I see the config file, I have tested it and it works great👍
Welldone

@sandygudie sandygudie self-requested a review October 21, 2022 09:33
@BatoolMM
Copy link
Member

@all-contributors add @JulianaSau for infra

@allcontributors
Copy link
Contributor

@BatoolMM

I've put up a pull request to add @JulianaSau! 🎉

@BatoolMM
Copy link
Member

@all-contributors add @JulianaSau for infra

@allcontributors
Copy link
Contributor

@BatoolMM

@JulianaSau already contributed before to infra

@BatoolMM
Copy link
Member

@all-contributors add @JulianaSau for Ideas & Planning

@allcontributors
Copy link
Contributor

@BatoolMM

I've updated the pull request to add @JulianaSau! 🎉

@BatoolMM BatoolMM merged commit 7b61ac5 into Open-Science-Community-Saudi-Arabia:dev_team2 Oct 21, 2022
@okerekechinweotito
Copy link
Contributor

@JulianaSau Good Job

@JulianaSau
Copy link
Contributor Author

Yeah, the pre-commit should run only on staged files. I see the config file, I have tested it and it works great👍 Welldone

Thank you😁

RealRichi3 pushed a commit to RealRichi3/MOOCs that referenced this pull request Feb 21, 2023
…aSau/dev_team2

Setup husky and lint-staged
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants