From f8c44efeba4f612d0e728db531f1cdae49316614 Mon Sep 17 00:00:00 2001 From: Marshall Polaris Date: Sat, 4 Jun 2022 13:30:54 -0700 Subject: [PATCH] Small cleanup to some `common` code (#422) * Remove unnecessary type helpers * Turn on unused code lint --- common/.eslintrc.js | 1 - common/util/types.ts | 5 ----- web/pages/[username]/[contractSlug].tsx | 3 +-- web/pages/embed/analytics.tsx | 3 +-- 4 files changed, 2 insertions(+), 10 deletions(-) delete mode 100644 common/util/types.ts diff --git a/common/.eslintrc.js b/common/.eslintrc.js index e03e5ef5..7904e7ad 100644 --- a/common/.eslintrc.js +++ b/common/.eslintrc.js @@ -22,7 +22,6 @@ module.exports = { ], rules: { 'no-extra-semi': 'off', - 'no-unused-vars': 'off', 'no-constant-condition': ['error', { checkLoops: false }], 'lodash/import-scope': [2, 'member'], }, diff --git a/common/util/types.ts b/common/util/types.ts deleted file mode 100644 index 865cb8f3..00000000 --- a/common/util/types.ts +++ /dev/null @@ -1,5 +0,0 @@ -export type FirstArgument = T extends (arg1: infer U, ...args: any[]) => any - ? U - : any - -export type Truthy = Exclude diff --git a/web/pages/[username]/[contractSlug].tsx b/web/pages/[username]/[contractSlug].tsx index e340e12a..008a97aa 100644 --- a/web/pages/[username]/[contractSlug].tsx +++ b/web/pages/[username]/[contractSlug].tsx @@ -29,7 +29,6 @@ import { resolvedPayout } from 'common/calculate' import { formatMoney } from 'common/util/format' import { useUserById } from 'web/hooks/use-users' import { ContractTabs } from 'web/components/contract/contract-tabs' -import { FirstArgument } from 'common/util/types' import { contractTextDetails } from 'web/components/contract/contract-details' import { useWindowSize } from 'web/hooks/use-window-size' import Confetti from 'react-confetti' @@ -88,7 +87,7 @@ export default function ContractPage(props: { return } -export function ContractPageContent(props: FirstArgument) { +export function ContractPageContent(props: Parameters[0]) { const { backToHome } = props const user = useUser() diff --git a/web/pages/embed/analytics.tsx b/web/pages/embed/analytics.tsx index 8ba2951a..564c4abc 100644 --- a/web/pages/embed/analytics.tsx +++ b/web/pages/embed/analytics.tsx @@ -1,4 +1,3 @@ -import { FirstArgument } from 'common/util/types' import { Col } from 'web/components/layout/col' import { Spacer } from 'web/components/layout/spacer' import { fromPropz } from 'web/hooks/use-propz' @@ -10,7 +9,7 @@ import Analytics, { export const getStaticProps = fromPropz(getStaticPropz) -export default function AnalyticsEmbed(props: FirstArgument) { +export default function AnalyticsEmbed(props: Parameters[0]) { return (