From 8fd91573fc2c05668a040a672fb0668fd599884e Mon Sep 17 00:00:00 2001 From: Lyubo Marinov Date: Thu, 16 Nov 2017 12:26:14 -0600 Subject: [PATCH] Fix eslint & flow errors Prepares for the latest eslint & flow-related npm packages which cause these errors. --- modules/UI/etherpad/Etherpad.js | 2 +- modules/UI/videolayout/VideoContainer.js | 2 +- modules/devices/mediaDeviceHelper.js | 2 +- modules/translation/translation.js | 2 +- react/features/app/components/AbstractApp.js | 4 +-- .../base/dialog/components/Dialog.native.js | 11 +++++++- .../base/media/components/AbstractAudio.js | 4 ++- .../components/Conference.native.js | 2 +- .../components/ConnectionIndicator.js | 4 +-- .../device-selection/DeviceSelectionPopup.js | 4 +-- react/features/device-selection/actions.js | 4 +-- .../feedback/components/FeedbackDialog.web.js | 4 +-- .../invite/components/InfoDialog.web.js | 4 +-- .../invite/components/InfoDialogButton.web.js | 5 ++-- .../invite/components/InviteButton.web.js | 4 +-- .../components/Notification.web.js | 8 ++++-- .../overlay/components/OverlayContainer.js | 4 +-- .../overlay/components/OverlayFrame.js | 4 +-- .../overlay/components/ReloadTimer.js | 4 +-- .../RemoteControlAuthorizationDialog.js | 8 +++++- .../RemoteVideoMenuTriggerButton.js | 28 +++++++++++-------- 21 files changed, 69 insertions(+), 45 deletions(-) diff --git a/modules/UI/etherpad/Etherpad.js b/modules/UI/etherpad/Etherpad.js index b04edae6c..ddc95b064 100644 --- a/modules/UI/etherpad/Etherpad.js +++ b/modules/UI/etherpad/Etherpad.js @@ -202,7 +202,7 @@ export default class EtherpadManager { } /** - * + * */ isVisible() { return VideoLayout.isLargeContainerTypeVisible(ETHERPAD_CONTAINER_TYPE); diff --git a/modules/UI/videolayout/VideoContainer.js b/modules/UI/videolayout/VideoContainer.js index e13a33d96..d902727ac 100644 --- a/modules/UI/videolayout/VideoContainer.js +++ b/modules/UI/videolayout/VideoContainer.js @@ -588,7 +588,7 @@ export class VideoContainer extends LargeContainer { } /** - * + * */ hide() { // as the container is hidden/replaced by another container diff --git a/modules/devices/mediaDeviceHelper.js b/modules/devices/mediaDeviceHelper.js index 9de55db83..787ddfd67 100644 --- a/modules/devices/mediaDeviceHelper.js +++ b/modules/devices/mediaDeviceHelper.js @@ -237,7 +237,7 @@ export default { } /** - * + * */ function createVideoTrack(showError) { return ( diff --git a/modules/translation/translation.js b/modules/translation/translation.js index 459d592fc..460b0f263 100644 --- a/modules/translation/translation.js +++ b/modules/translation/translation.js @@ -68,7 +68,7 @@ class Translation { } /** - * + * */ translateElement(selector: Object, options: Object) { // XXX i18next expects undefined if options are missing. diff --git a/react/features/app/components/AbstractApp.js b/react/features/app/components/AbstractApp.js index d0ad7d73d..138b000cc 100644 --- a/react/features/app/components/AbstractApp.js +++ b/react/features/app/components/AbstractApp.js @@ -1,3 +1,5 @@ +/* global APP */ + import PropTypes from 'prop-types'; import React, { Component } from 'react'; import { I18nextProvider } from 'react-i18next'; @@ -17,8 +19,6 @@ import { BlankPage } from '../../welcome'; import { appNavigate, appWillMount, appWillUnmount } from '../actions'; -declare var APP: Object; - /** * The default URL to open if no other was specified to {@code AbstractApp} * via props. diff --git a/react/features/base/dialog/components/Dialog.native.js b/react/features/base/dialog/components/Dialog.native.js index 3fc2a55aa..0e00e3164 100644 --- a/react/features/base/dialog/components/Dialog.native.js +++ b/react/features/base/dialog/components/Dialog.native.js @@ -1,3 +1,5 @@ +// @flow + import PropTypes from 'prop-types'; import React from 'react'; import { Modal, StyleSheet, TextInput } from 'react-native'; @@ -105,6 +107,8 @@ class Dialog extends AbstractDialog { void; + _onChangeText: (string) => void; /** @@ -254,6 +260,8 @@ class Dialog extends AbstractDialog { this.setState({ text }); } + _onSubmit: (?string) => void; + /** * Submits this {@code Dialog} with the value of the {@link TextInput} * rendered by {@link Prompt} unless a value is explicitly specified. @@ -263,6 +271,7 @@ class Dialog extends AbstractDialog { * @returns {void} */ _onSubmit(value: ?string) { + // $FlowFixMeState super._onSubmit(value || this.state.text); } } diff --git a/react/features/base/media/components/AbstractAudio.js b/react/features/base/media/components/AbstractAudio.js index da524e5e4..1635c1b24 100644 --- a/react/features/base/media/components/AbstractAudio.js +++ b/react/features/base/media/components/AbstractAudio.js @@ -1,3 +1,5 @@ +// @flow + import PropTypes from 'prop-types'; import React, { Component } from 'react'; @@ -5,7 +7,7 @@ import React, { Component } from 'react'; * The React {@link Component} which is similar to Web's * {@code HTMLAudioElement}. */ -export default class AbstractAudio extends Component { +export default class AbstractAudio extends Component<*> { /** * The (reference to the) {@link ReactElement} which actually implements * this {@code AbstractAudio}. diff --git a/react/features/conference/components/Conference.native.js b/react/features/conference/components/Conference.native.js index 81f4e0ea0..2d0ed8e7f 100644 --- a/react/features/conference/components/Conference.native.js +++ b/react/features/conference/components/Conference.native.js @@ -339,7 +339,7 @@ function _mapDispatchToProps(dispatch) { * @returns {void} * @private */ - _setToolboxVisible(visible: boolean) { + _setToolboxVisible(visible) { dispatch(setToolboxVisible(visible)); } }; diff --git a/react/features/connection-indicator/components/ConnectionIndicator.js b/react/features/connection-indicator/components/ConnectionIndicator.js index 852f7101e..ccd8a6316 100644 --- a/react/features/connection-indicator/components/ConnectionIndicator.js +++ b/react/features/connection-indicator/components/ConnectionIndicator.js @@ -1,3 +1,5 @@ +/* global interfaceConfig */ + import PropTypes from 'prop-types'; import React, { Component } from 'react'; @@ -8,8 +10,6 @@ import { ConnectionStatsTable } from '../../connection-stats'; import statsEmitter from '../statsEmitter'; -declare var interfaceConfig: Object; - /** * The connection quality percentage that must be reached to be considered of * good quality and can result in the connection indicator being hidden. diff --git a/react/features/device-selection/DeviceSelectionPopup.js b/react/features/device-selection/DeviceSelectionPopup.js index 6c91e590c..98a5a0b2f 100644 --- a/react/features/device-selection/DeviceSelectionPopup.js +++ b/react/features/device-selection/DeviceSelectionPopup.js @@ -1,3 +1,5 @@ +/* global JitsiMeetJS */ + import Logger from 'jitsi-meet-logger'; import React from 'react'; import ReactDOM from 'react-dom'; @@ -11,8 +13,6 @@ import { parseURLParams } from '../base/config'; import DeviceSelectionDialogBase from './components/DeviceSelectionDialogBase'; -declare var JitsiMeetJS: Object; - const logger = Logger.getLogger(__filename); /** diff --git a/react/features/device-selection/actions.js b/react/features/device-selection/actions.js index 25a3ee403..cdfa09a59 100644 --- a/react/features/device-selection/actions.js +++ b/react/features/device-selection/actions.js @@ -132,8 +132,8 @@ function _openDeviceSelectionDialogInPopup() { * @param {Function} responseCallback - The callback that will send the * response. * @returns {boolean} - */ // eslint-disable-next-line max-params -function _processRequest(dispatch, getState, request, responseCallback) { + */ +function _processRequest(dispatch, getState, request, responseCallback) { // eslint-disable-line max-len, max-params if (request.type === 'devices') { switch (request.name) { case 'isDeviceListAvailable': diff --git a/react/features/feedback/components/FeedbackDialog.web.js b/react/features/feedback/components/FeedbackDialog.web.js index affe0eb74..587094489 100644 --- a/react/features/feedback/components/FeedbackDialog.web.js +++ b/react/features/feedback/components/FeedbackDialog.web.js @@ -1,3 +1,5 @@ +/* global interfaceConfig */ + import StarIcon from '@atlaskit/icon/glyph/star'; import StarFilledIcon from '@atlaskit/icon/glyph/star-filled'; import PropTypes from 'prop-types'; @@ -10,8 +12,6 @@ import { translate } from '../../base/i18n'; import { cancelFeedback, submitFeedback } from '../actions'; -declare var interfaceConfig: Object; - const scoreAnimationClass = interfaceConfig.ENABLE_FEEDBACK_ANIMATION ? 'shake-rotate' : ''; diff --git a/react/features/invite/components/InfoDialog.web.js b/react/features/invite/components/InfoDialog.web.js index 4d669cb5e..9be57ee0e 100644 --- a/react/features/invite/components/InfoDialog.web.js +++ b/react/features/invite/components/InfoDialog.web.js @@ -1,3 +1,5 @@ +/* global interfaceConfig */ + import React, { Component } from 'react'; import { connect } from 'react-redux'; import PropTypes from 'prop-types'; @@ -10,8 +12,6 @@ import AddPeopleDialog from './AddPeopleDialog'; const logger = require('jitsi-meet-logger').getLogger(__filename); -declare var interfaceConfig: Object; - /** * A React Component with the contents for a dialog that shows information about * the current conference and provides ways to invite other participants. diff --git a/react/features/invite/components/InfoDialogButton.web.js b/react/features/invite/components/InfoDialogButton.web.js index a2817a185..7cf0ffa0f 100644 --- a/react/features/invite/components/InfoDialogButton.web.js +++ b/react/features/invite/components/InfoDialogButton.web.js @@ -1,3 +1,5 @@ +/* global interfaceConfig */ + import InlineDialog from '@atlaskit/inline-dialog'; import PropTypes from 'prop-types'; import React, { Component } from 'react'; @@ -6,11 +8,8 @@ import { connect } from 'react-redux'; import { ToolbarButton, TOOLTIP_TO_POPUP_POSITION } from '../../toolbox'; import { setInfoDialogVisibility } from '../actions'; - import InfoDialog from './InfoDialog'; -declare var interfaceConfig: Object; - const { INITIAL_TOOLBAR_TIMEOUT } = interfaceConfig; /** diff --git a/react/features/invite/components/InviteButton.web.js b/react/features/invite/components/InviteButton.web.js index 4940e1859..b2ac681ff 100644 --- a/react/features/invite/components/InviteButton.web.js +++ b/react/features/invite/components/InviteButton.web.js @@ -1,3 +1,5 @@ +/* global interfaceConfig */ + import PropTypes from 'prop-types'; import React, { Component } from 'react'; import { connect } from 'react-redux'; @@ -12,8 +14,6 @@ import { AddPeopleDialog, InviteDialog } from '.'; import { DialOutDialog } from '../../dial-out'; import { isInviteOptionEnabled, getInviteOptionPosition } from '../functions'; -declare var interfaceConfig: Object; - const SHARE_LINK_OPTION = 'invite'; const DIAL_OUT_OPTION = 'dialout'; const ADD_TO_CALL_OPTION = 'addtocall'; diff --git a/react/features/notifications/components/Notification.web.js b/react/features/notifications/components/Notification.web.js index a1c542c60..2f5308e85 100644 --- a/react/features/notifications/components/Notification.web.js +++ b/react/features/notifications/components/Notification.web.js @@ -1,9 +1,11 @@ +// @flow + import Flag from '@atlaskit/flag'; import EditorInfoIcon from '@atlaskit/icon/glyph/editor/info'; -import PropTypes from 'prop-types'; import ErrorIcon from '@atlaskit/icon/glyph/error'; import WarningIcon from '@atlaskit/icon/glyph/warning'; import { colors } from '@atlaskit/theme'; +import PropTypes from 'prop-types'; import React, { Component } from 'react'; import { translate } from '../../base/i18n'; @@ -30,7 +32,7 @@ const ICON_COLOR = { * * @extends Component */ -class Notification extends Component { +class Notification extends Component<*> { /** * Default values for {@code Notification} component's properties. * @@ -163,6 +165,8 @@ class Notification extends Component { ); } + _onDismissed: () => void; + /** * Calls back into {@code FlagGroup} to dismiss the notification. * diff --git a/react/features/overlay/components/OverlayContainer.js b/react/features/overlay/components/OverlayContainer.js index a93831d22..526ed0ca7 100644 --- a/react/features/overlay/components/OverlayContainer.js +++ b/react/features/overlay/components/OverlayContainer.js @@ -1,3 +1,5 @@ +/* global interfaceConfig */ + import PropTypes from 'prop-types'; import React, { Component } from 'react'; import { connect } from 'react-redux'; @@ -12,8 +14,6 @@ import UserMediaPermissionsFilmstripOnlyOverlay from './UserMediaPermissionsFilmstripOnlyOverlay'; import UserMediaPermissionsOverlay from './UserMediaPermissionsOverlay'; -declare var interfaceConfig: Object; - /** * Implements a React Component that will display the correct overlay when * needed. diff --git a/react/features/overlay/components/OverlayFrame.js b/react/features/overlay/components/OverlayFrame.js index 69cdfc64e..03041a433 100644 --- a/react/features/overlay/components/OverlayFrame.js +++ b/react/features/overlay/components/OverlayFrame.js @@ -1,8 +1,8 @@ +/* global interfaceConfig */ + import PropTypes from 'prop-types'; import React, { Component } from 'react'; -declare var interfaceConfig: Object; - /** * Implements a React Component for the frame of the overlays. */ diff --git a/react/features/overlay/components/ReloadTimer.js b/react/features/overlay/components/ReloadTimer.js index 3fa5d73d9..da0b31fd8 100644 --- a/react/features/overlay/components/ReloadTimer.js +++ b/react/features/overlay/components/ReloadTimer.js @@ -1,10 +1,10 @@ +/* global AJS */ + import PropTypes from 'prop-types'; import React, { Component } from 'react'; import { translate } from '../../base/i18n'; -declare var AJS: Object; - /** * Implements a React Component for the reload timer. Starts counter from * props.start, adds props.step to the current value on every props.interval diff --git a/react/features/remote-control/components/RemoteControlAuthorizationDialog.js b/react/features/remote-control/components/RemoteControlAuthorizationDialog.js index a2682fae7..8bda33bca 100644 --- a/react/features/remote-control/components/RemoteControlAuthorizationDialog.js +++ b/react/features/remote-control/components/RemoteControlAuthorizationDialog.js @@ -1,3 +1,5 @@ +// @flow + import PropTypes from 'prop-types'; import React, { Component } from 'react'; import { connect } from 'react-redux'; @@ -11,7 +13,7 @@ declare var APP: Object; /** * Implements a dialog for remote control authorization. */ -class RemoteControlAuthorizationDialog extends Component { +class RemoteControlAuthorizationDialog extends Component<*> { /** * RemoteControlAuthorizationDialog component's property types. * @@ -105,6 +107,8 @@ class RemoteControlAuthorizationDialog extends Component { ); } + _onCancel: () => boolean; + /** * Notifies the remote control module about the denial of the remote control * request. @@ -119,6 +123,8 @@ class RemoteControlAuthorizationDialog extends Component { return true; } + _onSubmit: () => boolean; + /** * Notifies the remote control module that the remote control request is * accepted. diff --git a/react/features/remote-video-menu/components/RemoteVideoMenuTriggerButton.js b/react/features/remote-video-menu/components/RemoteVideoMenuTriggerButton.js index d83352294..f66309ecc 100644 --- a/react/features/remote-video-menu/components/RemoteVideoMenuTriggerButton.js +++ b/react/features/remote-video-menu/components/RemoteVideoMenuTriggerButton.js @@ -1,3 +1,5 @@ +// @flow + import PropTypes from 'prop-types'; import React, { Component } from 'react'; @@ -20,7 +22,7 @@ declare var interfaceConfig: Object; * * @extends {Component} */ -class RemoteVideoMenuTriggerButton extends Component { +class RemoteVideoMenuTriggerButton extends Component<*> { static propTypes = { /** * A value between 0 and 1 indicating the volume of the participant's @@ -66,25 +68,25 @@ class RemoteVideoMenuTriggerButton extends Component { remoteControlState: PropTypes.number }; + /** + * The internal reference to topmost DOM/HTML element backing the React + * {@code Component}. Accessed directly for associating an element as + * the trigger for a popover. + * + * @private + * @type {HTMLDivElement} + */ + _rootElement = null; + /** * Initializes a new {#@code RemoteVideoMenuTriggerButton} instance. * * @param {Object} props - The read-only properties with which the new * instance is to be initialized. */ - constructor(props) { + constructor(props: Object) { super(props); - /** - * The internal reference to topmost DOM/HTML element backing the React - * {@code Component}. Accessed directly for associating an element as - * the trigger for a popover. - * - * @private - * @type {HTMLDivElement} - */ - this._rootElement = null; - // Bind event handler so it is only bound once for every instance. this._onShowRemoteMenu = this._onShowRemoteMenu.bind(this); } @@ -118,6 +120,8 @@ class RemoteVideoMenuTriggerButton extends Component { ); } + _onShowRemoteMenu: () => void; + /** * Opens the {@code RemoteVideoMenu}. *