Skip to content

Commit f8fc637

Browse files
committed
Turn on 'consistent-return'
1 parent b128097 commit f8fc637

File tree

4 files changed

+5
-7
lines changed

4 files changed

+5
-7
lines changed

.eslintrc

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@
1515
"react/react-in-jsx-scope": 2,
1616
"react/jsx-filename-extension": "off",
1717
"react/sort-comp": "off",
18-
"class-methods-use-this": "off",
19-
"consistent-return": "off"
18+
"class-methods-use-this": "off"
2019
}
2120
}

examples/00 Chessboard/Tutorial App/Board.js

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,9 +28,8 @@ export default class Board extends Component {
2828

2929
renderPiece(x, y) {
3030
const [knightX, knightY] = this.props.knightPosition;
31-
if (x === knightX && y === knightY) {
32-
return <Knight />;
33-
}
31+
const isKnightHere = x === knightX && y === knightY;
32+
return isKnightHere ? <Knight /> : null;
3433
}
3534

3635
render() {

src/createTargetFactory.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ export default function createTargetFactory(spec) {
6262

6363
drop() {
6464
if (!spec.drop) {
65-
return;
65+
return undefined;
6666
}
6767

6868
const dropResult = spec.drop(this.props, this.monitor, this.component);

src/wrapConnectorHooks.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ function wrapHookToRecognizeElement(hook) {
2525
if (!isValidElement(elementOrNode)) {
2626
const node = elementOrNode;
2727
hook(node, options);
28-
return;
28+
return undefined;
2929
}
3030

3131
// If passed a ReactElement, clone it and attach this function as a ref.

0 commit comments

Comments
 (0)