DevTools/CodingStandards: Difference between revisions

Jump to navigation Jump to search
updated coding style section
(Re-formatted the code style rules section)
(updated coding style section)
Line 26: Line 26:


== Code style ==
== Code style ==
Probably the best piece advice there is when talking about the code style is '''be consistent with the rest of the code in the file'''.


Here are some of the main code style rules:
Here are some of the main code style rules:
Line 31: Line 33:
* lines should be 80 characters maximum (go longer if wrapping hurts readability),
* lines should be 80 characters maximum (go longer if wrapping hurts readability),
* indent with 2 spaces (no tabs!),
* indent with 2 spaces (no tabs!),
* <code>camelCasePlease</code>,
* don't open braces on the next line,
* don't name function expressions: <code>let o = { doSomething: function doSomething() {} };</code>,
* aim for short functions, 24 lines max (ESLint has a rule that checks for function complexity too),
* aim for short functions, 24 lines max (ESLint has a rule that checks for function complexity too),
* aArguments aAre the aDevil (don't use them please),
* aArguments aAre the aDevil (don't use them please),
130

edits

Navigation menu