Skip to content

Commit db77bfa

Browse files
committed
Convert the project to typescript
1 parent 6c353da commit db77bfa

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

47 files changed

+865
-25
lines changed

package.json

Lines changed: 29 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,12 @@
55
"homepage": "https://react-native-community.github.io/upgrade-helper",
66
"scripts": {
77
"build": "EXTEND_ESLINT=true react-app-rewired build",
8-
"docker-test-e2e": "yarn start-and-wait && react-app-rewired test --watchAll=false --onlyChanged=false --testPathPattern='/__tests__/.*(\\.|).e2e.spec.js?$'",
8+
"docker-test-e2e": "yarn start-and-wait && react-app-rewired test --watchAll=false --onlyChanged=false --testPathPattern='/__tests__/.*(\\.|).e2e.spec.(js|jsx|ts|tsx)?$'",
99
"lint": "eslint . --cache --report-unused-disable-directives",
1010
"prepare": "husky install",
1111
"start": "EXTEND_ESLINT=true react-app-rewired start",
1212
"start-and-wait": "yarn start & wget --retry-connrefused --waitretry=1 --read-timeout=20 --timeout=15 -t 30 http://localhost:3000/",
13-
"test": "react-app-rewired test --watchAll=false --onlyChanged=false --testPathPattern='/__tests__/((?!e2e).)*.spec.js?$'",
13+
"test": "react-app-rewired test --watchAll=false --onlyChanged=false --testPathPattern='/__tests__/((?!e2e).)*.spec.(js|jsx|ts|tsx)?$'",
1414
"test-e2e": "docker-compose run tests"
1515
},
1616
"dependencies": {
@@ -37,7 +37,16 @@
3737
"devDependencies": {
3838
"@emotion/babel-preset-css-prop": "^11.10.0",
3939
"@emotion/eslint-plugin": "^11.10.0",
40+
"@jest/globals": "^29.7.0",
4041
"@testing-library/react": "^14.0.0",
42+
"@types/jest": "^29.5.12",
43+
"@types/node": "^20.11.16",
44+
"@types/react": "^18.2.52",
45+
"@types/react-copy-to-clipboard": "^5.0.7",
46+
"@types/react-dom": "^18.2.18",
47+
"@types/use-persisted-state": "^0.3.4",
48+
"@typescript-eslint/eslint-plugin": "^6.20.0",
49+
"@typescript-eslint/parser": "^6.20.0",
4150
"customize-cra": "^1.0.0",
4251
"eslint": "^8.35.0",
4352
"eslint-plugin-prettier": "^4.2.1",
@@ -47,7 +56,9 @@
4756
"prettier": "2.8.4",
4857
"pretty-quick": "3.1.3",
4958
"puppeteer": "10.0.0",
50-
"react-app-rewired": "^2.2.1"
59+
"react-app-rewired": "^2.2.1",
60+
"ts-jest": "^29.1.2",
61+
"typescript": "^5.3.3"
5162
},
5263
"browserslist": {
5364
"production": [
@@ -62,6 +73,7 @@
6273
]
6374
},
6475
"eslintConfig": {
76+
"parser": "@babel/eslint-parser",
6577
"extends": [
6678
"react-app"
6779
],
@@ -74,17 +86,28 @@
7486
"jsx-a11y/accessible-emoji": "off",
7587
"import/no-anonymous-default-export": "off",
7688
"react-hooks/exhaustive-deps": "off"
77-
}
89+
},
90+
"overrides": [
91+
{
92+
"files": [
93+
"src/__tests__/**/*"
94+
],
95+
"env": {
96+
"jest": true
97+
}
98+
}
99+
]
78100
},
79101
"husky": {
80102
"hooks": {
81-
"pre-commit": "pretty-quick --staged --pattern \"src/**/*.*(js|jsx)\"",
103+
"pre-commit": "pretty-quick --staged --pattern \"src/**/*.*(js|jsx|ts|tsx)\"",
82104
"pre-push": "yarn run lint"
83105
}
84106
},
85107
"jest": {
108+
"preset": "ts-jest",
86109
"testMatch": [
87-
"**/__tests__/**/*.spec.js"
110+
"**/__tests__/**/*.spec.(js|jsx|ts|tsx)"
88111
],
89112
"setupFilesAfterEnv": [
90113
"<rootDir>/jest.setup.js"

src/App.jsx renamed to src/App.tsx

File renamed without changes.
File renamed without changes.
File renamed without changes.

src/components/common/CompletedFilesCounter.js renamed to src/components/common/CompletedFilesCounter.tsx

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,22 @@ const shake = keyframes`
2626
}
2727
`
2828

29+
interface CompletedFilesCounterProps
30+
extends React.HTMLAttributes<HTMLDivElement> {
31+
completed: number
32+
total: number
33+
popoverContent: string
34+
popoverCursorType: string
35+
}
36+
2937
const CompletedFilesCounter = styled(
30-
({ completed, total, popoverContent, popoverCursorType, ...props }) => (
38+
({
39+
completed,
40+
total,
41+
popoverContent,
42+
popoverCursorType,
43+
...props
44+
}: CompletedFilesCounterProps) => (
3145
<div {...props}>
3246
<Popover
3347
content={popoverContent}

0 commit comments

Comments
 (0)