Skip to content

Commit

Permalink
move type checking to other workflow, fix TS errors, add TSC checking
Browse files Browse the repository at this point in the history
  • Loading branch information
AAGaming00 committed Sep 25, 2023
1 parent 5838ddc commit 300885f
Show file tree
Hide file tree
Showing 6 changed files with 48 additions and 22 deletions.
15 changes: 2 additions & 13 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,23 +11,12 @@ jobs:
steps:
- uses: actions/checkout@v2 # Check out the repository first.

- name: Install Python dependencies
run: |
python -m pip install --upgrade pip
[ -f requirements.txt ] && pip install -r requirements.txt
- name: Install JavaScript dependencies
- name: Install TypeScript dependencies
working-directory: frontend
run: |
npm i -g pnpm
pnpm i --frozen-lockfile
- name: Run pyright (Python)
uses: jakebailey/pyright-action@v1
with:
python-version: "3.10.6"
no-comments: true

- name: Run prettier (JavaScript & TypeScript)
- name: Run prettier (TypeScript)
working-directory: frontend
run: pnpm run lint
33 changes: 33 additions & 0 deletions .github/workflows/typecheck.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
name: Type check

on:
push:

jobs:
typecheck:
name: Run type checkers
runs-on: ubuntu-20.04

steps:
- uses: actions/checkout@v2 # Check out the repository first.

- name: Install Python dependencies
run: |
python -m pip install --upgrade pip
[ -f requirements.txt ] && pip install -r requirements.txt
- name: Install TypeScript dependencies
working-directory: frontend
run: |
npm i -g pnpm
pnpm i --frozen-lockfile
- name: Run pyright (Python)
uses: jakebailey/pyright-action@v1
with:
python-version: "3.10.6"
no-comments: true

- name: Run tsc (TypeScript)
working-directory: frontend
run: $(pnpm bin)/tsc --noEmit
9 changes: 7 additions & 2 deletions frontend/src/components/modals/filepicker/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import {
} from 'decky-frontend-lib';
import { filesize } from 'filesize';
import { FunctionComponent, useCallback, useEffect, useMemo, useState } from 'react';
import { FileIcon, defaultStyles } from 'react-file-icon';
import { DefaultExtensionType, FileIcon, defaultStyles } from 'react-file-icon';
import { useTranslation } from 'react-i18next';
import { FaArrowUp, FaFolder } from 'react-icons/fa';

Expand Down Expand Up @@ -316,7 +316,12 @@ const FilePicker: FunctionComponent<FilePickerProps> = ({
) : (
<div style={iconStyles}>
{file.realpath.includes('.') ? (
<FileIcon {...defaultStyles[extension]} {...styleDefObj[extension]} extension={''} />
<FileIcon
{...defaultStyles[extension as DefaultExtensionType]}
// @ts-expect-error
{...styleDefObj[extension]}
extension={''}
/>
) : (
<FileIcon />
)}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,10 @@ const BranchSelect: FunctionComponent<{}> = () => {
<Field label={t('BranchSelect.update_channel.label')} childrenContainerWidth={'fixed'}>
<Dropdown
rgOptions={Object.values(UpdateBranch)
.filter((branch) => typeof branch == 'string')
.filter((branch) => typeof branch == 'number')
.map((branch) => ({
label: tBranches[UpdateBranch[branch]],
data: UpdateBranch[branch],
label: tBranches[branch as number],
data: branch,
}))}
selectedOption={selectedBranch}
onChange={async (newVal) => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,10 @@ const StoreSelect: FunctionComponent<{}> = () => {
<Field label={t('StoreSelect.store_channel.label')} childrenContainerWidth={'fixed'}>
<Dropdown
rgOptions={Object.values(Store)
.filter((store) => typeof store == 'string')
.filter((store) => typeof store == 'number')
.map((store) => ({
label: tStores[Store[store]],
data: Store[store],
label: tStores[store as number],
data: store,
}))}
selectedOption={selectedStore}
onChange={async (newVal) => {
Expand Down
1 change: 0 additions & 1 deletion frontend/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
"noImplicitThis": true,
"noImplicitAny": true,
"strict": true,
"suppressImplicitAnyIndexErrors": true,
"allowSyntheticDefaultImports": true,
"skipLibCheck": true,
"resolveJsonModule": true
Expand Down

0 comments on commit 300885f

Please sign in to comment.