A style guide contains general rules about how to write code. They could include a better way to indent, where to place a function etc.
Here is a list of JavaScript Style Guides to checkout:
●Google JavaScript Style Guide
🔗https://google.github.io/styleguide/jsguide.html
●Airbnb JavaScript Style Guide
🔗https://github.com/airbnb/javascript
●Idiomatic.JS
🔗https://github.com/rwaldron/idiomatic.js
●StandardJS
🔗 https://standardjs.com/
Top comments (10)
I find it hard to take any style guide seriously that thinks spaces are a proper way of indenting code.
I agree, but it's good basics. For example in my company we use AirBnB style guide but, without semi colon ;)
I find it wild to not use semi colon in my code
What's the point of typing extra clutter that adds no value to the code?
I'd better define them like that:
As personal opinion on that, you should just stick to what the project states for the reason above, use Prettier (VSCode extension) with format on save enabled to avoid having to learn the style guides on each project you jump into, thus being released of that styling job which can be automated easily.
This way you code once with your own style and it gets formatted when saving according to the defined styles (usually in a Prettier.rc or an ESLint.rc file).
i.e. If your opinion is that using tabs is better than using spaces then use tabs always, if the project has spaces in the config, prettier will handle that for you. In your own projects you can set it to tabs and code the same way.
Didn't bring a linter but a lantern 🤷🏽♂️😅
Thank you for sharing
Thanks for sharing, Gloria. I didn't know about them, but they this is actually very useful at my current stage, so thank you!!
You're welcome
I'm glad you find it helpful
I did not know Iomatic.JS and there are very useful rules. Thanks for sharing ;)
It's my pleasure