Skip to content

Commit f797130

Browse files
committed
update examples for style
add link to no-param-reassign rule documentation
1 parent 2589c67 commit f797130

2 files changed

Lines changed: 9 additions & 8 deletions

File tree

README.md

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -637,24 +637,24 @@ Other Style Guides
637637
638638
```javascript
639639
// bad
640-
function f(a){
640+
function f1(a) {
641641
a = 1;
642642
}
643-
function f(a){
643+
function f2(a) {
644644
if (!a) { a = 1; }
645645
}
646-
function f(obj){
646+
function f3(obj) {
647647
obj.key = 1;
648648
};
649649

650650
// good
651-
function f(a){
652-
const b = (a || 1);
651+
function f4(a) {
652+
const b = a || 1;
653653
}
654-
function f(a = 1){
654+
function f5(a = 1) {
655655
}
656-
function f(obj){
657-
const key = obj.hasOwnProperty('key') ? obj.key ? 1;
656+
function f6(obj) {
657+
const key = Object.prototype.hasOwnProperty.call(obj, 'key') ? obj.key : 1;
658658
};
659659
```
660660

packages/eslint-config-airbnb/rules/best-practices.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,7 @@ module.exports = {
7575
'no-octal-escape': 2,
7676
// disallow reassignment of function parameters
7777
// disallow parameter object manipulation
78+
// rule: http://eslint.org/docs/rules/no-param-reassign.html
7879
'no-param-reassign': [2, { 'props': true }],
7980
// disallow use of process.env
8081
'no-process-env': 0,

0 commit comments

Comments
 (0)