Skip to content

Commit 23c7d84

Browse files
author
Alexander Vakrilov
authored
Merge pull request NativeScript#3897 from NativeScript/etabakov/fix-wrong-example
Fix wrong example of Quotes usage
2 parents 8b79937 + 05fe7d4 commit 23c7d84

File tree

1 file changed

+16
-10
lines changed

1 file changed

+16
-10
lines changed

CodingConvention.md

Lines changed: 16 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
#TSN-Modules Coding Convention#
1+
# TSN-Modules Coding Convention#
22

3-
##Linting
3+
## Linting
44

55
*TODO: We should further verify this may work with TypeScript*
66

@@ -55,13 +55,13 @@ Use single quotes, unless you are writing JSON.
5555
*Right:*
5656

5757
~~~ {.javascript}
58-
var foo = "bar";
58+
var foo = 'bar';
5959
~~~
6060

6161
*Wrong:*
6262

6363
~~~ {.javascript}
64-
var foo = 'bar';
64+
var foo = "bar";
6565
~~~
6666

6767
## Braces
@@ -283,7 +283,8 @@ if (a == '') {
283283

284284
[comparisonoperators]: https://developer.mozilla.org/en/JavaScript/Reference/Operators/Comparison_Operators
285285

286-
##Short-hand oprators
286+
## Short-hand oprators
287+
287288
Try to avoid short-hand operators except in very simple scenarios.
288289
*Right:*
289290

@@ -302,7 +303,8 @@ var big = (x > 10) ? checkX(x)?getExtraLarge():getDefaultSize():getSmallValue();
302303
~~~
303304

304305

305-
##Curly braces
306+
## Curly braces
307+
306308
Always use curly braces even in the cases of one line conditional operations.
307309

308310
*Right:*
@@ -324,7 +326,8 @@ if (a)
324326
if (a) return 'winning';
325327
~~~
326328

327-
##Boolean comparisons
329+
## Boolean comparisons
330+
328331
**Do not** directly compare with true, or false.
329332

330333
*Right:*
@@ -548,7 +551,8 @@ function doAsync(arg, onSuccess, onError) {
548551
}
549552
~~~
550553

551-
##Comments
554+
## Comments
555+
552556
Use the [JSDoc][JSDOC] convention for comments. When writing a comment always think how understandable will be for somebody who is new to this code. Even if it may look simple to you think how a guy that just joined will understand it. Always comment in the following cases:
553557
+ When there is some non-trivial logic.
554558
+ Some 'external' knowledge is needed which is missing in the context - workaround for driver, module bug, special 'hack' because of a bug and so on;
@@ -559,7 +563,8 @@ Use the [JSDoc][JSDOC] convention for comments. When writing a comment always th
559563
[param]: http://usejsdoc.org/tags-param.html
560564

561565

562-
##Commenting of parameters that are objects/complex types
566+
## Commenting of parameters that are objects/complex types
567+
563568
When you have parameters that are complex objexts like *options* or other type for which the properties are not clear or is external one use the [@type-def tag][typedef]
564569

565570
*Right:*
@@ -598,7 +603,8 @@ function checkProperties(properties) {
598603

599604
[typedef]: http://usejsdoc.org/tags-typedef.html
600605

601-
##File/module structure
606+
## File/module structure
607+
602608
Typical module should have the following structure:
603609

604610
1. required dependencies

0 commit comments

Comments
 (0)