diff --git a/.eslintignore.errorfiles b/.eslintignore.errorfiles index c6f25c2480f..430546d2817 100644 --- a/.eslintignore.errorfiles +++ b/.eslintignore.errorfiles @@ -2,7 +2,6 @@ src/autocomplete/AutocompleteProvider.js src/autocomplete/Autocompleter.js -src/autocomplete/EmojiProvider.js src/autocomplete/UserProvider.js src/component-index.js src/components/structures/BottomLeftMenu.js @@ -17,7 +16,6 @@ src/components/structures/MessagePanel.js src/components/structures/NotificationPanel.js src/components/structures/RoomDirectory.js src/components/structures/RoomStatusBar.js -src/components/structures/RoomSubList.js src/components/structures/RoomView.js src/components/structures/ScrollPanel.js src/components/structures/SearchBox.js @@ -29,7 +27,6 @@ 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/ChatCreateOrReuseDialog.js src/components/views/dialogs/DeactivateAccountDialog.js src/components/views/dialogs/SetPasswordDialog.js src/components/views/dialogs/UnknownDeviceDialog.js @@ -37,7 +34,6 @@ 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/EditableText.js src/components/views/elements/ImageView.js src/components/views/elements/InlineSpinner.js src/components/views/elements/MemberEventListSummary.js @@ -81,7 +77,6 @@ src/components/views/rooms/TopUnreadMessagesBar.js src/components/views/rooms/UserTile.js src/components/views/settings/AddPhoneNumber.js src/components/views/settings/ChangeAvatar.js -src/components/views/settings/ChangeDisplayName.js src/components/views/settings/ChangePassword.js src/components/views/settings/DevicesPanel.js src/components/views/settings/IntegrationsManager.js diff --git a/src/components/structures/RoomSubList.js b/src/components/structures/RoomSubList.js index 025c2b2e083..0b6f7eaa45a 100644 --- a/src/components/structures/RoomSubList.js +++ b/src/components/structures/RoomSubList.js @@ -16,30 +16,24 @@ See the License for the specific language governing permissions and limitations under the License. */ -'use strict'; - -var React = require('react'); -var ReactDOM = require('react-dom'); -var classNames = require('classnames'); -var sdk = require('../../index'); +import React from 'react'; +import classNames from 'classnames'; +import sdk from '../../index'; import { Droppable } from 'react-beautiful-dnd'; import { _t } from '../../languageHandler'; -var dis = require('../../dispatcher'); -var Unread = require('../../Unread'); -var MatrixClientPeg = require('../../MatrixClientPeg'); -var RoomNotifs = require('../../RoomNotifs'); -var FormattingUtils = require('../../utils/FormattingUtils'); -var AccessibleButton = require('../../components/views/elements/AccessibleButton'); -import Modal from '../../Modal'; +import dis from '../../dispatcher'; +import Unread from '../../Unread'; +import * as RoomNotifs from '../../RoomNotifs'; +import * as FormattingUtils from '../../utils/FormattingUtils'; import { KeyCode } from '../../Keyboard'; // turn this on for drop & drag console debugging galore -var debug = false; +const debug = false; const TRUNCATE_AT = 10; -var RoomSubList = React.createClass({ +const RoomSubList = React.createClass({ displayName: 'RoomSubList', debug: debug, @@ -78,8 +72,10 @@ var RoomSubList = React.createClass({ getDefaultProps: function() { return { - onHeaderClick: function() {}, // NOP - onShowMoreRooms: function() {}, // NOP + onHeaderClick: function() { + }, // NOP + onShowMoreRooms: function() { + }, // NOP extraTiles: [], isInvite: false, }; @@ -116,7 +112,7 @@ var RoomSubList = React.createClass({ // The header is collapsable if it is hidden or not stuck // The dataset elements are added in the RoomList _initAndPositionStickyHeaders method isCollapsableOnClick: function() { - var stuck = this.refs.header.dataset.stuck; + const stuck = this.refs.header.dataset.stuck; if (this.state.hidden || stuck === undefined || stuck === "none") { return true; } else { @@ -142,12 +138,12 @@ var RoomSubList = React.createClass({ onClick: function(ev) { if (this.isCollapsableOnClick()) { // The header isCollapsable, so the click is to be interpreted as collapse and truncation logic - var isHidden = !this.state.hidden; - this.setState({ hidden : isHidden }); + const isHidden = !this.state.hidden; + this.setState({hidden: isHidden}); if (isHidden) { // as good a way as any to reset the truncate state - this.setState({ truncateAt : TRUNCATE_AT }); + this.setState({truncateAt: TRUNCATE_AT}); } this.props.onShowMoreRooms(); @@ -162,7 +158,7 @@ var RoomSubList = React.createClass({ dis.dispatch({ action: 'view_room', room_id: roomId, - clear_search: (ev && (ev.keyCode == KeyCode.ENTER || ev.keyCode == KeyCode.SPACE)), + clear_search: (ev && (ev.keyCode === KeyCode.ENTER || ev.keyCode === KeyCode.SPACE)), }); }, @@ -172,17 +168,17 @@ var RoomSubList = React.createClass({ }, _shouldShowMentionBadge: function(roomNotifState) { - return roomNotifState != RoomNotifs.MUTE; + return roomNotifState !== RoomNotifs.MUTE; }, /** * Total up all the notification counts from the rooms * - * @param {Number} If supplied will only total notifications for rooms outside the truncation number + * @param {Number} truncateAt If supplied will only total notifications for rooms outside the truncation number * @returns {Array} The array takes the form [total, highlight] where highlight is a bool */ roomNotificationCount: function(truncateAt) { - var self = this; + const self = this; if (this.props.isInvite) { return [0, true]; @@ -190,9 +186,9 @@ var RoomSubList = React.createClass({ return this.props.list.reduce(function(result, room, index) { if (truncateAt === undefined || index >= truncateAt) { - var roomNotifState = RoomNotifs.getRoomNotifsState(room.roomId); - var highlight = room.getUnreadNotificationCount('highlight') > 0; - var notificationCount = room.getUnreadNotificationCount(); + const roomNotifState = RoomNotifs.getRoomNotifsState(room.roomId); + const highlight = room.getUnreadNotificationCount('highlight') > 0; + const notificationCount = room.getUnreadNotificationCount(); const notifBadges = notificationCount > 0 && self._shouldShowNotifBadge(roomNotifState); const mentionBadges = highlight && self._shouldShowMentionBadge(roomNotifState); @@ -242,29 +238,27 @@ var RoomSubList = React.createClass({ }, _getHeaderJsx: function() { - var TintableSvg = sdk.getComponent("elements.TintableSvg"); - - var subListNotifications = this.roomNotificationCount(); - var subListNotifCount = subListNotifications[0]; - var subListNotifHighlight = subListNotifications[1]; + const subListNotifications = this.roomNotificationCount(); + const subListNotifCount = subListNotifications[0]; + const subListNotifHighlight = subListNotifications[1]; - var totalTiles = this.props.list.length + (this.props.extraTiles || []).length; - var roomCount = totalTiles > 0 ? totalTiles : ''; + const totalTiles = this.props.list.length + (this.props.extraTiles || []).length; + const roomCount = totalTiles > 0 ? totalTiles : ''; - var chevronClasses = classNames({ + const chevronClasses = classNames({ 'mx_RoomSubList_chevron': true, 'mx_RoomSubList_chevronRight': this.state.hidden, 'mx_RoomSubList_chevronDown': !this.state.hidden, }); - var badgeClasses = classNames({ + const badgeClasses = classNames({ 'mx_RoomSubList_badge': true, 'mx_RoomSubList_badgeHighlight': subListNotifHighlight, }); - var badge; + let badge; if (subListNotifCount > 0) { - badge =