Fix linting errors and warnings

This commit is contained in:
Andrew Nicolaou 2019-09-08 16:43:16 +02:00
parent b1bfb91f80
commit 7ea4ae5637
6 changed files with 16 additions and 20 deletions

View File

@ -1,5 +1,4 @@
import React from 'react';
import PropTypes from 'prop-types';
import { connect } from 'react-redux';
import { browserHistory } from 'react-router';
@ -8,7 +7,7 @@ const RedirectToUser = ({ username, url = '/:username/sketches' }) => {
if (username == null) {
return;
}
browserHistory.replace(url.replace(':username', username));
}, [username]);
@ -23,6 +22,6 @@ function mapStateToProps(state) {
const ConnectedRedirectToUser = connect(mapStateToProps)(RedirectToUser);
const createRedirectWithUsername = (url) => (props) => <ConnectedRedirectToUser {...props} url={url} />;
const createRedirectWithUsername = url => props => <ConnectedRedirectToUser {...props} url={url} />;
export default createRedirectWithUsername;

View File

@ -39,7 +39,10 @@ class App extends React.Component {
App.propTypes = {
children: PropTypes.element,
location: PropTypes.shape({
pathname: PropTypes.string
pathname: PropTypes.string,
state: PropTypes.shape({
skipSavingPath: PropTypes.bool,
}),
}).isRequired,
setPreviousPath: PropTypes.func.isRequired,
};

View File

@ -1,6 +1,5 @@
import { browserHistory } from 'react-router';
import axios from 'axios';
import crypto from 'crypto';
import * as ActionTypes from '../../constants';
import { showErrorModal, justOpenedProject } from '../IDE/actions/ide';
import { showToast, setToastText } from '../IDE/actions/toast';

View File

@ -27,16 +27,14 @@ Tab.propTypes = {
to: PropTypes.string.isRequired,
};
const DashboardTabSwitcher = ({ currentTab, isOwner, username }) => {
return (
<ul className="dashboard-header__switcher">
<div className="dashboard-header__tabs">
<Tab to={`/${username}/sketches`} isSelected={currentTab === 'sketches'}>Sketches</Tab>
{isOwner && <Tab to={`/${username}/assets`} isSelected={currentTab === 'assets'}>Assets</Tab>}
</div>
</ul>
);
};
const DashboardTabSwitcher = ({ currentTab, isOwner, username }) => (
<ul className="dashboard-header__switcher">
<div className="dashboard-header__tabs">
<Tab to={`/${username}/sketches`} isSelected={currentTab === 'sketches'}>Sketches</Tab>
{isOwner && <Tab to={`/${username}/assets`} isSelected={currentTab === 'assets'}>Assets</Tab>}
</div>
</ul>
);
DashboardTabSwitcher.propTypes = {
currentTab: PropTypes.string.isRequired,

View File

@ -4,7 +4,6 @@ import { reduxForm } from 'redux-form';
import { bindActionCreators } from 'redux';
import { browserHistory } from 'react-router';
import { Tab, Tabs, TabList, TabPanel } from 'react-tabs';
import InlineSVG from 'react-inlinesvg';
import axios from 'axios';
import { Helmet } from 'react-helmet';
import { updateSettings, initiateVerification, createApiKey, removeApiKey } from '../actions';
@ -14,8 +13,6 @@ import GithubButton from '../components/GithubButton';
import APIKeyForm from '../components/APIKeyForm';
import NavBasic from '../../../components/NavBasic';
const exitUrl = require('../../../images/exit.svg');
class AccountView extends React.Component {
constructor(props) {
super(props);

View File

@ -2,7 +2,7 @@ import PropTypes from 'prop-types';
import React from 'react';
import { connect } from 'react-redux';
import { bindActionCreators } from 'redux';
import { browserHistory, Link } from 'react-router';
import { browserHistory } from 'react-router';
import { Helmet } from 'react-helmet';
import { updateSettings, initiateVerification, createApiKey, removeApiKey } from '../actions';
import NavBasic from '../../../components/NavBasic';
@ -80,7 +80,7 @@ class DashboardView extends React.Component {
<DashboardTabSwitcher currentTab={currentTab} isOwner={isOwner} username={username} />
</div>
<div className="dashboard-content">
{
currentTab === TabKey.sketches ? <SketchList username={username} /> : <AssetList username={username} />