Skip to content

Commit 00c933d

Browse files
committed
fix(web-devtools): type-issues
1 parent 7faeef3 commit 00c933d

File tree

9 files changed

+551
-148
lines changed

9 files changed

+551
-148
lines changed

web-devtools/.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ dist
2929

3030
# generated code
3131
src/hooks/contracts/generated.ts
32-
src/graphql
32+
src/graphql-generated
3333
generatedGitInfo.json
3434
generatedNetlifyInfo.json
3535

web-devtools/codegen.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ const config: CodegenConfig = {
77
schema: [getGraphqlUrl(false), getGraphqlUrl(true)],
88
documents: "./src/hooks/queries/*.ts",
99
generates: {
10-
"./src/graphql/": {
10+
"./src/graphql-generated/": {
1111
preset: "client",
1212
},
1313
},

web-devtools/eslint.config.mjs

Lines changed: 152 additions & 121 deletions
Original file line numberDiff line numberDiff line change
@@ -13,143 +13,174 @@ import { FlatCompat } from "@eslint/eslintrc";
1313
const __filename = fileURLToPath(import.meta.url);
1414
const __dirname = path.dirname(__filename);
1515
const compat = new FlatCompat({
16-
baseDirectory: __dirname,
17-
recommendedConfig: js.configs.recommended,
18-
allConfig: js.configs.all
16+
baseDirectory: __dirname,
17+
recommendedConfig: js.configs.recommended,
18+
allConfig: js.configs.all,
1919
});
2020

21-
export default [{
22-
ignores: ["src/assets", "src/hooks/contracts/generated.ts", "src/graphql/**/*.ts"],
23-
}, ...fixupConfigRules(compat.extends(
24-
"next/core-web-vitals",
25-
"eslint:recommended",
26-
"plugin:react/recommended",
27-
"plugin:react-hooks/recommended",
28-
"plugin:import/recommended",
29-
"plugin:import/react",
30-
"plugin:security/recommended",
31-
"plugin:@typescript-eslint/recommended",
32-
"plugin:prettier/recommended",
33-
"prettier",
34-
)), {
21+
export default [
22+
{
23+
ignores: ["src/assets", "src/hooks/contracts/generated.ts", "src/graphql-generated/**/*.ts"],
24+
},
25+
...fixupConfigRules(
26+
compat.extends(
27+
"next/core-web-vitals",
28+
"eslint:recommended",
29+
"plugin:react/recommended",
30+
"plugin:react-hooks/recommended",
31+
"plugin:import/recommended",
32+
"plugin:import/react",
33+
"plugin:security/recommended",
34+
"plugin:@typescript-eslint/recommended",
35+
"plugin:prettier/recommended",
36+
"prettier"
37+
)
38+
),
39+
{
3540
plugins: {
36-
react: fixupPluginRules(react),
37-
"react-hooks": fixupPluginRules(reactHooks),
38-
security: fixupPluginRules(security),
39-
import: fixupPluginRules(_import),
41+
react: fixupPluginRules(react),
42+
"react-hooks": fixupPluginRules(reactHooks),
43+
security: fixupPluginRules(security),
44+
import: fixupPluginRules(_import),
4045
},
4146

4247
languageOptions: {
43-
globals: {
44-
...globals.browser,
45-
...globals.node,
46-
Atomics: "readonly",
47-
SharedArrayBuffer: "readonly",
48+
globals: {
49+
...globals.browser,
50+
...globals.node,
51+
Atomics: "readonly",
52+
SharedArrayBuffer: "readonly",
53+
},
54+
55+
parser: tsParser,
56+
ecmaVersion: 2020,
57+
sourceType: "module",
58+
59+
parserOptions: {
60+
ecmaFeatures: {
61+
jsx: true,
4862
},
63+
},
64+
},
4965

50-
parser: tsParser,
51-
ecmaVersion: 2020,
52-
sourceType: "module",
66+
settings: {
67+
react: {
68+
version: "^16.12.0",
69+
},
70+
71+
"import/resolver": {
72+
typescript: {
73+
alwaysTryTypes: true,
74+
project: "./tsconfig.json",
75+
},
5376

54-
parserOptions: {
55-
ecmaFeatures: {
56-
jsx: true,
57-
},
77+
node: {
78+
extensions: [".js", ".jsx", ".ts", ".tsx"],
5879
},
80+
},
5981
},
6082

61-
settings: {
62-
react: {
63-
version: "^16.12.0",
83+
rules: {
84+
"max-len": [
85+
"warn",
86+
{
87+
code: 120,
6488
},
89+
],
6590

66-
"import/resolver": {
67-
typescript: {
68-
alwaysTryTypes: true,
69-
project: "./tsconfig.json",
70-
},
91+
"react/prop-types": 0,
92+
"no-unused-vars": "off",
7193

72-
node: {
73-
extensions: [".js", ".jsx", ".ts", ".tsx"],
74-
},
94+
"@typescript-eslint/no-unused-vars": [
95+
"error",
96+
{
97+
varsIgnorePattern: "(^_+[0-9]*$)|([iI]gnored$)|(^ignored)",
98+
argsIgnorePattern: "(^_+[0-9]*$)|([iI]gnored$)|(^ignored)",
7599
},
76-
},
100+
],
77101

78-
rules: {
79-
"max-len": ["warn", {
80-
code: 120,
81-
}],
82-
83-
"react/prop-types": 0,
84-
"no-unused-vars": "off",
85-
86-
"@typescript-eslint/no-unused-vars": ["error", {
87-
varsIgnorePattern: "(^_+[0-9]*$)|([iI]gnored$)|(^ignored)",
88-
argsIgnorePattern: "(^_+[0-9]*$)|([iI]gnored$)|(^ignored)",
89-
}],
90-
91-
"no-console": ["error", {
92-
allow: ["warn", "error", "info", "debug"],
93-
}],
94-
95-
"@typescript-eslint/no-non-null-assertion": "off",
96-
"@typescript-eslint/no-explicit-any": "off",
97-
"security/detect-object-injection": "off",
98-
"security/detect-non-literal-fs-filename": "off",
99-
100-
"import/extensions": ["error", "ignorePackages", {
101-
js: "never",
102-
jsx: "never",
103-
ts: "never",
104-
tsx: "never",
105-
}],
106-
107-
"import/no-unresolved": "off",
108-
109-
"import/order": ["warn", {
110-
groups: ["builtin", "external", "internal", "parent", "sibling", "index"],
111-
112-
pathGroups: [{
113-
pattern: "{react,styled-components}",
114-
group: "external",
115-
position: "before",
116-
}, {
117-
pattern: "@kleros/**",
118-
group: "external",
119-
position: "after",
120-
}, {
121-
pattern: "{svgs/**,assets/**}",
122-
group: "internal",
123-
position: "after",
124-
}, {
125-
pattern: "{hooks/**,utils/**,consts/**,types/**,context/**,connectors/**,}",
126-
group: "internal",
127-
position: "after",
128-
}, {
129-
pattern: "{queries/**,}",
130-
group: "internal",
131-
position: "after",
132-
}, {
133-
pattern: "{src/**,}",
134-
group: "internal",
135-
position: "after",
136-
}, {
137-
pattern: "{styles/**,}",
138-
group: "internal",
139-
position: "after",
140-
}, {
141-
pattern: "{layout/**,pages/**,components/**,}",
142-
group: "internal",
143-
position: "after",
144-
}],
145-
146-
pathGroupsExcludedImportTypes: ["builtin"],
147-
"newlines-between": "always",
148-
149-
alphabetize: {
150-
order: "asc",
151-
caseInsensitive: true,
102+
"no-console": [
103+
"error",
104+
{
105+
allow: ["warn", "error", "info", "debug"],
106+
},
107+
],
108+
109+
"@typescript-eslint/no-non-null-assertion": "off",
110+
"@typescript-eslint/no-explicit-any": "off",
111+
"security/detect-object-injection": "off",
112+
"security/detect-non-literal-fs-filename": "off",
113+
114+
"import/extensions": [
115+
"error",
116+
"ignorePackages",
117+
{
118+
js: "never",
119+
jsx: "never",
120+
ts: "never",
121+
tsx: "never",
122+
},
123+
],
124+
125+
"import/no-unresolved": "off",
126+
127+
"import/order": [
128+
"warn",
129+
{
130+
groups: ["builtin", "external", "internal", "parent", "sibling", "index"],
131+
132+
pathGroups: [
133+
{
134+
pattern: "{react,styled-components}",
135+
group: "external",
136+
position: "before",
137+
},
138+
{
139+
pattern: "@kleros/**",
140+
group: "external",
141+
position: "after",
142+
},
143+
{
144+
pattern: "{svgs/**,assets/**}",
145+
group: "internal",
146+
position: "after",
147+
},
148+
{
149+
pattern: "{hooks/**,utils/**,consts/**,types/**,context/**,connectors/**,}",
150+
group: "internal",
151+
position: "after",
152+
},
153+
{
154+
pattern: "{queries/**,}",
155+
group: "internal",
156+
position: "after",
152157
},
153-
}],
158+
{
159+
pattern: "{src/**,}",
160+
group: "internal",
161+
position: "after",
162+
},
163+
{
164+
pattern: "{styles/**,}",
165+
group: "internal",
166+
position: "after",
167+
},
168+
{
169+
pattern: "{layout/**,pages/**,components/**,}",
170+
group: "internal",
171+
position: "after",
172+
},
173+
],
174+
175+
pathGroupsExcludedImportTypes: ["builtin"],
176+
"newlines-between": "always",
177+
178+
alphabetize: {
179+
order: "asc",
180+
caseInsensitive: true,
181+
},
182+
},
183+
],
154184
},
155-
}];
185+
},
186+
];

web-devtools/next.config.mjs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ const nextConfig = {
88
// Dangerously allow production builds to successfully complete even if
99
// your project has type errors.
1010
// !! WARN !!
11-
ignoreBuildErrors: true,
11+
// ignoreBuildErrors: true,
1212
},
1313
webpack(config) {
1414
// Grab the existing rule that handles SVG imports

web-devtools/package.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,9 @@
4646
"dependencies": {
4747
"@kleros/kleros-sdk": "workspace:^",
4848
"@kleros/ui-components-library": "^2.15.0",
49-
"graphql": "^16.9.0",
49+
"@web3modal/wagmi": "^5.1.11",
50+
"graphql": "^16.8.1",
51+
"graphql-request": "^7.1.0",
5052
"next": "14.2.14",
5153
"react": "^18.2.0",
5254
"react-dom": "^18.2.0",

web-devtools/src/context/Web3Provider.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,7 @@ const wagmiConfig = createConfig({
6363
createWeb3Modal({
6464
wagmiConfig,
6565
projectId,
66+
// @ts-ignore
6667
defaultChain: arbitrumSepolia,
6768
themeVariables: {
6869
"--w3m-color-mix": theme.klerosUIComponentsPrimaryPurple,

web-devtools/src/hooks/queries/useDisputeTemplateFromId.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@ import { useQuery } from "@tanstack/react-query";
33
import { useGraphqlBatcher } from "context/GraphqlBatcher";
44
import { isUndefined } from "utils/isUndefined";
55

6-
import { graphql } from "src/graphql";
7-
import { DisputeTemplateQuery } from "src/graphql/graphql";
6+
import { graphql } from "src/graphql-generated";
7+
import { DisputeTemplateQuery } from "src/graphql-generated/graphql";
88

99
const disputeTemplateQuery = graphql(`
1010
query DisputeTemplate($id: ID!) {

web-devtools/src/utils/getDisputeRequestParamsFromTxn.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import { wagmiConfig } from "utils/wagmiConfig";
88
export const getDisputeRequestParamsFromTxn = async (hash: `0x${string}`, chainId: number) => {
99
try {
1010
const publicClient = getPublicClient(wagmiConfig, { chainId });
11-
11+
if (!publicClient) return;
1212
const txn: GetTransactionReceiptReturnType = await publicClient.getTransactionReceipt({
1313
hash,
1414
});

0 commit comments

Comments
 (0)