Skip to content

Commit

Permalink
Enable and apply prettier-plugin-sort-imports plugin fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
leighmacdonald committed Oct 21, 2023
1 parent 1531a8a commit fda1999
Show file tree
Hide file tree
Showing 140 changed files with 962 additions and 951 deletions.
18 changes: 14 additions & 4 deletions frontend/.prettierrc
Original file line number Diff line number Diff line change
@@ -1,6 +1,16 @@
{
"semi": true,
"trailingComma": "none",
"singleQuote": true,
"tabWidth": 4
"semi": true,
"trailingComma": "none",
"singleQuote": true,
"tabWidth": 4,
"plugins": [
"@trivago/prettier-plugin-sort-imports"
],
"importOrder": [
"^@core/(.*)$",
"^@server/(.*)$",
"^@ui/(.*)$",
"^[./]"
],
"importOrderSeparation": false
}
84 changes: 42 additions & 42 deletions frontend/src/App.tsx
Original file line number Diff line number Diff line change
@@ -1,21 +1,14 @@
import React, { useCallback, useMemo, useState, JSX } from 'react';
import NiceModal from '@ebay/nice-modal-react';
import { PaletteMode } from '@mui/material';
import { AlertColor } from '@mui/material/Alert';
import Container from '@mui/material/Container';
import CssBaseline from '@mui/material/CssBaseline';
import { ThemeProvider } from '@mui/material/styles';
import useMediaQuery from '@mui/material/useMediaQuery';
import { AdapterDateFns } from '@mui/x-date-pickers/AdapterDateFns';
import { LocalizationProvider } from '@mui/x-date-pickers/LocalizationProvider';
import React, { useCallback, useMemo, useState, JSX } from 'react';
import { BrowserRouter as Router, Route, Routes } from 'react-router-dom';
import { Home } from './page/Home';
import { ReportCreatePage } from './page/ReportCreatePage';
import { AdminReports } from './page/AdminReports';
import { AdminImport } from './page/AdminImport';
import { AdminPeople } from './page/AdminPeople';
import { Servers } from './page/Servers';
import { AdminServers } from './page/AdminServers';
import { Flash } from './component/Flashes';
import { LoginSteamSuccess } from './page/LoginSteamSuccess';
import { Profile } from './page/Profile';
import { Footer } from './component/Footer';
import { CurrentUserCtx, GuestProfile } from './contexts/CurrentUserCtx';
import { BanPage } from './page/BanPage';
import {
PermissionLevel,
readRefreshToken,
Expand All @@ -24,43 +17,50 @@ import {
writeAccessToken,
writeRefreshToken
} from './api';
import { AdminBan } from './page/AdminBan';
import { TopBar } from './component/TopBar';
import { UserFlashCtx } from './contexts/UserFlashCtx';
import { Logout } from './page/Logout';
import { PageNotFound } from './page/PageNotFound';
import { ErrorBoundary } from './component/ErrorBoundary';
import { Flash } from './component/Flashes';
import { Footer } from './component/Footer';
import { PrivateRoute } from './component/PrivateRoute';
import { createThemeByMode } from './theme';
import { ReportViewPage } from './page/ReportViewPage';
import { PaletteMode } from '@mui/material';
import useMediaQuery from '@mui/material/useMediaQuery';
import { TopBar } from './component/TopBar';
import { UserInit } from './component/UserInit';
import { ColourModeContext } from './contexts/ColourModeContext';
import { CurrentUserCtx, GuestProfile } from './contexts/CurrentUserCtx';
import { NotificationsProvider } from './contexts/NotificationsCtx';
import { UserFlashCtx } from './contexts/UserFlashCtx';
import { AdminAppeals } from './page/AdminAppeals';
import { AdminBan } from './page/AdminBan';
import { AdminContests } from './page/AdminContests';
import { AdminFilters } from './page/AdminFilters';
import { AdminImport } from './page/AdminImport';
import { AdminNetworkPage } from './page/AdminNetworkPage';
import { AdminNews } from './page/AdminNews';
import { WikiPage } from './page/WikiPage';
import { MatchPage } from './page/MatchPage';
import { AlertColor } from '@mui/material/Alert';
import { MatchListPage } from './page/MatchListPage';
import { LocalizationProvider } from '@mui/x-date-pickers/LocalizationProvider';
import { AdapterDateFns } from '@mui/x-date-pickers/AdapterDateFns';
import { AdminPeople } from './page/AdminPeople';
import { AdminReports } from './page/AdminReports';
import { AdminServers } from './page/AdminServers';
import { BanPage } from './page/BanPage';
import { ChatLogPage } from './page/ChatLogPage';
import { ContestListPage } from './page/ContestListPage';
import { ContestPage } from './page/ContestPage';
import { Home } from './page/Home';
import { Login } from './page/Login';
import { ErrorBoundary } from './component/ErrorBoundary';
import { AdminFilters } from './page/AdminFilters';
import { AdminAppeals } from './page/AdminAppeals';
import { UserInit } from './component/UserInit';
import { STVPage } from './page/STVPage';
import { LoginDiscordSuccess } from './page/LoginDiscordSuccess';
import { LoginSteamSuccess } from './page/LoginSteamSuccess';
import { Logout } from './page/Logout';
import { MatchListPage } from './page/MatchListPage';
import { MatchPage } from './page/MatchPage';
import { NotificationsPage } from './page/NotificationsPage';
import { NotificationsProvider } from './contexts/NotificationsCtx';
import { AdminNetworkPage } from './page/AdminNetworkPage';
import { PageNotFound } from './page/PageNotFound';
import { PlayerStatsPage } from './page/PlayerStatsPage';
import { Profile } from './page/Profile';
import { ProfileSettingsPage } from './page/ProfileSettingsPage';
import { StatsWeaponOverallPage } from './page/StatsWeaponOverallPage';
import { ReportCreatePage } from './page/ReportCreatePage';
import { ReportViewPage } from './page/ReportViewPage';
import { STVPage } from './page/STVPage';
import { Servers } from './page/Servers';
import { StatsPage } from './page/StatsPage';
import { PlayerStatsPage } from './page/PlayerStatsPage';
import { AdminContests } from './page/AdminContests';
import { ContestListPage } from './page/ContestListPage';
import NiceModal from '@ebay/nice-modal-react';
import { ContestPage } from './page/ContestPage';
import { StatsWeaponOverallPage } from './page/StatsWeaponOverallPage';
import { WikiPage } from './page/WikiPage';
import { createThemeByMode } from './theme';

export interface AppProps {
initialTheme: PaletteMode;
Expand Down
2 changes: 1 addition & 1 deletion frontend/src/api/auth.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { apiCall } from './common';
import { logErr } from '../util/errors';
import { apiCall } from './common';

export const refreshKey = 'refresh';
export const tokenKey = 'token';
Expand Down
4 changes: 2 additions & 2 deletions frontend/src/api/bans.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import { parseDateTime } from '../util/text';
import { IpRecord } from '../util/types';
import {
apiCall,
QueryFilter,
Expand All @@ -11,8 +13,6 @@ import {
UserProfile
} from './profile';
import { UserMessage } from './report';
import { parseDateTime } from '../util/text';
import { IpRecord } from '../util/types';

export enum AppealState {
Any = -1,
Expand Down
4 changes: 2 additions & 2 deletions frontend/src/api/common.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { ReportStatus } from './report';
import { format, parseISO } from 'date-fns';
import { readAccessToken, readRefreshToken, refreshToken } from './auth';
import { parseDateTime } from '../util/text';
import { readAccessToken, readRefreshToken, refreshToken } from './auth';
import { MatchResult } from './match';
import { ReportStatus } from './report';

export enum PermissionLevel {
Banned = 0,
Expand Down
6 changes: 3 additions & 3 deletions frontend/src/api/contests.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import { useEffect, useState } from 'react';
import { logErr } from '../util/errors';
import {
apiCall,
DateRange,
Expand All @@ -7,10 +9,8 @@ import {
transformDateRange,
transformTimeStampedDates
} from './common';
import { useEffect, useState } from 'react';
import { logErr } from '../util/errors';
import { LazyResult } from './stats';
import { EmptyUUID } from './const';
import { LazyResult } from './stats';

export interface Contest extends DateRange {
contest_id: string;
Expand Down
2 changes: 1 addition & 1 deletion frontend/src/api/demo.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { apiCall } from './common';
import { parseDateTime } from '../util/text';
import { apiCall } from './common';
import { Asset } from './media';

export interface DemoFile {
Expand Down
6 changes: 3 additions & 3 deletions frontend/src/api/match.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
import { PlayerClass, Team } from './const';
import { TeamScores } from './stats';
import { parseDateTime } from '../util/text';
import {
apiCall,
DataCount,
MatchTimes,
QueryFilter,
transformMatchDates
} from './common';
import { parseDateTime } from '../util/text';
import { PlayerClass, Team } from './const';
import { TeamScores } from './stats';

export interface MatchHealer {
match_medic_id: number;
Expand Down
2 changes: 1 addition & 1 deletion frontend/src/api/profile.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import { parseDateTime } from '../util/text';
import {
apiCall,
DataCount,
PermissionLevel,
QueryFilter,
TimeStamped
} from './common';
import { parseDateTime } from '../util/text';

export const defaultAvatarHash = 'fef49e7fa7e1997310d705b2a6158ff8dc1cdfeb';

Expand Down
4 changes: 2 additions & 2 deletions frontend/src/api/report.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { apiCall, AuthorQueryFilter, TimeStamped } from './common';
import { Person, UserProfile } from './profile';
import { Theme } from '@mui/material';
import { BanReason } from './bans';
import { apiCall, AuthorQueryFilter, TimeStamped } from './common';
import { Person, UserProfile } from './profile';

export enum ReportStatus {
Any = -1,
Expand Down
4 changes: 2 additions & 2 deletions frontend/src/api/wiki.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { apiCall, TimeStamped } from './common';
import { marked, Renderer } from 'marked';
import { gfmHeadingId } from 'marked-gfm-heading-id';
import { mangle } from 'marked-mangle';
import { apiCall, TimeStamped } from './common';

export interface Page extends TimeStamped {
slug: string;
Expand Down Expand Up @@ -59,5 +59,5 @@ export const renderMarkdown = (md: string) =>
/(media:\/\/)/gi,
window.gbans.asset_url + '/' + window.gbans.bucket_media + '/'
),
{ renderer: new WikiRenderer(), gfm: true, async: true }
{ renderer: new WikiRenderer(), gfm: true, async: false }
);
30 changes: 15 additions & 15 deletions frontend/src/component/BanASNModal.tsx
Original file line number Diff line number Diff line change
@@ -1,16 +1,14 @@
import React from 'react';
import GavelIcon from '@mui/icons-material/Gavel';
import { Dialog, DialogContent, DialogTitle } from '@mui/material';
import Stack from '@mui/material/Stack';
import { useFormik } from 'formik';
import React from 'react';
import * as yup from 'yup';
import { apiCreateBanASN, BanReason, BanType, Duration } from '../api';
import { useUserFlashCtx } from '../contexts/UserFlashCtx';
import { Heading } from './Heading';
import { logErr } from '../util/errors';
import {
SteamIdField,
SteamIDInputValue,
steamIdValidator
} from './formik/SteamIdField';
import * as yup from 'yup';
import { BanTypeField, BanTypeFieldValidator } from './formik/BanTypeField';
import { Heading } from './Heading';
import { ASNumberField, ASNumberFieldValidator } from './formik/ASNumberField';
import {
BanReasonField,
BanReasonFieldValidator
Expand All @@ -19,17 +17,19 @@ import {
BanReasonTextField,
BanReasonTextFieldValidator
} from './formik/BanReasonTextField';
import { DurationField, DurationFieldValidator } from './formik/DurationField';
import { BanTypeField, BanTypeFieldValidator } from './formik/BanTypeField';
import {
DurationCustomField,
DurationCustomFieldValidator
} from './formik/DurationCustomField';
import { NoteField, NoteFieldValidator } from './formik/NoteField';
import { Dialog, DialogContent, DialogTitle } from '@mui/material';
import GavelIcon from '@mui/icons-material/Gavel';
import { DurationField, DurationFieldValidator } from './formik/DurationField';
import { ModalButtons } from './formik/ModalButtons';
import { useFormik } from 'formik';
import { ASNumberField, ASNumberFieldValidator } from './formik/ASNumberField';
import { NoteField, NoteFieldValidator } from './formik/NoteField';
import {
SteamIdField,
SteamIDInputValue,
steamIdValidator
} from './formik/SteamIdField';

export interface BanASNModalProps {
open: boolean;
Expand Down
28 changes: 14 additions & 14 deletions frontend/src/component/BanCIDRModal.tsx
Original file line number Diff line number Diff line change
@@ -1,16 +1,13 @@
import React from 'react';
import GavelIcon from '@mui/icons-material/Gavel';
import { Dialog, DialogContent, DialogTitle } from '@mui/material';
import Stack from '@mui/material/Stack';
import { useFormik } from 'formik';
import React from 'react';
import * as yup from 'yup';
import { apiCreateBanCIDR, BanReason, BanType, Duration } from '../api';
import { useUserFlashCtx } from '../contexts/UserFlashCtx';
import { Heading } from './Heading';
import { logErr } from '../util/errors';
import {
SteamIdField,
SteamIDInputValue,
steamIdValidator
} from './formik/SteamIdField';
import * as yup from 'yup';
import { BanTypeField, BanTypeFieldValidator } from './formik/BanTypeField';
import { Heading } from './Heading';
import {
BanReasonField,
BanReasonFieldValidator
Expand All @@ -19,20 +16,23 @@ import {
BanReasonTextField,
BanReasonTextFieldValidator
} from './formik/BanReasonTextField';
import { DurationField, DurationFieldValidator } from './formik/DurationField';
import { BanTypeField, BanTypeFieldValidator } from './formik/BanTypeField';
import {
DurationCustomField,
DurationCustomFieldValidator
} from './formik/DurationCustomField';
import { NoteField, NoteFieldValidator } from './formik/NoteField';
import { Dialog, DialogContent, DialogTitle } from '@mui/material';
import GavelIcon from '@mui/icons-material/Gavel';
import { DurationField, DurationFieldValidator } from './formik/DurationField';
import { ModalButtons } from './formik/ModalButtons';
import { useFormik } from 'formik';
import {
NetworkRangeField,
NetworkRangeFieldValidator
} from './formik/NetworkRangeField';
import { NoteField, NoteFieldValidator } from './formik/NoteField';
import {
SteamIdField,
SteamIDInputValue,
steamIdValidator
} from './formik/SteamIdField';

export interface BanCIDRModalProps {
open: boolean;
Expand Down
30 changes: 15 additions & 15 deletions frontend/src/component/BanGroupModal.tsx
Original file line number Diff line number Diff line change
@@ -1,37 +1,37 @@
import React from 'react';
import GavelIcon from '@mui/icons-material/Gavel';
import { Dialog, DialogContent, DialogTitle } from '@mui/material';
import Stack from '@mui/material/Stack';
import { useFormik } from 'formik';
import React from 'react';
import * as yup from 'yup';
import {
apiCreateBanGroup,
BanReason,
BanType,
Duration,
IAPIBanGroupRecord
} from '../api';
import { ConfirmationModalProps } from './ConfirmationModal';
import { useUserFlashCtx } from '../contexts/UserFlashCtx';
import { Heading } from './Heading';
import { logErr } from '../util/errors';
import { useFormik } from 'formik';
import * as yup from 'yup';
import { Dialog, DialogContent, DialogTitle } from '@mui/material';
import GavelIcon from '@mui/icons-material/Gavel';
import { BanTypeField, BanTypeFieldValidator } from './formik/BanTypeField';
import { ConfirmationModalProps } from './ConfirmationModal';
import { Heading } from './Heading';
import {
BanReasonField,
BanReasonFieldValidator
} from './formik/BanReasonField';
import { DurationField, DurationFieldValidator } from './formik/DurationField';
import {
BanReasonTextField,
BanReasonTextFieldValidator
} from './formik/BanReasonTextField';
import { BanTypeField, BanTypeFieldValidator } from './formik/BanTypeField';
import {
DurationCustomField,
DurationCustomFieldValidator
} from './formik/DurationCustomField';
import { NoteField, NoteFieldValidator } from './formik/NoteField';
import { ModalButtons } from './formik/ModalButtons';
import { DurationField, DurationFieldValidator } from './formik/DurationField';
import { GroupIdField, GroupIdFieldValidator } from './formik/GroupIdField';
import {
BanReasonTextField,
BanReasonTextFieldValidator
} from './formik/BanReasonTextField';
import { ModalButtons } from './formik/ModalButtons';
import { NoteField, NoteFieldValidator } from './formik/NoteField';

export interface BanGroupModalProps
extends ConfirmationModalProps<IAPIBanGroupRecord> {
Expand Down
Loading

0 comments on commit fda1999

Please sign in to comment.