bitcart / bitcart-admin

Bitcart Admin Panel

Home Page:https://admin.bitcart.ai

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Add pre-commit

MrNaif2018 opened this issue · comments

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: bitcartcc/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

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

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?

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 ?

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

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 ?

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)

alright cool, I can do that!

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

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!