Skip to content

Commit 3e782ee

Browse files
authored
Merge pull request #111 from BinaryStudioAcademy/task/thjs-63-move-project-into-typescript
thjs-63: Move project into typescript
2 parents 1dbb218 + 2b8ac7b commit 3e782ee

File tree

570 files changed

+9374
-5626
lines changed

Some content is hidden

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

570 files changed

+9374
-5626
lines changed

.eslintrc.yml

Lines changed: 75 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,24 @@ parserOptions:
44
ecmaVersion: 2022
55
sourceType: module
66
project:
7-
- ./client/jsconfig.json
7+
- ./tsconfig.json
8+
- ./shared/tsconfig.json
9+
- ./client/tsconfig.json
10+
- ./server/tsconfig.json
811

912
settings:
1013
node: true
1114

1215
extends:
1316
- eslint:recommended
1417
- plugin:import/recommended
18+
- plugin:import/typescript
19+
- plugin:@typescript-eslint/recommended
20+
- plugin:@typescript-eslint/recommended-type-checked
21+
- plugin:@typescript-eslint/strict
22+
- plugin:@typescript-eslint/strict-type-checked
23+
- plugin:@typescript-eslint/stylistic
24+
- plugin:@typescript-eslint/stylistic-type-checked
1525
- plugin:unicorn/recommended
1626
- plugin:sonarjs/recommended
1727

@@ -56,9 +66,7 @@ rules:
5666
import/no-duplicates:
5767
- error
5868
no-unused-vars:
59-
- error
60-
- argsIgnorePattern: ^_
61-
ignoreRestSiblings: true
69+
- off
6270
sonarjs/cognitive-complexity:
6371
- error
6472
- 18
@@ -68,19 +76,74 @@ rules:
6876
object-curly-spacing:
6977
- error
7078
- always
71-
semi:
79+
'@typescript-eslint/no-unused-vars':
80+
- error
81+
- argsIgnorePattern: ^_
82+
ignoreRestSiblings: true
83+
'@typescript-eslint/lines-between-class-members':
84+
- error
85+
'@typescript-eslint/padding-line-between-statements':
86+
- error
87+
- blankLine: never
88+
prev: export
89+
next: export
90+
- blankLine: always
91+
prev:
92+
- const
93+
- class
94+
next: export
95+
- blankLine: always
96+
prev: '*'
97+
next:
98+
- switch
99+
- class
100+
- function
101+
- if
102+
- return
103+
- try
104+
- interface
105+
- type
106+
'@typescript-eslint/consistent-type-definitions':
107+
- off
108+
'@typescript-eslint/non-nullable-type-assertion-style':
109+
- off
110+
'@typescript-eslint/no-unnecessary-condition':
111+
- off
112+
'@typescript-eslint/return-await':
113+
- error
114+
- always
115+
'@typescript-eslint/quotes':
116+
- error
117+
- single
118+
'@typescript-eslint/consistent-type-imports':
119+
- error
120+
'@typescript-eslint/consistent-type-exports':
121+
- error
122+
'@typescript-eslint/no-unnecessary-type-assertion':
123+
- off
124+
'@typescript-eslint/explicit-function-return-type':
125+
- error
126+
- allowTypedFunctionExpressions: true
127+
'@typescript-eslint/no-empty-interface':
128+
- error
129+
- allowSingleExtends: true
130+
'@typescript-eslint/explicit-member-accessibility':
131+
- error
132+
'@typescript-eslint/no-misused-promises':
133+
- error
134+
- checksVoidReturn: false
135+
'@typescript-eslint/object-curly-spacing':
136+
- error
137+
- always
138+
'@typescript-eslint/semi':
72139
- error
73140
- always
74141

75142
overrides:
76143
- files:
77-
- project.config.cjs
78-
- commitlint.config.cjs
79-
- dangerfile.cjs
80-
parserOptions:
81-
sourceType: commonjs
82-
env:
83-
node: true
144+
- project.config.ts
145+
- commitlint.config.ts
146+
- dangerfile.ts
84147
rules:
85148
'import/no-default-export':
86149
- off

.github/workflows/ci-pr.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ jobs:
4444
4545
- name: Lint Commits
4646
run: |
47-
npx commitlint --from ${{ github.event.pull_request.base.sha }} --to ${{ github.event.pull_request.head.sha }} --verbose -g ./commitlint.config.cjs
47+
npx commitlint --from ${{ github.event.pull_request.base.sha }} --to ${{ github.event.pull_request.head.sha }} --verbose -g ./commitlint.config.ts
4848
4949
- name: Add Folder Labels
5050
uses: actions/labeler@v4
@@ -62,4 +62,4 @@ jobs:
6262
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
6363

6464
run: |
65-
npx danger ci --failOnErrors --text-only -d ./dangerfile.cjs
65+
npx danger ci --failOnErrors --text-only

.lintstagedrc.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
'*': npm run lint:editorconfig && npm run lint:fs
2-
'*.{js,jsx,scss,json,md,html}': npm run prettify
3-
shared/**/*.js: npm run lint:shared:js
4-
client/src/**/*.{js,jsx}: npm run lint:client:js
2+
'*.{ts,tsx,scss,json,md,html}': npm run prettify
3+
shared/**/*.ts: npm run lint:shared:js
4+
client/src/**/*.{ts,tsx}: npm run lint:client:js
55
client/src/**/*.scss: npm run lint:client:css
6-
server/**/*.js: npm run lint:server:js
6+
server/**/*.ts: npm run lint:server:js

.nvmrc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
18
1+
18.18

.prettierignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
build
2+
dist

client/.env.example

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,5 +6,5 @@ VITE_API_SERVER=http://localhost:3001
66
VITE_SOCKET_SERVER=ws://localhost:3001
77
VITE_API_PATH=/api
88
VITE_SOCKET_PATH=/socket.io
9-
VITE_PORT=3000
10-
VITE_HOST=localhost
9+
VITE_APP_PORT=3000
10+
VITE_APP_HOST=localhost

client/.eslintrc.yml

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,14 +7,15 @@ settings:
77

88
parserOptions:
99
project:
10-
- ./jsconfig.json
10+
- ./tsconfig.json
1111

1212
extends:
1313
- ../.eslintrc.yml
1414
- plugin:react/recommended
1515
- plugin:react/jsx-runtime
1616
- plugin:react-hooks/recommended
1717
- plugin:jsx-a11y/recommended
18+
- plugin:import/typescript
1819

1920
rules:
2021
react/jsx-no-bind:
@@ -29,10 +30,12 @@ rules:
2930
- error
3031
import/no-unresolved:
3132
- off
33+
react/prop-types:
34+
- off
3235

3336
overrides:
3437
- files:
35-
- vite.config.js
38+
- vite.config.ts
3639
rules:
3740
import/no-default-export:
3841
- off

client/index.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
<body>
2828
<noscript>You need to enable JavaScript to run this app.</noscript>
2929
<div id="root"></div>
30-
<script type="module" src="./src/index.jsx"></script>
30+
<script type="module" src="./src/index.tsx"></script>
3131
<!--
3232
This HTML file is a template.
3333
If you open it directly in the browser, you will see an empty page.

client/jsconfig.json

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

client/package.json

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,17 +2,17 @@
22
"name": "client",
33
"private": true,
44
"engines": {
5-
"node": "18.x.x",
6-
"npm": "9.x.x"
5+
"node": "18.18.x",
6+
"npm": "9.8.x"
77
},
88
"type": "module",
99
"scripts": {
10-
"start": "vite",
11-
"build": "vite build",
10+
"start:dev": "vite",
11+
"build": "tsc && vite build",
1212
"preview": "vite preview",
1313
"lint": "npm run lint:css && npm run lint:js",
1414
"lint:css": "npx stylelint \"src/**/*.scss\"",
15-
"lint:js": "npx eslint --ext .js,jsx src"
15+
"lint:js": "npx eslint --ext .ts,tsx src"
1616
},
1717
"dependencies": {
1818
"@fortawesome/fontawesome-svg-core": "6.4.0",
@@ -21,9 +21,8 @@
2121
"@hookform/error-message": "2.0.1",
2222
"@hookform/resolvers": "3.1.1",
2323
"@reduxjs/toolkit": "1.9.5",
24-
"clsx": "1.2.1",
24+
"clsx": "2.0.0",
2525
"events": "3.3.0",
26-
"prop-types": "15.8.1",
2726
"query-string": "8.1.0",
2827
"react": "18.2.0",
2928
"react-dom": "18.2.0",
@@ -41,6 +40,8 @@
4140
"not op_mini all"
4241
],
4342
"devDependencies": {
43+
"@types/react": "18.2.20",
44+
"@types/react-dom": "18.2.7",
4445
"@vitejs/plugin-react": "4.0.0",
4546
"eslint-config-airbnb": "19.0.4",
4647
"eslint-config-react-app": "7.0.1",
@@ -49,6 +50,7 @@
4950
"sass": "1.63.4",
5051
"stylelint-config-standard-scss": "9.0.0",
5152
"stylelint-scss": "5.0.1",
52-
"vite": "4.3.9"
53+
"vite": "4.3.9",
54+
"vite-tsconfig-paths": "4.2.2"
5355
}
5456
}

0 commit comments

Comments
 (0)