diff --git a/.github/workflows/ci-web.yml b/.github/workflows/ci-web.yml new file mode 100644 index 0000000..efc3b22 --- /dev/null +++ b/.github/workflows/ci-web.yml @@ -0,0 +1,60 @@ +name: CI checks for web workspace + +on: + push: + branches: ['main'] + paths: ['web/**/*', '!**/*.{txt,md}'] + pull_request: + branches: ['main'] + paths: ['web/**/*', '!**/*.{txt,md}'] + +defaults: + run: + working-directory: 'web' + +jobs: + Prettier: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: actions/setup-node@v4 + with: + node-version: 'lts/*' # TODO: determine version used in production server + cache: yarn + cache-dependency-path: 'yarn.lock' + - name: Install yarn + run: npm install -g yarn + - name: Install dependencies + run: yarn install + - name: Run prettier + run: yarn prettier . --check --ignore-unknown + ESLint: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: actions/setup-node@v4 + with: + node-version: 'lts/*' + cache: yarn + cache-dependency-path: 'yarn.lock' + - name: Install yarn + run: npm install -g yarn + - name: Install dependencies + run: yarn install + - name: Run ESLint + run: yarn eslint . + typecheck: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: actions/setup-node@v4 + with: + node-version: 'lts/*' + cache: yarn + cache-dependency-path: 'yarn.lock' + - name: Install yarn + run: npm install -g yarn + - name: Install dependencies + run: yarn install + - name: Compile with tsc + run: yarn tsc --noEmit --strict diff --git a/web/components/answers/compatibility-questions-display.tsx b/web/components/answers/compatibility-questions-display.tsx index da0b898..02e40f8 100644 --- a/web/components/answers/compatibility-questions-display.tsx +++ b/web/components/answers/compatibility-questions-display.tsx @@ -407,7 +407,7 @@ function CompatibilityAnswerBlock(props: { {answerText} - + {answer.explanation && ( )} @@ -419,7 +419,7 @@ function CompatibilityAnswerBlock(props: { ? 'Acceptable' : 'Also acceptable'} - + {distinctPreferredAnswersText.map((text) => ( )} - {comparedLover && ( void }) { - const { isFirstQuestion, questions, user, refreshAnswers } = props + const { /*isFirstQuestion,*/ questions, user, refreshAnswers } = props const [openModal, setOpenModal] = usePersistentInMemoryState( false, `add-question-${user.id}` diff --git a/web/components/browse-matches-button.tsx b/web/components/browse-matches-button.tsx index 7b859be..eb97306 100644 --- a/web/components/browse-matches-button.tsx +++ b/web/components/browse-matches-button.tsx @@ -38,11 +38,11 @@ export const BrowseMatchesButton = (props: { placeholder: 'Write your introduction...', }) - const [isSubmitting, setIsSubmitting] = useState(false) + const [isSubmitting /*, setIsSubmitting*/] = useState(false) const submit = async () => { - const introduction = - (editor?.getCharacterCount() ?? 0) > 0 ? editor?.getJSON() : undefined + //const introduction = + ;(editor?.getCharacterCount() ?? 0) > 0 ? editor?.getJSON() : undefined // setIsSubmitting(true) // const result = await createMatch({ @@ -107,14 +107,14 @@ const BrowseMatchesDialog = (props: { lover, potentialLovers, compatibilityScores, - isSubmitting, + //isSubmitting, setOpen, - submit, - editor, + //submit, + //editor, } = props const [query, setQuery] = useState('') - const [error, setError] = useState(undefined) + //const [error, setError] = useState(undefined) const currentUser = useUser() const isCurrentUser = currentUser?.id === lover.user_id diff --git a/web/components/filters/location-filter.tsx b/web/components/filters/location-filter.tsx index 28b0069..5efcf86 100644 --- a/web/components/filters/location-filter.tsx +++ b/web/components/filters/location-filter.tsx @@ -28,7 +28,7 @@ export function LocationFilterText(props: { radius: number highlightedClass?: string }) { - const { location, youLover, radius, highlightedClass } = props + const { location, /*youLover,*/ radius, highlightedClass } = props if (!location) { return ( diff --git a/web/components/layout/tabs.tsx b/web/components/layout/tabs.tsx index 3684128..80e2ae6 100644 --- a/web/components/layout/tabs.tsx +++ b/web/components/layout/tabs.tsx @@ -157,8 +157,9 @@ export function ControlledTabs(props: TabProps & { activeIndex: number }) { aria-current={activeIndex === i ? 'page' : undefined} > diff --git a/web/components/love-page.tsx b/web/components/love-page.tsx index ac15ef6..1be577a 100644 --- a/web/components/love-page.tsx +++ b/web/components/love-page.tsx @@ -45,7 +45,7 @@ export function LovePage(props: { const bottomNavOptions = user ? getBottomNavigation(user, lover) : signedOutNavigation() - const [isModalOpen, setIsModalOpen] = useState(false) + //const [isModalOpen, setIsModalOpen] = useState(false) const desktopSidebarOptions = getDesktopNav(user) const mobileSidebarOptions = user @@ -55,7 +55,7 @@ export function LovePage(props: { // eslint-disable-next-line react-hooks/rules-of-hooks trackPageView && useTracking(`view love ${trackPageView}`, trackPageProps) useOnline() - const [isAddFundsModalOpen, setIsAddFundsModalOpen] = useState(false) + const [, /*isAddFundsModalOpen*/ setIsAddFundsModalOpen] = useState(false) return ( <> diff --git a/web/components/required-lover-form.tsx b/web/components/required-lover-form.tsx index cf6454d..98d75ea 100644 --- a/web/components/required-lover-form.tsx +++ b/web/components/required-lover-form.tsx @@ -47,7 +47,10 @@ export const RequiredLoveUserForm = (props: { setEditUsername?: (name: string) => unknown setEditDisplayName?: (name: string) => unknown lover: LoverRow - setLover: >(key: K, value: LoverRow[K] | undefined) => void + setLover: >( + key: K, + value: LoverRow[K] | undefined + ) => void isSubmitting: boolean onSubmit?: () => void loverCreatedAlready?: boolean diff --git a/web/components/widgets/choices-toggle-group.tsx b/web/components/widgets/choices-toggle-group.tsx index cf05fa8..928e220 100644 --- a/web/components/widgets/choices-toggle-group.tsx +++ b/web/components/widgets/choices-toggle-group.tsx @@ -13,8 +13,9 @@ const colorClasses = { export type ColorType = keyof typeof colorClasses -export function ChoicesToggleGroup>( - props: { +export function ChoicesToggleGroup< + T extends Record +>(props: { currentChoice: T[keyof T] | undefined choicesMap: T disabled?: boolean diff --git a/web/components/widgets/searchable-select.tsx b/web/components/widgets/searchable-select.tsx index bd31144..fe3a0a8 100644 --- a/web/components/widgets/searchable-select.tsx +++ b/web/components/widgets/searchable-select.tsx @@ -52,7 +52,7 @@ export function SearchableSelect(props: { return ( - {({ open, close }) => ( + {({ close, ..._ }) => ( <> Bot ) -} +}*/ export function BannedBadge() { return ( diff --git a/web/pages/profile.tsx b/web/pages/profile.tsx index 9cf2e66..6acb12a 100644 --- a/web/pages/profile.tsx +++ b/web/pages/profile.tsx @@ -30,7 +30,10 @@ function ProfilePageInner(props: { user: User; lover: Lover }) { user, }) - const setLoverState = > (key: K, value: LoverRow[K] | undefined) => { + const setLoverState = >( + key: K, + value: LoverRow[K] | undefined + ) => { setLover((prevState) => ({ ...prevState, [key]: value })) }