|
|
|
@ -32,7 +32,26 @@ To make merging as easy as possible, please keep these rules in mind:
|
|
|
|
### Flot Style Guidelines ###
|
|
|
|
### Flot Style Guidelines ###
|
|
|
|
|
|
|
|
|
|
|
|
Flot follows the [jQuery Core Style Guidelines](http://docs.jquery.com/JQuery_Core_Style_Guidelines),
|
|
|
|
Flot follows the [jQuery Core Style Guidelines](http://docs.jquery.com/JQuery_Core_Style_Guidelines),
|
|
|
|
with the following minor changes:
|
|
|
|
with the following updates and exceptions:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#### Spacing ####
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Do not add horizontal space around parameter lists, loop definitions, or
|
|
|
|
|
|
|
|
array/object indices. For example:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
```js
|
|
|
|
|
|
|
|
for ( var i = 0; i < data.length; i++ ) { // This block is wrong!
|
|
|
|
|
|
|
|
if ( data[ i ] > 1 ) {
|
|
|
|
|
|
|
|
data[ i ] = 2;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
for (var i = 0; i < data.length; i++) { // This block is correct!
|
|
|
|
|
|
|
|
if (data[i] > 1) {
|
|
|
|
|
|
|
|
data[i] = 2;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
|
|
#### Comments ####
|
|
|
|
#### Comments ####
|
|
|
|
|
|
|
|
|
|
|
|
@ -63,11 +82,9 @@ Statements containing complex logic should not be wrapped arbitrarily if they
|
|
|
|
do not exceed 80 characters. For example:
|
|
|
|
do not exceed 80 characters. For example:
|
|
|
|
|
|
|
|
|
|
|
|
```js
|
|
|
|
```js
|
|
|
|
WRONG
|
|
|
|
if (a == 1 && // This block is wrong!
|
|
|
|
if (a == 1 &&
|
|
|
|
|
|
|
|
b == 2 &&
|
|
|
|
b == 2 &&
|
|
|
|
c == 3) {}
|
|
|
|
c == 3) {}
|
|
|
|
|
|
|
|
|
|
|
|
CORRECT
|
|
|
|
if (a == 1 && b == 2 && c == 3) {} // This block is correct!
|
|
|
|
if ( a == 1 && b == 2 && c == 3 ) {}
|
|
|
|
|
|
|
|
```
|
|
|
|
```
|