Skip to content
This repository has been archived by the owner on Jun 20, 2024. It is now read-only.

Forces linter check before commit #224

Merged

Conversation

ccolorado
Copy link
Contributor

Forces linter (npx prettier) check to pass before git commit

Requires installation
$ npm install && npm run prepare

more options for npm and yarn @
https://typicode.github.io/husky/getting-started.html

@ccolorado
Copy link
Contributor Author

Please review @omarespejel

@omarespejel
Copy link
Collaborator

Hey @ccolorado,

This is truly valuable, thank you!

Before merging, could you clarify: What steps do contributors need to follow to comply with this new process? The simpler the better. We want to ensure it's straightforward for them to contribute to the Book.

@ccolorado
Copy link
Contributor Author

ccolorado commented Oct 19, 2023

After husky is installed and prepared (npm install && npm run prepare). Whenever a commit is attempted a lint check will be trigger.
If the lint check succeeds, the commit will proceed as usual.
If it fails the commit will be aborted.

Users can opt out of this helper by:
a) Not running the prepare command
b) uninstalling husky instructions for both npm and yarn @ https://typicode.github.io/husky/getting-started.html

Usage Video

@dalmasonto
Copy link
Contributor

Hello @ccolorado seems prettier failed on your side too, kindly run

npm i
npm run format

That way prettier problems will be evaded

@ccolorado
Copy link
Contributor Author

Hello @ccolorado seems prettier failed on your side too, kindly run

npm i
npm run format

That way prettier problems will be evaded

Yeah I notice it failed on CI, but wierdly "works on my machine".
Forgot to mark pr as draft until i figure It out

@dalmasonto
Copy link
Contributor

It will work locally but that does not pass when you push to github since it will try run its checks. Some files might be having issues within the code you pushed. Just formatting issues ie not formatted correctly that is why i was suggesting you run npm run format before pushing.

@omarespejel
Copy link
Collaborator

omarespejel commented Oct 23, 2023

Thanks, @ccolorado! Your explanation clarified everything for me. Could you address the conflict in the foundry forge chapter update? It is because the chapter was badly formatted and we recently updated it, it is not fault of your PR. That would be all.

And a big thanks to @dalmasonto for the review!

@omarespejel omarespejel merged commit 8282e7a into starknet-edu:main Oct 29, 2023
1 check passed
@omarespejel
Copy link
Collaborator

Hey @ccolorado! Thank you for your contribution. Anything that makes the Book work and look better is very important! let me know if you want to contribute further, I know your abilities!
Thanks @dalmasonto for reviewing!

@ccolorado ccolorado deleted the integrate-linter-hook-at-commit branch October 30, 2023 20:25
imgbot bot pushed a commit to hardiktheprogrammer/starknetbook that referenced this pull request Jan 28, 2024
* Adds pre-commit hook to force running linter

* Refactor pre-commit hoock

* Update to main + lint run

---------

Co-authored-by: Omar U. Espejel <espejelomar@gmail.com>
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants