Eslint autofix

This commit is contained in:
James Barnsley
2021-03-23 21:21:00 +13:00
parent 7dd6e80315
commit 1ce85499f9
114 changed files with 675 additions and 813 deletions

View File

@ -189,7 +189,7 @@ class Artist extends React.Component {
const {
albumsFilter: filter,
} = this.state;
let {
const {
tracks,
related_artists,
} = artist;
@ -405,7 +405,7 @@ class Artist extends React.Component {
<Thumbnail size="huge" canZoom fill images={image} />
</div>
);
}
},
);
return (

View File

@ -1,4 +1,3 @@
import React from 'react';
import { connect } from 'react-redux';
import { bindActionCreators } from 'redux';
@ -91,7 +90,7 @@ class Playlist extends React.Component {
setWindowTitle = (playlist = this.props.playlist) => {
const { uiActions: { setWindowTitle } } = this.props;
setWindowTitle(
playlist ? i18n('playlist.title_window', { name: playlist.name }) : i18n('playlist.title')
playlist ? i18n('playlist.title_window', { name: playlist.name }) : i18n('playlist.title'),
);
}

View File

@ -48,7 +48,7 @@ const Artwork = ({
</Thumbnail>
</div>
);
}
};
class Queue extends React.Component {
componentDidMount() {
@ -130,7 +130,7 @@ class Queue extends React.Component {
let addedFromItems = [];
// Radio nests it's seed URIs in an encoded URI format
switch (uri_type){
switch (uri_type) {
case 'radio':
addedFromItems = indexToArray(items, getFromUri('seeds', added_from_uri));
break;

View File

@ -1,4 +1,3 @@
import React from 'react';
import { connect } from 'react-redux';
import { bindActionCreators } from 'redux';

View File

@ -1,4 +1,3 @@
import React from 'react';
import { connect } from 'react-redux';
import { bindActionCreators } from 'redux';

View File

@ -1,4 +1,3 @@
import React from 'react';
import { connect } from 'react-redux';
import { bindActionCreators } from 'redux';
@ -66,7 +65,7 @@ class Settings extends React.Component {
set,
},
} = this.props;
const shortName = name.replace('mopidy_','');
const shortName = name.replace('mopidy_', '');
set({ [shortName]: value });
this.setState({ [name]: value });
}
@ -278,7 +277,7 @@ class Settings extends React.Component {
onChange={() => uiActions.set({ hotkeys_enabled: !ui.hotkeys_enabled })}
/>
<span className="label">
<I18n path="settings.interface.behavior.hotkeys" />
<I18n path="settings.interface.behavior.hotkeys" />
</span>
</label>
<label>

View File

@ -31,8 +31,7 @@ const LyricsSelector = ({
lyrics_path,
} = {},
getTrackLyrics,
}) => {
}) => {
if (lyrics_results === undefined || lyrics_results === null) return null;
if (lyrics_results.length <= 0) {
return (
@ -66,7 +65,7 @@ const LyricsSelector = ({
</div>
</div>
);
}
};
const LyricsContent = ({
authorized,
@ -87,7 +86,7 @@ const LyricsContent = ({
.
</p>
);
};
}
if (!lyrics) return null;
return (
@ -105,33 +104,31 @@ const LyricsContent = ({
</div>
</div>
);
}
};
const Lyrics = ({
loading,
authorized,
track,
getTrackLyrics,
}) => {
return (
<>
<h4>
<I18n path="track.lyrics" />
{loading && <Loader loading mini />}
</h4>
}) => (
<>
<h4>
<I18n path="track.lyrics" />
{loading && <Loader loading mini />}
</h4>
<LyricsSelector
getTrackLyrics={getTrackLyrics}
authorized={authorized}
track={track}
/>
<LyricsContent
track={track}
authorized={authorized}
/>
</>
);
}
<LyricsSelector
getTrackLyrics={getTrackLyrics}
authorized={authorized}
track={track}
/>
<LyricsContent
track={track}
authorized={authorized}
/>
</>
);
class Track extends React.Component {
componentDidMount() {
@ -223,7 +220,7 @@ class Track extends React.Component {
uiActions,
genius_authorized,
geniusActions: {
getTrackLyrics
getTrackLyrics,
},
loadingLyrics,
} = this.props;

View File

@ -242,7 +242,7 @@ class Discover extends React.Component {
let uri = 'iris:discover';
if (seeds) {
uri += ':';
for (var i = 0; i < seeds.length; i++) {
for (let i = 0; i < seeds.length; i++) {
if (i > 0) {
uri += ',';
}
@ -363,22 +363,22 @@ class Discover extends React.Component {
}
return (
<div className={`seed${seed.images ? ' has-thumbnail' : ''}`} key={seed.uri}>
{images && (
<URILink className="thumbnail-wrapper" type={type} uri={seed.uri}>
<Thumbnail images={images} circle={seed.type === 'artist'} size="small" />
</URILink>
)}
<div className="seed__details">
<div className="seed__label">
<span className="seed__label__text">{titleCase(type)}</span>
<Icon name="close" className="seed__label__remove" onClick={() => this.removeSeed(index)} />
</div>
<div className="seed__label__name">{seed.name}</div>
</div>
</div>
<div className={`seed${seed.images ? ' has-thumbnail' : ''}`} key={seed.uri}>
{images && (
<URILink className="thumbnail-wrapper" type={type} uri={seed.uri}>
<Thumbnail images={images} circle={seed.type === 'artist'} size="small" />
</URILink>
)}
<div className="seed__details">
<div className="seed__label">
<span className="seed__label__text">{titleCase(type)}</span>
<Icon name="close" className="seed__label__remove" onClick={() => this.removeSeed(index)} />
</div>
<div className="seed__label__name">{seed.name}</div>
</div>
</div>
);
})
})
}
</div>
);
@ -514,7 +514,7 @@ class Discover extends React.Component {
tunabilities,
seeds,
} = this.state;
const is_loading = isLoading(load_queue, ['spotify_recommendations']);
const addable_tunabilities = [];
for (const key in this.state.tunabilities) {

View File

@ -248,7 +248,7 @@ class LibraryArtists extends React.Component {
<FilterField
initialValue={this.state.filter}
handleChange={(value) => this.setState({ filter: value, limit: this.state.per_page })}
onSubmit={e => this.props.uiActions.hideContextMenu()}
onSubmit={(e) => this.props.uiActions.hideContextMenu()}
/>
<DropdownField
icon="swap_vert"
@ -291,7 +291,7 @@ class LibraryArtists extends React.Component {
<div className="view library-artists-view">
<Header options={options} uiActions={this.props.uiActions}>
<Icon name="recent_actors" type="material" />
<I18n path="library.artists.title" />
<I18n path="library.artists.title" />
</Header>
{this.renderView()}
</div>

View File

@ -50,7 +50,7 @@ const Subdirectories = ({ items, view }) => {
);
}
return <Grid items={items} nocontext link={(item) => link(item)} />
return <Grid items={items} nocontext link={(item) => link(item)} />;
};
class LibraryBrowseDirectory extends React.Component {

View File

@ -1,4 +1,3 @@
import React from 'react';
import { connect } from 'react-redux';
import { bindActionCreators } from 'redux';
@ -81,7 +80,7 @@ class AddToPlaylist extends React.Component {
playlists = sortItems(playlists, 'name');
if (playlists.length > 0 ){
if (playlists.length > 0) {
return (
<div className="list small playlists">
{playlists.map((playlist) => (
@ -103,7 +102,7 @@ class AddToPlaylist extends React.Component {
</div>
);
}
return (
<div className="no-results">
<I18n path="modal.add_to_playlist.no_playlists" />

View File

@ -1,4 +1,3 @@
import React from 'react';
import { connect } from 'react-redux';
import { bindActionCreators } from 'redux';

View File

@ -1,4 +1,3 @@
import React from 'react';
import { connect } from 'react-redux';
import { bindActionCreators } from 'redux';
@ -40,7 +39,6 @@ class CreatePlaylist extends React.Component {
);
window.history.back();
return false;
}
@ -78,7 +76,7 @@ class CreatePlaylist extends React.Component {
<div className="field checkbox white">
<div className="name">
<I18n path="modal.edit_playlist.options.label" />
<I18n path="modal.edit_playlist.options.label" />
</div>
<div className="input">
<label>
@ -140,7 +138,7 @@ class CreatePlaylist extends React.Component {
<div className="field radio white">
<div className="name">
<I18n path="modal.edit_playlist.provider" />
<I18n path="modal.edit_playlist.provider" />
</div>
<div className="input">
<label>
@ -160,7 +158,7 @@ class CreatePlaylist extends React.Component {
type="radio"
name="scheme"
value="spotify"
disabled={!spotify_available }
disabled={!spotify_available}
checked={this.state.scheme === 'spotify'}
onChange={(e) => this.setState({ scheme: e.target.value })}
/>

View File

@ -1,4 +1,3 @@
import React from 'react';
import { connect } from 'react-redux';
import { bindActionCreators } from 'redux';
@ -128,7 +127,7 @@ class EditCommand extends React.Component {
<div className="field textarea white">
<div className="name">
<I18n path="modal.edit_command.name" />
<I18n path="modal.edit_command.name" />
</div>
<div className="input">
<TextField
@ -141,7 +140,7 @@ class EditCommand extends React.Component {
<div className="field radio white">
<div className="name">
<I18n path="modal.edit_command.colour" />
<I18n path="modal.edit_command.colour" />
</div>
<div className="input">
<ColourField
@ -153,7 +152,7 @@ class EditCommand extends React.Component {
<div className="field radio white">
<div className="name">
<I18n path="modal.edit_command.icon" />
<I18n path="modal.edit_command.icon" />
</div>
<div className="input">
<IconField
@ -166,7 +165,7 @@ class EditCommand extends React.Component {
<div className="field textarea white">
<div className="name">
<I18n path="modal.edit_command.url" />
<I18n path="modal.edit_command.url" />
</div>
<div className="input">
<TextField
@ -179,7 +178,7 @@ class EditCommand extends React.Component {
<div className="field radio white">
<div className="name">
<I18n path="modal.edit_command.method.label" />
<I18n path="modal.edit_command.method.label" />
</div>
<div className="input">
<label>
@ -212,7 +211,7 @@ class EditCommand extends React.Component {
{method === 'POST' && (
<div className="field textarea white">
<div className="name">
<I18n path="modal.edit_command.data" />
<I18n path="modal.edit_command.data" />
</div>
<div className="input">
<textarea
@ -226,7 +225,7 @@ class EditCommand extends React.Component {
<div className="field textarea white">
<div className="name">
<I18n path="modal.edit_command.headers" />
<I18n path="modal.edit_command.headers" />
</div>
<div className="input">
<textarea
@ -237,7 +236,6 @@ class EditCommand extends React.Component {
</div>
</div>
<div className="actions centered-text">
{command && (
<Button

View File

@ -1,4 +1,3 @@
import React from 'react';
import { connect } from 'react-redux';
import { bindActionCreators } from 'redux';
@ -183,13 +182,13 @@ class EditPlaylist extends React.Component {
onChange={(e) => this.setImage(e)}
/>
<div className="description">
<I18n path="modal.edit_playlist.image.description" />
<I18n path="modal.edit_playlist.image.description" />
</div>
</div>
</div>
<div className="field checkbox white">
<div className="name">
<I18n path="modal.edit_playlist.options.label" />
<I18n path="modal.edit_playlist.options.label" />
</div>
<div className="input">
<label>

View File

@ -1,4 +1,3 @@
import React from 'react';
import { connect } from 'react-redux';
import { bindActionCreators } from 'redux';

View File

@ -28,30 +28,28 @@ class HotkeysInfo extends React.Component {
setWindowTitle('Hotkeys');
}
render = () => {
return (
<Modal className="modal--hotkeys-info">
<h1><I18n path="modal.hotkeys_info.title" /></h1>
<div className="list small playlists">
{hotkeys.map((hotkey) => (
<div className="list__item" key={hotkey.label}>
{hotkey.keys.map((key, index) => (
<>
<pre>
{key}
</pre>
{index === 0 && hotkey.keys.length > 1 && ' or '}
</>
))}
<span className="description">
{i18n(`modal.hotkeys_info.keys.${hotkey.label}`)}
</span>
</div>
))}
</div>
</Modal>
);
}
render = () => (
<Modal className="modal--hotkeys-info">
<h1><I18n path="modal.hotkeys_info.title" /></h1>
<div className="list small playlists">
{hotkeys.map((hotkey) => (
<div className="list__item" key={hotkey.label}>
{hotkey.keys.map((key, index) => (
<>
<pre>
{key}
</pre>
{index === 0 && hotkey.keys.length > 1 && ' or '}
</>
))}
<span className="description">
{i18n(`modal.hotkeys_info.keys.${hotkey.label}`)}
</span>
</div>
))}
</div>
</Modal>
)
}
const mapStateToProps = () => ({});

View File

@ -1,4 +1,3 @@
import React from 'react';
import { connect } from 'react-redux';
import { bindActionCreators } from 'redux';

View File

@ -1,4 +1,3 @@
import React from 'react';
import { connect } from 'react-redux';
import { bindActionCreators } from 'redux';
@ -94,7 +93,7 @@ class InitialSetup extends React.Component {
<div className="field text">
<div className="name">
<I18n path="settings.server.username.label" />
<I18n path="settings.server.username.label" />
</div>
<div className="input">
<input
@ -151,12 +150,13 @@ class InitialSetup extends React.Component {
<I18n path="settings.interface.reporting.description" />
<a href="https://github.com/jaedb/Iris/wiki/Terms-of-use#privacy-policy" target="_blank">
<I18n path="settings.interface.reporting.privacy_policy" />
</a>.
</a>
.
{!this.state.allow_reporting && (
<span className="red-text">
<br />
<I18n path="settings.interface.reporting.are_you_sure" />
</span>
<span className="red-text">
<br />
<I18n path="settings.interface.reporting.are_you_sure" />
</span>
)}
</p>
</div>

View File

@ -1,4 +1,3 @@
import React from 'react';
import { connect } from 'react-redux';
import { bindActionCreators } from 'redux';
@ -27,7 +26,7 @@ const LyricsScroller = ({ content = '', time_position = 1, duration = 100 }) =>
/>
</div>
);
}
};
const Lyrics = ({
show_lyrics,
@ -56,12 +55,11 @@ const Lyrics = ({
duration={duration}
/>
);
};
}
return null;
};
class KioskMode extends React.Component {
class KioskMode extends React.Component {
componentDidMount() {
const {
current_track,
@ -91,8 +89,7 @@ class KioskMode extends React.Component {
} = this.props;
if (!prev_stream_title && stream_title) {
this.setWindowTitle();
this.setWindowTitle();
} else if (!prev_current_track && current_track) {
this.setWindowTitle();

View File

@ -1,4 +1,3 @@
import React from 'react';
import { connect } from 'react-redux';
import Icon from '../../components/Icon';

View File

@ -1,4 +1,3 @@
import React from 'react';
import { connect } from 'react-redux';
import { bindActionCreators } from 'redux';
@ -66,7 +65,7 @@ class ShareConfiguration extends React.Component {
enabled: this.props.snapcast.enabled,
host: this.props.snapcast.host,
port: this.props.snapcast.port,
}
};
}
for (const recipient of this.state.recipients) {
@ -105,7 +104,9 @@ class ShareConfiguration extends React.Component {
<div>
<div className="title">{connection.username}</div>
<div className="description mid_grey-text">
({connection.ip})
(
{connection.ip}
)
</div>
</div>
</div>