diff --git a/.eslintrc b/.eslintrc index 7b31cca3b..b472a1535 100755 --- a/.eslintrc +++ b/.eslintrc @@ -28,8 +28,8 @@ "no-alert": 0, "no-lone-blocks": 0, "jsx-quotes": 1, - "react/display-name": [ 1, {"acceptTranspilerName": true }], - "react/forbid-prop-types": [1, {"forbid": "any"}], + "react/display-name": [ 1, {"ignoreTranspilerName": false }], + "react/forbid-prop-types": [1, {"forbid": ["any"]}], "react/jsx-boolean-value": 1, "react/jsx-closing-bracket-location": 0, "react/jsx-curly-spacing": 1, diff --git a/package.json b/package.json index b55e27cd6..837d421e1 100644 --- a/package.json +++ b/package.json @@ -41,9 +41,9 @@ "colors": "1.1.2", "cross-env": "1.0.7", "css-loader": "0.23.1", - "eslint": "1.10.3", - "eslint-loader": "1.2.0", - "eslint-plugin-react": "3.15.0", + "eslint": "2.2.0", + "eslint-loader": "1.3.0", + "eslint-plugin-react": "4.0.0", "extract-text-webpack-plugin": "1.0.1", "file-loader": "0.8.5", "mocha": "2.3.4", diff --git a/src/reducers/fuelSavings.js b/src/reducers/fuelSavings.js index a31e354cf..d15d5a6f3 100644 --- a/src/reducers/fuelSavings.js +++ b/src/reducers/fuelSavings.js @@ -33,17 +33,19 @@ export default function fuelSavingsAppState(state = initialState, action) { return objectAssign({}, state, { dateModified: dateHelper.getFormattedDateTime(new Date()) }); case CALCULATE_FUEL_SAVINGS: - let newState = objectAssign({}, state); - newState[action.fieldName] = action.value; - let calc = calculator(); - newState.necessaryDataIsProvidedToCalculateSavings = calc.necessaryDataIsProvidedToCalculateSavings(newState); - newState.dateModified = dateHelper.getFormattedDateTime(new Date()); + { // limit scope with this code block, to satisfy eslint no-case-declarations rule. + let newState = objectAssign({}, state); + newState[action.fieldName] = action.value; + let calc = calculator(); + newState.necessaryDataIsProvidedToCalculateSavings = calc.necessaryDataIsProvidedToCalculateSavings(newState); + newState.dateModified = dateHelper.getFormattedDateTime(new Date()); - if (newState.necessaryDataIsProvidedToCalculateSavings) { - newState.savings = calc.calculateSavings(newState); - } + if (newState.necessaryDataIsProvidedToCalculateSavings) { + newState.savings = calc.calculateSavings(newState); + } - return newState; + return newState; + } default: return state;