mirror of
https://github.com/Sendouc/sendou.ink.git
synced 2026-03-21 18:04:39 -05:00
TS check for unused vars
This commit is contained in:
parent
a62685e1e1
commit
2584213b3d
|
|
@ -10,7 +10,7 @@ import {
|
|||
NumberInputStepper,
|
||||
Radio,
|
||||
} from "@chakra-ui/react";
|
||||
import { t, Trans } from "@lingui/macro";
|
||||
import { Trans } from "@lingui/macro";
|
||||
import { Ability, Mode } from "@prisma/client";
|
||||
import AbilityIcon from "components/common/AbilityIcon";
|
||||
import {
|
||||
|
|
|
|||
|
|
@ -1,6 +1,5 @@
|
|||
import { useToast } from "@chakra-ui/react";
|
||||
import { t } from "@lingui/macro";
|
||||
import { useRouter } from "next/router";
|
||||
import { useState } from "react";
|
||||
import { SWRConfig } from "swr";
|
||||
import Footer from "./Footer";
|
||||
|
|
@ -10,18 +9,8 @@ import Nav from "./Nav";
|
|||
|
||||
const DATE_KEYS = ["createdAt", "updatedAt"];
|
||||
|
||||
const WIDE = [
|
||||
"analyzer",
|
||||
"plans",
|
||||
"builds",
|
||||
"u/",
|
||||
"sr/leaderboards",
|
||||
"plus/history",
|
||||
];
|
||||
|
||||
const Layout = ({ children }: { children: React.ReactNode }) => {
|
||||
const [navIsOpen, setNavIsOpen] = useState(false);
|
||||
const router = useRouter();
|
||||
const [errors, setErrors] = useState(new Set<string>());
|
||||
const toast = useToast();
|
||||
|
||||
|
|
|
|||
|
|
@ -306,7 +306,7 @@ const BuildModal: React.FC<Props> = ({ onClose, build, weaponFromQuery }) => {
|
|||
name="headGear"
|
||||
control={control}
|
||||
defaultValue=""
|
||||
render={({ onChange, value, name }) => (
|
||||
render={({ onChange, value }) => (
|
||||
<GearSelector
|
||||
slot="head"
|
||||
value={value}
|
||||
|
|
|
|||
|
|
@ -1,45 +0,0 @@
|
|||
import { adjustedSearchParams } from "./useMyRouter";
|
||||
|
||||
const TEST_URL = "https://sendou.ink/freeagents?xp=true&playstyle=MIDLINE";
|
||||
|
||||
describe("adjustedSearchParams", () => {
|
||||
test("no changes return search params unchanged", () => {
|
||||
const newParams = adjustedSearchParams(TEST_URL, []);
|
||||
const newParamsObj = Object.fromEntries(Array.from(newParams.entries()));
|
||||
|
||||
expect(newParamsObj.xp).toBe("true");
|
||||
expect(newParamsObj.playstyle).toBe("MIDLINE");
|
||||
expect(Object.keys(newParamsObj).length).toBe(2);
|
||||
});
|
||||
|
||||
test("adds search params while retaining old", () => {
|
||||
const newParams = adjustedSearchParams(TEST_URL, [["test", "works"]]);
|
||||
const newParamsObj = Object.fromEntries(Array.from(newParams.entries()));
|
||||
|
||||
expect(newParamsObj.xp).toBe("true");
|
||||
expect(newParamsObj.playstyle).toBe("MIDLINE");
|
||||
expect(newParamsObj.test).toBe("works");
|
||||
expect(Object.keys(newParamsObj).length).toBe(3);
|
||||
});
|
||||
|
||||
test("adds search params of number and boolean types", () => {
|
||||
const newParams = adjustedSearchParams(TEST_URL, [
|
||||
["number", 2],
|
||||
["boolean", true],
|
||||
]);
|
||||
const newParamsObj = Object.fromEntries(Array.from(newParams.entries()));
|
||||
|
||||
expect(newParamsObj.number).toBe("2");
|
||||
expect(newParamsObj.boolean).toBe("true");
|
||||
});
|
||||
|
||||
test("falsy value removes the key", () => {
|
||||
const newParams = adjustedSearchParams(TEST_URL, [
|
||||
["xp", ""],
|
||||
["playstyle", null],
|
||||
]);
|
||||
const newParamsObj = Object.fromEntries(Array.from(newParams.entries()));
|
||||
|
||||
expect(Object.keys(newParamsObj).length).toBe(0);
|
||||
});
|
||||
});
|
||||
|
|
@ -1,6 +1,4 @@
|
|||
import { NextRouter, useRouter } from "next/router";
|
||||
import type { URLSearchParams as URLSearchParamsType } from "url";
|
||||
import * as z from "zod";
|
||||
|
||||
type SearchParamsType =
|
||||
| string
|
||||
|
|
|
|||
|
|
@ -1,4 +0,0 @@
|
|||
module.exports = {
|
||||
preset: "ts-jest",
|
||||
testEnvironment: "node",
|
||||
};
|
||||
7789
package-lock.json
generated
7789
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
|
|
@ -3,10 +3,10 @@
|
|||
"version": "1.0.0",
|
||||
"private": true,
|
||||
"scripts": {
|
||||
"test": "jest",
|
||||
"dev": "next dev",
|
||||
"build": "lingui compile && npm run prebuild && next build",
|
||||
"build:analyze": "lingui compile && npm run prebuild && ANALYZE=true next build",
|
||||
"typecheck": "tsc --noEmit",
|
||||
"start": "next start",
|
||||
"compile": "lingui compile",
|
||||
"migrate": "npx prisma migrate deploy",
|
||||
|
|
@ -71,7 +71,6 @@
|
|||
"@babel/core": "^7.14.6",
|
||||
"@lingui/cli": "^3.8.3",
|
||||
"@lingui/macro": "^3.8.3",
|
||||
"@types/jest": "^26.0.23",
|
||||
"@types/node": "^15.12.4",
|
||||
"@types/nprogress": "^0.2.0",
|
||||
"@types/randomcolor": "^0.5.5",
|
||||
|
|
@ -86,7 +85,6 @@
|
|||
"eslint-config-next": "^11.0.0",
|
||||
"prettier": "^2.3.1",
|
||||
"prisma": "^2.25.0",
|
||||
"ts-jest": "^27.0.3",
|
||||
"ts-node": "^10.0.0",
|
||||
"typescript": "^4.3.4"
|
||||
},
|
||||
|
|
|
|||
|
|
@ -1,5 +1,4 @@
|
|||
import { ChakraProvider, extendTheme } from "@chakra-ui/react";
|
||||
import { mode } from "@chakra-ui/theme-tools";
|
||||
import { i18n } from "@lingui/core";
|
||||
import { I18nProvider } from "@lingui/react";
|
||||
import Layout from "components/layout";
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
import { Box, Button, Grid } from "@chakra-ui/react";
|
||||
import { Box, Grid } from "@chakra-ui/react";
|
||||
import MyLink from "components/common/MyLink";
|
||||
import BeautifulDrawingOfBorzoic from "components/layout/BeautifulDrawingByBorzoic";
|
||||
import NavButtons from "components/layout/NavButtons";
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
import { Box, HStack, Radio, RadioGroup } from "@chakra-ui/react";
|
||||
import { t, Trans } from "@lingui/macro";
|
||||
import { Trans } from "@lingui/macro";
|
||||
import MyLink from "components/common/MyLink";
|
||||
import QuadTable from "components/player/QuadTable";
|
||||
import TwinTable from "components/player/TwinTable";
|
||||
|
|
@ -70,12 +70,6 @@ const PlayerPage = (props: Props) => {
|
|||
</>
|
||||
);
|
||||
|
||||
function getPlayerName() {
|
||||
if (player?.placements.length) return player.placements[0].playerName;
|
||||
|
||||
return "???";
|
||||
}
|
||||
|
||||
function getInitialTabValue() {
|
||||
if (
|
||||
!router.query.tab ||
|
||||
|
|
|
|||
|
|
@ -31,7 +31,7 @@ const XTrendsPage = ({ trends }: XTrendsPageProps) => {
|
|||
<TrendTier
|
||||
key={tier.label}
|
||||
tier={tier}
|
||||
data={trends[mode].filter((weapon, _, arr) => {
|
||||
data={trends[mode].filter((weapon) => {
|
||||
const targetCount = 1500 * (tier.criteria / 100);
|
||||
const previousTargetCount =
|
||||
i === 0 ? Infinity : 1500 * (xTrendsTiers[i - 1].criteria / 100);
|
||||
|
|
|
|||
|
|
@ -6,6 +6,8 @@
|
|||
"skipLibCheck": true,
|
||||
"strict": true,
|
||||
"forceConsistentCasingInFileNames": true,
|
||||
"noUnusedParameters": true,
|
||||
"noUnusedLocals": true,
|
||||
"noEmit": true,
|
||||
"esModuleInterop": true,
|
||||
"module": "esnext",
|
||||
|
|
|
|||
|
|
@ -1 +1 @@
|
|||
[]
|
||||
[{"username":"Fuwa","discriminator":"8633","patreonTier":3,"discordId":"150612545336508418"},{"username":"Kabagu","discriminator":"6766","patreonTier":3,"discordId":"399267313674747905"},{"username":"Re-Mi","discriminator":"6123","patreonTier":3,"discordId":"361742382963621889"},{"username":"Krent0n","discriminator":"9587","patreonTier":3,"discordId":"429651155224887299"},{"username":"Adept","discriminator":"7777","patreonTier":3,"discordId":"68811718473555968"},{"username":"beta","discriminator":"3025","patreonTier":3,"discordId":"364469424960438272"},{"username":"RevengeZ","discriminator":"1919","patreonTier":3,"discordId":"305453601474609153"},{"username":"aceticke","discriminator":"0001","patreonTier":2,"discordId":"574626573152419840"},{"username":"Jess Batey","discriminator":"7406","patreonTier":2,"discordId":"328319613140074507"},{"username":"Lui","discriminator":"1185","patreonTier":2,"discordId":"351801323810717712"},{"username":"fancy","discriminator":"8811","patreonTier":2,"discordId":"125757563047247873"},{"username":"linko","discriminator":"0666","patreonTier":2,"discordId":"555562311251918848"},{"username":"prosper","discriminator":"8265","patreonTier":2,"discordId":"412754879933841409"},{"username":"EdmundDickens","discriminator":"1955","patreonTier":2,"discordId":"428618743153688576"},{"username":"synapse","discriminator":"9753","patreonTier":2,"discordId":"397208511848644619"},{"username":"Dio","discriminator":"3896","patreonTier":2,"discordId":"138400548633313281"},{"username":"miyn","discriminator":"2522","patreonTier":2,"discordId":"358623826721898496"},{"username":"Slate","discriminator":"3249","patreonTier":2,"discordId":"97288493029416960"},{"username":"Brock.com","discriminator":"0048","patreonTier":2,"discordId":"123514351641559042"},{"username":"Cue","discriminator":"1132","patreonTier":2,"discordId":"347036855453220865"},{"username":"Sakaali","discriminator":"2092","patreonTier":2,"discordId":"140911330059091969"},{"username":"Fusion","discriminator":"1883","patreonTier":2,"discordId":"78615504511574016"},{"username":"MasterRS","discriminator":"4321","patreonTier":2,"discordId":"277760673436401664"},{"username":"littlepetfrog","discriminator":"6051","patreonTier":2,"discordId":"106462785549897728"},{"username":"CoconutTank","discriminator":"1053","patreonTier":2,"discordId":"78901351706271744"},{"username":"Lucyfer","discriminator":"0666","patreonTier":2,"discordId":"254943418755710976"},{"username":"Smaack","discriminator":"8232","patreonTier":1,"discordId":"262647368183185408"}]
|
||||
|
|
@ -317,7 +317,7 @@ type RGB = [number, number, number];
|
|||
function hexToRgb(hex: string): RGB {
|
||||
// Expand shorthand form (e.g. "03F") to full form (e.g. "0033FF")
|
||||
const shorthandRegex = /^#?([a-f\d])([a-f\d])([a-f\d])$/i;
|
||||
hex = hex.replace(shorthandRegex, (m, r, g, b) => {
|
||||
hex = hex.replace(shorthandRegex, (_m, r, g, b) => {
|
||||
return r + r + g + g + b + b;
|
||||
});
|
||||
|
||||
|
|
|
|||
|
|
@ -387,6 +387,7 @@ export const weaponsWithHeroCategorized: readonly {
|
|||
|
||||
// done like this so that the strings get translated but
|
||||
// components receive the names in English as well
|
||||
// @ts-expect-error
|
||||
const weaponsWithHeroCategorizedLocalized = [
|
||||
t`Sploosh-o-matic`,
|
||||
t`Neo Sploosh-o-matic`,
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user