Skip to content
This repository was archived by the owner on Jul 16, 2024. It is now read-only.

Commit 75d4b60

Browse files
nichujienichujie
and
nichujie
authored
fix: type errors (#113)
* fix: type errors * fix: type errors --------- Co-authored-by: nichujie <[email protected]>
1 parent 08d7df6 commit 75d4b60

File tree

35 files changed

+8258
-3385
lines changed

35 files changed

+8258
-3385
lines changed

.eslintrc.json

+179-178
Original file line numberDiff line numberDiff line change
@@ -1,185 +1,186 @@
11
{
2-
"root": true,
3-
"env": {
4-
"browser": true,
5-
"node": true,
6-
"es2021": true
7-
},
8-
"parser": "@typescript-eslint/parser",
9-
"plugins": ["react-prefer-function-component"],
10-
"extends": [
11-
"eslint:all",
12-
"plugin:@typescript-eslint/all",
13-
"plugin:import/recommended",
14-
"plugin:import/typescript",
15-
"plugin:react/all",
16-
"plugin:jsx-a11y/recommended",
17-
"airbnb",
18-
"airbnb-typescript",
19-
"airbnb/hooks",
20-
"plugin:react/jsx-runtime",
21-
"plugin:unicorn/all",
22-
"plugin:react-prefer-function-component/recommended",
23-
"prettier"
24-
],
25-
"rules": {
26-
"no-dupe-else-if": "error",
27-
"no-promise-executor-return": "error",
28-
"no-unreachable-loop": "error",
29-
"no-useless-backreference": "error",
30-
"require-atomic-updates": "error",
31-
"default-case-last": "error",
32-
"grouped-accessor-pairs": "error",
33-
"no-constructor-return": "error",
34-
"no-implicit-coercion": "error",
35-
"prefer-regex-literals": "error",
36-
"capitalized-comments": "error",
37-
"no-restricted-syntax": [
38-
"error",
39-
{
40-
"selector": "ForInStatement",
41-
"message": "for..in loops iterate over the entire prototype chain, which is virtually never what you want. Use Object.{keys,values,entries}, and iterate over the resulting array."
42-
},
43-
{
44-
"selector": "LabeledStatement",
45-
"message": "Labels are a form of GOTO; using them makes code confusing and hard to maintain and understand."
46-
},
47-
{
48-
"selector": "WithStatement",
49-
"message": "`with` is disallowed in strict mode because it makes code impossible to predict and optimize."
50-
}
51-
],
52-
"no-void": "off",
2+
"root": true,
3+
"env": {
4+
"browser": true,
5+
"node": true,
6+
"es2021": true
7+
},
8+
"parser": "@typescript-eslint/parser",
9+
"plugins": ["react-prefer-function-component"],
10+
"extends": [
11+
"eslint:all",
12+
"plugin:@typescript-eslint/all",
13+
"plugin:import/recommended",
14+
"plugin:import/typescript",
15+
"plugin:react/all",
16+
"plugin:jsx-a11y/recommended",
17+
"airbnb",
18+
"airbnb-typescript",
19+
"airbnb/hooks",
20+
"plugin:react/jsx-runtime",
21+
"plugin:unicorn/all",
22+
"plugin:react-prefer-function-component/recommended",
23+
"prettier"
24+
],
25+
"rules": {
26+
"no-dupe-else-if": "error",
27+
"no-promise-executor-return": "error",
28+
"no-unreachable-loop": "error",
29+
"no-useless-backreference": "error",
30+
"require-atomic-updates": "error",
31+
"default-case-last": "error",
32+
"grouped-accessor-pairs": "error",
33+
"no-constructor-return": "error",
34+
"no-implicit-coercion": "error",
35+
"prefer-regex-literals": "error",
36+
"capitalized-comments": "error",
37+
"no-restricted-syntax": [
38+
"error",
39+
{
40+
"selector": "ForInStatement",
41+
"message": "for..in loops iterate over the entire prototype chain, which is virtually never what you want. Use Object.{keys,values,entries}, and iterate over the resulting array."
42+
},
43+
{
44+
"selector": "LabeledStatement",
45+
"message": "Labels are a form of GOTO; using them makes code confusing and hard to maintain and understand."
46+
},
47+
{
48+
"selector": "WithStatement",
49+
"message": "`with` is disallowed in strict mode because it makes code impossible to predict and optimize."
50+
}
51+
],
52+
"no-void": "off",
5353

54-
"@typescript-eslint/padding-line-between-statements": "off",
55-
"@typescript-eslint/prefer-enum-initializers": "off",
56-
"@typescript-eslint/prefer-readonly-parameter-types": "off",
57-
"@typescript-eslint/prefer-regexp-exec": "off",
58-
"@typescript-eslint/no-magic-numbers": "off",
59-
"@typescript-eslint/explicit-module-boundary-types": "off",
60-
"@typescript-eslint/init-declarations": "off",
61-
"@typescript-eslint/no-confusing-void-expression": [
62-
"error",
63-
{ "ignoreArrowShorthand": true }
64-
],
65-
"@typescript-eslint/non-nullable-type-assertion-style": "off",
66-
"@typescript-eslint/strict-boolean-expressions": "off",
67-
"@typescript-eslint/no-implicit-any-catch": "off",
68-
"@typescript-eslint/member-ordering": "off",
69-
"@typescript-eslint/prefer-includes": "off",
70-
"@typescript-eslint/no-restricted-imports": "off",
71-
"@typescript-eslint/no-floating-promises": "off",
72-
"@typescript-eslint/ban-ts-comment": [
73-
"error",
74-
{
75-
"ts-nocheck": "allow-with-description"
76-
}
77-
],
78-
"@typescript-eslint/explicit-function-return-type": "off",
54+
"@typescript-eslint/padding-line-between-statements": "off",
55+
"@typescript-eslint/prefer-enum-initializers": "off",
56+
"@typescript-eslint/prefer-readonly-parameter-types": "off",
57+
"@typescript-eslint/prefer-regexp-exec": "off",
58+
"@typescript-eslint/no-magic-numbers": "off",
59+
"@typescript-eslint/explicit-module-boundary-types": "off",
60+
"@typescript-eslint/init-declarations": "off",
61+
"@typescript-eslint/no-confusing-void-expression": [
62+
"error",
63+
{ "ignoreArrowShorthand": true }
64+
],
65+
"@typescript-eslint/non-nullable-type-assertion-style": "off",
66+
"@typescript-eslint/strict-boolean-expressions": "off",
67+
"@typescript-eslint/no-implicit-any-catch": "off",
68+
"@typescript-eslint/member-ordering": "off",
69+
"@typescript-eslint/prefer-includes": "off",
70+
"@typescript-eslint/no-restricted-imports": "off",
71+
"@typescript-eslint/no-floating-promises": "off",
72+
"@typescript-eslint/ban-ts-comment": [
73+
"error",
74+
{
75+
"ts-nocheck": "allow-with-description"
76+
}
77+
],
78+
"@typescript-eslint/explicit-function-return-type": "off",
79+
"@typescript-eslint/no-type-alias": "off",
7980

80-
"import/no-deprecated": "error",
81-
"import/order": "off",
82-
"import/no-extraneous-dependencies": [
83-
"error",
84-
{
85-
"devDependencies": [
86-
"vite.config.ts",
87-
"src/setupTests.ts",
88-
"src/testUtils.tsx",
89-
"src/mocks/**",
90-
"**/__tests__/*.{ts,tsx}"
91-
]
92-
}
93-
],
94-
"import/prefer-default-export": "off",
81+
"import/no-deprecated": "error",
82+
"import/order": "off",
83+
"import/no-extraneous-dependencies": [
84+
"error",
85+
{
86+
"devDependencies": [
87+
"vite.config.ts",
88+
"src/setupTests.ts",
89+
"src/testUtils.tsx",
90+
"src/mocks/**",
91+
"**/__tests__/*.{ts,tsx}"
92+
]
93+
}
94+
],
95+
"import/prefer-default-export": "off",
9596

96-
"react/no-did-update-set-state": "off",
97-
"react/no-find-dom-node": "off",
98-
"react/no-is-mounted": "off",
99-
"react/no-redundant-should-component-update": "off",
100-
"react/no-render-return-value": "off",
101-
"react/no-string-refs": "off",
102-
"react/no-this-in-sfc": "off",
103-
"react/no-will-update-set-state": "off",
104-
"react/prefer-es6-class": "off",
105-
"react/no-unused-state": "off",
106-
"react/prefer-stateless-function": "off",
107-
"react/require-render-return": "off",
108-
"react/sort-comp": "off",
109-
"react/state-in-constructor": "off",
110-
"react/static-property-placement": "off",
97+
"react/no-did-update-set-state": "off",
98+
"react/no-find-dom-node": "off",
99+
"react/no-is-mounted": "off",
100+
"react/no-redundant-should-component-update": "off",
101+
"react/no-render-return-value": "off",
102+
"react/no-string-refs": "off",
103+
"react/no-this-in-sfc": "off",
104+
"react/no-will-update-set-state": "off",
105+
"react/prefer-es6-class": "off",
106+
"react/no-unused-state": "off",
107+
"react/prefer-stateless-function": "off",
108+
"react/require-render-return": "off",
109+
"react/sort-comp": "off",
110+
"react/state-in-constructor": "off",
111+
"react/static-property-placement": "off",
111112

112-
"react/boolean-prop-naming": [
113-
"error",
114-
{
115-
"validateNested": true
116-
}
117-
],
118-
"react/function-component-definition": "off",
119-
"react/no-unstable-nested-components": "error",
120-
"react/jsx-handler-names": "off",
121-
"react/jsx-key": "error",
122-
"react/jsx-no-bind": [
123-
"error",
124-
{
125-
"ignoreRefs": false,
126-
"allowArrowFunctions": true,
127-
"allowFunctions": true,
128-
"allowBind": false,
129-
"ignoreDOMComponents": false
130-
}
131-
],
132-
"react/jsx-no-constructed-context-values": "error",
133-
"react/jsx-no-script-url": "error",
134-
"react/jsx-no-useless-fragment": "error",
135-
"react/require-default-props": "off",
136-
"react/jsx-props-no-spreading": "off",
113+
"react/boolean-prop-naming": [
114+
"error",
115+
{
116+
"validateNested": true
117+
}
118+
],
119+
"react/function-component-definition": "off",
120+
"react/no-unstable-nested-components": "error",
121+
"react/jsx-handler-names": "off",
122+
"react/jsx-key": "error",
123+
"react/jsx-no-bind": [
124+
"error",
125+
{
126+
"ignoreRefs": false,
127+
"allowArrowFunctions": true,
128+
"allowFunctions": true,
129+
"allowBind": false,
130+
"ignoreDOMComponents": false
131+
}
132+
],
133+
"react/jsx-no-constructed-context-values": "error",
134+
"react/jsx-no-script-url": "error",
135+
"react/jsx-no-useless-fragment": "error",
136+
"react/require-default-props": "off",
137+
"react/jsx-props-no-spreading": "off",
137138

138-
"unicorn/filename-case": [
139-
"error",
140-
{
141-
"cases": {
142-
"camelCase": true,
143-
"pascalCase": true
144-
}
145-
}
146-
],
147-
"unicorn/no-nested-ternary": ["error"],
148-
"unicorn/prevent-abbreviations": "off",
149-
"unicorn/no-useless-undefined": "off",
150-
"unicorn/no-abusive-eslint-disable": "off",
151-
"unicorn/no-null": "off",
152-
"unicorn/prefer-export-from": "off",
153-
"unicorn/no-keyword-prefix": "off"
154-
},
155-
"settings": {
156-
"react": {
157-
"version": "detect"
158-
}
159-
},
160-
"overrides": [
161-
{
162-
"files": ["src/**/*.ts?(x)"],
163-
"parserOptions": {
164-
"project": ["./tsconfig.json"]
165-
}
166-
},
167-
{
168-
"files": ["vite.config.ts"],
169-
"parserOptions": {
170-
"project": ["./tsconfig.node.json"]
171-
}
172-
},
173-
{
174-
"files": ["**/__tests__/**/*.ts?(x)"],
175-
"extends": ["plugin:testing-library/react"],
176-
"rules": {
177-
"testing-library/no-await-sync-events": "error",
178-
"testing-library/no-manual-cleanup": "error",
179-
"testing-library/prefer-explicit-assert": "error",
180-
"testing-library/prefer-user-event": "error",
181-
"testing-library/prefer-wait-for": "error"
182-
}
183-
}
184-
]
139+
"unicorn/filename-case": [
140+
"error",
141+
{
142+
"cases": {
143+
"camelCase": true,
144+
"pascalCase": true
145+
}
146+
}
147+
],
148+
"unicorn/no-nested-ternary": ["error"],
149+
"unicorn/prevent-abbreviations": "off",
150+
"unicorn/no-useless-undefined": "off",
151+
"unicorn/no-abusive-eslint-disable": "off",
152+
"unicorn/no-null": "off",
153+
"unicorn/prefer-export-from": "off",
154+
"unicorn/no-keyword-prefix": "off"
155+
},
156+
"settings": {
157+
"react": {
158+
"version": "detect"
159+
}
160+
},
161+
"overrides": [
162+
{
163+
"files": ["src/**/*.ts?(x)"],
164+
"parserOptions": {
165+
"project": ["./tsconfig.json"]
166+
}
167+
},
168+
{
169+
"files": ["vite.config.ts"],
170+
"parserOptions": {
171+
"project": ["./tsconfig.node.json"]
172+
}
173+
},
174+
{
175+
"files": ["**/__tests__/**/*.ts?(x)"],
176+
"extends": ["plugin:testing-library/react"],
177+
"rules": {
178+
"testing-library/no-await-sync-events": "error",
179+
"testing-library/no-manual-cleanup": "error",
180+
"testing-library/prefer-explicit-assert": "error",
181+
"testing-library/prefer-user-event": "error",
182+
"testing-library/prefer-wait-for": "error"
183+
}
184+
}
185+
]
185186
}

package.json

+7-7
Original file line numberDiff line numberDiff line change
@@ -74,16 +74,16 @@
7474
"@types/crypto-js": "^4.1.1",
7575
"@types/css-mediaquery": "0.1.1",
7676
"@types/lodash-es": "^4.17.6",
77-
"@types/react": "17.0.40",
77+
"@types/react": "18.0.27",
7878
"@types/react-copy-to-clipboard": "^5.0.4",
79-
"@types/react-dom": "17.0.13",
79+
"@types/react-dom": "18.0.10",
8080
"@types/react-highlight-words": "^0.16.4",
81-
"@types/react-router-dom": "5.3.3",
82-
"@types/react-syntax-highlighter": "^13.5.2",
81+
"@types/react-syntax-highlighter": "^15.5.6",
8382
"@types/testing-library__jest-dom": "^5.14.5",
84-
"@typescript-eslint/eslint-plugin": "5.14.0",
85-
"@typescript-eslint/parser": "5.14.0",
83+
"@typescript-eslint/eslint-plugin": "5.50.0",
84+
"@typescript-eslint/parser": "5.50.0",
8685
"@vitejs/plugin-react": "3.0.1",
86+
"@vitest/coverage-c8": "^0.28.3",
8787
"autoprefixer": "10.4.13",
8888
"c8": "7.11.0",
8989
"commitizen": "4.2.4",
@@ -108,7 +108,7 @@
108108
"i18next-parser": "^7.6.0",
109109
"jsdom": "21.1.0",
110110
"lint-staged": "12.3.5",
111-
"msw": "0.39.1",
111+
"msw": "1.0.0",
112112
"npm-run-all": "4.1.5",
113113
"postcss": "8.4.21",
114114
"prettier": "2.5.1",

0 commit comments

Comments
 (0)