Git21221 / IBMSkillsBuild

IBMSkillsBuild Project
https://virtual-galaxy.netlify.app/
MIT License
11 stars 13 forks source link

[CODE QUALITY] static code analysis of the project - code formatting #78

Open bugITwhisperer opened 9 months ago

bugITwhisperer commented 9 months ago

Current project's challenge Since there are many contributors involved in this project, the code formatting may vary depending on the individual. Currently, there is no implemented solution to ensure consistent code formatting throughout the repository.

Tool for static code analysis: Prettier & Husky library Implementing them will:

@RAHUL956777 : what do you think about it?

bugITwhisperer commented 9 months ago

@Git21221 : could you advise on the above? If you're not interested, please let me know so that I can close the issue. :)

Git21221 commented 9 months ago

@bugITwhisperer How this thing works? elaborate

bugITwhisperer commented 9 months ago

@Git21221 : well, both Eslint and Prettier libraries are tools which ensure the same code standards, quality rules, but also stylistic rules are used througout the project, e.g. they enforce double quote or single quote, 1 empty line at the end of each file, etc. It's very useful when many Contributors are working at the same project! Also, if there are any issues like missing tags in HTML, missing commas or any other code issues, the tools will find those and prompt Contributor to make required changes. is a code formatter that makes your code more readable with just a few clicks. It automatically formats your code to match a set of pre-defined rules, ensuring consistency across your entire codebase.

As for Husky - it is used to create hooks which can run Prettier/Eslint before each commit is made by Contributor. This way we would make sure that each change, before it's pushed to repository follows the same standards.

For more info, you can check out the below references.

References: https://dev.to/andrewbaisden/how-to-use-eslint-and-prettier-for-code-analysis-and-formatting-1b4g https://www.npmjs.com/package/prettier && https://prettier.io/ https://www.npmjs.com/package/eslint && https://eslint.org/ https://www.npmjs.com/package/husky && https://typicode.github.io/husky/