You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
* Use `a` prefix on declared parameter lists... change all samples and mirror under naming
* Use `www` for Wikipedia ... this allows Wikipedia to choose the language based off browser instead of us.
* Miscellaneous sentence structure enhancement.
* Whitespace adjustment
Applies to OpenUserJS#262
Copy file name to clipboardExpand all lines: STYLEGUIDE.md
+16-9
Original file line number
Diff line number
Diff line change
@@ -1,6 +1,5 @@
1
-
# OpenUserJS.org Style Guide
2
-
3
1
2
+
# OpenUserJS.org Style Guide
4
3
5
4
### Preliminary Notes
6
5
@@ -26,7 +25,7 @@ To help with the above rules, we use [EditorConfig][editorconfig]. Install the p
26
25
27
26
### Variable Declarations
28
27
29
-
All variables should be declared before used. JavaScript does not require this, but doing so makes the program easier to read and makes it easier to detect undeclared variables that may become implied globals. Implied global variables should never be used.
28
+
All variables should be declared before used. JavaScript does not require this by default, but doing so makes the program easier to read and makes it easier to detect undeclared variables that may become implied globals. Implied global variables should never be used.
30
29
Variable declarations without value should be initialized to `null`
31
30
32
31
All variable statements should be the first statements within the function body.
@@ -52,13 +51,14 @@ All functions should be declared, before they are used, after the variable decla
52
51
* There should be one space between the right-parenthesis and the left-curly-brace that begins the statement body.
53
52
* The body itself is indented two spaces.
54
53
* The right-curly-brace is aligned with the line containing the beginning of the function declaration.
54
+
* Declared parameter lists variables should start with a lower case a, which stands for argument, and continue with [camel casing][camelcase]*(except if the phrase is an acronym like HTML)*.
55
55
56
56
```javascript
57
-
functionouter(c, d) {
58
-
var e =c*d;
57
+
functionouter(aC, aD) {
58
+
var e =aC*aD;
59
59
60
-
functioninner(a, b) {
61
-
return (e *a) +b;
60
+
functioninner(aA, aB) {
61
+
return (e *aA) +aB;
62
62
}
63
63
64
64
returninner(0, 1);
@@ -77,7 +77,7 @@ If a function literal is anonymous, there should be one space between the word `
77
77
If the space is omitted, then it can appear that the function's name is `function`, which is incorrect.
78
78
79
79
```javascript
80
-
div.onclick=function (e) {
80
+
div.onclick=function (aE) {
81
81
returnfalse;
82
82
};
83
83
@@ -171,6 +171,13 @@ var rSelector = /^\*|^\.[a-z][\w\d-]*|^#[^ ]+|^[a-z]+|^\[a-z]+/i; // matches a
171
171
var rHTML =/<[^>]+>/; // matches a string of HTML
172
172
```
173
173
174
+
Declared parameter lists variables should start with a lower case a, which stands for argument, and continue with [camel casing][camelcase]*(except if the phrase is an acronym like HTML)*.
175
+
176
+
```javascript
177
+
functionfoo(aName, aValue) {
178
+
}
179
+
```
180
+
174
181
---
175
182
176
183
### Statements
@@ -391,7 +398,7 @@ Read more on the [awful parts of JavaScript][awfulparts].
0 commit comments