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,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>
)
}
}