Skip to content

Commit

Permalink
Fix linting issues
Browse files Browse the repository at this point in the history
  • Loading branch information
b-cho committed Mar 5, 2022
1 parent 099b427 commit 502a7f6
Show file tree
Hide file tree
Showing 39 changed files with 193 additions and 96 deletions.
4 changes: 2 additions & 2 deletions src/galeforce/actions/action.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,10 @@ import debug from 'debug';
import chalk from 'chalk';
import { v4 as uuidv4 } from 'uuid';
import _ from 'lodash';
import axios from 'axios';
import { Payload, ModifiablePayload, CreatePayloadProxy } from './payload';
import SubmoduleMap from '../interfaces/submodule-map';
import Request from '../../riot-api/requests';
import axios from 'axios';

const actionDebug = debug('galeforce:action');

Expand Down Expand Up @@ -156,7 +156,7 @@ export default class Action<TResult> {
throw new Error(`[galeforce]: Data fetch failed with status code ${e.response?.status}`);
}
} else {
throw new Error(`[galeforce]: ${e instanceof Error ? e.message : 'Data fetch failed with an unknown error'}`)
throw new Error(`[galeforce]: ${e instanceof Error ? e.message : 'Data fetch failed with an unknown error'}`);
}
}
}
Expand Down
6 changes: 4 additions & 2 deletions src/galeforce/actions/lol/champion-mastery/by-champion.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,10 @@ import { TakesChampionId, TakesRegion, TakesSummonerId } from '../../mixins';

const BaseAction = TakesSummonerId(
TakesChampionId(
TakesRegion({} as LeagueRegion,
Action),
TakesRegion(
{} as LeagueRegion,
Action,
),
),
);

Expand Down
6 changes: 4 additions & 2 deletions src/galeforce/actions/lol/champion-mastery/by-summoner.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,10 @@ import SubmoduleMap from '../../../interfaces/submodule-map';
import { TakesRegion, TakesSummonerId } from '../../mixins';

const BaseAction = TakesSummonerId(
TakesRegion({} as LeagueRegion,
Action),
TakesRegion(
{} as LeagueRegion,
Action,
),
);

export default class GetMasteryList extends BaseAction<ChampionMasteryDTO[]> {
Expand Down
6 changes: 4 additions & 2 deletions src/galeforce/actions/lol/champion-mastery/score.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,10 @@ import SubmoduleMap from '../../../interfaces/submodule-map';
import { TakesRegion, TakesSummonerId } from '../../mixins';

const BaseAction = TakesSummonerId(
TakesRegion({} as LeagueRegion,
Action),
TakesRegion(
{} as LeagueRegion,
Action,
),
);

export default class GetMasteryScore extends BaseAction<number> {
Expand Down
6 changes: 4 additions & 2 deletions src/galeforce/actions/lol/clash/players.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,10 @@ import SubmoduleMap from '../../../interfaces/submodule-map';
import { TakesSummonerId, TakesRegion } from '../../mixins';

const BaseAction = TakesSummonerId(
TakesRegion({} as LeagueRegion,
Action),
TakesRegion(
{} as LeagueRegion,
Action,
),
);

export default class GetClashPlayers extends BaseAction<PlayerDTO[]> {
Expand Down
6 changes: 4 additions & 2 deletions src/galeforce/actions/lol/clash/teams.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,10 @@ import SubmoduleMap from '../../../interfaces/submodule-map';
import { TakesTeamId, TakesRegion } from '../../mixins';

const BaseAction = TakesTeamId(
TakesRegion({} as LeagueRegion,
Action),
TakesRegion(
{} as LeagueRegion,
Action,
),
);

export default class GetClashTeam extends BaseAction<TeamDTO> {
Expand Down
6 changes: 4 additions & 2 deletions src/galeforce/actions/lol/clash/tournaments.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,10 @@ import { TakesTournamentId, TakesTeamId, TakesRegion } from '../../mixins';

const BaseAction = TakesTournamentId(
TakesTeamId(
TakesRegion({} as LeagueRegion,
Action),
TakesRegion(
{} as LeagueRegion,
Action,
),
),
);

Expand Down
16 changes: 11 additions & 5 deletions src/galeforce/actions/lol/league/entries.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,16 +12,22 @@ type GetLeagueEntriesQuery = {
page?: number;
}

const BaseAction = TakesQueue({} as LeagueQueue,
const BaseAction = TakesQueue(
{} as LeagueQueue,
TakesTier(
TakesDivision(
TakesSummonerId(
TakesQuery({} as GetLeagueEntriesQuery,
TakesRegion({} as LeagueRegion,
Action)),
TakesQuery(
{} as GetLeagueEntriesQuery,
TakesRegion(
{} as LeagueRegion,
Action,
),
),
),
),
));
),
);

export default class GetLeagueEntries extends BaseAction<LeagueEntryDTO[]> {
constructor(submodules: SubmoduleMap) {
Expand Down
12 changes: 8 additions & 4 deletions src/galeforce/actions/lol/league/leagues.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,17 @@ import {
TakesQueue, TakesTier, TakesLeagueId, TakesRegion,
} from '../../mixins';

const BaseAction = TakesQueue({} as LeagueQueue,
const BaseAction = TakesQueue(
{} as LeagueQueue,
TakesTier(
TakesLeagueId(
TakesRegion({} as LeagueRegion,
Action),
TakesRegion(
{} as LeagueRegion,
Action,
),
),
));
),
);

export default class GetLeagueList extends BaseAction<LeagueListDTO> {
constructor(submodules: SubmoduleMap) {
Expand Down
6 changes: 4 additions & 2 deletions src/galeforce/actions/lol/match/match.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,10 @@ import SubmoduleMap from '../../../interfaces/submodule-map';
import { TakesMatchId, TakesRegion } from '../../mixins';

const BaseAction = TakesMatchId(
TakesRegion({} as RiotRegion,
Action),
TakesRegion(
{} as RiotRegion,
Action,
),
);

export default class GetMatch extends BaseAction<MatchDTO> {
Expand Down
10 changes: 7 additions & 3 deletions src/galeforce/actions/lol/match/matchlist.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,13 @@ type GetMatchlistQuery = {
}

const BaseAction = TakesPUUID(
TakesQuery({} as GetMatchlistQuery,
TakesRegion({} as RiotRegion,
Action)),
TakesQuery(
{} as GetMatchlistQuery,
TakesRegion(
{} as RiotRegion,
Action,
),
),
);

export default class GetMatchlist extends BaseAction<string[]> {
Expand Down
6 changes: 4 additions & 2 deletions src/galeforce/actions/lol/match/timeline.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,10 @@ import SubmoduleMap from '../../../interfaces/submodule-map';
import { TakesMatchId, TakesRegion } from '../../mixins';

const BaseAction = TakesMatchId(
TakesRegion({} as RiotRegion,
Action),
TakesRegion(
{} as RiotRegion,
Action,
),
);

export default class GetTimeline extends BaseAction<MatchTimelineDTO> {
Expand Down
6 changes: 4 additions & 2 deletions src/galeforce/actions/lol/spectator/active-games.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,10 @@ import { CurrentGameInfoDTO } from '../../../interfaces/dto';
import { TakesRegion, TakesSummonerId } from '../../mixins';

const BaseAction = TakesSummonerId(
TakesRegion({} as LeagueRegion,
Action),
TakesRegion(
{} as LeagueRegion,
Action,
),
);

export default class GetCurrentGameInfo extends BaseAction<CurrentGameInfoDTO> {
Expand Down
6 changes: 4 additions & 2 deletions src/galeforce/actions/lol/summoner/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,10 @@ const BaseAction = TakesSummonerName(
TakesSummonerId(
TakesAccountId(
TakesPUUID(
TakesRegion({} as LeagueRegion,
Action),
TakesRegion(
{} as LeagueRegion,
Action,
),
),
),
),
Expand Down
6 changes: 4 additions & 2 deletions src/galeforce/actions/lol/third-party-code/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,10 @@ import SubmoduleMap from '../../../interfaces/submodule-map';
import { TakesRegion, TakesSummonerId } from '../../mixins';

const BaseAction = TakesSummonerId(
TakesRegion({} as LeagueRegion,
Action),
TakesRegion(
{} as LeagueRegion,
Action,
),
);

export default class GetThirdPartyCode extends BaseAction<string> {
Expand Down
14 changes: 10 additions & 4 deletions src/galeforce/actions/lol/tournament/create-codes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,16 @@ type PostTournamentCodesQuery = {
tournamentId: number;
}

const BaseAction = TakesBody({} as TournamentCodeParameters,
TakesQuery({} as PostTournamentCodesQuery,
TakesRegion({} as RiotRegion,
Action)));
const BaseAction = TakesBody(
{} as TournamentCodeParameters,
TakesQuery(
{} as PostTournamentCodesQuery,
TakesRegion(
{} as RiotRegion,
Action,
),
),
);

export default class PostTournamentCodes extends BaseAction<string[]> {
constructor(submodules: SubmoduleMap) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,10 @@ import { TournamentCodeDTO } from '../../../interfaces/dto';
import { TakesRegion, TakesTournamentCode } from '../../mixins';

const BaseAction = TakesTournamentCode(
TakesRegion({} as RiotRegion,
Action),
TakesRegion(
{} as RiotRegion,
Action,
),
);

export default class GetTournamentCodes extends BaseAction<TournamentCodeDTO> {
Expand Down
6 changes: 4 additions & 2 deletions src/galeforce/actions/lol/tournament/lobby-events.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,10 @@ import { LobbyEventDTOWrapper } from '../../../interfaces/dto';
import { TakesTournamentCode, TakesRegion } from '../../mixins';

const BaseAction = TakesTournamentCode(
TakesRegion({} as RiotRegion,
Action),
TakesRegion(
{} as RiotRegion,
Action,
),
);

export default class GetLobbyEvents extends BaseAction<LobbyEventDTOWrapper> {
Expand Down
10 changes: 7 additions & 3 deletions src/galeforce/actions/lol/tournament/providers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,13 @@ import SubmoduleMap from '../../../interfaces/submodule-map';
import { ProviderRegistrationParameters } from '../../../interfaces/parameters';
import { TakesBody, TakesRegion } from '../../mixins';

const BaseAction = TakesBody({} as ProviderRegistrationParameters,
TakesRegion({} as RiotRegion,
Action));
const BaseAction = TakesBody(
{} as ProviderRegistrationParameters,
TakesRegion(
{} as RiotRegion,
Action,
),
);

export default class PostProviders extends BaseAction<string[]> {
constructor(submodules: SubmoduleMap) {
Expand Down
10 changes: 7 additions & 3 deletions src/galeforce/actions/lol/tournament/tournaments.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,13 @@ import SubmoduleMap from '../../../interfaces/submodule-map';
import { TournamentRegistrationParameters } from '../../../interfaces/parameters';
import { TakesBody, TakesRegion } from '../../mixins';

const BaseAction = TakesBody({} as TournamentRegistrationParameters,
TakesRegion({} as RiotRegion,
Action));
const BaseAction = TakesBody(
{} as TournamentRegistrationParameters,
TakesRegion(
{} as RiotRegion,
Action,
),
);

export default class PostTournaments extends BaseAction<number> {
constructor(submodules: SubmoduleMap) {
Expand Down
12 changes: 8 additions & 4 deletions src/galeforce/actions/lol/tournament/update-tournament.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,15 @@ import SubmoduleMap from '../../../interfaces/submodule-map';
import { TournamentCodeUpdateParameters } from '../../../interfaces/parameters';
import { TakesBody, TakesRegion, TakesTournamentCode } from '../../mixins';

const BaseAction = TakesBody({} as TournamentCodeUpdateParameters,
const BaseAction = TakesBody(
{} as TournamentCodeUpdateParameters,
TakesTournamentCode(
TakesRegion({} as RiotRegion,
Action),
));
TakesRegion(
{} as RiotRegion,
Action,
),
),
);

export default class PutTournamentCodes extends BaseAction<void> {
constructor(submodules: SubmoduleMap) {
Expand Down
6 changes: 4 additions & 2 deletions src/galeforce/actions/lor/lor-match/match.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,10 @@ import SubmoduleMap from '../../../interfaces/submodule-map';
import { TakesMatchId, TakesRegion } from '../../mixins';

const BaseAction = TakesMatchId(
TakesRegion({} as LorRegion,
Action),
TakesRegion(
{} as LorRegion,
Action,
),
);

export default class GetLorMatch extends BaseAction<LorMatchDTO> {
Expand Down
6 changes: 4 additions & 2 deletions src/galeforce/actions/lor/lor-match/matchlist.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,10 @@ import SubmoduleMap from '../../../interfaces/submodule-map';
import { TakesPUUID, TakesRegion } from '../../mixins';

const BaseAction = TakesPUUID(
TakesRegion({} as LorRegion,
Action),
TakesRegion(
{} as LorRegion,
Action,
),
);

export default class GetLorMatchlist extends BaseAction<string[]> {
Expand Down
1 change: 1 addition & 0 deletions src/galeforce/actions/payload.ts
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,7 @@ export const CreatePayloadProxy = (payload: Payload): Payload => new Proxy(paylo
if (typeof value !== 'string' || !(/^\/.*$/.test(value))) {
throw new Error(`[galeforce]: Invalid ${name} provided (failed regex check).`);
}
break;
default:
// Throw an error if the key does not exist on the payload interface
if (!payloadKeys.includes(name)) {
Expand Down
6 changes: 4 additions & 2 deletions src/galeforce/actions/riot/account/account.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,10 @@ import { TakesPUUID, TakesRiotId, TakesRegion } from '../../mixins';

const BaseAction = TakesPUUID(
TakesRiotId(
TakesRegion({} as RiotRegion,
Action),
TakesRegion(
{} as RiotRegion,
Action,
),
),
);

Expand Down
6 changes: 4 additions & 2 deletions src/galeforce/actions/riot/account/active-shard.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,10 @@ import { TakesPUUID, TakesGame, TakesRegion } from '../../mixins';

const BaseAction = TakesPUUID(
TakesGame(
TakesRegion({} as RiotRegion,
Action),
TakesRegion(
{} as RiotRegion,
Action,
),
),
);

Expand Down
Loading

0 comments on commit 502a7f6

Please sign in to comment.