Add ESLint & Run it against the system (#4470)

This commit is contained in:
Zach H 2021-11-13 14:49:06 -05:00 committed by ZeldaZach
parent 43eee6b32e
commit f789e02096
106 changed files with 1235 additions and 20242 deletions

View file

@ -1,20 +1,20 @@
// eslint-disable-next-line
import React, { Component } from "react";
import { connect } from "react-redux";
import { connect } from 'react-redux';
import Button from "@material-ui/core/Button";
import ListItem from "@material-ui/core/ListItem";
import Paper from "@material-ui/core/Paper";
import Button from '@material-ui/core/Button';
import ListItem from '@material-ui/core/ListItem';
import Paper from '@material-ui/core/Paper';
import { UserDisplay, VirtualList, AuthGuard } from "components";
import { AuthenticationService, SessionService } from "api";
import { ServerSelectors } from "store";
import { UserDisplay, VirtualList, AuthGuard } from 'components';
import { AuthenticationService, SessionService } from 'api';
import { ServerSelectors } from 'store';
import { User } from 'types';
import AddToBuddies from './AddToBuddies';
import AddToIgnore from './AddToIgnore';
import "./Account.css";
import './Account.css';
class Account extends Component<AccountProps> {
handleAddToBuddies({ userName }) {
@ -31,7 +31,7 @@ class Account extends Component<AccountProps> {
const { buddyList, ignoreList, serverName, serverVersion, user } = this.props;
const { country, realName, name, userLevel, accountageSecs, avatarBmp } = user;
var url = URL.createObjectURL(new Blob([avatarBmp], {'type': 'image/png'}));
let url = URL.createObjectURL(new Blob([avatarBmp], { 'type': 'image/png' }));
return (
<div className="account">
@ -47,9 +47,9 @@ class Account extends Component<AccountProps> {
<ListItem button dense>
<UserDisplay user={user} />
</ListItem>
) ) }
)) }
/>
<div className="" style={{borderTop: "1px solid"}}>
<div className="" style={{ borderTop: '1px solid' }}>
<AddToBuddies onSubmit={this.handleAddToBuddies} />
</div>
</Paper>
@ -65,15 +65,15 @@ class Account extends Component<AccountProps> {
<ListItem button dense>
<UserDisplay user={user} />
</ListItem>
) ) }
)) }
/>
<div className="" style={{borderTop: "1px solid"}}>
<div className="" style={{ borderTop: '1px solid' }}>
<AddToIgnore onSubmit={this.handleAddToIgnore} />
</div>
</Paper>
</div>
<div className="account-column overflow-scroll">
<Paper className="account-details" style={{margin: "0 0 5px 0"}}>
<Paper className="account-details" style={{ margin: '0 0 5px 0' }}>
<img src={url} alt={name} />
<p><strong>{name}</strong></p>
<p>Location: ({country?.toUpperCase()})</p>
@ -92,7 +92,7 @@ class Account extends Component<AccountProps> {
<Button color="primary" variant="contained" onClick={() => AuthenticationService.disconnect()}>Disconnect</Button>
</Paper>
</div>
</div>
</div>
)
}
}

View file

@ -1,7 +1,7 @@
// eslint-disable-next-line
import React from "react";
import { connect } from "react-redux";
import { Form, reduxForm } from "redux-form"
import { connect } from 'react-redux';
import { Form, reduxForm } from 'redux-form'
import { InputAction } from 'components';
import { FormKey } from 'types';

View file

@ -1,7 +1,7 @@
// eslint-disable-next-line
import React from "react";
import { connect } from "react-redux";
import { Form, reduxForm } from "redux-form"
import { connect } from 'react-redux';
import { Form, reduxForm } from 'redux-form'
import { InputAction } from 'components';
import { FormKey } from 'types';

View file

@ -1,13 +1,13 @@
// eslint-disable-next-line
import React, { Component } from "react";
import { Provider } from "react-redux";
import { MemoryRouter as Router } from "react-router-dom";
import CssBaseline from "@material-ui/core/CssBaseline";
import { store } from "store";
import { Provider } from 'react-redux';
import { MemoryRouter as Router } from 'react-router-dom';
import CssBaseline from '@material-ui/core/CssBaseline';
import { store } from 'store';
import { Header } from 'components';
import Routes from "./AppShellRoutes";
import Routes from './AppShellRoutes';
import "./AppShell.css";
import './AppShell.css';
class AppShell extends Component {
componentDidMount() {

View file

@ -1,17 +1,17 @@
import React from "react";
import { Redirect, Route, Switch } from "react-router-dom";
import React from 'react';
import { Redirect, Route, Switch } from 'react-router-dom';
import { RouteEnum } from "types";
import { RouteEnum } from 'types';
import {
Account,
Decks,
Game,
Player,
Room,
Server,
Decks,
Game,
Player,
Room,
Server,
Login,
Logs
} from "containers";
} from 'containers';
const Routes = () => (
<div className="AppShell-routes overflow-scroll">
@ -30,4 +30,4 @@ const Routes = () => (
</div>
);
export default Routes;
export default Routes;

View file

@ -1,9 +1,9 @@
// eslint-disable-next-line
import React, { Component } from "react";
import { AuthGuard } from "components/index";
import { AuthGuard } from 'components/index';
import "./Decks.css";
import './Decks.css';
class Decks extends Component {
render() {
@ -16,4 +16,4 @@ class Decks extends Component {
}
}
export default Decks;
export default Decks;

View file

@ -1,9 +1,9 @@
// eslint-disable-next-line
import React, { Component } from "react";
import { AuthGuard } from "components";
import { AuthGuard } from 'components';
import "./Game.css";
import './Game.css';
class Game extends Component {
render() {
@ -16,4 +16,4 @@ class Game extends Component {
}
}
export default Game;
export default Game;

View file

@ -1,19 +1,19 @@
// eslint-disable-next-line
import React from "react";
import { connect } from "react-redux";
import { Redirect } from "react-router-dom";
import { connect } from 'react-redux';
import { Redirect } from 'react-router-dom';
import { makeStyles } from '@material-ui/core/styles';
import Button from '@material-ui/core/Button';
import Paper from '@material-ui/core/Paper';
import Typography from '@material-ui/core/Typography';
import { AuthenticationService } from "api";
import { LoginForm } from "forms";
import { Images } from "images";
import { RouteEnum } from "types";
import { /* ServerDispatch, */ ServerSelectors } from "store";
import { AuthenticationService } from 'api';
import { LoginForm } from 'forms';
import { Images } from 'images';
import { RouteEnum } from 'types';
import { ServerSelectors } from 'store';
import "./Login.css";
import './Login.css';
const useStyles = makeStyles(theme => ({
root: {
@ -58,7 +58,7 @@ const Login = ({ state, description }: LoginProps) => {
const showDescription = () => {
return !isConnected && description?.length;
}
};
const createAccount = () => {
console.log('Login.createAccount->openForgotPasswordDialog');
@ -131,7 +131,9 @@ const Login = ({ state, description }: LoginProps) => {
</div>
{ /*<img src={loginGraphic} className="login-content__description-image"/>*/}
<p className="login-content__description-subtitle1">Play multiplayer card games online.</p>
<p className="login-content__description-subtitle2">Cross-platform virtual tabletop for multiplayer card games. Forever free.</p>
<p className="login-content__description-subtitle2">
Cross-platform virtual tabletop for multiplayer card games. Forever free.
</p>
</div>
</div>
</Paper>

View file

@ -1,19 +1,19 @@
import React from "react";
import * as _ from "lodash";
import React from 'react';
import * as _ from 'lodash';
import AppBar from "@material-ui/core/AppBar";
import Box from "@material-ui/core/Box";
import Paper from "@material-ui/core/Paper";
import Table from "@material-ui/core/Table";
import TableBody from "@material-ui/core/TableBody";
import TableCell from "@material-ui/core/TableCell";
import TableHead from "@material-ui/core/TableHead";
import TableRow from "@material-ui/core/TableRow";
import Tab from "@material-ui/core/Tab";
import Tabs from "@material-ui/core/Tabs";
import Typography from "@material-ui/core/Typography";
import AppBar from '@material-ui/core/AppBar';
import Box from '@material-ui/core/Box';
import Paper from '@material-ui/core/Paper';
import Table from '@material-ui/core/Table';
import TableBody from '@material-ui/core/TableBody';
import TableCell from '@material-ui/core/TableCell';
import TableHead from '@material-ui/core/TableHead';
import TableRow from '@material-ui/core/TableRow';
import Tab from '@material-ui/core/Tab';
import Tabs from '@material-ui/core/Tabs';
import Typography from '@material-ui/core/Typography';
import "./LogResults.css";
import './LogResults.css';
const LogResults = (props) => {
const { logs } = props;
@ -21,7 +21,7 @@ const LogResults = (props) => {
const hasRoomLogs = logs.room && logs.room.length;
const hasGameLogs = logs.game && logs.game.length;
const hasChatLogs = logs.chat && logs.chat.length;
const [value, setValue] = React.useState(0);
const handleChange = (event, newValue) => {
@ -30,32 +30,32 @@ const LogResults = (props) => {
const headerCells = [
{
label: "Time"
label: 'Time'
},
{
label: "Sender Name"
label: 'Sender Name'
},
{
label: "Sender IP"
label: 'Sender IP'
},
{
label: "Message"
label: 'Message'
},
{
label: "Target ID"
label: 'Target ID'
},
{
label: "Target Name"
label: 'Target Name'
}
];
return (
<div>
<AppBar position="static">
<Tabs value={value} onChange={handleChange} aria-label="simple tabs example">
<Tab label={"Rooms" + (hasRoomLogs ? ` [${logs.room.length}]` : "")} {...a11yProps(0)} />
<Tab label={"Games" + (hasGameLogs ? ` [${logs.game.length}]` : "")} {...a11yProps(1)} />
<Tab label={"Chats" + (hasChatLogs ? ` [${logs.chat.length}]` : "")} {...a11yProps(2)} />
<Tab label={'Rooms' + (hasRoomLogs ? ` [${logs.room.length}]` : '')} {...a11yProps(0)} />
<Tab label={'Games' + (hasGameLogs ? ` [${logs.game.length}]` : '')} {...a11yProps(1)} />
<Tab label={'Chats' + (hasChatLogs ? ` [${logs.chat.length}]` : '')} {...a11yProps(2)} />
</Tabs>
</AppBar>
<TabPanel value={value} index={0}>
@ -74,7 +74,7 @@ const LogResults = (props) => {
const a11yProps = index => {
return {
id: `simple-tab-${index}`,
"aria-controls": `simple-tabpanel-${index}`,
'aria-controls': `simple-tabpanel-${index}`,
};
};
@ -93,7 +93,7 @@ const TabPanel = ({ children, value, index, ...other }) => {
);
};
const Results = ({headerCells, logs}) => (
const Results = ({ headerCells, logs }) => (
<Paper className="log-results">
<Table size="small">
<TableHead>
@ -119,4 +119,4 @@ const Results = ({headerCells, logs}) => (
</Paper>
);
export default LogResults;
export default LogResults;

View file

@ -1,15 +1,15 @@
// eslint-disable-next-line
import React, { Component } from "react";
import { connect } from "react-redux";
import * as _ from "lodash";
import { connect } from 'react-redux';
import * as _ from 'lodash';
import { ModeratorService } from "api";
import { AuthGuard, ModGuard} from "components";
import { SearchForm } from "forms";
import { ServerDispatch, ServerSelectors, ServerStateLogs } from "store";
import { ModeratorService } from 'api';
import { AuthGuard, ModGuard } from 'components';
import { SearchForm } from 'forms';
import { ServerDispatch, ServerSelectors, ServerStateLogs } from 'store';
import LogResults from "./LogResults";
import "./Logs.css";
import LogResults from './LogResults';
import './Logs.css';
class Logs extends Component<LogsTypes> {
MAXIMUM_RESULTS = 1000;
@ -26,7 +26,7 @@ class Logs extends Component<LogsTypes> {
onSubmit(fields) {
const trimmedFields: any = this.trimFields(fields);
const { userName, ipAddress, gameName, gameId, message, logLocation } = trimmedFields;
const required = _.filter({
@ -48,7 +48,7 @@ class Logs extends Component<LogsTypes> {
private trimFields(fields) {
return _.reduce(fields, (obj, field, key) => {
if (typeof field === "string") {
if (typeof field === 'string') {
const trimmed = _.trim(field);
if (!!trimmed) {
@ -74,7 +74,7 @@ class Logs extends Component<LogsTypes> {
<div className="moderator-logs overflow-scroll">
<AuthGuard />
<ModGuard />
<div className="moderator-logs__form">
<SearchForm onSubmit={this.onSubmit} />
</div>
@ -82,7 +82,7 @@ class Logs extends Component<LogsTypes> {
<div className="moderator-logs__results">
<LogResults logs={this.props.logs} />
</div>
</div>
</div>
)
}
}

View file

@ -1,7 +1,7 @@
// eslint-disable-next-line
import React, { Component } from "react";
import { AuthGuard } from "components";
import { AuthGuard } from 'components';
class Player extends Component {
render() {
@ -14,4 +14,4 @@ class Player extends Component {
}
}
export default Player;
export default Player;

View file

@ -1,53 +1,53 @@
// eslint-disable-next-line
import React, { Component } from "react";
import { connect } from "react-redux";
import * as _ from "lodash";
import { connect } from 'react-redux';
import * as _ from 'lodash';
import Table from "@material-ui/core/Table";
import TableBody from "@material-ui/core/TableBody";
import TableCell from "@material-ui/core/TableCell";
import TableHead from "@material-ui/core/TableHead";
import TableRow from "@material-ui/core/TableRow";
import TableSortLabel from "@material-ui/core/TableSortLabel";
import Tooltip from "@material-ui/core/Tooltip";
import Table from '@material-ui/core/Table';
import TableBody from '@material-ui/core/TableBody';
import TableCell from '@material-ui/core/TableCell';
import TableHead from '@material-ui/core/TableHead';
import TableRow from '@material-ui/core/TableRow';
import TableSortLabel from '@material-ui/core/TableSortLabel';
import Tooltip from '@material-ui/core/Tooltip';
// import { RoomsService } from "AppShell/common/services";
import { SortUtil, RoomsDispatch, RoomsSelectors } from "store";
import { UserDisplay } from "components";
import { SortUtil, RoomsDispatch, RoomsSelectors } from 'store';
import { UserDisplay } from 'components';
import "./Games.css";
import './Games.css';
// @TODO run interval to update timeSinceCreated
class Games extends Component<GamesProps> {
private headerCells = [
{
label: "Age",
field: "startTime"
label: 'Age',
field: 'startTime'
},
{
label: "Description",
field: "description"
label: 'Description',
field: 'description'
},
{
label: "Creator",
field: "creatorInfo.name"
label: 'Creator',
field: 'creatorInfo.name'
},
{
label: "Type",
field: "gameType"
label: 'Type',
field: 'gameType'
},
{
label: "Restrictions",
label: 'Restrictions',
// field: "?"
},
{
label: "Players",
label: 'Players',
// field: ["maxPlayers", "playerCount"]
},
{
label: "Spectators",
field: "spectatorsCount"
label: 'Spectators',
field: 'spectatorsCount'
},
];

View file

@ -3,7 +3,7 @@ import React from "react";
import { Message } from 'components';
import "./Messages.css";
import './Messages.css';
const Messages = ({ messages }) => (
<div className="messages">
@ -12,7 +12,7 @@ const Messages = ({ messages }) => (
<div className="message-wrapper" key={message.timeReceived}>
<Message message={message} />
</div>
) )
))
}
</div>
);

View file

@ -1,53 +1,53 @@
// eslint-disable-next-line
import React, { Component } from "react";
import { connect } from "react-redux";
import * as _ from "lodash";
import { connect } from 'react-redux';
import * as _ from 'lodash';
import Table from "@material-ui/core/Table";
import TableBody from "@material-ui/core/TableBody";
import TableCell from "@material-ui/core/TableCell";
import TableHead from "@material-ui/core/TableHead";
import TableRow from "@material-ui/core/TableRow";
import TableSortLabel from "@material-ui/core/TableSortLabel";
import Tooltip from "@material-ui/core/Tooltip";
import Table from '@material-ui/core/Table';
import TableBody from '@material-ui/core/TableBody';
import TableCell from '@material-ui/core/TableCell';
import TableHead from '@material-ui/core/TableHead';
import TableRow from '@material-ui/core/TableRow';
import TableSortLabel from '@material-ui/core/TableSortLabel';
import Tooltip from '@material-ui/core/Tooltip';
// import { RoomsService } from "AppShell/common/services";
import { SortUtil, RoomsDispatch, RoomsSelectors } from "store";
import { UserDisplay } from "components";
import { SortUtil, RoomsDispatch, RoomsSelectors } from 'store';
import { UserDisplay } from 'components';
import "./OpenGames.css";
import './OpenGames.css';
// @TODO run interval to update timeSinceCreated
class OpenGames extends Component<OpenGamesProps> {
private headerCells = [
{
label: "Age",
field: "startTime"
label: 'Age',
field: 'startTime'
},
{
label: "Description",
field: "description"
label: 'Description',
field: 'description'
},
{
label: "Creator",
field: "creatorInfo.name"
label: 'Creator',
field: 'creatorInfo.name'
},
{
label: "Type",
field: "gameType"
label: 'Type',
field: 'gameType'
},
{
label: "Restrictions",
label: 'Restrictions',
// field: "?"
},
{
label: "Players",
label: 'Players',
// field: ["maxPlayers", "playerCount"]
},
{
label: "Spectators",
field: "spectatorsCount"
label: 'Spectators',
field: 'spectatorsCount'
},
];

View file

@ -1,21 +1,21 @@
// eslint-disable-next-line
import React, { Component } from "react";
import { connect } from "react-redux";
import { withRouter /*, RouteComponentProps */, generatePath } from "react-router-dom";
import { connect } from 'react-redux';
import { withRouter, generatePath } from 'react-router-dom';
import ListItem from "@material-ui/core/ListItem";
import Paper from "@material-ui/core/Paper";
import ListItem from '@material-ui/core/ListItem';
import Paper from '@material-ui/core/Paper';
import { RoomsService } from "api";
import { ScrollToBottomOnChanges, ThreePaneLayout, UserDisplay, VirtualList, AuthGuard} from "components";
import { RoomsStateMessages, RoomsStateRooms, JoinedRooms, RoomsSelectors } from "store";
import { RouteEnum } from "types";
import { RoomsService } from 'api';
import { ScrollToBottomOnChanges, ThreePaneLayout, UserDisplay, VirtualList, AuthGuard } from 'components';
import { RoomsStateMessages, RoomsStateRooms, JoinedRooms, RoomsSelectors } from 'store';
import { RouteEnum } from 'types';
import OpenGames from "./OpenGames";
import Messages from "./Messages";
import SayMessage from "./SayMessage";
import OpenGames from './OpenGames';
import Messages from './Messages';
import SayMessage from './SayMessage';
import "./Room.css";
import './Room.css';
// @TODO (3)
class Room extends Component<any> {
@ -25,7 +25,7 @@ class Room extends Component<any> {
roomId = parseInt(roomId, 0);
if (!joined.find(({roomId: id}) => id === roomId)) {
if (!joined.find(({ roomId: id }) => id === roomId)) {
history.push(generatePath(RouteEnum.SERVER));
}
}
@ -61,7 +61,7 @@ class Room extends Component<any> {
top={(
<Paper className="room-view__games overflow-scroll">
<OpenGames room={room} />
</Paper>
</Paper>
)}
bottom={(
@ -89,7 +89,7 @@ class Room extends Component<any> {
<ListItem button className="room-view__side-list__item">
<UserDisplay user={user} />
</ListItem>
) ) }
)) }
/>
</Paper>
)}

View file

@ -1,7 +1,7 @@
// eslint-disable-next-line
import React from "react";
import { connect } from "react-redux";
import { Form, reduxForm } from "redux-form"
import { connect } from 'react-redux';
import { Form, reduxForm } from 'redux-form'
import { InputAction } from 'components';
@ -12,7 +12,7 @@ const SayMessage = ({ handleSubmit }) => (
);
const propsMap = {
form: "sayMessage"
form: 'sayMessage'
};
export default connect()(reduxForm(propsMap)(SayMessage));

View file

@ -1,20 +1,20 @@
// eslint-disable-next-line
import React from "react";
import { generatePath } from "react-router-dom";
import * as _ from "lodash";
import { generatePath } from 'react-router-dom';
import * as _ from 'lodash';
import Button from "@material-ui/core/Button";
import Table from "@material-ui/core/Table";
import TableBody from "@material-ui/core/TableBody";
import TableCell from "@material-ui/core/TableCell";
import TableHead from "@material-ui/core/TableHead";
import TableRow from "@material-ui/core/TableRow";
import Button from '@material-ui/core/Button';
import Table from '@material-ui/core/Table';
import TableBody from '@material-ui/core/TableBody';
import TableCell from '@material-ui/core/TableCell';
import TableHead from '@material-ui/core/TableHead';
import TableRow from '@material-ui/core/TableRow';
import { RoomsService } from "api";
import { RouteEnum } from "types";
import { RoomsService } from 'api';
import { RouteEnum } from 'types';
import "./Rooms.css";
import './Rooms.css';
const Rooms = ({ rooms, joinedRooms, history }) => {
function onClick(roomId) {

View file

@ -1,18 +1,18 @@
// eslint-disable-next-line
import React, { Component } from "react";
import { connect } from "react-redux";
import { withRouter } from "react-router-dom";
import { connect } from 'react-redux';
import { withRouter } from 'react-router-dom';
import ListItem from "@material-ui/core/ListItem";
import Paper from "@material-ui/core/Paper";
import ListItem from '@material-ui/core/ListItem';
import Paper from '@material-ui/core/Paper';
import { RoomsSelectors, ServerSelectors } from "store";
import { RoomsSelectors, ServerSelectors } from 'store';
import { AuthGuard, ThreePaneLayout, UserDisplay, VirtualList } from "components";
import { Room, User } from "types";
import { AuthGuard, ThreePaneLayout, UserDisplay, VirtualList } from 'components';
import { Room, User } from 'types';
import Rooms from './Rooms';
import "./Server.css";
import './Server.css';
class Server extends Component<ServerProps, ServerState> {
render() {
@ -46,7 +46,7 @@ class Server extends Component<ServerProps, ServerState> {
<ListItem button dense>
<UserDisplay user={user} />
</ListItem>
) ) }
)) }
/>
</Paper>
)}

View file

@ -2,8 +2,8 @@ export { default as AppShell } from './App/AppShell';
export { default as Account } from './Account/Account';
export { default as Game } from './Game/Game';
export { default as Decks } from './Decks/Decks';
export { default as Room } from "./Room/Room";
export { default as Player } from "./Player/Player";
export { default as Server } from "./Server/Server";
export { default as Logs } from "./Logs/Logs";
export { default as Login } from "./Login/Login";
export { default as Room } from './Room/Room';
export { default as Player } from './Player/Player';
export { default as Server } from './Server/Server';
export { default as Logs } from './Logs/Logs';
export { default as Login } from './Login/Login';