Skip to content

Commit 80bb36b

Browse files
PROD-1583 add support for typescript #time 10m
1 parent 0eae43f commit 80bb36b

File tree

4 files changed

+226
-1
lines changed

4 files changed

+226
-1
lines changed

package.json

+6-1
Original file line numberDiff line numberDiff line change
@@ -17,12 +17,16 @@
1717
"@babel/plugin-transform-runtime": "^7.8.3",
1818
"@babel/preset-env": "^7.7.6",
1919
"@babel/preset-react": "^7.7.4",
20+
"@babel/preset-typescript": "^7.16.7",
2021
"@babel/runtime": "^7.8.7",
2122
"@stripe/react-stripe-js": "1.3.0",
2223
"@stripe/stripe-js": "1.3.0",
2324
"@testing-library/jest-dom": "^5.5.0",
2425
"@testing-library/react": "^9.4.0",
25-
"@types/jest": "^25.2.1",
26+
"@types/jest": "^25.2.3",
27+
"@types/node": "^17.0.23",
28+
"@types/react": "^18.0.1",
29+
"@types/react-dom": "^18.0.0",
2630
"@types/systemjs": "^6.1.0",
2731
"autoprefixer": "^9.8.6",
2832
"babel-eslint": "^11.0.0-beta.2",
@@ -90,6 +94,7 @@
9094
"redux-promise-middleware": "^6.1.2",
9195
"redux-thunk": "^2.3.0",
9296
"tc-auth-lib": "topcoder-platform/tc-auth-lib#1.0.4",
97+
"typescript": "^4.6.3",
9398
"uuid": "^8.3.2"
9499
},
95100
"browserslist": [

tsconfig.json

+34
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
{
2+
"compilerOptions": {
3+
"target": "es5",
4+
"lib": [
5+
"dom",
6+
"dom.iterable",
7+
"esnext"
8+
],
9+
"allowJs": true,
10+
"skipLibCheck": true,
11+
"esModuleInterop": true,
12+
"allowSyntheticDefaultImports": true,
13+
"strict": true,
14+
"strictNullChecks": true,
15+
"forceConsistentCasingInFileNames": true,
16+
"noFallthroughCasesInSwitch": true,
17+
"module": "esnext",
18+
"moduleResolution": "node",
19+
"resolveJsonModule": true,
20+
"isolatedModules": true,
21+
"noEmit": true,
22+
"jsx": "react-jsx",
23+
"typeRoots": [
24+
"./types",
25+
"./node_modules/@types"
26+
]
27+
},
28+
"include": [
29+
"src"
30+
],
31+
"exclude": [
32+
"**/*.test.*"
33+
]
34+
}

tslint.json

+177
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,177 @@
1+
{
2+
"extends": "tslint:latest",
3+
"files": [],
4+
"compilerOptions": {
5+
"jsx": "react",
6+
"declarationDir": "dist"
7+
},
8+
"include": [
9+
"src/**/*"
10+
],
11+
"exclude": [
12+
"src/**/*.test*"
13+
],
14+
"rules": {
15+
"array-type": [
16+
true,
17+
"generic"
18+
],
19+
"arrow-return-shorthand": true,
20+
"callable-types": true,
21+
"class-name": true,
22+
"comment-format": [
23+
true,
24+
"check-space"
25+
],
26+
"curly": true,
27+
"cyclomatic-complexity": [
28+
true,
29+
7
30+
],
31+
"deprecation": {
32+
"severity": "none"
33+
},
34+
"eofline": true,
35+
"forin": true,
36+
"import-blacklist": [
37+
true,
38+
"rxjs/Rx"
39+
],
40+
"import-spacing": true,
41+
"indent": [
42+
true,
43+
"spaces",
44+
4
45+
],
46+
"interface-over-type-literal": true,
47+
"label-position": true,
48+
"max-classes-per-file": [
49+
true,
50+
1
51+
],
52+
"max-line-length": false,
53+
"member-access": false,
54+
"member-ordering": [
55+
true,
56+
{
57+
"alphabetize": true,
58+
"order": [
59+
"private-static-field",
60+
"private-instance-field",
61+
"private-static-accessor",
62+
"private-instance-accessor",
63+
"public-static-field",
64+
"public-instance-field",
65+
"public-static-accessor",
66+
"public-instance-accessor",
67+
"public-constructor",
68+
"private-constructor",
69+
"public-instance-method",
70+
"private-instance-method"
71+
]
72+
}
73+
],
74+
"no-arg": true,
75+
"no-bitwise": true,
76+
"no-consecutive-blank-lines": true,
77+
"no-console": true,
78+
"no-construct": true,
79+
"no-debugger": true,
80+
"no-duplicate-super": true,
81+
"no-empty": false,
82+
"no-empty-interface": true,
83+
"no-eval": true,
84+
"no-implicit-dependencies": [
85+
true,
86+
"dev"
87+
],
88+
"no-inferrable-types": [
89+
false,
90+
"ignore-params"
91+
],
92+
"no-misused-new": true,
93+
"no-null-keyword": true,
94+
"no-non-null-assertion": true,
95+
"no-shadowed-variable": true,
96+
"no-string-literal": false,
97+
"no-string-throw": true,
98+
"no-submodule-imports": [
99+
true,
100+
"@heroicons"
101+
],
102+
"no-switch-case-fall-through": true,
103+
"no-trailing-whitespace": true,
104+
"no-unnecessary-initializer": true,
105+
"no-unused-expression": true,
106+
"no-var-keyword": true,
107+
"object-literal-sort-keys": true,
108+
"one-line": [
109+
true,
110+
"check-open-brace",
111+
"check-catch",
112+
"check-else",
113+
"check-whitespace"
114+
],
115+
"ordered-imports": [
116+
true,
117+
{
118+
"grouped-imports": true
119+
}
120+
],
121+
"prefer-const": true,
122+
"quotemark": [
123+
true,
124+
"single"
125+
],
126+
"radix": true,
127+
"semicolon": [
128+
true,
129+
"never"
130+
],
131+
"trailing-comma": [
132+
true,
133+
{
134+
"multiline": {
135+
"objects": "always",
136+
"arrays": "always",
137+
"typeLiterals": "ignore"
138+
},
139+
"esSpecCompliant": true
140+
}
141+
],
142+
"triple-equals": [
143+
true,
144+
"allow-null-check"
145+
],
146+
"typedef": [
147+
true,
148+
"call-signature",
149+
"parameter",
150+
"property-declaration",
151+
"variable-declaration",
152+
"member-variable-declaration",
153+
"object-destructuring",
154+
"array-destructuring"
155+
],
156+
"typedef-whitespace": [
157+
true,
158+
{
159+
"call-signature": "nospace",
160+
"index-signature": "nospace",
161+
"parameter": "nospace",
162+
"property-declaration": "nospace",
163+
"variable-declaration": "nospace"
164+
}
165+
],
166+
"unified-signatures": true,
167+
"variable-name": false,
168+
"whitespace": [
169+
true,
170+
"check-branch",
171+
"check-decl",
172+
"check-operator",
173+
"check-separator",
174+
"check-type"
175+
]
176+
}
177+
}

webpack.config.js

+9
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,14 @@ module.exports = (webpackConfigEnv) => {
8686
outputPath: "icons",
8787
},
8888
},
89+
{
90+
test: /\.(js|jsx|ts|tsx)$/,
91+
exclude: /(node_modules|bower_components)/,
92+
loader: "babel-loader",
93+
options: {
94+
presets: ["@babel/env", "@babel/preset-react", "@babel/preset-typescript"]
95+
}
96+
},
8997
],
9098
},
9199
resolve: {
@@ -102,6 +110,7 @@ module.exports = (webpackConfigEnv) => {
102110
thunks: path.resolve(__dirname, "src/thunks"),
103111
hoc: path.resolve(__dirname, "src/hoc"),
104112
},
113+
extensions: [".ts", ".tsx", ".js", ".jsx"]
105114
},
106115
plugins: [
107116
new webpack.DefinePlugin({

0 commit comments

Comments
 (0)