-
Indentation: 2 spaces
-
List items/properties alphabetically
-
Use an editor that supports .editorconfig. Feel free to have a look at the editor plug-ins
-
Remove
console.log()messages when committing your code. -
Only use anchor tags
<a>for actual links, otherwise use<button>instead. This is especially important for IE9. -
Never use ngBindHtmlUnsafe.
-
Never use innerHTML unless displaying completely static data.
-
Filenames for images should be in the following format:
name_name2_00x00.ext. When it's an icon (e.g. 32x32 / 64x64), then start it withicon_. -
Specify colors in
hexformat and create a variable for them. -
Write
0instead of0px. -
Use
data-ng-ifinstead ofdata-ng-showordata-ng-hidewhen possible. -
When you're adding / updating images, make sure to optimize them. (e.g. imageOptim)
-
Use multiple lines for
varstatements and specifyvaron each line:👎
var name = 'Jason', name2 = 'Mike'
👍
var name = 'Jason'; var name2 = 'Mike';
-
Write objects on multiple lines:
👎
var enabled = { faceplant: true };
👍
var enabled = { faceplant: true };
-
Use single quotes when possible
👎
var name = "Christian Vuerings";
👍
var name = 'Christian Vuerings';
-
Use
data-ng-instead ofng-orng:and adddata-for directives👎
<ng:view> <span ng-bind="name"></span> <input mmddyyvalidator />
👍
<div data-ng-view></div> <span data-ng-bind="name"></span> <input data-mmddyyvalidator />