update examples for style

add link to no-param-reassign rule documentation
This commit is contained in:
Thomas Shafer
2015-12-16 20:21:38 -08:00
parent 2589c67b0c
commit f7971301b0
2 changed files with 9 additions and 8 deletions

View File

@@ -637,24 +637,24 @@ Other Style Guides
```javascript
// bad
function f(a){
function f1(a) {
a = 1;
}
function f(a){
function f2(a) {
if (!a) { a = 1; }
}
function f(obj){
function f3(obj) {
obj.key = 1;
};
// good
function f(a){
const b = (a || 1);
function f4(a) {
const b = a || 1;
}
function f(a = 1){
function f5(a = 1) {
}
function f(obj){
const key = obj.hasOwnProperty('key') ? obj.key ? 1;
function f6(obj) {
const key = Object.prototype.hasOwnProperty.call(obj, 'key') ? obj.key : 1;
};
```

View File

@@ -75,6 +75,7 @@ module.exports = {
'no-octal-escape': 2,
// disallow reassignment of function parameters
// disallow parameter object manipulation
// rule: http://eslint.org/docs/rules/no-param-reassign.html
'no-param-reassign': [2, { 'props': true }],
// disallow use of process.env
'no-process-env': 0,