asyncapi / website

AsyncAPI specification website
https://www.asyncapi.com
Apache License 2.0
443 stars 578 forks source link

Adding husky precommit tests and eslint config #598

Closed akshatnema closed 2 years ago

akshatnema commented 2 years ago

Reason/Context

This is my idea to propose some addition of tests in our project. This may be wrong in your perspective. Do tell me in the discussion, what is best according to you.

Description

I will like to invite @fmvilas @magicmatatjahu @derberg @alequetzalli for discussion and approval on this issue. Since this is going to be a major change in codebase, I will like to inform community members regarding this. Secondly, will it be okay if we apply formatter (Prettier) on docs and blogs to format it? @alequetzalli @derberg

derberg commented 2 years ago

I'm not a fan of pre-commit hooks if they are not really needed. Have a look at https://github.com/asyncapi/cli/issues/198

I definitely think we should use eslint and best if we apply the same config that we have in other repos to be consistent.

Secondly, will it be okay if we apply formatter (Prettier) on docs and blogs to format it? @alequetzalli @derberg

do you mean prettier can be used with Markdown files? I had no idea 😄 are we sure it won't break anything? in the end it is not pure markdown but mdx 🤔 maybe there is some eslint plugin?

akshatnema commented 2 years ago

I'm not a fan of pre-commit hooks if they are not really needed. Have a look at https://github.com/asyncapi/cli/issues/198

Yeah, I can understand that you have already setup your VS code on auto-linting the code on save. But, this is not a default feature of VS Code or any other code editor. This setup may not be in any other contributor's editor. Therefore, I preferred to have it as a DevDependencies in project and set a script to run all necessary tests before. Secondly, I have made plan for adding all the tests in pre-commit including eslint fix, prettier, run build and more, if you specified.

do you mean prettier can be used with Markdown files? I had no idea 😄 are we sure it won't break anything? in the end it is not pure markdown but mdx 🤔 maybe there is some eslint plugin?

Yes, Prettier allows mdx code formatting. I have tried it on my local system. I am not sure of eslint plugin but prettier definitely provides formatting on both js and mdx.

quetzalliwrites commented 2 years ago

I'm also not a fan of pre-commit hooks. 🪝

I also don't know that I want to add prettier because linting issues are hard to troubleshoot and I'm concerned that this could hamper contributions 🤔

imabp commented 2 years ago

I guess, you can close this.

akshatnema commented 2 years ago

Fine, I can understand why everyone is reluctant for using husky and prettier. It is my suggestion, but it's totally up to you all. I was just thinking of long-term use in this. Sometimes, while a project becomes open-source, contributors from outside, don't take much care of the code readability and code formatting. Secondly, when a project grows and accepts contributions on large scale, it is better to have tests in the project to have proper working and maintenance of a deployed project. It prevents a commit to be made to the project that makes it produce breaking changes on production.

That's all my logic and perspective was, to make this issue. If you still think that there should be proper linting and its fixes, I can make a PR but want to hear from you regarding this, whether this is needed or not.

imabp commented 2 years ago

Hello @akshatnema

You are right, it does help. But please read this.

I have learned one thing from @fmvilas and @derberg, always do what is required by the community. We can have lot of things, but if its not required by the community, its not worth putting the effort, provided everyone has limited time.

I will suggest you, to think in terms of what's required, take some inputs from the AsyncAPI community, and this will help you to add more quality contributions.

quetzalliwrites commented 2 years ago

I have learned one thing from @fmvilas and @derberg, always do what is required by the community. We can have lot of things, but if its not required by the community, its not worth putting the effort, provided everyone has limited time. I will suggest you, to think in terms of what's required, take some inputs from the AsyncAPI community, and this will help you to add more quality contributions.

Yes! I feel that this explains it so well.

And I totally feel you because I too would love to make 1 million changes to the docs, but I have to acknowledge that not all my ideas make sense from an open source community perspective. 😄👍🏽👍🏽

akshatnema commented 2 years ago

Yepp, I understood well. Thanks for your guidance and views on the issue @imabp @alequetzalli. I will like to now close the issue as it isn't needed in the project right now. Thanks to all the contributors here for sharing their views and ideas. With this closing comment, I am closing this issue now. Will love to see you soon in the next GitHub discussion 😄.

derberg commented 2 years ago

well we still need eslint 😄 but it can wait until end of March, maybe someone will first work on https://github.com/asyncapi/community/issues/238 during OpenForce 🤞🏼 I think this detail was lost in the discussion about prettier and husky