From ebcd4e50d8cb8e163b6f1e05850a0cd26ac462a5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Scott=20Gonz=C3=A1lez?= Date: Mon, 23 Mar 2015 13:39:54 -0400 Subject: [PATCH 1/4] JS Style Guide: Fix full file closures --- pages/style-guide/js.md | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/pages/style-guide/js.md b/pages/style-guide/js.md index 56c8b135..43624084 100644 --- a/pages/style-guide/js.md +++ b/pages/style-guide/js.md @@ -249,17 +249,17 @@ elements When an entire file is wrapped in a closure, the body of the closure is not indented. ```js -(function( $ ) { +( function( $ ) { // this doesn't get indented -})( jQuery ); +} )( jQuery ); ``` The same applies to AMD wrappers. ```js -define([ +define( [ "foo", "bar", "baz" @@ -267,17 +267,17 @@ define([ // this doesn't get indented -}); +} ); ``` For UMD, the factory is indented to visually differentiate it from the body. ```js -(function( factory ) { +( function( factory ) { if ( typeof define === "function" && define.amd ) { // AMD. Register as an anonymous module. - define([ + define( [ "jquery" ], factory ); } else { @@ -285,11 +285,11 @@ For UMD, the factory is indented to visually differentiate it from the body. // Browser globals factory( jQuery ); } -}(function( $ ) { +}( function( $ ) { // this doesn't get indented -})); +} ) ); ``` ## Assignments From 93b3612fbf9c78a645273b831ab600e47f254ef8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Scott=20Gonz=C3=A1lez?= Date: Mon, 23 Mar 2015 13:52:56 -0400 Subject: [PATCH 2/4] [fixup]: Add node example --- pages/style-guide/js.md | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/pages/style-guide/js.md b/pages/style-guide/js.md index 43624084..9135ee34 100644 --- a/pages/style-guide/js.md +++ b/pages/style-guide/js.md @@ -251,11 +251,18 @@ When an entire file is wrapped in a closure, the body of the closure is not inde ```js ( function( $ ) { -// this doesn't get indented +// This doesn't get indented } )( jQuery ); ``` +``` +module.exports = function( grunt ) { + +// This doesn't get indented + +}; + The same applies to AMD wrappers. ```js @@ -265,7 +272,7 @@ define( [ "baz" ], function( foo, bar, baz ) { -// this doesn't get indented +// This doesn't get indented } ); ``` @@ -287,7 +294,7 @@ For UMD, the factory is indented to visually differentiate it from the body. } }( function( $ ) { -// this doesn't get indented +// This doesn't get indented } ) ); ``` From f88f82d053b54cc79922671ea1bf9ab98d9b2dc6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Scott=20Gonz=C3=A1lez?= Date: Mon, 23 Mar 2015 13:57:16 -0400 Subject: [PATCH 3/4] [fixup]: language for code block --- pages/style-guide/js.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pages/style-guide/js.md b/pages/style-guide/js.md index 9135ee34..bae54f96 100644 --- a/pages/style-guide/js.md +++ b/pages/style-guide/js.md @@ -256,7 +256,7 @@ When an entire file is wrapped in a closure, the body of the closure is not inde } )( jQuery ); ``` -``` +```js module.exports = function( grunt ) { // This doesn't get indented From c146f1ec6e7e5381417daeec38ceecccbeeecf88 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Scott=20Gonz=C3=A1lez?= Date: Mon, 23 Mar 2015 14:23:37 -0400 Subject: [PATCH 4/4] [fixup]: such a small change, so many mistakes... --- pages/style-guide/js.md | 1 + 1 file changed, 1 insertion(+) diff --git a/pages/style-guide/js.md b/pages/style-guide/js.md index bae54f96..77b97b19 100644 --- a/pages/style-guide/js.md +++ b/pages/style-guide/js.md @@ -262,6 +262,7 @@ module.exports = function( grunt ) { // This doesn't get indented }; +``` The same applies to AMD wrappers.