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

Add pre-commit #122

Closed
Tracked by #120
MrNaif2018 opened this issue Oct 1, 2021 · 9 comments · Fixed by #130
Closed
Tracked by #120

Add pre-commit #122

MrNaif2018 opened this issue Oct 1, 2021 · 9 comments · Fixed by #130
Labels
enhancement New feature or request good first issue Good for newcomers

Comments

@MrNaif2018
Copy link
Member

MrNaif2018 commented Oct 1, 2021

Pre-commit hooks should be added, documented and applied as we did in all our python repositories.
Pre-commit hooks are to be added by pre-commit app: https://pre-commit.com/
See those pull requests for reference: bitcart/bitcart#238, bitcart/bitcart-sdk#32, bitcart/bitccl#13

Of course, python-related tasks should be removed, and a set of rules for js repos should be created. Pre-commit checks should run most basic checks for file consistency (newlines, trailing whitespaces, etc), also probably eslint with our config (so that it runs prettier too) and any other useful checks for js code

We currently use husky for pre-commit hooks. Preferably pre-commit would also run the linting run by husky, or just run husky itself

The main issue is to make pre-commit use versions from package.json without manually specifying them in it's config file

Important: the pull request will be merged without squash, so please try to make it like reference PRs, first commit adding the pre-commit config, and in next commits applying fixers one by one, and in last commits documenting it and adding to CI. To add to CI you can use bitcartcc/lint action by our bitcartcc/bitcartcc-shared orb. See other pull requests for reference

@hmajid2301
Copy link

I can pick this up as well seeing as im doing, bitcart/bitcart-blog#110

@MrNaif2018
Copy link
Member Author

Alright, our js repos will share same config anyway.
See this comment for how to get api running for admin panel
Do you have any questions so far regarding pre-commit setup?

@hmajid2301
Copy link

Wait do you want to use the same pre-commit library as you use in Python. Or can I just simply setup pre-commit checks using Husky ?

@MrNaif2018
Copy link
Member Author

The same pre-commit library as in python. It is installed via numerous ways, one of which is via python, and it can run git hooks in any language. It can run prettier, eslint, some misc formatters and so on without requiring user to manually install them

@hmajid2301
Copy link

Ok sure I guess we assume the user already has it installed ? or shall I update the README with say how to do it via curl ?

@MrNaif2018
Copy link
Member Author

For js repos we can't assume user has python installed, so yes, installing via curl method should be documented (and a link to pre-commit install docs showing all methods)

@hmajid2301
Copy link

alright cool, I can do that!

@hmajid2301
Copy link

Im sorry about the delay working on this, i've been super busy with stuff at work. Happy to hand this over to someone else if you want. Sorry

@MrNaif2018
Copy link
Member Author

The nature of opensource is that anyone can contribute, there is no need to assign because everyone does stuff in their free time. I can unassign you if you want to not confuse others, but feel free to submit PR any time!

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
None yet
Development

Successfully merging a pull request may close this issue.

2 participants