From 698b347f8869086bf9b34a8e33444dd8ba2bddd9 Mon Sep 17 00:00:00 2001 From: chandermani Date: Mon, 17 Feb 2014 13:10:26 +0530 Subject: [PATCH 1/2] Updated the spacing guideline as VS does auto indentation. --- README.md | 30 ++---------------------------- 1 file changed, 2 insertions(+), 28 deletions(-) diff --git a/README.md b/README.md index 3a477b6c50..20555002f9 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -# Airbnb JavaScript Style Guide() { +# Airbnb JavaScript Style Guide(Customized for .Net) { *A mostly reasonable approach to JavaScript* @@ -727,24 +727,8 @@ ## Whitespace - - Use soft tabs set to 2 spaces + - Use the standard Visual Studio formatting and indentation. Do not manually align same level statements. Visual Studio does it for you when you add `;` or ending bracket for statement block. If VS is not doing allignment there is some issue in lines above or below which is not allowing VS to do code indentation. - ```javascript - // bad - function() { - ∙∙∙∙var name; - } - - // bad - function() { - ∙var name; - } - - // good - function() { - ∙∙var name; - } - ``` - Place 1 space before the leading brace. @@ -772,16 +756,6 @@ }); ``` - - Set off operators with spaces. - - ```javascript - // bad - var x=y+5; - - // good - var x = y + 5; - ``` - - Place an empty newline at the end of the file. ```javascript From 14e2a057491b52a9ff13c043bb289c45fcb9f501 Mon Sep 17 00:00:00 2001 From: chandermani Date: Mon, 17 Feb 2014 14:25:27 +0530 Subject: [PATCH 2/2] Added reference to angularjs guidelines. --- README.md | 31 ++++--------------------------- 1 file changed, 4 insertions(+), 27 deletions(-) diff --git a/README.md b/README.md index 20555002f9..cbf967120a 100644 --- a/README.md +++ b/README.md @@ -24,7 +24,7 @@ 1. [Accessors](#accessors) 1. [Constructors](#constructors) 1. [Events](#events) - 1. [Modules](#modules) + 1. [AngularJS](#angular) 1. [jQuery](#jquery) 1. [ES5 Compatibility](#es5) 1. [Testing](#testing) @@ -1255,33 +1255,10 @@ **[[⬆]](#TOC)** -## Modules +## AngularJS - - The module should start with a `!`. This ensures that if a malformed module forgets to include a final semicolon there aren't errors in production when the scripts get concatenated. [Explanation](https://github.com/airbnb/javascript/issues/44#issuecomment-13063933) - - The file should be named with camelCase, live in a folder with the same name, and match the name of the single export. - - Add a method called noConflict() that sets the exported module to the previous version and returns this one. - - Always declare `'use strict';` at the top of the module. - - ```javascript - // fancyInput/fancyInput.js - - !function(global) { - 'use strict'; - - var previousFancyInput = global.FancyInput; - - function FancyInput(options) { - this.options = options || {}; - } - - FancyInput.noConflict = function noConflict() { - global.FancyInput = previousFancyInput; - return FancyInput; - }; - - global.FancyInput = FancyInput; - }(this); - ``` + - Look at AngularJS style guideline [here](https://github.com/mgechev/angularjs-style-guide). Read the complete guide and concentrate on sections that provide guidelines around using controllers, factories, directives etc. + **[[⬆]](#TOC)**