mirror of
https://github.com/NativeScript/NativeScript.git
synced 2025-08-17 21:01:34 +08:00
Merge pull request #3897 from NativeScript/etabakov/fix-wrong-example
Fix wrong example of Quotes usage
This commit is contained in:
@ -55,13 +55,13 @@ Use single quotes, unless you are writing JSON.
|
||||
*Right:*
|
||||
|
||||
~~~ {.javascript}
|
||||
var foo = "bar";
|
||||
var foo = 'bar';
|
||||
~~~
|
||||
|
||||
*Wrong:*
|
||||
|
||||
~~~ {.javascript}
|
||||
var foo = 'bar';
|
||||
var foo = "bar";
|
||||
~~~
|
||||
|
||||
## Braces
|
||||
@ -284,6 +284,7 @@ if (a == '') {
|
||||
[comparisonoperators]: https://developer.mozilla.org/en/JavaScript/Reference/Operators/Comparison_Operators
|
||||
|
||||
## Short-hand oprators
|
||||
|
||||
Try to avoid short-hand operators except in very simple scenarios.
|
||||
*Right:*
|
||||
|
||||
@ -303,6 +304,7 @@ var big = (x > 10) ? checkX(x)?getExtraLarge():getDefaultSize():getSmallValue();
|
||||
|
||||
|
||||
## Curly braces
|
||||
|
||||
Always use curly braces even in the cases of one line conditional operations.
|
||||
|
||||
*Right:*
|
||||
@ -325,6 +327,7 @@ if (a) return 'winning';
|
||||
~~~
|
||||
|
||||
## Boolean comparisons
|
||||
|
||||
**Do not** directly compare with true, or false.
|
||||
|
||||
*Right:*
|
||||
@ -549,6 +552,7 @@ function doAsync(arg, onSuccess, onError) {
|
||||
~~~
|
||||
|
||||
## Comments
|
||||
|
||||
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:
|
||||
+ When there is some non-trivial logic.
|
||||
+ 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;
|
||||
@ -560,6 +564,7 @@ Use the [JSDoc][JSDOC] convention for comments. When writing a comment always th
|
||||
|
||||
|
||||
## Commenting of parameters that are objects/complex types
|
||||
|
||||
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]
|
||||
|
||||
*Right:*
|
||||
@ -599,6 +604,7 @@ function checkProperties(properties) {
|
||||
[typedef]: http://usejsdoc.org/tags-typedef.html
|
||||
|
||||
## File/module structure
|
||||
|
||||
Typical module should have the following structure:
|
||||
|
||||
1. required dependencies
|
||||
|
Reference in New Issue
Block a user