From 3b081bda080eceeb05c63e74cf2803821f1330ab Mon Sep 17 00:00:00 2001 From: Christopher Speller Date: Mon, 13 Mar 2017 16:42:25 -0400 Subject: Update eslint (#5752) * Updating eslint * Updating eslint-plugin-react --- webapp/.eslintrc.json | 11 +++++++++++ webapp/components/admin_console/password_settings.jsx | 16 ++++++++-------- webapp/components/channel_header.jsx | 8 ++++---- webapp/components/navbar.jsx | 8 ++++---- webapp/package.json | 4 ++-- webapp/utils/async_client.jsx | 6 +++--- webapp/utils/utils.jsx | 10 +++++----- 7 files changed, 37 insertions(+), 26 deletions(-) (limited to 'webapp') diff --git a/webapp/.eslintrc.json b/webapp/.eslintrc.json index 183df2017..bb4721c22 100644 --- a/webapp/.eslintrc.json +++ b/webapp/.eslintrc.json @@ -37,6 +37,7 @@ "block-scoped-var": 2, "brace-style": [2, "1tbs", { "allowSingleLine": false }], "camelcase": [2, {"properties": "never"}], + "capitalized-comments": 0, "class-methods-use-this": 1, "comma-dangle": [2, "never"], "comma-spacing": [2, {"before": false, "after": true}], @@ -76,9 +77,11 @@ "newline-per-chained-call": 0, "no-alert": 2, "no-array-constructor": 2, + "no-await-in-loop": 2, "no-caller": 2, "no-case-declarations": 2, "no-class-assign": 2, + "no-compare-neg-zero": 2, "no-cond-assign": [2, "except-parens"], "no-confusing-arrow": 2, "no-console": 2, @@ -120,6 +123,7 @@ "no-magic-numbers": [1, { "ignore": [-1, 0, 1, 2], "enforceConst": true, "detectObjects": true } ], "no-mixed-operators": [2, {"allowSamePrecedence": false}], "no-mixed-spaces-and-tabs": 2, + "no-multi-assign": 2, "no-multi-spaces": [2, { "exceptions": { "Property": false } }], "no-multi-str": 0, "no-multiple-empty-lines": [2, {"max": 1}], @@ -181,11 +185,14 @@ "object-shorthand": [2, "always"], "one-var": [2, "never"], "one-var-declaration-per-line": 0, + "operator-assignment": [2, "always"], "operator-linebreak": [2, "after"], "padded-blocks": [2, "never"], "prefer-arrow-callback": 2, "prefer-const": 2, + "prefer-destructuring": 0, "prefer-numeric-literals": 2, + "prefer-promise-reject-errors": 2, "prefer-rest-params": 2, "prefer-spread": 2, "prefer-template": 0, @@ -194,6 +201,7 @@ "radix": 2, "react/display-name": [2, { "ignoreTranspilerName": false }], "react/forbid-component-props": 0, + "react/forbid-elements": [2, { "forbid": ["embed"] }], "react/jsx-boolean-value": [2, "always"], "react/jsx-closing-bracket-location": [2, { "location": "tag-aligned" }], "react/jsx-curly-spacing": [2, "never"], @@ -217,6 +225,7 @@ "react/jsx-uses-react": 2, "react/jsx-uses-vars": 2, "react/jsx-wrap-multilines": 2, + "react/no-array-index-key": 1, "react/no-children-prop": 2, "react/no-danger": 0, "react/no-danger-with-children": 2, @@ -236,11 +245,13 @@ "react/prefer-es6-class": 2, "react/prefer-stateless-function": 0, "react/prop-types": 2, + "react/require-default-props": 0, "react/require-optimization": 1, "react/require-render-return": 2, "react/self-closing-comp": 2, "react/sort-comp": 0, "react/style-prop-object": 2, + "require-await": 2, "require-yield": 2, "rest-spread-spacing": [2, "never"], "semi": [2, "always"], diff --git a/webapp/components/admin_console/password_settings.jsx b/webapp/components/admin_console/password_settings.jsx index 3707977b8..43ec40904 100644 --- a/webapp/components/admin_console/password_settings.jsx +++ b/webapp/components/admin_console/password_settings.jsx @@ -39,16 +39,16 @@ export default class PasswordSettings extends AdminSettings { if (global.window.mm_license.IsLicensed === 'true' && global.window.mm_license.PasswordRequirements === 'true') { let sampleErrorMsgId = 'user.settings.security.passwordError'; if (props.config.PasswordSettings.Lowercase) { - sampleErrorMsgId = sampleErrorMsgId + 'Lowercase'; + sampleErrorMsgId += 'Lowercase'; } if (props.config.PasswordSettings.Uppercase) { - sampleErrorMsgId = sampleErrorMsgId + 'Uppercase'; + sampleErrorMsgId += 'Uppercase'; } if (props.config.PasswordSettings.Number) { - sampleErrorMsgId = sampleErrorMsgId + 'Number'; + sampleErrorMsgId += 'Number'; } if (props.config.PasswordSettings.Symbol) { - sampleErrorMsgId = sampleErrorMsgId + 'Symbol'; + sampleErrorMsgId += 'Symbol'; } this.sampleErrorMsg = ( : - } + } ); const toggleFavorite = ( diff --git a/webapp/components/navbar.jsx b/webapp/components/navbar.jsx index 1ad2f916d..28d8fae05 100644 --- a/webapp/components/navbar.jsx +++ b/webapp/components/navbar.jsx @@ -554,10 +554,10 @@ export default class Navbar extends React.Component { id='channelHeader.removeFromFavorites' defaultMessage='Remove from Favorites' /> : - } + } ); diff --git a/webapp/package.json b/webapp/package.json index 9d61bc125..f0b1b8bb2 100644 --- a/webapp/package.json +++ b/webapp/package.json @@ -48,8 +48,8 @@ "copy-webpack-plugin": "4.0.1", "cross-env": "3.2.3", "css-loader": "0.27.3", - "eslint": "3.10.2", - "eslint-plugin-react": "6.7.1", + "eslint": "3.17.1", + "eslint-plugin-react": "6.10.0", "exports-loader": "0.6.4", "extract-text-webpack-plugin": "2.1.0", "file-loader": "0.10.1", diff --git a/webapp/utils/async_client.jsx b/webapp/utils/async_client.jsx index f4faba934..2ecb0f07d 100644 --- a/webapp/utils/async_client.jsx +++ b/webapp/utils/async_client.jsx @@ -132,7 +132,7 @@ export function getMyChannelMembers() { (err) => { callTracker.getChannelsUnread = 0; dispatchError(err, 'getMyChannelMembers'); - reject(); + reject(new Error('Unable to getMyChannelMembers')); } ); }); @@ -161,7 +161,7 @@ export function getMyChannelMembersForTeam(teamId) { (err) => { callTracker[`getMyChannelMembers${teamId}`] = 0; dispatchError(err, 'getMyChannelMembersForTeam'); - reject(); + reject(new Error('Unable to getMyChannelMembersForTeam')); } ); }); @@ -303,7 +303,7 @@ export function getChannelMember(channelId, userId) { (err) => { callTracker[`getChannelMember${channelId}${userId}`] = 0; dispatchError(err, 'getChannelMember'); - reject(); + reject(new Error('Unable to getChannelMeber')); } ); }); diff --git a/webapp/utils/utils.jsx b/webapp/utils/utils.jsx index 34573a2e5..b4afc65b3 100644 --- a/webapp/utils/utils.jsx +++ b/webapp/utils/utils.jsx @@ -179,7 +179,7 @@ export function displayTime(ticks, utc) { ampm = ' PM'; } - hours = hours % 12; + hours %= 12; if (!hours) { hours = '12'; } @@ -1217,7 +1217,7 @@ export function isValidPassword(password) { error = true; } - errorId = errorId + 'Lowercase'; + errorId += 'Lowercase'; } if (global.window.mm_config.PasswordRequireUppercase === 'true') { @@ -1225,7 +1225,7 @@ export function isValidPassword(password) { error = true; } - errorId = errorId + 'Uppercase'; + errorId += 'Uppercase'; } if (global.window.mm_config.PasswordRequireNumber === 'true') { @@ -1233,7 +1233,7 @@ export function isValidPassword(password) { error = true; } - errorId = errorId + 'Number'; + errorId += 'Number'; } if (global.window.mm_config.PasswordRequireSymbol === 'true') { @@ -1241,7 +1241,7 @@ export function isValidPassword(password) { error = true; } - errorId = errorId + 'Symbol'; + errorId += 'Symbol'; } minimumLength = global.window.mm_config.PasswordMinimumLength; -- cgit v1.2.3-1-g7c22