From 790ecbcbb09e28376301b5085e72392d8e040356 Mon Sep 17 00:00:00 2001 From: Aaron Raimist Date: Fri, 26 Oct 2018 22:07:10 -0500 Subject: [PATCH 1/5] Update babel-eslint to 8.1.1 Signed-off-by: Aaron Raimist --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 03311a50e3b..7934cc2bcbf 100644 --- a/package.json +++ b/package.json @@ -101,7 +101,7 @@ "devDependencies": { "babel-cli": "^6.26.0", "babel-core": "^6.26.3", - "babel-eslint": "^6.1.2", + "babel-eslint": "^8.1.1", "babel-loader": "^7.1.5", "babel-plugin-add-module-exports": "^0.2.1", "babel-plugin-transform-async-to-bluebird": "^1.1.1", From 952bdba9791c4c7bd5680c845104dc4f7f2fb96f Mon Sep 17 00:00:00 2001 From: Aaron Raimist Date: Fri, 26 Oct 2018 22:48:11 -0500 Subject: [PATCH 2/5] Update more eslint related packages Signed-off-by: Aaron Raimist --- package.json | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/package.json b/package.json index 7934cc2bcbf..8cd612f84b0 100644 --- a/package.json +++ b/package.json @@ -101,7 +101,7 @@ "devDependencies": { "babel-cli": "^6.26.0", "babel-core": "^6.26.3", - "babel-eslint": "^8.1.1", + "babel-eslint": "^10.0.1", "babel-loader": "^7.1.5", "babel-plugin-add-module-exports": "^0.2.1", "babel-plugin-transform-async-to-bluebird": "^1.1.1", @@ -115,9 +115,9 @@ "babel-preset-react": "^6.24.1", "chokidar": "^1.6.1", "concurrently": "^4.0.1", - "eslint": "^3.13.1", + "eslint": "^5.8.0", "eslint-config-google": "^0.7.1", - "eslint-plugin-babel": "^4.1.2", + "eslint-plugin-babel": "^5.2.1", "eslint-plugin-flowtype": "^2.30.0", "eslint-plugin-react": "^7.7.0", "estree-walker": "^0.5.0", From 49ce4ef117b854eff3ab26ae30a1b336a250532d Mon Sep 17 00:00:00 2001 From: Aaron Raimist Date: Fri, 26 Oct 2018 22:50:35 -0500 Subject: [PATCH 3/5] eslint --fix src/ Signed-off-by: Aaron Raimist --- .eslintignore.errorfiles | 10 --- src/ComposerHistoryManager.js | 1 - src/Entities.js | 1 - src/HtmlUtils.js | 2 +- src/PasswordReset.js | 1 - src/Presence.js | 1 - src/Rooms.js | 3 +- src/ScalarAuthClient.js | 1 - src/SdkConfig.js | 1 - src/UserActivity.js | 1 - src/UserSettingsStore.js | 2 +- src/VelocityBounce.js | 6 +- src/autocomplete/Autocompleter.js | 2 +- src/autocomplete/CommunityProvider.js | 2 +- src/autocomplete/PlainWithPillsSerializer.js | 1 - src/components/structures/BottomLeftMenu.js | 12 +-- .../structures/CompatibilityPage.js | 9 +- src/components/structures/CreateRoom.js | 8 +- src/components/structures/GroupView.js | 2 +- src/components/structures/HomePage.js | 14 ++- src/components/structures/LeftPanel.js | 6 +- src/components/structures/LoggedInView.js | 6 +- src/components/structures/LoginBox.js | 2 +- src/components/structures/RoomDirectory.js | 90 +++++++++---------- src/components/structures/RoomStatusBar.js | 4 +- src/components/structures/RoomView.js | 6 +- src/components/structures/SearchBox.js | 30 +++---- src/components/structures/TimelinePanel.js | 2 +- src/components/structures/UserSettings.js | 2 +- src/components/structures/ViewSource.js | 2 +- src/components/views/avatars/MemberAvatar.js | 2 +- .../GroupInviteTileContextMenu.js | 2 +- .../views/dialogs/ChangelogDialog.js | 10 +-- .../views/dialogs/ChatCreateOrReuseDialog.js | 1 - .../views/directory/NetworkDropdown.js | 10 +-- .../views/elements/DeviceVerifyButtons.js | 2 +- .../views/elements/EditableTextContainer.js | 1 - src/components/views/elements/ImageView.js | 52 ++++++----- .../views/elements/InlineSpinner.js | 10 +-- .../views/elements/PersistedElement.js | 1 - src/components/views/elements/Spinner.js | 12 +-- .../views/elements/TintableSvgButton.js | 1 - src/components/views/globals/MatrixToolbar.js | 2 +- src/components/views/globals/NewVersionBar.js | 10 +-- .../views/globals/UpdateCheckBar.js | 10 +-- .../login/InteractiveAuthEntryComponents.js | 4 +- .../views/room_settings/AliasSettings.js | 4 +- src/components/views/rooms/Autocomplete.js | 1 - .../views/rooms/LinkPreviewWidget.js | 2 +- src/components/views/rooms/MemberInfo.js | 2 +- src/components/views/rooms/MessageComposer.js | 4 +- .../views/rooms/MessageComposerInput.js | 16 ++-- src/components/views/rooms/RoomPreviewBar.js | 2 +- src/components/views/rooms/RoomSettings.js | 14 +-- .../views/settings/Notifications.js | 14 +-- src/notifications/StandardActions.js | 4 +- src/settings/SettingsStore.js | 2 +- src/settings/controllers/SettingController.js | 1 - src/stores/RoomListStore.js | 1 - src/utils/DMRoomMap.js | 2 +- src/utils/DecryptFile.js | 2 +- 61 files changed, 199 insertions(+), 232 deletions(-) diff --git a/.eslintignore.errorfiles b/.eslintignore.errorfiles index 8d0821207a4..0b4266c0b5a 100644 --- a/.eslintignore.errorfiles +++ b/.eslintignore.errorfiles @@ -7,11 +7,8 @@ src/component-index.js src/components/structures/BottomLeftMenu.js src/components/structures/CompatibilityPage.js src/components/structures/CreateRoom.js -src/components/structures/HomePage.js -src/components/structures/LeftPanel.js src/components/structures/LoggedInView.js src/components/structures/login/ForgotPassword.js -src/components/structures/LoginBox.js src/components/structures/MessagePanel.js src/components/structures/NotificationPanel.js src/components/structures/RoomDirectory.js @@ -22,22 +19,17 @@ src/components/structures/SearchBox.js src/components/structures/TimelinePanel.js src/components/structures/UploadBar.js src/components/structures/UserSettings.js -src/components/structures/ViewSource.js src/components/views/avatars/BaseAvatar.js src/components/views/avatars/MemberAvatar.js src/components/views/create_room/RoomAlias.js -src/components/views/dialogs/ChangelogDialog.js src/components/views/dialogs/DeactivateAccountDialog.js src/components/views/dialogs/SetPasswordDialog.js src/components/views/dialogs/UnknownDeviceDialog.js src/components/views/directory/NetworkDropdown.js src/components/views/elements/AddressSelector.js -src/components/views/elements/DeviceVerifyButtons.js src/components/views/elements/DirectorySearchBox.js src/components/views/elements/ImageView.js -src/components/views/elements/InlineSpinner.js src/components/views/elements/MemberEventListSummary.js -src/components/views/elements/Spinner.js src/components/views/elements/TintableSvg.js src/components/views/elements/UserSelector.js src/components/views/globals/MatrixToolbar.js @@ -90,7 +82,6 @@ src/MatrixClientPeg.js src/Modal.js src/notifications/ContentRules.js src/notifications/PushRuleVectorState.js -src/notifications/StandardActions.js src/notifications/VectorPushRulesDefinitions.js src/Notifier.js src/PlatformPeg.js @@ -111,7 +102,6 @@ src/utils/MultiInviter.js src/utils/Receipt.js src/VectorConferenceHandler.js src/Velociraptor.js -src/VelocityBounce.js src/WhoIsTyping.js src/wrappers/withMatrixClient.js test/components/structures/login/Registration-test.js diff --git a/src/ComposerHistoryManager.js b/src/ComposerHistoryManager.js index 0164e6c4cde..ecf773f2e73 100644 --- a/src/ComposerHistoryManager.js +++ b/src/ComposerHistoryManager.js @@ -22,7 +22,6 @@ import _clamp from 'lodash/clamp'; type MessageFormat = 'rich' | 'markdown'; class HistoryItem { - // We store history items in their native format to ensure history is accurate // and then convert them if our RTE has subsequently changed format. value: Value; diff --git a/src/Entities.js b/src/Entities.js index 21abd9c4730..8be1da0db84 100644 --- a/src/Entities.js +++ b/src/Entities.js @@ -78,7 +78,6 @@ class MemberEntity extends Entity { } class UserEntity extends Entity { - constructor(model, showInviteButton, inviteFn) { super(model); this.showInviteButton = Boolean(showInviteButton); diff --git a/src/HtmlUtils.js b/src/HtmlUtils.js index b6a2bd0acb3..e72c0bfe4bb 100644 --- a/src/HtmlUtils.js +++ b/src/HtmlUtils.js @@ -64,7 +64,7 @@ export function containsEmoji(str) { * because we want to include emoji shortnames in title text */ function unicodeToImage(str) { - let replaceWith, unicode, alt, short, fname; + let replaceWith; let unicode; let alt; let short; let fname; const mappedUnicode = emojione.mapUnicodeToShort(); str = str.replace(emojione.regUnicode, function(unicodeChar) { diff --git a/src/PasswordReset.js b/src/PasswordReset.js index 71fc4f6b31b..df51e4d846e 100644 --- a/src/PasswordReset.js +++ b/src/PasswordReset.js @@ -25,7 +25,6 @@ import { _t } from './languageHandler'; * API on the homeserver in question with the new password. */ class PasswordReset { - /** * Configure the endpoints for password resetting. * @param {string} homeserverUrl The URL to the HS which has the account to reset. diff --git a/src/Presence.js b/src/Presence.js index 9367fe35cd3..b1e85e4bc73 100644 --- a/src/Presence.js +++ b/src/Presence.js @@ -23,7 +23,6 @@ const UNAVAILABLE_TIME_MS = 3 * 60 * 1000; // 3 mins const PRESENCE_STATES = ["online", "offline", "unavailable"]; class Presence { - /** * Start listening the user activity to evaluate his presence state. * Any state change will be sent to the Home Server. diff --git a/src/Rooms.js b/src/Rooms.js index e24b8316b36..6f73ea0659f 100644 --- a/src/Rooms.js +++ b/src/Rooms.js @@ -32,7 +32,6 @@ export function getDisplayAliasForRoom(room) { * return the other one. Otherwise, return null. */ export function getOnlyOtherMember(room, myUserId) { - if (room.currentState.getJoinedMemberCount() === 2) { return room.getJoinedMembers().filter(function(m) { return m.userId !== myUserId; @@ -103,7 +102,7 @@ export function guessAndSetDMRoom(room, isDirect) { let newTarget; if (isDirect) { const guessedUserId = guessDMRoomTargetId( - room, MatrixClientPeg.get().getUserId() + room, MatrixClientPeg.get().getUserId(), ); newTarget = guessedUserId; } else { diff --git a/src/ScalarAuthClient.js b/src/ScalarAuthClient.js index 2038430576e..0639e7ceaef 100644 --- a/src/ScalarAuthClient.js +++ b/src/ScalarAuthClient.js @@ -22,7 +22,6 @@ const SdkConfig = require('./SdkConfig'); const MatrixClientPeg = require('./MatrixClientPeg'); class ScalarAuthClient { - constructor() { this.scalarToken = null; } diff --git a/src/SdkConfig.js b/src/SdkConfig.js index 8df725a913f..65982bd6f2b 100644 --- a/src/SdkConfig.js +++ b/src/SdkConfig.js @@ -24,7 +24,6 @@ const DEFAULTS = { }; class SdkConfig { - static get() { return global.mxReactSdkConfig || {}; } diff --git a/src/UserActivity.js b/src/UserActivity.js index b6fae38ed59..c628ab41861 100644 --- a/src/UserActivity.js +++ b/src/UserActivity.js @@ -25,7 +25,6 @@ const CURRENTLY_ACTIVE_THRESHOLD_MS = 2000; * with the app (but at a much lower frequency than mouse move events) */ class UserActivity { - /** * Start listening to user activity */ diff --git a/src/UserSettingsStore.js b/src/UserSettingsStore.js index 5d2af3715fb..b40d0529a22 100644 --- a/src/UserSettingsStore.js +++ b/src/UserSettingsStore.js @@ -87,7 +87,7 @@ export default { device_display_name: address, lang: navigator.language, data: data, - append: true, // We always append for email pushers since we don't want to stop other accounts notifying to the same email address + append: true, // We always append for email pushers since we don't want to stop other accounts notifying to the same email address }); }, }; diff --git a/src/VelocityBounce.js b/src/VelocityBounce.js index 2141b053256..732550cfcb5 100644 --- a/src/VelocityBounce.js +++ b/src/VelocityBounce.js @@ -3,8 +3,10 @@ const Velocity = require('velocity-vector'); // courtesy of https://github.com/julianshapiro/velocity/issues/283 // We only use easeOutBounce (easeInBounce is just sort of nonsensical) function bounce( p ) { - let pow2, - bounce = 4; + let pow2; + + +let bounce = 4; while ( p < ( ( pow2 = Math.pow( 2, --bounce ) ) - 1 ) / 11 ) { // just sets pow2 diff --git a/src/autocomplete/Autocompleter.js b/src/autocomplete/Autocompleter.js index 7f91676cc3a..e7b89fe576d 100644 --- a/src/autocomplete/Autocompleter.js +++ b/src/autocomplete/Autocompleter.js @@ -85,7 +85,7 @@ export default class Autocompleter { provider .getCompletions(query, selection, force) .timeout(PROVIDER_COMPLETION_TIMEOUT) - .reflect() + .reflect(), ), ); diff --git a/src/autocomplete/CommunityProvider.js b/src/autocomplete/CommunityProvider.js index d164fab46a3..b85c09b320b 100644 --- a/src/autocomplete/CommunityProvider.js +++ b/src/autocomplete/CommunityProvider.js @@ -61,7 +61,7 @@ export default class CommunityProvider extends AutocompleteProvider { if (command) { const joinedGroups = cli.getGroups().filter(({myMembership}) => myMembership === 'join'); - const groups = (await Promise.all(joinedGroups.map(async ({groupId}) => { + const groups = (await Promise.all(joinedGroups.map(async({groupId}) => { try { return FlairStore.getGroupProfileCached(cli, groupId); } catch (e) { // if FlairStore failed, fall back to just groupId diff --git a/src/autocomplete/PlainWithPillsSerializer.js b/src/autocomplete/PlainWithPillsSerializer.js index 59cf1bde3b1..09bb3772ac3 100644 --- a/src/autocomplete/PlainWithPillsSerializer.js +++ b/src/autocomplete/PlainWithPillsSerializer.js @@ -26,7 +26,6 @@ import { Block } from 'slate'; */ class PlainWithPillsSerializer { - /* * @param {String} options.pillFormat - either 'md', 'plain', 'id' */ diff --git a/src/components/structures/BottomLeftMenu.js b/src/components/structures/BottomLeftMenu.js index d289ca5da1f..ed8b8a00b75 100644 --- a/src/components/structures/BottomLeftMenu.js +++ b/src/components/structures/BottomLeftMenu.js @@ -33,12 +33,12 @@ module.exports = React.createClass({ }, getInitialState: function() { - return({ - directoryHover : false, - roomsHover : false, + return ({ + directoryHover: false, + roomsHover: false, homeHover: false, - peopleHover : false, - settingsHover : false, + peopleHover: false, + settingsHover: false, }); }, @@ -145,7 +145,7 @@ module.exports = React.createClass({ // Get the label/tooltip to show getLabel: function(label, show) { if (show) { - var RoomTooltip = sdk.getComponent("rooms.RoomTooltip"); + const RoomTooltip = sdk.getComponent("rooms.RoomTooltip"); return ; } }, diff --git a/src/components/structures/CompatibilityPage.js b/src/components/structures/CompatibilityPage.js index 4cbaab3dfa1..3c5005c053f 100644 --- a/src/components/structures/CompatibilityPage.js +++ b/src/components/structures/CompatibilityPage.js @@ -16,18 +16,18 @@ limitations under the License. 'use strict'; -var React = require('react'); +const React = require('react'); import { _t } from '../../languageHandler'; module.exports = React.createClass({ displayName: 'CompatibilityPage', propTypes: { - onAccept: React.PropTypes.func + onAccept: React.PropTypes.func, }, getDefaultProps: function() { return { - onAccept: function() {} // NOP + onAccept: function() {}, // NOP }; }, @@ -36,7 +36,6 @@ module.exports = React.createClass({ }, render: function() { - return (
@@ -69,5 +68,5 @@ module.exports = React.createClass({
); - } + }, }); diff --git a/src/components/structures/CreateRoom.js b/src/components/structures/CreateRoom.js index 2bb9adb5441..a8aac71479e 100644 --- a/src/components/structures/CreateRoom.js +++ b/src/components/structures/CreateRoom.js @@ -36,10 +36,10 @@ module.exports = React.createClass({ }, phases: { - CONFIG: "CONFIG", // We're waiting for user to configure and hit create. - CREATING: "CREATING", // We're sending the request. - CREATED: "CREATED", // We successfully created the room. - ERROR: "ERROR", // There was an error while trying to create room. + CONFIG: "CONFIG", // We're waiting for user to configure and hit create. + CREATING: "CREATING", // We're sending the request. + CREATED: "CREATED", // We successfully created the room. + ERROR: "ERROR", // There was an error while trying to create room. }, getDefaultProps: function() { diff --git a/src/components/structures/GroupView.js b/src/components/structures/GroupView.js index 5d231947028..2c287c1b605 100644 --- a/src/components/structures/GroupView.js +++ b/src/components/structures/GroupView.js @@ -777,7 +777,7 @@ export default React.createClass({ ), button: _t("Leave"), danger: this.state.isUserPrivileged, - onFinished: async (confirmed) => { + onFinished: async(confirmed) => { if (!confirmed) return; this.setState({membershipBusy: true}); diff --git a/src/components/structures/HomePage.js b/src/components/structures/HomePage.js index 457796f5dce..89053b35c75 100644 --- a/src/components/structures/HomePage.js +++ b/src/components/structures/HomePage.js @@ -52,15 +52,14 @@ class HomePage extends React.Component { if (this.props.teamToken && this.props.teamServerUrl) { this.setState({ - iframeSrc: `${this.props.teamServerUrl}/static/${this.props.teamToken}/home.html` + iframeSrc: `${this.props.teamServerUrl}/static/${this.props.teamToken}/home.html`, }); - } - else { + } else { // we use request() to inline the homepage into the react component // so that it can inherit CSS and theming easily rather than mess around // with iframes and trying to synchronise document.stylesheets. - let src = this.props.homePageUrl || 'home.html'; + const src = this.props.homePageUrl || 'home.html'; request( { method: "GET", url: src }, @@ -77,7 +76,7 @@ class HomePage extends React.Component { body = body.replace(/_t\(['"]([\s\S]*?)['"]\)/mg, (match, g1)=>this.translate(g1)); this.setState({ page: body }); - } + }, ); } } @@ -93,8 +92,7 @@ class HomePage extends React.Component {