ryanpcmcquen / worstStyleGuideEver.js

:suspect:

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

worstStyleGuideEver.js

  1. Always indent with 2 full tabs.

  2. Actually ... use 16 spaces so tricksters cannot get around it with fancy tabstop settings (attempt to make your documents as wide as possible).

  3. Always start curly braces on their own line, especially after 'return'.

  4. Never use semicolons, JavaScript inserts them for you.

  5. Alternate between }()) and })() with IIFE's.

  6. Use 2 spaces between every character.

  7. Leave several spaces at the end of most lines.

  8. Always use == and !=, and never the 3 character versions, because type-coercion is your friend.

  9. Divide all arithmetical operations by 10 until they occur at the decimal level.

  10. Favor for loops over .forEach() and .map().

  11. Favor .innerHTML over .textContent.

  12. Query the dom as much as possible, it's fast.

  13. Never use var, just repeat any reusable code.

  14. Put all function declarations at the bottom of the file and rely on hoisting.

  15. If you absolutely must use var, make sure all your variables are global.

  16. Never throw errors, this keeps other JavaScripters from learning how to fix code.

  17. Put all functions within a loop.

  18. Declare all var's inside of for loops whose outer scope is global.

  19. Use intentional fall throughs in all switch statements.

  20. Use eval whenever possible.

  21. Repeat yourself often.

  22. Sometimes forget to indent, other times indent twice for no apparent reason.

  23. Write no comments, they clutter the code.

  24. If you do use comments, open with /* but never close it.

  25. Never use alphabetical characters, instead rely on ASCII codes and charCodeAt.

  26. Never set this equal to a var.

  27. Never version your code. If you do, make breaking changes often, but increment the version number the least amount possible.

  28. Name variables starting alphabetically a, b, c, d .... This will make it easy to know how many variables you have.

  29. Use short variable names in different contexts.

  30. Always use different selectors to query the same element.

  31. Keep your commit comments as short as possible. "Update" is ideal.

About

:suspect:

License:Mozilla Public License 2.0