diff --git a/.eslintrc b/.eslintrc index 57cc6d6..bdb67dc 100644 --- a/.eslintrc +++ b/.eslintrc @@ -5,6 +5,7 @@ env: extends: - eslint:recommended + - plugin:react/recommended globals: unsafeWindow: false @@ -19,8 +20,6 @@ plugins: root: true rules: - react/jsx-uses-react: 1 - react/jsx-uses-vars: 1 eqeqeq: 2 indent: [2, 2] diff --git a/components/app-view.js b/components/app-view.js index acb75bc..0965244 100644 --- a/components/app-view.js +++ b/components/app-view.js @@ -4,7 +4,7 @@ const PlayerView = require('./player-view'); const LoadingView = require('./loading-view'); const ErrorView = require('./error-view'); -module.exports = class AppView extends React.Component { +class AppView extends React.Component { render() { return (
@@ -19,3 +19,10 @@ module.exports = class AppView extends React.Component { ); } } + +AppView.propTypes = { + error: React.PropTypes.bool, + loaded: React.PropTypes.bool +}; + +module.exports = AppView; diff --git a/components/error-view.js b/components/error-view.js index 4fcbb25..d27603f 100644 --- a/components/error-view.js +++ b/components/error-view.js @@ -4,7 +4,7 @@ const sendToAddon = require('../client-lib/send-to-addon'); const sendMetricsEvent = require('../client-lib/send-metrics-event'); const GeneralControls = require('./general-controls'); -module.exports = class ErrorView extends React.Component { +class ErrorView extends React.Component { constructor(props) { super(props); this.state = {hovered: false}; @@ -56,3 +56,13 @@ module.exports = class ErrorView extends React.Component { ); } } + +ErrorView.propTypes = { + id: React.PropTypes.string, + tabId: React.PropTypes.number, + domain: React.PropTypes.string, + strings: React.PropTypes.object, + minimized: React.PropTypes.bool +}; + +module.exports = ErrorView; diff --git a/components/general-controls.js b/components/general-controls.js index 420b977..2c2f404 100644 --- a/components/general-controls.js +++ b/components/general-controls.js @@ -3,7 +3,7 @@ const cn = require('classnames'); const ReactTooltip = require('react-tooltip'); const emitter = require('../client-lib/emitter'); -module.exports = class GeneralControls extends React.Component { +class GeneralControls extends React.Component { close() { emitter.emit('close'); } @@ -42,3 +42,10 @@ module.exports = class GeneralControls extends React.Component { ); } } + +GeneralControls.propTypes = { + strings: React.PropTypes.object, + minimized: React.PropTypes.bool +}; + +module.exports = GeneralControls; diff --git a/components/loading-view.js b/components/loading-view.js index a20cf4d..9f28f0d 100644 --- a/components/loading-view.js +++ b/components/loading-view.js @@ -2,7 +2,7 @@ const React = require('react'); const cn = require('classnames'); const GeneralControls = require('./general-controls'); -module.exports = class LoadingView extends React.Component { +class LoadingView extends React.Component { constructor(props) { super(props); this.state = {hovered: false}; @@ -30,3 +30,10 @@ module.exports = class LoadingView extends React.Component { ); } } + +LoadingView.propTypes = { + strings: React.PropTypes.object, + minimized: React.PropTypes.bool +}; + +module.exports = LoadingView; diff --git a/components/player-controls.js b/components/player-controls.js index 00a6d9b..2acba62 100644 --- a/components/player-controls.js +++ b/components/player-controls.js @@ -6,7 +6,7 @@ const appData = require('../client-lib/app-data'); const GeneralControls = require('./general-controls'); -module.exports = class PlayerControls extends React.Component { +class PlayerControls extends React.Component { constructor(props) { super(props); this.state = {showVolume: false}; @@ -111,3 +111,15 @@ module.exports = class PlayerControls extends React.Component { ); } } + +PlayerControls.propTypes = { + muted: React.PropTypes.bool, + exited: React.PropTypes.bool, + volume: React.PropTypes.number, + playing: React.PropTypes.bool, + hovered: React.PropTypes.bool, + strings: React.PropTypes.object, + minimized: React.PropTypes.bool, +}; + +module.exports = PlayerControls; diff --git a/components/player-view.js b/components/player-view.js index 33dd844..8753020 100644 --- a/components/player-view.js +++ b/components/player-view.js @@ -4,7 +4,7 @@ const PlayerControls = require('../components/player-controls'); const ReplayView = require('../components/replay-view'); const Progress = require('../components/progress'); -module.exports = class Player extends React.Component { +class Player extends React.Component { constructor(props) { super(props); this.state = {hovered: false}; @@ -108,13 +108,13 @@ module.exports = class Player extends React.Component { const noop = () => false; const audioEl = this.props.player === 'audio' ? - () : null; const visualEl = audioEl ? audioEl : (this.props.player === 'youtube') ? (