diff --git a/README.md b/README.md index 3a477b6c50..cbf967120a 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* @@ -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) @@ -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 @@ -1281,33 +1255,10 @@ **[[⬆]](#TOC)** -## Modules - - - 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 +## AngularJS - !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)**