diff --git a/.eslintrc.js b/.eslintrc.js index 57231e2c8043a35938759b1efb62f6e994a0f813..292b7e0608a754486dcc1f1519295ab775c5590b 100755 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -22,7 +22,6 @@ module.exports = { 'jsx-a11y/click-events-have-key-events': 0, 'jsx-a11y/no-static-element-interactions': 0, 'jsx-a11y/anchor-is-valid': 0, - 'consistent-return': 0, }, settings: { polyfills: ['fetch', 'promises'], diff --git a/mock/api.js b/mock/api.js index 2bcdd8bb3a904e3f892eaccfaa08904f09fe4ea2..a1ffa76ed843cff9f0f447602c3d89a780c6bbbc 100644 --- a/mock/api.js +++ b/mock/api.js @@ -118,12 +118,7 @@ function getFakeList(req, res) { const result = fakeList(count); sourceData = result; - - if (res && res.json) { - res.json(result); - } else { - return result; - } + res.json(result); } function postFakeList(req, res) { @@ -155,11 +150,7 @@ function postFakeList(req, res) { break; } - if (res && res.json) { - res.json(result); - } else { - return result; - } + res.json(result); } const getNotice = [ @@ -327,11 +318,7 @@ const getActivities = [ ]; function getFakeCaptcha(req, res) { - if (res && res.json) { - res.json('captcha-xxx'); - } else { - return 'captcha-xxx'; - } + res.json('captcha-xxx'); } export default { diff --git a/mock/rule.js b/mock/rule.js index ea1b0fac375ec2aeaee272a29f287d0538361b37..eaa2bede531715c91aa02180efe57afc1e308d97 100644 --- a/mock/rule.js +++ b/mock/rule.js @@ -72,11 +72,7 @@ function getRule(req, res, u) { }, }; - if (res && res.json) { - res.json(result); - } else { - return result; - } + res.json(result); } function postRule(req, res, u, b) { @@ -133,11 +129,7 @@ function postRule(req, res, u, b) { }, }; - if (res && res.json) { - res.json(result); - } else { - return result; - } + res.json(result); } export default { diff --git a/src/pages/Dashboard/Analysis.js b/src/pages/Dashboard/Analysis.js index b7f7e6ba5060d494a10230fcc1b28e8d23144177..4ba2f017750d5fa09f059a8c954005693b0822f2 100644 --- a/src/pages/Dashboard/Analysis.js +++ b/src/pages/Dashboard/Analysis.js @@ -132,7 +132,7 @@ class Analysis extends Component { const { rangePickerValue } = this.state; const value = getTimeDistance(type); if (!rangePickerValue[0] || !rangePickerValue[1]) { - return; + return undefined; } if ( rangePickerValue[0].isSame(value[0], 'day') && @@ -140,6 +140,7 @@ class Analysis extends Component { ) { return styles.currentDate; } + return undefined; } render() { diff --git a/src/utils/utils.js b/src/utils/utils.js index e9c515145d200753889827d075e6f9624e032f1b..a506dd03413175bcd1d10cade1b7508b9997be8a 100644 --- a/src/utils/utils.js +++ b/src/utils/utils.js @@ -52,6 +52,7 @@ export function getTimeDistance(type) { return [moment(`${year}-01-01 00:00:00`), moment(`${year}-12-31 23:59:59`)]; } + return undefined; } export function getPlainNode(nodeList, parentPath = '') {