Skip to content

Commit 049ac4f

Browse files
committed
feat: automatically run unit tests on new PRs (#27) (#29)
fix: wrong types fix: typescript compile errors feat: run lint on new PRs type node .
1 parent 300a4af commit 049ac4f

File tree

8 files changed

+65
-895
lines changed

8 files changed

+65
-895
lines changed

.github/workflows/lint.yml

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
name: Run Lint
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
pull_request:
8+
9+
jobs:
10+
lint:
11+
runs-on: ubuntu-latest
12+
13+
steps:
14+
# Checkout the code
15+
- name: Checkout code
16+
uses: actions/checkout@v4
17+
18+
# Set up Node.js
19+
- name: Set up Node.js
20+
uses: actions/setup-node@v4
21+
with:
22+
node-version: 20
23+
cache: 'npm'
24+
25+
# Install dependencies
26+
- name: Install dependencies
27+
run: npm ci
28+
29+
# Run tests with coverage
30+
- name: Run lint
31+
run: |
32+
npm run lint

package-lock.json

Lines changed: 14 additions & 861 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
"test:watch": "jest --watch",
2222
"test:coverage": "jest --coverage --collectCoverageFrom=\"./src/**\"",
2323
"test:snapshots": "jest -u",
24-
"lint": "npm run eslint",
24+
"lint": "tsc && npm run eslint",
2525
"eslint": "eslint src/* app/*",
2626
"eslint:fix": "npm run lint -- --fix",
2727
"prettier": "prettier --check \"**/*.{js,jsx,ts,tsx,json,md}\"",
@@ -96,6 +96,7 @@
9696
"@types/eslint__js": "^8.42.3",
9797
"@types/jest": "^29.5.12",
9898
"@types/lodash": "^4.17.13",
99+
"@types/node": "^22.9.1",
99100
"@types/react": "~18.3.12",
100101
"babel-loader": "^8.4.1",
101102
"detox": "^20.27.6",

src/components/DataRow/index.stories.tsx

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,7 @@ export default {
1919
export const Default = () => (
2020
<DataRow>
2121
<DataRow.Label>Send</DataRow.Label>
22-
<DataRow.Value>
23-
<Text>0.05452 ETH</Text>
24-
</DataRow.Value>
22+
<DataRow.Value>0.05452 ETH</DataRow.Value>
2523
</DataRow>
2624
)
2725

src/components/DataRow/index.tsx

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,17 @@
11
import React from 'react'
22
import { XStack, Text, Theme, XStackProps } from 'tamagui'
33

4-
interface Props {
4+
type Props = {
55
children: string
66
}
77

8+
type ValueProps = {
9+
children: string | React.ReactElement
10+
}
11+
812
export const DataRow: React.FC<XStackProps> & {
913
Label: React.FC<Props>
10-
Value: React.FC<Props>
14+
Value: React.FC<ValueProps>
1115
Header: React.FC<Props>
1216
} = (props: XStackProps) => {
1317
const { children, ...rest } = props
@@ -24,7 +28,13 @@ const Label = ({ children }: Props) => (
2428
</Theme>
2529
)
2630

27-
const Value = ({ children }: Props) => <Text>{children}</Text>
31+
const Value = ({ children }: { children: string | React.ReactElement }) => {
32+
if (typeof children === 'string') {
33+
return <Text>{children}</Text>
34+
}
35+
36+
return children
37+
}
2838

2939
const Header = ({ children }: Props) => (
3040
<Text fontWeight="600" marginVertical="$2">

src/components/ExternalLink/index.tsx

Lines changed: 0 additions & 24 deletions
This file was deleted.

src/components/InlineTab/index.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,15 +4,15 @@ import { StyledTransactionsTabs, StyledTransactionTabItem, StyledTransactionTabT
44

55
interface InlineTabProps {
66
items: {
7-
path: Href<string>
7+
path: Href
88
label: string
99
}[]
1010
}
1111

1212
function InlineTab({ items }: InlineTabProps) {
1313
const path = usePathname()
1414

15-
const onTabItemClick = (screenPath: Href<string>) => () => {
15+
const onTabItemClick = (screenPath: Href) => () => {
1616
router.replace(screenPath)
1717
}
1818

tsconfig.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
"paths": {
66
"@/*": ["./*"]
77
},
8-
"types": ["jest"]
8+
"types": ["jest", "node"]
99
},
1010
"include": ["**/*.ts", "**/*.tsx", ".expo/types/**/*.ts", "expo-env.d.ts"]
1111
}

0 commit comments

Comments
 (0)