Skip to content

Commit 7870dbd

Browse files
author
Sönke Kluth
committed
clean code
1 parent 6e7974f commit 7870dbd

File tree

16 files changed

+188
-199
lines changed

16 files changed

+188
-199
lines changed

package.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,9 @@
1717
"react": "15.3.2",
1818
"react-dom": "15.3.2"
1919
},
20+
"eslintConfig": {
21+
"extends": "react-app"
22+
},
2023
"scripts": {
2124
"start": "react-scripts start",
2225
"build": "react-scripts build",

src/controller/CounterCommand.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@ export default class CounterCommand extends SimpleCommand {
1313
case EventNames.SUBVIEW_LOCAL_COUNT:
1414
counter = this.facade.getProxy(CounterProxy.NAME_LOCAL);
1515
break;
16+
default:
17+
break;
1618
}
1719

1820
if (counter) {

src/core/constants/NotificationNames.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ const NotificationNames = {
33
DATA_CHANGE: 'DATA_CHANGE',
44
RENDER: 'RENDER',
55
STARTUP: 'STARTUP',
6-
STARTUP_COMPLETE: 'STARTUP_COMPLETE'
6+
STARTUP_COMPLETE: 'STARTUP_COMPLETE',
77
};
88

99
export default NotificationNames;

src/core/controller/DataChangeCommand.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ export default class DataChangeCommand extends SimpleCommand {
88
localState[note.getType()] = data;
99

1010
const state = this.facade.getState();
11-
if(Object.hasOwnProperty.call(state, note.getType())){
11+
if (Object.hasOwnProperty.call(state, note.getType())) {
1212
this.facade.updateState(localState);
1313
}
1414
}

src/core/controller/StartupCommand.js

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -4,16 +4,16 @@ import { ModelPrepCommand, ViewPrepCommand } from '../../controller/prep-command
44

55
export default class StartupCommand extends MacroCommand {
66

7-
initializeMacroCommand() {
8-
this.addSubCommand(ModelPrepCommand);
9-
this.addSubCommand(ViewPrepCommand);
10-
}
7+
initializeMacroCommand() {
8+
this.addSubCommand(ModelPrepCommand);
9+
this.addSubCommand(ViewPrepCommand);
10+
}
1111

12-
execute(note) {
12+
execute(note) {
1313
// console.log('StartupCommand execute()');
14-
super.execute(note);
15-
this.facade.removeCommand(NotificationNames.STARTUP);
16-
this.facade.send(NotificationNames.RENDER);
17-
}
14+
super.execute(note);
15+
this.facade.removeCommand(NotificationNames.STARTUP);
16+
this.facade.send(NotificationNames.RENDER);
17+
}
1818
}
1919

src/core/controller/StateChangeCommand.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
import { SimpleCommand } from 'pmvc';
2-
import NotificationNames from '../constants/NotificationNames';
32

43
export default class StateChangeCommand extends SimpleCommand {
54
execute(note) {

src/core/utils/shallowEqual.js

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,23 @@
11
export default function shallowEqual(objA, objB) {
22
if (objA === objB) {
3-
return true
3+
return true;
44
}
55

6-
const keysA = Object.keys(objA)
7-
const keysB = Object.keys(objB)
6+
const keysA = Object.keys(objA);
7+
const keysB = Object.keys(objB);
88

99
if (keysA.length !== keysB.length) {
10-
return false
10+
return false;
1111
}
1212

1313
// Test for A's keys different from B.
14-
const hasOwn = Object.prototype.hasOwnProperty
14+
const hasOwn = Object.prototype.hasOwnProperty;
1515
for (let i = 0; i < keysA.length; i++) {
1616
if (!hasOwn.call(objB, keysA[i]) ||
1717
objA[keysA[i]] !== objB[keysA[i]]) {
18-
return false
18+
return false;
1919
}
2020
}
2121

22-
return true
22+
return true;
2323
}

src/core/utils/storeShape.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
import { PropTypes } from 'react'
1+
import { PropTypes } from 'react';
22

33
export default PropTypes.shape({
44
subscribe: PropTypes.func.isRequired,
55
dispatch: PropTypes.func.isRequired,
6-
getState: PropTypes.func.isRequired
7-
})
6+
getState: PropTypes.func.isRequired,
7+
});

src/core/utils/warning.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,14 +7,14 @@
77
export default function warning(message) {
88
/* eslint-disable no-console */
99
if (typeof console !== 'undefined' && typeof console.error === 'function') {
10-
console.error(message)
10+
console.error(message);
1111
}
1212
/* eslint-enable no-console */
1313
try {
1414
// This error was thrown as a convenience so that if you enable
1515
// "break on all exceptions" in your console,
1616
// it would pause the execution at this line.
17-
throw new Error(message)
17+
throw new Error(message);
1818
/* eslint-disable no-empty */
1919
} catch (e) {}
2020
/* eslint-enable no-empty */
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
// import { bindActionCreators } from 'redux'
22

3-
export default function wrapActionCreators(actionCreators){
3+
export default function wrapActionCreators(actionCreators) {
44
console.log('wrapActionCreators', actionCreators);
55
// return dispatch => bindActionCreators(actionCreators, dispatch)
66
}

0 commit comments

Comments
 (0)