diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index c9311738370..a70dbb39ce6 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -69,21 +69,21 @@ jobs: - run: npm run depcheck - # find-unused-exports: - # runs-on: ubuntu-latest + ts-unused-exports: + runs-on: ubuntu-latest - # timeout-minutes: 15 + timeout-minutes: 15 - # steps: - # - name: Checkout - # uses: actions/checkout@v4 + steps: + - name: Checkout + uses: actions/checkout@v4 - # - name: Setup project - # uses: ./.github/actions/setup-project - # with: - # CACHE_VERSION: ${{ secrets.CACHE_VERSION }} + - name: Setup project + uses: ./.github/actions/setup-project + with: + CACHE_VERSION: ${{ secrets.CACHE_VERSION }} - # - run: npm run find-unused-exports + - run: npm run ts-unused-exports check-langs: runs-on: ubuntu-latest diff --git a/components/EditTagsModal.tsx b/components/EditTagsModal.tsx index b1cd54d7866..90ace3408c8 100644 --- a/components/EditTagsModal.tsx +++ b/components/EditTagsModal.tsx @@ -27,7 +27,7 @@ const tagStatsQuery = gql` } `; -export type EditTagsModalProps = { +type EditTagsModalProps = { collective: Collective; onClose: () => void; }; diff --git a/components/FormikZod.tsx b/components/FormikZod.tsx index 5b332a60b98..d0f99cf7e33 100644 --- a/components/FormikZod.tsx +++ b/components/FormikZod.tsx @@ -296,6 +296,7 @@ export const FormikZodContext = React.createContext<{ * component will not work out of the box with `StyledInputFormikField` and other components that rely on Formik context such as `Field` or `FastField`. * If you are trying to access Formik state via context, use `useFormikContext`. Only use this hook if you are NOT using or withFormik. */ +// ts-unused-exports:disable-next-line export function useFormikZod({ schema, ...props @@ -338,5 +339,3 @@ export function FormikZod({ ); } - -// ignore unused exports useFormikZod, FormikZod, getInputAttributesFromZodSchema diff --git a/components/I18nFormatters.js b/components/I18nFormatters.js index 5d8b9676eb6..0f46837e07c 100644 --- a/components/I18nFormatters.js +++ b/components/I18nFormatters.js @@ -4,7 +4,6 @@ import { FormattedMessage } from 'react-intl'; import Link from './Link'; import StyledLink from './StyledLink'; -// ignore unused exports // utility library // eslint-disable-next-line react/display-name @@ -13,9 +12,13 @@ export const getI18nLink = linkProps => chunks => ( ); export const I18nBold = chunks => {chunks}; export const I18nItalic = chunks => {chunks}; +// ts-unused-exports:disable-next-line export const I18nCode = chunks => {chunks}; +// ts-unused-exports:disable-next-line export const I18nOrderedList = chunks =>
    {chunks}
; +// ts-unused-exports:disable-next-line export const I18nUnorderedList = chunks =>
    {chunks}
; +// ts-unused-exports:disable-next-line export const I18nListItem = chunks =>
  • {chunks}
  • ; export const I18nUnderline = chunks => {chunks}; @@ -33,11 +36,14 @@ export const I18nSignInLink = chunks => ( ); +// ts-unused-exports:disable-next-line export const I18nTOSLink = msg => ( {msg} ); + +// ts-unused-exports:disable-next-line export const I18nPrivacyLink = msg => ( {msg} diff --git a/components/ModalContext.tsx b/components/ModalContext.tsx index 1f2b5567a5b..4d784751283 100644 --- a/components/ModalContext.tsx +++ b/components/ModalContext.tsx @@ -117,15 +117,6 @@ const reducer = (state: ModalContextValues, action: ModalAction) => { } }; -export type CloseComponentType = React.ComponentType<{ - onClick: React.MouseEventHandler; -}>; - -export type ContentComponentType = React.ComponentType<{ - className?: string; - children: React.ReactNode; -}>; - const ModalRoot = () => { const { modals, hideModal } = useModal(); return modals.map(({ component: Component, modalProps, type, id, open }) => { @@ -150,7 +141,7 @@ const ModalRoot = () => { }); }; -const ModalProvider = ({ children }) => { +export const ModalProvider = ({ children }) => { const initialState = { modals: [], showModal: (component, modalProps = {}, modalId) => { @@ -178,8 +169,4 @@ const ModalProvider = ({ children }) => { ); }; -const useModal = () => useContext(ModalContext); - -// ignore unused exports - -export { ModalProvider, useModal }; +export const useModal = () => useContext(ModalContext); diff --git a/components/StyledDropzone.tsx b/components/StyledDropzone.tsx index ba914a79c42..0cddc187d83 100644 --- a/components/StyledDropzone.tsx +++ b/components/StyledDropzone.tsx @@ -22,7 +22,6 @@ import StyledSpinner from './StyledSpinner'; import { P, Span } from './Text'; import UploadedFilePreview from './UploadedFilePreview'; -// ignore unused exports DROPZONE_ACCEPT_PDF export const DROPZONE_ACCEPT_IMAGES = { 'image/*': ['.jpeg', '.png'] }; export const DROPZONE_ACCEPT_PDF = { 'application/pdf': ['.pdf'] }; export const DROPZONE_ACCEPT_ALL = { ...DROPZONE_ACCEPT_IMAGES, ...DROPZONE_ACCEPT_PDF }; diff --git a/components/StyledKeyframes.js b/components/StyledKeyframes.js index 2aeb65c74ec..8354dc33c4c 100644 --- a/components/StyledKeyframes.js +++ b/components/StyledKeyframes.js @@ -4,7 +4,6 @@ import { keyframes } from 'styled-components'; -// ignore unused exports // utility library export const rotating = keyframes` @@ -16,6 +15,7 @@ export const rotating = keyframes` } `; +// ts-unused-exports:disable-next-line export const fadeIn = keyframes` from { opacity: 0; @@ -34,6 +34,7 @@ export const slideInUp = keyframes` } `; +// ts-unused-exports:disable-next-line export const fadeInUp = keyframes` from { opacity: 0; diff --git a/components/accept-financial-contributions/StartAcceptingFinancialContributionsPage.tsx b/components/accept-financial-contributions/StartAcceptingFinancialContributionsPage.tsx index 7ad3e7b54de..a2442d185d8 100644 --- a/components/accept-financial-contributions/StartAcceptingFinancialContributionsPage.tsx +++ b/components/accept-financial-contributions/StartAcceptingFinancialContributionsPage.tsx @@ -20,7 +20,7 @@ import { H1, P } from '../Text'; import FindAHostSearch from './FindAHostSearch'; -export type StartAcceptingFinancialContributionsPageProps = { +type StartAcceptingFinancialContributionsPageProps = { collective: Collective; onChange: (field: string, value: unknown) => void; }; diff --git a/components/budget/DebitCreditList.js b/components/budget/DebitCreditList.js index eb4c1d7cfe1..73b3b83c53f 100644 --- a/components/budget/DebitCreditList.js +++ b/components/budget/DebitCreditList.js @@ -72,7 +72,6 @@ export const CreditItem = ({ children, ...props }) => { CreditItem.propTypes = { children: PropTypes.node }; -// ignore unused exports default // used in Stories mdx - +// ts-unused-exports:disable-next-line export default DebitCreditList; diff --git a/components/collective-page/hero/HeroSocialLinks.tsx b/components/collective-page/hero/HeroSocialLinks.tsx index 3bd4beb4b42..bd1dea7fcfd 100644 --- a/components/collective-page/hero/HeroSocialLinks.tsx +++ b/components/collective-page/hero/HeroSocialLinks.tsx @@ -50,7 +50,7 @@ function iconForSocialLinkType(type: SocialLinkType) { return SocialLinkIcon[type] || Globe; } -export type HeroSocialLinksProps = { +type HeroSocialLinksProps = { socialLinks: SocialLink[]; relMe?: boolean; }; diff --git a/components/collectives/Banner.js b/components/collectives/Banner.js index 18d802c6eb9..5a195a01d52 100644 --- a/components/collectives/Banner.js +++ b/components/collectives/Banner.js @@ -1,4 +1,3 @@ -// ignore unused exports default // keeping the file in case we want to use it in the future import React from 'react'; @@ -29,4 +28,5 @@ const Banner = () => ( ); +// ts-unused-exports:disable-next-line export default Banner; diff --git a/components/dashboard/filters/HostsFilter.tsx b/components/dashboard/filters/HostsFilter.tsx index 56c25fca29f..5500b34a7c7 100644 --- a/components/dashboard/filters/HostsFilter.tsx +++ b/components/dashboard/filters/HostsFilter.tsx @@ -34,7 +34,7 @@ const hostsFilterSearchQuery = gql` ${accountHoverCardFields} `; -export const AccountRenderer = ({ +const AccountRenderer = ({ account, inOptionsList, }: { diff --git a/components/dashboard/filters/PeriodCompareFilter/index.tsx b/components/dashboard/filters/PeriodCompareFilter/index.tsx index c7dfc878223..832df3f40a0 100644 --- a/components/dashboard/filters/PeriodCompareFilter/index.tsx +++ b/components/dashboard/filters/PeriodCompareFilter/index.tsx @@ -25,7 +25,7 @@ import { Select, SelectContent, SelectItem, SelectValue } from '../../../ui/Sele import { PeriodFilterCompare, PeriodFilterType, schema } from './schema'; -export type PeriodCompareFilterValueType = z.infer; +type PeriodCompareFilterValueType = z.infer; const getAvailableTimeUnits = (value: PeriodCompareFilterValueType): TimeUnit[] => { const { dateTo, dateFrom } = getPeriodDates(value); diff --git a/components/dashboard/sections/contributions/filters.tsx b/components/dashboard/sections/contributions/filters.tsx index 0db8265696f..d2008b9d4a6 100644 --- a/components/dashboard/sections/contributions/filters.tsx +++ b/components/dashboard/sections/contributions/filters.tsx @@ -47,7 +47,7 @@ export const schema = z.object({ paymentMethod: z.string().optional(), }); -export type FilterValues = z.infer; +type FilterValues = z.infer; export type FilterMeta = { currency?: Currency; diff --git a/components/dashboard/sections/expenses/PaypalPreApprovalDetailsIcon.js b/components/dashboard/sections/expenses/PaypalPreApprovalDetailsIcon.js index ab035dfc61a..3dcd873c830 100644 --- a/components/dashboard/sections/expenses/PaypalPreApprovalDetailsIcon.js +++ b/components/dashboard/sections/expenses/PaypalPreApprovalDetailsIcon.js @@ -82,7 +82,6 @@ PaypalPreApprovalDetailsIcon.propTypes = { }), }; -// ignore unused exports default // keep for future use? - +// ts-unused-exports:disable-next-line export default PaypalPreApprovalDetailsIcon; diff --git a/components/dashboard/sections/expenses/filters.tsx b/components/dashboard/sections/expenses/filters.tsx index 182272d3284..b50a71d9264 100644 --- a/components/dashboard/sections/expenses/filters.tsx +++ b/components/dashboard/sections/expenses/filters.tsx @@ -49,7 +49,7 @@ export const schema = z.object({ virtualCard: isMulti(z.string()).optional(), }); -export type FilterValues = z.infer; +type FilterValues = z.infer; export type FilterMeta = { currency?: Currency; diff --git a/components/dashboard/sections/tax-information/common.ts b/components/dashboard/sections/tax-information/common.ts index 8668d5f72c3..36d09d626cf 100644 --- a/components/dashboard/sections/tax-information/common.ts +++ b/components/dashboard/sections/tax-information/common.ts @@ -63,7 +63,7 @@ export const TaxFormNameFields = z.object({ lastName: z.string().min(1).max(50), }); -export type TaxFormNameValues = z.infer; +// type TaxFormNameValues = z.infer; export const TaxFormLocationFields = z.object({ country: z.string(), @@ -76,7 +76,7 @@ export const TaxFormLocationFields = z.object({ }), }); -export type TaxFormLocationValues = z.infer; +// type TaxFormLocationValues = z.infer; export const BaseFormSchema = z.object({ isUSPersonOrEntity: z.boolean(), diff --git a/components/edit-collective/EditVirtualCardModal.tsx b/components/edit-collective/EditVirtualCardModal.tsx index 43de39cad30..f4d9f1e5dfa 100644 --- a/components/edit-collective/EditVirtualCardModal.tsx +++ b/components/edit-collective/EditVirtualCardModal.tsx @@ -164,7 +164,7 @@ const throttledCall = debounce((searchFunc, variables) => { return searchFunc({ variables }); }, 750); -export type EditVirtualCardModalProps = { +type EditVirtualCardModalProps = { host: Account; collective?: Account; virtualCard?: VirtualCard; diff --git a/components/edit-collective/SocialLinksFormField.tsx b/components/edit-collective/SocialLinksFormField.tsx index 8fa21bffb71..7220e79e362 100644 --- a/components/edit-collective/SocialLinksFormField.tsx +++ b/components/edit-collective/SocialLinksFormField.tsx @@ -17,7 +17,7 @@ import StyledInput from '../StyledInput'; import StyledSelect from '../StyledSelect'; import { Span } from '../Text'; -export type SocialLinksFormFieldProps = { +type SocialLinksFormFieldProps = { value?: SocialLink[]; touched?: boolean; onChange: (value: SocialLinkInput[]) => void; diff --git a/components/expenses/ApproveExpenseModal.tsx b/components/expenses/ApproveExpenseModal.tsx index 28890a5d934..56371a20225 100644 --- a/components/expenses/ApproveExpenseModal.tsx +++ b/components/expenses/ApproveExpenseModal.tsx @@ -12,7 +12,7 @@ import { useToast } from '../ui/useToast'; import { editExpenseCategoryMutation } from './graphql/mutations'; -export type ConfirmProcessExpenseModalProps = { +type ConfirmProcessExpenseModalProps = { onClose: () => void; expense: Expense; host: Host; diff --git a/components/expenses/ConfirmProcessExpenseModal.tsx b/components/expenses/ConfirmProcessExpenseModal.tsx index c0a6ce589c8..1c5ba1d5367 100644 --- a/components/expenses/ConfirmProcessExpenseModal.tsx +++ b/components/expenses/ConfirmProcessExpenseModal.tsx @@ -161,7 +161,7 @@ const MessagesPerType: Record< }, }; -export type ConfirmProcessExpenseModalType = +type ConfirmProcessExpenseModalType = | 'REQUEST_RE_APPROVAL' | 'MARK_AS_INCOMPLETE' | 'MARK_AS_SPAM' @@ -171,7 +171,7 @@ export type ConfirmProcessExpenseModalType = | 'HOLD' | 'RELEASE'; -export type ConfirmProcessExpenseModalProps = { +type ConfirmProcessExpenseModalProps = { type: ConfirmProcessExpenseModalType; onClose: () => void; expense: Pick; diff --git a/components/expenses/lib/utils.ts b/components/expenses/lib/utils.ts index a53ba9a1c61..22eeea8c35f 100644 --- a/components/expenses/lib/utils.ts +++ b/components/expenses/lib/utils.ts @@ -11,7 +11,7 @@ import { validateTaxInput } from '../../taxes/TaxesFormikFields'; import { ExpenseItemFormValues } from '../types/FormValues'; // Please adjust the values below based on `prepareItems` from `api/server/graphql/common/expenses.ts` -// ignore unused exports FX_RATE_WARNING_THRESHOLD +// ts-unused-exports:disable-next-line export const FX_RATE_WARNING_THRESHOLD = 0.02; export const FX_RATE_ERROR_THRESHOLD = 0.1; diff --git a/components/submit-expense/ExpenseItemsForm.tsx b/components/submit-expense/ExpenseItemsForm.tsx index 9615cc71b3e..5abde04dda1 100644 --- a/components/submit-expense/ExpenseItemsForm.tsx +++ b/components/submit-expense/ExpenseItemsForm.tsx @@ -24,13 +24,6 @@ import { Button } from '../ui/Button'; import { ExpenseForm } from './useExpenseForm'; -export type ExpenseItem = { - description: string; - date: string; - amount: { valueInCents: number; currency: string }; - url?: string; -}; - type ExpenseItemsFormProps = { className?: string; form: ExpenseForm; diff --git a/components/submit-expense/Steps.tsx b/components/submit-expense/Steps.tsx index fa77fc6e8c6..7fcb4d8fd63 100644 --- a/components/submit-expense/Steps.tsx +++ b/components/submit-expense/Steps.tsx @@ -38,7 +38,7 @@ export const ExpenseStepOrder = [ ExpenseFlowStep.EXPENSE_SUMMARY, ]; -export type StepDefinition< +type StepDefinition< FormValues extends Record, Form extends ReturnType>, AddProps = never, @@ -49,7 +49,7 @@ export type StepDefinition< Subtitle?: React.FC<{ form: Form } | {}>; }; -export type ExpenseStepDefinition = StepDefinition; +type ExpenseStepDefinition = StepDefinition; export const Steps: Record = { [ExpenseFlowStep.COLLECTIVE]: { diff --git a/components/submit-expense/useExpenseForm.ts b/components/submit-expense/useExpenseForm.ts index 201f129ef74..95d1119037b 100644 --- a/components/submit-expense/useExpenseForm.ts +++ b/components/submit-expense/useExpenseForm.ts @@ -33,7 +33,7 @@ import { computeExpenseAmounts, expenseTypeSupportsItemCurrency, getSupportedCur import { loggedInAccountExpensePayoutFieldsFragment } from '../expenses/graphql/fragments'; import { getCustomZodErrorMap } from '../FormikZod'; -export type ExpenseTypeOption = ExpenseType.INVOICE | ExpenseType.RECEIPT; +type ExpenseTypeOption = ExpenseType.INVOICE | ExpenseType.RECEIPT; export type ExpenseItem = { description?: string; @@ -92,7 +92,7 @@ export type ExpenseFormValues = { }; }; -export type ExpenseFormik = Omit>, 'setFieldValue'> & { +type ExpenseFormik = Omit>, 'setFieldValue'> & { setFieldValue: >( field: F, value: PathValue, diff --git a/components/ui/AlertDialog.tsx b/components/ui/AlertDialog.tsx index 707d5bd3d43..4c99060497e 100644 --- a/components/ui/AlertDialog.tsx +++ b/components/ui/AlertDialog.tsx @@ -96,9 +96,8 @@ const AlertDialogCancel = React.forwardRef< )); AlertDialogCancel.displayName = AlertDialogPrimitive.Cancel.displayName; -// ignore unused exports // ui library - +// ts-unused-exports:disable-next-line export { AlertDialog, AlertDialogPortal, diff --git a/components/ui/Calendar.tsx b/components/ui/Calendar.tsx index 041c9b43242..71c3562798e 100644 --- a/components/ui/Calendar.tsx +++ b/components/ui/Calendar.tsx @@ -9,7 +9,7 @@ import { cn } from '../../lib/utils'; import { buttonVariants } from './Button'; -export type CalendarProps = React.ComponentProps; +type CalendarProps = React.ComponentProps; function Calendar({ className, classNames, showOutsideDays = true, ...props }: CalendarProps) { return ( diff --git a/components/ui/Collapsible.tsx b/components/ui/Collapsible.tsx index fe8e28fbcd8..e985b218179 100644 --- a/components/ui/Collapsible.tsx +++ b/components/ui/Collapsible.tsx @@ -24,7 +24,6 @@ const CollapsibleContent = React.forwardRef< )); CollapsibleContent.displayName = CollapsiblePrimitive.CollapsibleContent.displayName; -// ignore unused exports // ui library export { Collapsible, CollapsibleTrigger, CollapsibleContent }; diff --git a/components/ui/Command.tsx b/components/ui/Command.tsx index e2f7dbc7999..85f12dfd7c6 100644 --- a/components/ui/Command.tsx +++ b/components/ui/Command.tsx @@ -1,5 +1,3 @@ -// ignore unused exports - 'use client'; import * as React from 'react'; @@ -148,6 +146,7 @@ const CommandShortcut = ({ className, ...props }: React.HTMLAttributes; +// eslint-disable-next-line @typescript-eslint/no-unused-vars +type HoverCardContentProps = React.ComponentProps; + export { HoverCard, HoverCardTrigger, HoverCardContent }; diff --git a/components/ui/InfoList.tsx b/components/ui/InfoList.tsx index 8d472c5e76e..7e93330c15c 100644 --- a/components/ui/InfoList.tsx +++ b/components/ui/InfoList.tsx @@ -2,7 +2,6 @@ import React from 'react'; import { cn } from '../../lib/utils'; -// ignore unused exports // ui library export function InfoList({ children, className }: { children: React.ReactNode; className?: string }) { @@ -13,6 +12,7 @@ export function InfoListItemTitle({ children }: { children: React.ReactNode }) { return
    {children}
    ; } +// ts-unused-exports:disable-next-line export function InfoListItemValue({ children }: { children: React.ReactNode }) { return
    {children}
    ; } diff --git a/components/ui/Input.tsx b/components/ui/Input.tsx index e4196ea27f7..9b96c4a3834 100644 --- a/components/ui/Input.tsx +++ b/components/ui/Input.tsx @@ -2,7 +2,7 @@ import * as React from 'react'; import { cn } from '../../lib/utils'; -export interface InputProps extends React.InputHTMLAttributes {} +interface InputProps extends React.InputHTMLAttributes {} const Input = React.forwardRef(({ className, type, ...props }, ref) => { return ( diff --git a/components/ui/Select.tsx b/components/ui/Select.tsx index 9f40e6e025e..311134507ea 100644 --- a/components/ui/Select.tsx +++ b/components/ui/Select.tsx @@ -107,7 +107,6 @@ const SelectSeparator = React.forwardRef< )); SelectSeparator.displayName = SelectPrimitive.Separator.displayName; -// ignore unused exports // ui library export { diff --git a/components/ui/Sheet.tsx b/components/ui/Sheet.tsx index a124119bf1f..aacf9d1e576 100644 --- a/components/ui/Sheet.tsx +++ b/components/ui/Sheet.tsx @@ -94,9 +94,8 @@ const SheetBody = ({ className, ...props }: React.HTMLAttributes ); SheetBody.displayName = 'SheetBody'; -// ignore unused exports // ui library - +// ts-unused-exports:disable-next-line export { Sheet, SheetPortal, diff --git a/components/ui/Table.tsx b/components/ui/Table.tsx index cd22a780c72..1b02ce4e2b4 100644 --- a/components/ui/Table.tsx +++ b/components/ui/Table.tsx @@ -1,5 +1,3 @@ -// ignore unused exports - import * as React from 'react'; import { MoreHorizontal } from 'lucide-react'; @@ -118,4 +116,5 @@ const TableActionsButton = React.forwardRef { +interface TextareaProps extends React.TextareaHTMLAttributes { showCount?: boolean; } diff --git a/components/ui/Toast.tsx b/components/ui/Toast.tsx index 4d0fe891eb4..2eb2b3a2329 100644 --- a/components/ui/Toast.tsx +++ b/components/ui/Toast.tsx @@ -126,9 +126,8 @@ type ToastProps = React.ComponentPropsWithoutRef; type ToastActionElement = React.ReactElement; -// ignore unused exports // ui library - +// ts-unused-exports:disable-next-line export { type ToastProps, type ToastActionElement, diff --git a/lib/actions/types.ts b/lib/actions/types.ts index b09c16171db..c2877c68938 100644 --- a/lib/actions/types.ts +++ b/lib/actions/types.ts @@ -1,7 +1,7 @@ import { LucideIcon } from 'lucide-react'; import type React from 'react'; -export type Action = { +type Action = { label: string; onClick: () => void; Icon?: LucideIcon; diff --git a/lib/apollo-client.ts b/lib/apollo-client.ts index 58d5371a83f..ad534d1348a 100644 --- a/lib/apollo-client.ts +++ b/lib/apollo-client.ts @@ -29,8 +29,8 @@ const INTERNAL_API_V2_URL = process.env.INTERNAL_API_V2_URL; const INTERNAL_API_V1_OPERATION_NAMES = process.env.INTERNAL_API_V1_OPERATION_NAMES; const INTERNAL_API_V2_OPERATION_NAMES = process.env.INTERNAL_API_V2_OPERATION_NAMES; -// ignore unused exports APOLLO_ERROR_PROP_NAME export const APOLLO_STATE_PROP_NAME = '__APOLLO_STATE__' as const; +// ts-unused-exports:disable-next-line export const APOLLO_ERROR_PROP_NAME = '__APOLLO_ERROR__' as const; export const APOLLO_VARIABLES_PROP_NAME = '__APOLLO_VARIABLES__' as const; diff --git a/lib/constants/animations.js b/lib/constants/animations.js index 13499fb77b7..db3461e8b9c 100644 --- a/lib/constants/animations.js +++ b/lib/constants/animations.js @@ -1,13 +1,14 @@ import { css, keyframes } from 'styled-components'; -// ignore unused exports // library +// ts-unused-exports:disable-next-line export const rotate = keyframes` 0% { transform: rotate(0deg); } 100% { transform: rotate(360deg); } `; +// ts-unused-exports:disable-next-line export const fadeIn = keyframes` 0% { opacity: 0; } 100% { opacity: 1; } diff --git a/lib/expenses/useProcessExpense.ts b/lib/expenses/useProcessExpense.ts index 1f277f8ffe1..12bc8f5f535 100644 --- a/lib/expenses/useProcessExpense.ts +++ b/lib/expenses/useProcessExpense.ts @@ -10,7 +10,7 @@ type ProcessExpenseAction = (params?: { paymentParams?: ProcessExpensePaymentParams; message?: string; }) => Promise; -export type ProcessExpenseActionName = +type ProcessExpenseActionName = | 'APPROVE' | 'REJECT' | 'PAY' diff --git a/lib/filters/filter-types.ts b/lib/filters/filter-types.ts index aea968f5437..04eebecbacc 100644 --- a/lib/filters/filter-types.ts +++ b/lib/filters/filter-types.ts @@ -42,13 +42,13 @@ export type SetFilter = (filter: K, value: FV[K], resetP export type SetFilters = (filters: Partial, newPath?: string) => void; export type resetFilters = (filters: Partial, newPath?: string) => void; -export type StandaloneFilter = { +type StandaloneFilter = { static: true; Component?: never; StandaloneComponent: (props: FilterComponentProps) => React.ReactNode; }; -export type FilterComponentConfig = { +type FilterComponentConfig = { labelMsg?: MessageDescriptor; static?: boolean; hide?: ({ meta }: { meta: Meta }) => boolean; diff --git a/lib/filters/schemas.ts b/lib/filters/schemas.ts index 2cd8bf906ac..77fe68fba36 100644 --- a/lib/filters/schemas.ts +++ b/lib/filters/schemas.ts @@ -7,10 +7,9 @@ export function isMulti(value: z.ZodType) { return z.union([singleValueToArray, enumArray]); } -// ignore unused exports isNullable -// filter schema helper - // Use isNullable to allow setting null values in the query filter +// filter schema helper +// ts-unused-exports:disable-next-line export function isNullable(value: z.ZodType) { return z.union([ z diff --git a/lib/ml-service.ts b/lib/ml-service.ts index e9c3ea049db..8a697d86e01 100644 --- a/lib/ml-service.ts +++ b/lib/ml-service.ts @@ -2,7 +2,7 @@ import { ExpenseType } from './graphql/types/v2/graphql'; const ML_SERVICE_URL = process.env.ML_SERVICE_URL || 'http://localhost:8000'; -export type ExpenseCategoryPrediction = { +type ExpenseCategoryPrediction = { code: string; name: string; confidence: number; diff --git a/lib/pagination.ts b/lib/pagination.ts index c066228c93a..1d50d0fb1ec 100644 --- a/lib/pagination.ts +++ b/lib/pagination.ts @@ -1,6 +1,6 @@ import lodashRange from 'lodash/range'; -export type PaginationElement = number | 'right_elipsis' | 'left_elipsis'; +type PaginationElement = number | 'right_elipsis' | 'left_elipsis'; function range(start: number, end: number): number[] { if (end <= start) { diff --git a/lib/styled-system-custom-properties.ts b/lib/styled-system-custom-properties.ts index c2a850f4439..c608ab44fc9 100644 --- a/lib/styled-system-custom-properties.ts +++ b/lib/styled-system-custom-properties.ts @@ -29,6 +29,7 @@ export const overflow = style({ prop: 'overflow' }); export type OverflowProps = { overflow?: 'visible' | 'hidden' | 'scroll' | 'auto' | 'initial' | 'inherit' }; export const resize = style({ prop: 'resize' }); +// ts-unused-exports:disable-next-line export type ResizeProps = { resize?: 'none' | 'both' | 'horizontal' | 'vertical' | 'initial' | 'inherit' }; export const pointerEvents = style({ prop: 'pointerEvents' }); @@ -41,4 +42,5 @@ export const clear = style({ prop: 'clear' }); export type ClearProps = { clear?: 'left' | 'right' | 'both' | 'none' | 'initial' | 'inherit' }; export const listStyle = style({ prop: 'listStyle' }); +// ts-unused-exports:disable-next-line export type ListStyleProps = { listStyle?: string }; diff --git a/lib/tier-utils.js b/lib/tier-utils.js index 357d2dcbb49..e39d9fb0148 100644 --- a/lib/tier-utils.js +++ b/lib/tier-utils.js @@ -4,9 +4,9 @@ import { CollectiveType } from './constants/collectives'; import INTERVALS from './constants/intervals'; import { AmountTypes, TierTypes } from './constants/tiers-types'; -// ignore unused exports DEFAULT_FUNDS_PRESETS export const TIERS_ORDER_KEY = 'collectivePage.tiersOrder'; export const DEFAULT_PRESETS = [500, 1000, 2000, 5000]; +// ts-unused-exports:disable-next-line export const DEFAULT_FUNDS_PRESETS = [100000, 200000, 500000, 1000000]; export const DEFAULT_MINIMUM_AMOUNT = 100; diff --git a/lib/two-factor-authentication/TwoFactorAuthenticationContext.js b/lib/two-factor-authentication/TwoFactorAuthenticationContext.js index 8929327ddf1..2fd8d84cf73 100644 --- a/lib/two-factor-authentication/TwoFactorAuthenticationContext.js +++ b/lib/two-factor-authentication/TwoFactorAuthenticationContext.js @@ -56,9 +56,8 @@ class TwoFactorAuthPrompt { }; } -// ignore unused exports TwoFactorAuthContext // used in Stories mdx - +// ts-unused-exports:disable-next-line export const TwoFactorAuthContext = React.createContext({ prompt: { // eslint-disable-next-line @typescript-eslint/no-unused-vars @@ -117,9 +116,8 @@ export function withTwoFactorAuthentication(WrappedComponent) { const prompt = new TwoFactorAuthPrompt(); -// ignore unused exports default // used in Stories mdx - +// ts-unused-exports:disable-next-line export default function TwoFactorAuthProvider({ children }) { const [contextChanged, setContextChanged] = React.useState(0); diff --git a/lib/withViewport.tsx b/lib/withViewport.tsx index 0969607e199..073b922cf7e 100644 --- a/lib/withViewport.tsx +++ b/lib/withViewport.tsx @@ -4,8 +4,6 @@ import { debounce, findIndex, isEqual, zipObject } from 'lodash'; import breakpoints from './theme/breakpoints'; import { emToPx } from './theme/helpers'; -// ignore unused exports BREAKPOINTS_NAMES, BREAKPOINTS_WIDTHS, viewportIsAbove, isDesktopOrAbove - /** * Defines all the breakpoints names as passed by `withViewport` */ @@ -18,7 +16,9 @@ export enum VIEWPORTS { } // Please keep the same length for these two arrays +// ts-unused-exports:disable-next-line export const BREAKPOINTS_NAMES = [VIEWPORTS.XSMALL, VIEWPORTS.SMALL, VIEWPORTS.MEDIUM, VIEWPORTS.LARGE]; +// ts-unused-exports:disable-next-line export const BREAKPOINTS_WIDTHS = BREAKPOINTS_NAMES.map((_, idx) => emToPx(breakpoints[idx])); export const BREAKPOINTS = zipObject(BREAKPOINTS_NAMES, BREAKPOINTS_WIDTHS) as Record< (typeof BREAKPOINTS_NAMES)[number], @@ -32,6 +32,7 @@ export const BREAKPOINTS = zipObject(BREAKPOINTS_NAMES, BREAKPOINTS_WIDTHS) as R * @param {VIEWPORTS} viewport * @param {VIEWPORTS} breakpointName */ +// ts-unused-exports:disable-next-line export const viewportIsAbove = (viewport, breakpointName) => { return BREAKPOINTS_NAMES.indexOf(viewport) >= BREAKPOINTS_NAMES.indexOf(breakpointName); }; @@ -41,6 +42,7 @@ export const viewportIsAbove = (viewport, breakpointName) => { * * @param {VIEWPORTS} viewport */ +// ts-unused-exports:disable-next-line export const isDesktopOrAbove = viewport => { return BREAKPOINTS_NAMES.indexOf(viewport) >= BREAKPOINTS_NAMES.indexOf(VIEWPORTS.MEDIUM); }; diff --git a/lostpixel.config.ts b/lostpixel.config.ts index 7d49d4c4738..4cbae38978d 100644 --- a/lostpixel.config.ts +++ b/lostpixel.config.ts @@ -1,7 +1,6 @@ // eslint-disable-next-line node/no-unpublished-import import { CustomProjectConfig } from 'lost-pixel'; -// ignore unused exports config // config file export const config: Partial = { diff --git a/package-lock.json b/package-lock.json index 6d0647d80e8..5790849fc61 100644 --- a/package-lock.json +++ b/package-lock.json @@ -188,7 +188,6 @@ "eslint-plugin-simple-import-sort": "^12.0.0", "eslint-plugin-styled-components-a11y": "^2.1.31", "file-loader": "^6.2.0", - "find-unused-exports": "^5.0.0", "fs-extra": "^11.2.0", "html-loader": "^5.0.0", "husky": "^4.3.8", @@ -216,6 +215,7 @@ "styled-jsx": "^5.1.2", "tailwindcss": "3.4.3", "tailwindcss-animate": "1.0.7", + "ts-unused-exports": "^10.0.1", "tsx": "^4.7.2", "typescript": "^5.3.2", "url-loader": "^4.1.1", @@ -813,9 +813,9 @@ } }, "node_modules/@babel/helper-plugin-utils": { - "version": "7.22.5", - "resolved": "https://registry.npmjs.org/@babel/helper-plugin-utils/-/helper-plugin-utils-7.22.5.tgz", - "integrity": "sha512-uLls06UVKgFG9QD4OeFYLEGteMIAa5kpTPcFL28yuCIIzsf6ZyKZMllKVOCZFhiZ5ptnwX4mtKdWCBE/uT4amg==", + "version": "7.24.5", + "resolved": "https://registry.npmjs.org/@babel/helper-plugin-utils/-/helper-plugin-utils-7.24.5.tgz", + "integrity": "sha512-xjNLDopRzW2o6ba0gKbkZq5YWEBaK3PCyTOY1K2P/O07LGMhMqlMXPxwN4S5/RhWuCobT8z0jrlKGlYmeR1OhQ==", "engines": { "node": ">=6.9.0" } @@ -1208,11 +1208,11 @@ } }, "node_modules/@babel/plugin-syntax-jsx": { - "version": "7.23.3", - "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-jsx/-/plugin-syntax-jsx-7.23.3.tgz", - "integrity": "sha512-EB2MELswq55OHUoRZLGg/zC7QWUKfNLpE57m/S2yr1uEneIgsTgrSzXP3NXEsMkVn76OlaVVnzN+ugObuYGwhg==", + "version": "7.24.1", + "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-jsx/-/plugin-syntax-jsx-7.24.1.tgz", + "integrity": "sha512-2eCtxZXf+kbkMIsXS4poTvT4Yu5rXiRa+9xGVT56raghjmBTKMpFNc9R4IDiB4emao9eO22Ox7CxuJG7BgExqA==", "dependencies": { - "@babel/helper-plugin-utils": "^7.22.5" + "@babel/helper-plugin-utils": "^7.24.0" }, "engines": { "node": ">=6.9.0" @@ -1973,12 +1973,12 @@ } }, "node_modules/@babel/plugin-transform-react-display-name": { - "version": "7.23.3", - "resolved": "https://registry.npmjs.org/@babel/plugin-transform-react-display-name/-/plugin-transform-react-display-name-7.23.3.tgz", - "integrity": "sha512-GnvhtVfA2OAtzdX58FJxU19rhoGeQzyVndw3GgtdECQvQFXPEZIOVULHVZGAYmOgmqjXpVpfocAbSjh99V/Fqw==", + "version": "7.24.1", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-react-display-name/-/plugin-transform-react-display-name-7.24.1.tgz", + "integrity": "sha512-mvoQg2f9p2qlpDQRBC7M3c3XTr0k7cp/0+kFKKO/7Gtu0LSw16eKB+Fabe2bDT/UpsyasTBBkAnbdsLrkD5XMw==", "dev": true, "dependencies": { - "@babel/helper-plugin-utils": "^7.22.5" + "@babel/helper-plugin-utils": "^7.24.0" }, "engines": { "node": ">=6.9.0" @@ -2022,13 +2022,13 @@ } }, "node_modules/@babel/plugin-transform-react-pure-annotations": { - "version": "7.23.3", - "resolved": "https://registry.npmjs.org/@babel/plugin-transform-react-pure-annotations/-/plugin-transform-react-pure-annotations-7.23.3.tgz", - "integrity": "sha512-qMFdSS+TUhB7Q/3HVPnEdYJDQIk57jkntAwSuz9xfSE4n+3I+vHYCli3HoHawN1Z3RfCz/y1zXA/JXjG6cVImQ==", + "version": "7.24.1", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-react-pure-annotations/-/plugin-transform-react-pure-annotations-7.24.1.tgz", + "integrity": "sha512-+pWEAaDJvSm9aFvJNpLiM2+ktl2Sn2U5DdyiWdZBxmLc6+xGt88dvFqsHiAiDS+8WqUwbDfkKz9jRxK3M0k+kA==", "dev": true, "dependencies": { "@babel/helper-annotate-as-pure": "^7.22.5", - "@babel/helper-plugin-utils": "^7.22.5" + "@babel/helper-plugin-utils": "^7.24.0" }, "engines": { "node": ">=6.9.0" @@ -2371,17 +2371,17 @@ } }, "node_modules/@babel/preset-react": { - "version": "7.23.3", - "resolved": "https://registry.npmjs.org/@babel/preset-react/-/preset-react-7.23.3.tgz", - "integrity": "sha512-tbkHOS9axH6Ysf2OUEqoSZ6T3Fa2SrNH6WTWSPBboxKzdxNc9qOICeLXkNG0ZEwbQ1HY8liwOce4aN/Ceyuq6w==", + "version": "7.24.1", + "resolved": "https://registry.npmjs.org/@babel/preset-react/-/preset-react-7.24.1.tgz", + "integrity": "sha512-eFa8up2/8cZXLIpkafhaADTXSnl7IsUFCYenRWrARBz0/qZwcT0RBXpys0LJU4+WfPoF2ZG6ew6s2V6izMCwRA==", "dev": true, "dependencies": { - "@babel/helper-plugin-utils": "^7.22.5", - "@babel/helper-validator-option": "^7.22.15", - "@babel/plugin-transform-react-display-name": "^7.23.3", - "@babel/plugin-transform-react-jsx": "^7.22.15", + "@babel/helper-plugin-utils": "^7.24.0", + "@babel/helper-validator-option": "^7.23.5", + "@babel/plugin-transform-react-display-name": "^7.24.1", + "@babel/plugin-transform-react-jsx": "^7.23.4", "@babel/plugin-transform-react-jsx-development": "^7.22.5", - "@babel/plugin-transform-react-pure-annotations": "^7.23.3" + "@babel/plugin-transform-react-pure-annotations": "^7.24.1" }, "engines": { "node": ">=6.9.0" @@ -21886,69 +21886,6 @@ "resolved": "https://registry.npmjs.org/find-root/-/find-root-1.1.0.tgz", "integrity": "sha512-NKfW6bec6GfKc0SGx1e07QZY9PE99u0Bft/0rzSD5k3sO/vwkVUpDUKVm5Gpp5Ue3YfShPFTX2070tDs5kB9Ng==" }, - "node_modules/find-unused-exports": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/find-unused-exports/-/find-unused-exports-5.0.0.tgz", - "integrity": "sha512-jITgJu32oyoXKPHmWz4erOMzRXogalC10gP8Mv5XH/zeahPYgbOxm/4teYCHlyRcTZjQXhblqIcDZ/vVe9WrEQ==", - "dev": true, - "dependencies": { - "@babel/core": "^7.19.6", - "@types/babel__core": "^7.1.19", - "@types/node": "*", - "arg": "^5.0.2", - "globby": "^13.1.2", - "kleur": "^4.1.5" - }, - "bin": { - "find-unused-exports": "find-unused-exports.mjs" - }, - "engines": { - "node": "^14.17.0 || ^16.0.0 || >= 18.0.0" - }, - "funding": { - "url": "https://github.com/sponsors/jaydenseric" - } - }, - "node_modules/find-unused-exports/node_modules/globby": { - "version": "13.2.2", - "resolved": "https://registry.npmjs.org/globby/-/globby-13.2.2.tgz", - "integrity": "sha512-Y1zNGV+pzQdh7H39l9zgB4PJqjRNqydvdYCDG4HFXM4XuvSaQQlEc91IU1yALL8gUTDomgBAfz3XJdmUS+oo0w==", - "dev": true, - "dependencies": { - "dir-glob": "^3.0.1", - "fast-glob": "^3.3.0", - "ignore": "^5.2.4", - "merge2": "^1.4.1", - "slash": "^4.0.0" - }, - "engines": { - "node": "^12.20.0 || ^14.13.1 || >=16.0.0" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/find-unused-exports/node_modules/kleur": { - "version": "4.1.5", - "resolved": "https://registry.npmjs.org/kleur/-/kleur-4.1.5.tgz", - "integrity": "sha512-o+NO+8WrRiQEE4/7nwRJhN1HWpVmJm511pBHUxPLtp0BUISzlBplORYSmTclCnJvQq2tKu/sgl3xVpkc7ZWuQQ==", - "dev": true, - "engines": { - "node": ">=6" - } - }, - "node_modules/find-unused-exports/node_modules/slash": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/slash/-/slash-4.0.0.tgz", - "integrity": "sha512-3dOsAHXXUkQTpOYcoAxLIorMTp4gIQr5IW3iVb7A7lFIp0VHhnynm9izx6TssdrIcVIESAlVjtnO2K8bg+Coew==", - "dev": true, - "engines": { - "node": ">=12" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, "node_modules/find-up": { "version": "5.0.0", "resolved": "https://registry.npmjs.org/find-up/-/find-up-5.0.0.tgz", @@ -35830,6 +35767,115 @@ } } }, + "node_modules/ts-unused-exports": { + "version": "10.0.1", + "resolved": "https://registry.npmjs.org/ts-unused-exports/-/ts-unused-exports-10.0.1.tgz", + "integrity": "sha512-nWG8Y96pKem01Hw4j4+Mwuy+L0/9sKT7D61Q+OS3cii9ocQACuV6lu00B9qpiPhF4ReVWw3QYHDqV8+to2wbsg==", + "dev": true, + "dependencies": { + "chalk": "^4.0.0", + "tsconfig-paths": "^3.9.0" + }, + "bin": { + "ts-unused-exports": "bin/ts-unused-exports" + }, + "funding": { + "url": "https://github.com/pzavolinsky/ts-unused-exports?sponsor=1" + }, + "peerDependencies": { + "typescript": ">=3.8.3" + }, + "peerDependenciesMeta": { + "typescript": { + "optional": false + } + } + }, + "node_modules/ts-unused-exports/node_modules/ansi-styles": { + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", + "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", + "dev": true, + "dependencies": { + "color-convert": "^2.0.1" + }, + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/chalk/ansi-styles?sponsor=1" + } + }, + "node_modules/ts-unused-exports/node_modules/chalk": { + "version": "4.1.2", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.2.tgz", + "integrity": "sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA==", + "dev": true, + "dependencies": { + "ansi-styles": "^4.1.0", + "supports-color": "^7.1.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/chalk/chalk?sponsor=1" + } + }, + "node_modules/ts-unused-exports/node_modules/has-flag": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", + "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", + "dev": true, + "engines": { + "node": ">=8" + } + }, + "node_modules/ts-unused-exports/node_modules/json5": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/json5/-/json5-1.0.2.tgz", + "integrity": "sha512-g1MWMLBiz8FKi1e4w0UyVL3w+iJceWAFBAaBnnGKOpNa5f8TLktkbre1+s6oICydWAm+HRUGTmI+//xv2hvXYA==", + "dev": true, + "dependencies": { + "minimist": "^1.2.0" + }, + "bin": { + "json5": "lib/cli.js" + } + }, + "node_modules/ts-unused-exports/node_modules/strip-bom": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/strip-bom/-/strip-bom-3.0.0.tgz", + "integrity": "sha512-vavAMRXOgBVNF6nyEEmL3DBK19iRpDcoIwW+swQ+CbGiu7lju6t+JklA1MHweoWtadgt4ISVUsXLyDq34ddcwA==", + "dev": true, + "engines": { + "node": ">=4" + } + }, + "node_modules/ts-unused-exports/node_modules/supports-color": { + "version": "7.2.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz", + "integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==", + "dev": true, + "dependencies": { + "has-flag": "^4.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/ts-unused-exports/node_modules/tsconfig-paths": { + "version": "3.15.0", + "resolved": "https://registry.npmjs.org/tsconfig-paths/-/tsconfig-paths-3.15.0.tgz", + "integrity": "sha512-2Ac2RgzDe/cn48GvOe3M+o82pEFewD3UPbyoUHHdKasHwJKjds4fLXWf/Ux5kATBKN20oaFGu+jbElp1pos0mg==", + "dev": true, + "dependencies": { + "@types/json5": "^0.0.29", + "json5": "^1.0.2", + "minimist": "^1.2.6", + "strip-bom": "^3.0.0" + } + }, "node_modules/tsconfig-paths": { "version": "4.2.0", "resolved": "https://registry.npmjs.org/tsconfig-paths/-/tsconfig-paths-4.2.0.tgz", diff --git a/package.json b/package.json index 00c7881a5a6..c26d6eaade3 100644 --- a/package.json +++ b/package.json @@ -161,7 +161,6 @@ "deploy:staging": "cross-env ./scripts/pre-deploy.sh staging && git push -f staging main", "dev": "node server", "docs:generate:contribution-flow": "tsx ./scripts/docs/contribution-flow.js", - "find-unused-exports": "find-unused-exports --module-glob \"(components|lib|pages|test)/**/*.{js,ts,jsx,tsx}\" --resolve-file-extensions js,ts,jsx,tsx --resolve-index-files", "git:clean": "cross-env ./scripts/git_clean.sh", "graphql:codegen": "graphql-codegen --config scripts/config/graphql-codegen.ts", "graphql:get-schema": "npm-run-all graphql:updateV1 graphql:updateV2", @@ -197,6 +196,7 @@ "test:e2e:3": "cross-env TZ=UTC cypress run --spec \"test/cypress/integration/3*.js\"", "test:jest": "cross-env NODE_ENV=test TZ=UTC jest components lib pages", "test:update": "npm run test:jest -- --updateSnapshot", + "ts-unused-exports": "ts-unused-exports tsconfig.json --ignoreFiles=lib/graphql/types/ --ignoreFiles=stories/", "type:check": "tsc", "jest": "cross-env NODE_ENV=test TZ=UTC jest" }, @@ -253,7 +253,6 @@ "eslint-plugin-simple-import-sort": "^12.0.0", "eslint-plugin-styled-components-a11y": "^2.1.31", "file-loader": "^6.2.0", - "find-unused-exports": "^5.0.0", "fs-extra": "^11.2.0", "html-loader": "^5.0.0", "husky": "^4.3.8", @@ -281,6 +280,7 @@ "styled-jsx": "^5.1.2", "tailwindcss": "3.4.3", "tailwindcss-animate": "1.0.7", + "ts-unused-exports": "^10.0.1", "tsx": "^4.7.2", "typescript": "^5.3.2", "url-loader": "^4.1.1", diff --git a/pages/404.js b/pages/404.js index cb9247f0c9d..22ab8323678 100644 --- a/pages/404.js +++ b/pages/404.js @@ -4,8 +4,8 @@ import Container from '../components/Container'; import NotFound from '../components/NotFound'; import Page from '../components/Page'; -// ignore unused exports default // next.js export +// ts-unused-exports:disable-next-line export default function Custom404() { return ( diff --git a/pages/_app.js b/pages/_app.js index c032e52fc59..40120b2a1e9 100644 --- a/pages/_app.js +++ b/pages/_app.js @@ -161,6 +161,7 @@ class OpenCollectiveFrontendApp extends App { } } -// ignore unused exports default // next.js export +// ts-unused-exports:disable-next-line +// ts-unused-exports:disable-next-line export default withTwoFactorAuthentication(OpenCollectiveFrontendApp); diff --git a/pages/_document.js b/pages/_document.js index 1768c281ee9..ff905bb2c5b 100644 --- a/pages/_document.js +++ b/pages/_document.js @@ -33,8 +33,9 @@ const cache = createIntlCache(); // The document (which is SSR-only) needs to be customized to expose the locale // data for the user's locale for React Intl to work in the browser. -// ignore unused exports default + // next.js export +// ts-unused-exports:disable-next-line export default class IntlDocument extends Document { static async getInitialProps(ctx) { // Get the `locale` and `messages` from the request object on the server. diff --git a/pages/_error.js b/pages/_error.js index 1164c57834f..f5f20fb5993 100644 --- a/pages/_error.js +++ b/pages/_error.js @@ -42,6 +42,6 @@ class NextJSErrorPage extends React.Component { } } -// ignore unused exports default // next.js export +// ts-unused-exports:disable-next-line export default NextJSErrorPage; diff --git a/pages/accept-financial-contributions.js b/pages/accept-financial-contributions.js index 59c03a103bc..72f044fdbe1 100644 --- a/pages/accept-financial-contributions.js +++ b/pages/accept-financial-contributions.js @@ -52,6 +52,6 @@ const addCollectivePageData = graphql(collectivePageQuery, { }), }); -// ignore unused exports default // next.js export +// ts-unused-exports:disable-next-line export default withUser(addCollectivePageData(AcceptFinancialContributionsPage)); diff --git a/pages/api/connected-accounts/[service]/callback.js b/pages/api/connected-accounts/[service]/callback.js index a6d974da863..6ffb1211bcc 100644 --- a/pages/api/connected-accounts/[service]/callback.js +++ b/pages/api/connected-accounts/[service]/callback.js @@ -2,8 +2,8 @@ import { URL } from 'url'; import { pick } from 'lodash'; -// ignore unused exports default // next.js export +// ts-unused-exports:disable-next-line export default async function handle(req, res) { const { service } = req.query; const apiUrl = new URL( diff --git a/pages/api/connected-accounts/[service]/oauthUrl.js b/pages/api/connected-accounts/[service]/oauthUrl.js index 3b653b167c7..979ebcc46f6 100644 --- a/pages/api/connected-accounts/[service]/oauthUrl.js +++ b/pages/api/connected-accounts/[service]/oauthUrl.js @@ -2,8 +2,8 @@ import { URL } from 'url'; import { pick } from 'lodash'; -// ignore unused exports default // next.js export +// ts-unused-exports:disable-next-line export default async function handle(req, res) { const { service } = req.query; const apiUrl = new URL( diff --git a/pages/api/docs/search.js b/pages/api/docs/search.js index b9d8b2702d3..afa2b4e7a8f 100644 --- a/pages/api/docs/search.js +++ b/pages/api/docs/search.js @@ -1,5 +1,5 @@ -// ignore unused exports default // next.js export +// ts-unused-exports:disable-next-line export default async function handle(req, res) { const { query } = req.query; const apiUrl = new URL(`${process.env.API_URL}/docs/search?api_key=${process.env.API_KEY}`); diff --git a/pages/api/download-file.js b/pages/api/download-file.js index f0b262eca14..e193c2ea81f 100644 --- a/pages/api/download-file.js +++ b/pages/api/download-file.js @@ -1,5 +1,5 @@ import downloadFileHandler from '../../server/download-file'; -// ignore unused exports default // next.js export +// ts-unused-exports:disable-next-line export default downloadFileHandler; diff --git a/pages/api/github-repositories.js b/pages/api/github-repositories.js index cb6e6f639ec..222ec3c5f35 100644 --- a/pages/api/github-repositories.js +++ b/pages/api/github-repositories.js @@ -2,8 +2,8 @@ import { URL } from 'url'; import { pick } from 'lodash'; -// ignore unused exports default // next.js export +// ts-unused-exports:disable-next-line export default async function handle(req, res) { const apiUrl = new URL(`${process.env.API_URL}/github-repositories?api_key=${process.env.API_KEY}`); diff --git a/pages/api/graphql/v1.js b/pages/api/graphql/v1.js index 2ddbbd33170..1550b171c04 100644 --- a/pages/api/graphql/v1.js +++ b/pages/api/graphql/v1.js @@ -1,7 +1,7 @@ import { pick } from 'lodash'; -// ignore unused exports default // next.js export +// ts-unused-exports:disable-next-line export default async function handle(req, res) { const graphqlUrl = `${process.env.API_URL}/graphql/v1?api_key=${process.env.API_KEY}`; diff --git a/pages/api/graphql/v2.js b/pages/api/graphql/v2.js index e72fc0ba471..95794ce53ed 100644 --- a/pages/api/graphql/v2.js +++ b/pages/api/graphql/v2.js @@ -1,7 +1,7 @@ import { pick } from 'lodash'; -// ignore unused exports default // next.js export +// ts-unused-exports:disable-next-line export default async function handle(req, res) { const graphqlUrl = `${process.env.API_URL}/graphql/v2?api_key=${process.env.API_KEY}`; diff --git a/pages/api/legacy/button.js b/pages/api/legacy/button.js index db36b8d69d8..c338a127dcc 100644 --- a/pages/api/legacy/button.js +++ b/pages/api/legacy/button.js @@ -3,8 +3,8 @@ import path from 'path'; import { template } from 'lodash'; -// ignore unused exports default // next.js export +// ts-unused-exports:disable-next-line export default function handler(req, res) { const content = fs.readFileSync(path.join(process.cwd(), 'server/templates/button.js'), 'utf8'); const compiled = template(content, { interpolate: /{{([\s\S]+?)}}/g }); diff --git a/pages/api/legacy/contribute.js b/pages/api/legacy/contribute.js index a7e0cf90dcb..9c7fe96f297 100644 --- a/pages/api/legacy/contribute.js +++ b/pages/api/legacy/contribute.js @@ -1,7 +1,7 @@ import path from 'path'; -// ignore unused exports default // next.js export +// ts-unused-exports:disable-next-line export default function handler(req, res) { const color = req.query.color === 'blue' ? 'blue' : 'white'; const verb = ['donate', 'contribute'].includes(req.query.verb) ? req.query.verb : 'contribute'; diff --git a/pages/api/legacy/widget.js b/pages/api/legacy/widget.js index 6d453c2b2eb..f5edeab3a69 100644 --- a/pages/api/legacy/widget.js +++ b/pages/api/legacy/widget.js @@ -3,8 +3,8 @@ import path from 'path'; import { template } from 'lodash'; -// ignore unused exports default // next.js export +// ts-unused-exports:disable-next-line export default function handler(req, res) { const content = fs.readFileSync(path.join(process.cwd(), 'server/templates/widget.js'), 'utf8'); const compiled = template(content, { interpolate: /{{([\s\S]+?)}}/g }); diff --git a/pages/api/robots.js b/pages/api/robots.js index 45b744ca19a..b644ff3135a 100644 --- a/pages/api/robots.js +++ b/pages/api/robots.js @@ -1,8 +1,8 @@ const fs = require('fs'); const path = require('path'); -// ignore unused exports default // next.js export +// ts-unused-exports:disable-next-line export default async function handler(req, res) { const hostname = req.headers['original-hostname'] || req.hostname; if (hostname !== 'opencollective.com') { diff --git a/pages/api/users/exchange-login-token.js b/pages/api/users/exchange-login-token.js index eddd58467c7..07193c6a309 100644 --- a/pages/api/users/exchange-login-token.js +++ b/pages/api/users/exchange-login-token.js @@ -1,7 +1,7 @@ import { pick } from 'lodash'; -// ignore unused exports default // next.js export +// ts-unused-exports:disable-next-line export default async function handle(req, res) { const apiUrl = `${process.env.API_URL}/users/exchange-login-token?api_key=${process.env.API_KEY}`; diff --git a/pages/api/users/exists.js b/pages/api/users/exists.js index bdd66841c30..641191dd1fe 100644 --- a/pages/api/users/exists.js +++ b/pages/api/users/exists.js @@ -1,7 +1,7 @@ import { URL } from 'url'; -// ignore unused exports default // next.js export +// ts-unused-exports:disable-next-line export default async function handle(req, res) { const apiUrl = new URL(`${process.env.API_URL}/users/exists?api_key=${process.env.API_KEY}`); apiUrl.searchParams.set('email', req.query.email); diff --git a/pages/api/users/refresh-token.js b/pages/api/users/refresh-token.js index 2519caeed4e..85e1ecd3a63 100644 --- a/pages/api/users/refresh-token.js +++ b/pages/api/users/refresh-token.js @@ -1,7 +1,7 @@ import { pick } from 'lodash'; -// ignore unused exports default // next.js export +// ts-unused-exports:disable-next-line export default async function handle(req, res) { const apiUrl = `${process.env.API_URL}/users/refresh-token?api_key=${process.env.API_KEY}`; diff --git a/pages/api/users/signin.js b/pages/api/users/signin.js index 8e6a5bd9104..55b63d288c5 100644 --- a/pages/api/users/signin.js +++ b/pages/api/users/signin.js @@ -1,5 +1,5 @@ -// ignore unused exports default // next.js export +// ts-unused-exports:disable-next-line export default async function handle(req, res) { const apiUrl = `${process.env.API_URL}/users/signin?api_key=${process.env.API_KEY}`; diff --git a/pages/api/users/two-factor-auth.js b/pages/api/users/two-factor-auth.js index 55866cc786d..34fc255ad15 100644 --- a/pages/api/users/two-factor-auth.js +++ b/pages/api/users/two-factor-auth.js @@ -1,7 +1,7 @@ import { pick } from 'lodash'; -// ignore unused exports default // next.js export +// ts-unused-exports:disable-next-line export default async function handle(req, res) { const apiUrl = `${process.env.API_URL}/users/two-factor-auth?api_key=${process.env.API_KEY}`; diff --git a/pages/api/users/update-token.js b/pages/api/users/update-token.js index 80aef6ef982..c4f458422ca 100644 --- a/pages/api/users/update-token.js +++ b/pages/api/users/update-token.js @@ -1,7 +1,7 @@ import { pick } from 'lodash'; -// ignore unused exports default // next.js export +// ts-unused-exports:disable-next-line export default async function handle(req, res) { const apiUrl = `${process.env.API_URL}/users/update-token?api_key=${process.env.API_KEY}`; diff --git a/pages/applications.js b/pages/applications.js index 02e50e859f2..9744b434e2d 100644 --- a/pages/applications.js +++ b/pages/applications.js @@ -39,6 +39,6 @@ class Apps extends React.Component { } } -// ignore unused exports default // next.js export +// ts-unused-exports:disable-next-line export default Apps; diff --git a/pages/banner-iframe.js b/pages/banner-iframe.js index efc9a60dd6e..a5d12395f23 100644 --- a/pages/banner-iframe.js +++ b/pages/banner-iframe.js @@ -435,6 +435,6 @@ const addCollectiveBannerIframeData = graphql(collectiveBannerIframeQuery, { }, }); -// ignore unused exports default // next.js export +// ts-unused-exports:disable-next-line export default addCollectiveBannerIframeData(BannerIframe); diff --git a/pages/become-a-host.js b/pages/become-a-host.js index 75a0a5a68f3..e14865d258d 100644 --- a/pages/become-a-host.js +++ b/pages/become-a-host.js @@ -28,6 +28,6 @@ const BecomeAHost = () => { ); }; -// ignore unused exports default // next.js export +// ts-unused-exports:disable-next-line export default BecomeAHost; diff --git a/pages/become-a-sponsor.js b/pages/become-a-sponsor.js index 55fdda9c56a..52264cccd26 100644 --- a/pages/become-a-sponsor.js +++ b/pages/become-a-sponsor.js @@ -28,6 +28,6 @@ const BecomeASponsor = () => { ); }; -// ignore unused exports default // next.js export +// ts-unused-exports:disable-next-line export default BecomeASponsor; diff --git a/pages/button.js b/pages/button.js index 5a267ea5483..0a2b3cddd02 100644 --- a/pages/button.js +++ b/pages/button.js @@ -54,6 +54,6 @@ class ButtonPage extends React.Component { } } -// ignore unused exports default // next.js export +// ts-unused-exports:disable-next-line export default ButtonPage; diff --git a/pages/collective-contact.tsx b/pages/collective-contact.tsx index ba55887aaeb..9637e9ccfe8 100644 --- a/pages/collective-contact.tsx +++ b/pages/collective-contact.tsx @@ -116,6 +116,6 @@ const collectiveContactPageQuery = gql` ${accountNavbarFieldsFragment} `; -// ignore unused exports default // next.js export +// ts-unused-exports:disable-next-line export default CollectiveContact; diff --git a/pages/collective-page.js b/pages/collective-page.js index 0e291a6badf..a131820e742 100644 --- a/pages/collective-page.js +++ b/pages/collective-page.js @@ -232,6 +232,6 @@ const addCollectivePageData = ssrGraphQLQuery({ preload: (client, result) => preloadCollectivePageGraphqlQueries(client, result?.data?.Collective), }); -// ignore unused exports default // next.js export +// ts-unused-exports:disable-next-line export default withRouter(withUser(addCollectivePageData(CollectivePage))); diff --git a/pages/collectives-iframe.js b/pages/collectives-iframe.js index 22b2cefbcbd..1c4fe41e2c3 100644 --- a/pages/collectives-iframe.js +++ b/pages/collectives-iframe.js @@ -133,6 +133,6 @@ class CollectivesIframe extends React.Component { } } -// ignore unused exports default // next.js export +// ts-unused-exports:disable-next-line export default CollectivesIframe; diff --git a/pages/collectives.js b/pages/collectives.js index 75e70780c48..9a4732dd54e 100644 --- a/pages/collectives.js +++ b/pages/collectives.js @@ -56,6 +56,6 @@ CollectivesPage.getInitialProps = ({ req, res }) => { return { skipDataFromTree }; }; -// ignore unused exports default // next.js export +// ts-unused-exports:disable-next-line export default CollectivesPage; diff --git a/pages/confirm-guest.js b/pages/confirm-guest.js index 16aa6634937..27f1ae865a2 100644 --- a/pages/confirm-guest.js +++ b/pages/confirm-guest.js @@ -150,6 +150,6 @@ ConfirmGuestPage.getInitialProps = ({ req: { query } }) => { return { token: query.token, email: query.email }; }; -// ignore unused exports default // next.js export +// ts-unused-exports:disable-next-line export default ConfirmGuestPage; diff --git a/pages/confirmCollectiveDeletion.js b/pages/confirmCollectiveDeletion.js index 0100f2ac2f1..69472b9892b 100644 --- a/pages/confirmCollectiveDeletion.js +++ b/pages/confirmCollectiveDeletion.js @@ -100,6 +100,6 @@ ConfirmCollectiveDeletion.propTypes = { logout: PropTypes.func, }; -// ignore unused exports default // next.js export +// ts-unused-exports:disable-next-line export default withUser(ConfirmCollectiveDeletion); diff --git a/pages/confirmEmail.js b/pages/confirmEmail.js index 6728d0a941a..7735f968185 100644 --- a/pages/confirmEmail.js +++ b/pages/confirmEmail.js @@ -127,6 +127,6 @@ const addConfirmUserEmailMutation = graphql(confirmUserEmailMutation, { name: 'confirmUserEmail', }); -// ignore unused exports default // next.js export +// ts-unused-exports:disable-next-line export default withUser(addConfirmUserEmailMutation(ConfirmEmailPage)); diff --git a/pages/confirmOrder.js b/pages/confirmOrder.js index b034774ac91..e67d0a177ab 100644 --- a/pages/confirmOrder.js +++ b/pages/confirmOrder.js @@ -144,6 +144,6 @@ const addConfirmOrderMutation = graphql(confirmOrderMutation, { options: { context: API_V2_CONTEXT }, }); -// ignore unused exports default // next.js export +// ts-unused-exports:disable-next-line export default withUser(addConfirmOrderMutation(withRouter(ConfirmOrderPage))); diff --git a/pages/contribute.js b/pages/contribute.js index e1c0595d9fe..94d6476a329 100644 --- a/pages/contribute.js +++ b/pages/contribute.js @@ -472,6 +472,6 @@ const addContributePageData = ssrGraphQLQuery({ }), }); -// ignore unused exports default // next.js export +// ts-unused-exports:disable-next-line export default withUser(addContributePageData(ContributePage)); diff --git a/pages/contribution-flow.js b/pages/contribution-flow.js index 2e080e3a60c..e4957436606 100644 --- a/pages/contribution-flow.js +++ b/pages/contribution-flow.js @@ -151,6 +151,6 @@ const addContributionFlowData = graphql(contributionFlowAccountQuery, { }), }); -// ignore unused exports default // next.js export +// ts-unused-exports:disable-next-line export default addContributionFlowData(withUser(injectIntl(withStripeLoader(withRouter(NewContributionFlowPage))))); diff --git a/pages/conversation.js b/pages/conversation.js index 48844b4c750..ca2a05b4666 100644 --- a/pages/conversation.js +++ b/pages/conversation.js @@ -518,6 +518,6 @@ const getData = graphql(conversationPageQuery, { }, }); -// ignore unused exports default // next.js export +// ts-unused-exports:disable-next-line export default withUser(getData(withRouter(withApollo(ConversationPage)))); diff --git a/pages/conversations.js b/pages/conversations.js index ab903d1a955..ca6dbc427d9 100644 --- a/pages/conversations.js +++ b/pages/conversations.js @@ -257,6 +257,6 @@ const addConversationsPageData = graphql(conversationsPageQuery, { }, }); -// ignore unused exports default // next.js export +// ts-unused-exports:disable-next-line export default withUser(withRouter(addConversationsPageData(ConversationsPage))); diff --git a/pages/create-collective.js b/pages/create-collective.js index b876e0c7fc1..08ce94af3eb 100644 --- a/pages/create-collective.js +++ b/pages/create-collective.js @@ -68,6 +68,6 @@ CreateCollectivePage.propTypes = { LoggedInUser: PropTypes.object, }; -// ignore unused exports default // next.js export +// ts-unused-exports:disable-next-line export default withUser(CreateCollectivePage); diff --git a/pages/create-conversation.js b/pages/create-conversation.js index 3047d852652..b6d5778ae28 100644 --- a/pages/create-conversation.js +++ b/pages/create-conversation.js @@ -183,6 +183,6 @@ const addCreateConversationPageData = graphql(createConversationPageQuery, { }, }); -// ignore unused exports default // next.js export +// ts-unused-exports:disable-next-line export default withUser(withRouter(addCreateConversationPageData(CreateConversationPage))); diff --git a/pages/create-expense.js b/pages/create-expense.js index a387f93785f..5abb0ef74d7 100644 --- a/pages/create-expense.js +++ b/pages/create-expense.js @@ -654,6 +654,6 @@ const addHoc = compose( injectIntl, ); -// ignore unused exports default // next.js export +// ts-unused-exports:disable-next-line export default addHoc(CreateExpensePage); diff --git a/pages/create-fund.js b/pages/create-fund.js index 60a8016b2e8..d1ea3dbd724 100644 --- a/pages/create-fund.js +++ b/pages/create-fund.js @@ -22,6 +22,6 @@ CreateFundPage.propTypes = { loadingLoggedInUser: PropTypes.bool.isRequired, }; -// ignore unused exports default // next.js export +// ts-unused-exports:disable-next-line export default withUser(CreateFundPage); diff --git a/pages/create-project.js b/pages/create-project.js index 77da0b1914b..2b314ce502f 100644 --- a/pages/create-project.js +++ b/pages/create-project.js @@ -65,6 +65,6 @@ CreateProjectPage.propTypes = { LoggedInUser: PropTypes.object, }; -// ignore unused exports default // next.js export +// ts-unused-exports:disable-next-line export default withUser(CreateProjectPage); diff --git a/pages/createEvent.js b/pages/createEvent.js index e78ebddd1e2..1eb9ad94189 100644 --- a/pages/createEvent.js +++ b/pages/createEvent.js @@ -38,6 +38,6 @@ class CreateEventPage extends React.Component { const addLegacyCollectiveData = graphql(legacyCollectiveQuery); -// ignore unused exports default // next.js export +// ts-unused-exports:disable-next-line export default withUser(addLegacyCollectiveData(CreateEventPage)); diff --git a/pages/createOrganization.js b/pages/createOrganization.js index 2ddac2d4f9d..34310669fca 100644 --- a/pages/createOrganization.js +++ b/pages/createOrganization.js @@ -32,6 +32,6 @@ class CreateOrganizationPage extends React.Component { } } -// ignore unused exports default // next.js export +// ts-unused-exports:disable-next-line export default withUser(CreateOrganizationPage); diff --git a/pages/dashboard.tsx b/pages/dashboard.tsx index fef98a7166b..8fc23df7049 100644 --- a/pages/dashboard.tsx +++ b/pages/dashboard.tsx @@ -290,6 +290,6 @@ DashboardPage.getInitialProps = () => { }; }; -// ignore unused exports default // next.js export +// ts-unused-exports:disable-next-line export default DashboardPage; diff --git a/pages/e2c.js b/pages/e2c.js index 4e3c3504be7..760ff00a777 100644 --- a/pages/e2c.js +++ b/pages/e2c.js @@ -34,6 +34,6 @@ const E2C = () => { ); }; -// ignore unused exports default // next.js export +// ts-unused-exports:disable-next-line export default E2C; diff --git a/pages/embed/contribution-flow.js b/pages/embed/contribution-flow.js index 10ee6ef8704..9932c083114 100644 --- a/pages/embed/contribution-flow.js +++ b/pages/embed/contribution-flow.js @@ -147,6 +147,6 @@ const addContributionFlowData = graphql(contributionFlowAccountQuery, { }), }); -// ignore unused exports default // next.js export +// ts-unused-exports:disable-next-line export default addContributionFlowData(withUser(injectIntl(withStripeLoader(withRouter(EmbedContributionFlowPage))))); diff --git a/pages/expense.tsx b/pages/expense.tsx index 00c9155bf54..0937275d9ec 100644 --- a/pages/expense.tsx +++ b/pages/expense.tsx @@ -62,8 +62,8 @@ const expensePageQueryHelper = getSSRQueryHelpers< getPropsFromContext: context => getPropsFromQuery(context.query), }); -// ignore unused exports getServerSideProps // next.js export +// ts-unused-exports:disable-next-line export const getServerSideProps = expensePageQueryHelper.getServerSideProps; const getPageMetadata = (intl, legacyExpenseId, expense) => { @@ -78,8 +78,8 @@ const getPageMetadata = (intl, legacyExpenseId, expense) => { } }; -// ignore unused exports default // next.js export +// ts-unused-exports:disable-next-line export default function ExpensePage(props: InferGetServerSidePropsType) { const intl = useIntl(); const { LoggedInUser } = useLoggedInUser(); diff --git a/pages/expenses.tsx b/pages/expenses.tsx index 7fccbf075f8..70636098f39 100644 --- a/pages/expenses.tsx +++ b/pages/expenses.tsx @@ -254,12 +254,12 @@ const expensePageQueryHelpers = getSSRQueryHelpers) { const intl = useIntl(); const router = useRouter(); diff --git a/pages/external-redirect.js b/pages/external-redirect.js index 299f759dd72..04579adb7e8 100644 --- a/pages/external-redirect.js +++ b/pages/external-redirect.js @@ -136,6 +136,6 @@ const ExternalRedirectPage = () => { ); }; -// ignore unused exports default // next.js export +// ts-unused-exports:disable-next-line export default ExternalRedirectPage; diff --git a/pages/fiscal-hosting.js b/pages/fiscal-hosting.js index f98547c1561..e79fc7c3054 100644 --- a/pages/fiscal-hosting.js +++ b/pages/fiscal-hosting.js @@ -34,6 +34,6 @@ const FiscalHosting = () => { ); }; -// ignore unused exports default // next.js export +// ts-unused-exports:disable-next-line export default FiscalHosting; diff --git a/pages/guest-join.js b/pages/guest-join.js index eecdfb1ae80..0c49841ed0e 100644 --- a/pages/guest-join.js +++ b/pages/guest-join.js @@ -222,6 +222,6 @@ const JoinGuestPage = () => { ); }; -// ignore unused exports default // next.js export +// ts-unused-exports:disable-next-line export default JoinGuestPage; diff --git a/pages/help-and-support.js b/pages/help-and-support.js index 549d1e06aab..1d0f0de148b 100644 --- a/pages/help-and-support.js +++ b/pages/help-and-support.js @@ -101,6 +101,6 @@ HelpAndSupport.getInitialProps = async ctx => ({ ...ctx.query, }); -// ignore unused exports default // next.js export +// ts-unused-exports:disable-next-line export default HelpAndSupport; diff --git a/pages/home.js b/pages/home.js index d59bdfa5000..e6d86f6f346 100644 --- a/pages/home.js +++ b/pages/home.js @@ -48,8 +48,8 @@ export const HomePage = () => { ); }; -// ignore unused exports getServerSideProps // next.js export +// ts-unused-exports:disable-next-line export const getServerSideProps = async ({ req, res }) => { if (res && req) { const { locale } = getRequestIntl(req); @@ -67,6 +67,6 @@ export const getServerSideProps = async ({ req, res }) => { return { props: { skipDataFromTree } }; }; -// ignore unused exports default // next.js export +// ts-unused-exports:disable-next-line export default HomePage; diff --git a/pages/how-it-works.js b/pages/how-it-works.js index b21282f9f8d..a1c33bbc726 100644 --- a/pages/how-it-works.js +++ b/pages/how-it-works.js @@ -41,6 +41,6 @@ const HowItWorks = () => { ); }; -// ignore unused exports default // next.js export +// ts-unused-exports:disable-next-line export default HowItWorks; diff --git a/pages/index.js b/pages/index.js index 07074f731c4..df9003d8347 100644 --- a/pages/index.js +++ b/pages/index.js @@ -1,5 +1,5 @@ import { HomePage } from './home'; -// ignore unused exports default // next.js export +// ts-unused-exports:disable-next-line export default HomePage; diff --git a/pages/manage-contributions.js b/pages/manage-contributions.js index 30ac7931d97..24265f2ddb8 100644 --- a/pages/manage-contributions.js +++ b/pages/manage-contributions.js @@ -210,6 +210,6 @@ const addManageContributionsPageData = graphql(manageContributionsQuery, { }), }); -// ignore unused exports default // next.js export +// ts-unused-exports:disable-next-line export default withRouter(withUser(injectIntl(addManageContributionsPageData(ManageContributionsPage)))); diff --git a/pages/marketingPage.js b/pages/marketingPage.js index e1db10d0794..41dc8b725e6 100644 --- a/pages/marketingPage.js +++ b/pages/marketingPage.js @@ -94,6 +94,6 @@ class MarketingPage extends React.Component { } } -// ignore unused exports default // next.js export +// ts-unused-exports:disable-next-line export default injectIntl(withUser(MarketingPage)); diff --git a/pages/member-invitations.js b/pages/member-invitations.js index 7774bcb58e7..a5440895bf3 100644 --- a/pages/member-invitations.js +++ b/pages/member-invitations.js @@ -101,6 +101,6 @@ class MemberInvitationsPage extends React.Component { } } -// ignore unused exports default // next.js export +// ts-unused-exports:disable-next-line export default MemberInvitationsPage; diff --git a/pages/oauth/authorize.js b/pages/oauth/authorize.js index 1be7b5f33c8..7601d89df58 100644 --- a/pages/oauth/authorize.js +++ b/pages/oauth/authorize.js @@ -101,6 +101,6 @@ const OAuthAuthorizePage = () => { ); }; -// ignore unused exports default // next.js export +// ts-unused-exports:disable-next-line export default OAuthAuthorizePage; diff --git a/pages/order.tsx b/pages/order.tsx index 32999fcaa7a..617441c26b2 100644 --- a/pages/order.tsx +++ b/pages/order.tsx @@ -201,8 +201,8 @@ const contributionPageQueryHelper = getSSRQueryHelpers<{ legacyId: number; colle }), }); -// ignore unused exports getServerSideProps // next.js export +// ts-unused-exports:disable-next-line export const getServerSideProps: GetServerSideProps = contributionPageQueryHelper.getServerSideProps; const messages = defineMessages({ @@ -322,8 +322,8 @@ const getTransactionsToDisplay = (account, transactions) => { return [...accountTransactions, ...tipTransactionsToDisplay]; }; -// ignore unused exports default // next.js export +// ts-unused-exports:disable-next-line export default function OrderPage(props) { const { LoggedInUser } = useLoggedInUser(); const prevLoggedInUser = usePrevious(LoggedInUser); diff --git a/pages/orders.js b/pages/orders.js index 2f095de9285..85dc26a2564 100644 --- a/pages/orders.js +++ b/pages/orders.js @@ -48,6 +48,6 @@ class OrdersPage extends React.Component { } } -// ignore unused exports default // next.js export +// ts-unused-exports:disable-next-line export default withUser(addCollectiveNavbarData(OrdersPage)); diff --git a/pages/osc-host-application.js b/pages/osc-host-application.js index 2e9d8c00198..29998fff43f 100644 --- a/pages/osc-host-application.js +++ b/pages/osc-host-application.js @@ -211,6 +211,6 @@ OSCHostApplication.propTypes = { refetchLoggedInUser: PropTypes.func, }; -// ignore unused exports default // next.js export +// ts-unused-exports:disable-next-line export default withUser(OSCHostApplication); diff --git a/pages/pricing.js b/pages/pricing.js index f21c7ffda48..301f1ddca4f 100644 --- a/pages/pricing.js +++ b/pages/pricing.js @@ -4,8 +4,8 @@ import PropTypes from 'prop-types'; import Page from '../components/Page'; import Pricing from '../components/pricing'; -// ignore unused exports default // next.js export +// ts-unused-exports:disable-next-line export default class PricingPage extends Component { static getInitialProps({ query }) { return { diff --git a/pages/redeem.js b/pages/redeem.js index a4815ab89d0..ee1f4b895f5 100644 --- a/pages/redeem.js +++ b/pages/redeem.js @@ -295,6 +295,6 @@ const addRedeemPaymentMethodMutation = graphql(redeemPaymentMethodMutation, { const addGraphql = compose(addRedeemPageData, addRedeemPaymentMethodMutation); -// ignore unused exports default // next.js export +// ts-unused-exports:disable-next-line export default injectIntl(withUser(withRouter(addGraphql(RedeemPage)))); diff --git a/pages/redeemed.js b/pages/redeemed.js index 34accd6cf40..cd0b76fa4a8 100644 --- a/pages/redeemed.js +++ b/pages/redeemed.js @@ -241,6 +241,6 @@ const addRedeemedPageData = graphql(redeemedPageQuery, { skip: props => !props.collectiveSlug, }); -// ignore unused exports default // next.js export +// ts-unused-exports:disable-next-line export default withUser(withData(addRedeemedPageData(RedeemedPage))); diff --git a/pages/reset-password-completed.js b/pages/reset-password-completed.js index 2ce75262e2f..f6a99bf1072 100644 --- a/pages/reset-password-completed.js +++ b/pages/reset-password-completed.js @@ -57,6 +57,6 @@ ResetPasswordCompleted.propTypes = { LoggedInUser: PropTypes.object, }; -// ignore unused exports default // next.js export +// ts-unused-exports:disable-next-line export default withUser(ResetPasswordCompleted); diff --git a/pages/reset-password-sent.js b/pages/reset-password-sent.js index 6b009bbc429..7d7d7cd0454 100644 --- a/pages/reset-password-sent.js +++ b/pages/reset-password-sent.js @@ -68,6 +68,6 @@ ResetPasswordSent.propTypes = { email: PropTypes.string.isRequired, }; -// ignore unused exports default // next.js export +// ts-unused-exports:disable-next-line export default ResetPasswordSent; diff --git a/pages/reset-password.js b/pages/reset-password.js index 8d3d91b8231..55f74b2a2aa 100644 --- a/pages/reset-password.js +++ b/pages/reset-password.js @@ -297,6 +297,6 @@ const addGraphql = compose( }), ); -// ignore unused exports default // next.js export +// ts-unused-exports:disable-next-line export default withRouter(injectIntl(withUser(addGraphql(ResetPasswordPage)))); diff --git a/pages/root-actions.js b/pages/root-actions.js index 7daeff5aead..ef01be6b468 100644 --- a/pages/root-actions.js +++ b/pages/root-actions.js @@ -201,6 +201,6 @@ const RootActionsPage = () => { RootActionsPage.propTypes = {}; -// ignore unused exports default // next.js export +// ts-unused-exports:disable-next-line export default RootActionsPage; diff --git a/pages/search.js b/pages/search.js index 5da28029e5f..3bc77062a71 100644 --- a/pages/search.js +++ b/pages/search.js @@ -656,6 +656,6 @@ const addSearchPageData = graphql(searchPageQuery, { }), }); -// ignore unused exports default // next.js export +// ts-unused-exports:disable-next-line export default injectIntl(withRouter(addSearchPageData(SearchPage))); diff --git a/pages/signin.js b/pages/signin.js index 6481d20ae94..ce3bafa7320 100644 --- a/pages/signin.js +++ b/pages/signin.js @@ -209,6 +209,6 @@ class SigninPage extends React.Component { } } -// ignore unused exports default // next.js export +// ts-unused-exports:disable-next-line export default withUser(withRouter(SigninPage)); diff --git a/pages/signinLinkSent.js b/pages/signinLinkSent.js index 1dfd8281ca5..769a1246426 100644 --- a/pages/signinLinkSent.js +++ b/pages/signinLinkSent.js @@ -73,6 +73,6 @@ SignInLinkSent.propTypes = { email: PropTypes.string.isRequired, }; -// ignore unused exports default // next.js export +// ts-unused-exports:disable-next-line export default SignInLinkSent; diff --git a/pages/staticPage.js b/pages/staticPage.js index a9aa03a1c7a..a44bc2447aa 100644 --- a/pages/staticPage.js +++ b/pages/staticPage.js @@ -58,6 +58,6 @@ class StaticPage extends React.Component { } } -// ignore unused exports default // next.js export +// ts-unused-exports:disable-next-line export default StaticPage; diff --git a/pages/submitted-expenses.tsx b/pages/submitted-expenses.tsx index 62e4cbc8859..1dd779a29dc 100644 --- a/pages/submitted-expenses.tsx +++ b/pages/submitted-expenses.tsx @@ -361,6 +361,6 @@ const addExpensesPageData = graphql(submittedExpense }, }); -// ignore unused exports default // next.js export +// ts-unused-exports:disable-next-line export default injectIntl(addExpensesPageData(withUser(withRouter(SubmittedExpensesPage)))); diff --git a/pages/terms-of-fiscal-sponsorship.tsx b/pages/terms-of-fiscal-sponsorship.tsx index fa9bacfbcb0..cae70b73264 100644 --- a/pages/terms-of-fiscal-sponsorship.tsx +++ b/pages/terms-of-fiscal-sponsorship.tsx @@ -27,8 +27,8 @@ const tosQueryHelper = getSSRQueryHelpers) => { @@ -58,6 +58,6 @@ TermsOfFiscalSponsorship.propTypes = { hostCollectiveSlug: PropTypes.string, }; -// ignore unused exports default // next.js export +// ts-unused-exports:disable-next-line export default TermsOfFiscalSponsorship; diff --git a/pages/tier.tsx b/pages/tier.tsx index df9fee36f86..2899e3df00f 100644 --- a/pages/tier.tsx +++ b/pages/tier.tsx @@ -69,8 +69,8 @@ const tierPageQueryHelpers = getSSRQueryHelpers<{ tierId: number }, TierPageProp }), }); -// ignore unused exports getServerSideProps // next.js export +// ts-unused-exports:disable-next-line export const getServerSideProps = tierPageQueryHelpers.getServerSideProps; /** @@ -120,6 +120,6 @@ const TierPage = (pageProps: InferGetServerSidePropsType) { const { LoggedInUser } = useLoggedInUser(); const queryResult = updatePageSSRQueryHelpers.useQuery(props); diff --git a/pages/updatePaymentMethod.js b/pages/updatePaymentMethod.js index 0c2b24932c7..7f2dfafe762 100644 --- a/pages/updatePaymentMethod.js +++ b/pages/updatePaymentMethod.js @@ -389,6 +389,6 @@ const addSubscriptionsData = graphql(subscriptionsQuery, { const addGraphql = compose(addSubscriptionsData, addReplaceCreditCardMutation); -// ignore unused exports default // next.js export +// ts-unused-exports:disable-next-line export default injectIntl(withUser(addGraphql(withStripeLoader(UpdatePaymentPage)))); diff --git a/pages/updates.tsx b/pages/updates.tsx index 2e7e990800c..8565b213f35 100644 --- a/pages/updates.tsx +++ b/pages/updates.tsx @@ -128,12 +128,12 @@ const updatesPageQueryHelper = getSSRQueryHelpers< skipClientIfSSRThrows404: true, }); -// ignore unused exports getServerSideProps // next.js export +// ts-unused-exports:disable-next-line export const getServerSideProps = updatesPageQueryHelper.getServerSideProps; -// ignore unused exports default // next.js export +// ts-unused-exports:disable-next-line export default function UpdatesPage(props: InferGetServerSidePropsType) { const router = useRouter(); const { LoggedInUser } = useLoggedInUser(); diff --git a/pages/welcome.js b/pages/welcome.js index 9522f7015e8..3c66f16339c 100644 --- a/pages/welcome.js +++ b/pages/welcome.js @@ -143,6 +143,6 @@ const Welcome = () => { ); }; -// ignore unused exports default // next.js export +// ts-unused-exports:disable-next-line export default Welcome; diff --git a/scripts/config/graphql-codegen.ts b/scripts/config/graphql-codegen.ts index 7c2594a811f..d0b8714364a 100644 --- a/scripts/config/graphql-codegen.ts +++ b/scripts/config/graphql-codegen.ts @@ -14,13 +14,6 @@ const config: CodegenConfig = { fragmentMasking: false, }, schema: './lib/graphql/schemaV2.graphql', - plugins: [ - { - add: { - content: '/* ignore unused exports */', - }, - }, - ], }, }, pluckConfig: { @@ -29,7 +22,6 @@ const config: CodegenConfig = { }, }; -// ignore unused exports default // config file - +// ts-unused-exports:disable-next-line export default config; diff --git a/stories/two-factor-authentication/TwoFactorAuthenticationPromptButton.js b/stories/two-factor-authentication/TwoFactorAuthenticationPromptButton.js index 8815e6c6164..40acbd12901 100644 --- a/stories/two-factor-authentication/TwoFactorAuthenticationPromptButton.js +++ b/stories/two-factor-authentication/TwoFactorAuthenticationPromptButton.js @@ -7,6 +7,8 @@ import { useTwoFactorAuthenticationPrompt } from '../../lib/two-factor-authentic import StyledButton from '../../components/StyledButton'; import TwoFactorAuthPrompt from '../../components/two-factor-authentication/TwoFactorAuthenticationModal'; +// used in Stories mdx +// ts-unused-exports:disable-next-line export default function TwoFactorAuthenticationPromptButton() { const intl = useIntl(); const prompt = useTwoFactorAuthenticationPrompt(); diff --git a/test/cypress/scripts/get-text-from-pdf-content.ts b/test/cypress/scripts/get-text-from-pdf-content.ts index 02795107e26..86398016d30 100644 --- a/test/cypress/scripts/get-text-from-pdf-content.ts +++ b/test/cypress/scripts/get-text-from-pdf-content.ts @@ -1,8 +1,7 @@ const pdf = require('pdf-parse'); // eslint-disable-line node/no-unpublished-require -// ignore unused exports getTextFromPdfContent // imported using require - +// ts-unused-exports:disable-next-line export const getTextFromPdfContent = (pdfContent: string): Promise => { return pdf(pdfContent).then(({ text }) => text); }; diff --git a/test/cypress/support/helpers.js b/test/cypress/support/helpers.js index ec343ab3f0f..752da2bddcd 100644 --- a/test/cypress/support/helpers.js +++ b/test/cypress/support/helpers.js @@ -1,9 +1,8 @@ -// ignore unused exports repeatIt, repeatDescribe -// keep for future use? - import { flatten } from 'lodash'; /** Helper to loop on specific test */ +// keep for future use? +// ts-unused-exports:disable-next-line export const repeatIt = (testName, count, func) => { const range = Array(count).fill(); const tests = range.map((_, testNum) => it(`${testName} - ${testNum}`, func)); @@ -11,6 +10,8 @@ export const repeatIt = (testName, count, func) => { }; /** Helper to loop on specific describe */ +// keep for future use? +// ts-unused-exports:disable-next-line export const repeatDescribe = (describeName, count, func) => { const range = Array(count).fill(); const describes = range.map((_, testNum) => describe(`${describeName} - ${testNum}`, func)); diff --git a/test/mocks/withMockRouter.js b/test/mocks/withMockRouter.js index 1aefbf40c32..1cedb405c20 100644 --- a/test/mocks/withMockRouter.js +++ b/test/mocks/withMockRouter.js @@ -1,10 +1,9 @@ -// ignore unused exports mockedRouter, withMockRouterContext -// keep for future use? - import React from 'react'; import PropTypes from 'prop-types'; import Router from 'next/router'; +// keep for future use? +// ts-unused-exports:disable-next-line export const mockedRouter = { push: () => {}, replace: () => {}, @@ -15,6 +14,8 @@ export const mockedRouter = { Router.router = mockedRouter; +// keep for future use? +// ts-unused-exports:disable-next-line export const withMockRouterContext = mockRouter => { class MockRouterContext extends React.Component { getChildContext() {