Skip to content

Commit 65779c7

Browse files
committed
Up TypeScript, ESLint, and related packages
1 parent 57e37a9 commit 65779c7

File tree

11 files changed

+285
-379
lines changed

11 files changed

+285
-379
lines changed

packages/nextjs/.eslintignore

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

packages/nextjs/.eslintrc.json

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

packages/nextjs/components/NetworksDropdown/utils.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,7 @@ export const removeChainFromLocalStorage = (chainId: number) => {
133133
};
134134

135135
export const formDataToChain = (formData: FormData): Chain => {
136-
const blockExplorers: Chain["blockExplorers"] | undefined = Boolean(formData.get("blockExplorer"))
136+
const blockExplorers: Chain["blockExplorers"] | undefined = formData.get("blockExplorer")
137137
? {
138138
default: {
139139
name: "Block Explorer",

packages/nextjs/components/scaffold-eth/Address.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ export const Address = ({ address, disableAddressLink, format, size = "base" }:
9595
size={(blockieSizeMap[size] * 24) / blockieSizeMap["base"]}
9696
/>
9797
</div>
98-
{disableAddressLink || targetNetwork.id === hardhat.id || !Boolean(blockExplorerAddressLink) ? (
98+
{disableAddressLink || targetNetwork.id === hardhat.id || !blockExplorerAddressLink ? (
9999
<span className={`ml-1.5 text-${size} font-normal`}>{displayAddress}</span>
100100
) : (
101101
<a

packages/nextjs/components/scaffold-eth/Contract/TupleArray.tsx

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -21,15 +21,18 @@ export const TupleArray = ({ abiTupleParameter, setParentForm, parentStateObject
2121

2222
useEffect(() => {
2323
// Extract and group fields based on index prefix
24-
const groupedFields = Object.keys(form).reduce((acc, key) => {
25-
const [indexPrefix, ...restArray] = key.split("_");
26-
const componentName = restArray.join("_");
27-
if (!acc[indexPrefix]) {
28-
acc[indexPrefix] = {};
29-
}
30-
acc[indexPrefix][componentName] = form[key];
31-
return acc;
32-
}, {} as Record<string, Record<string, any>>);
24+
const groupedFields = Object.keys(form).reduce(
25+
(acc, key) => {
26+
const [indexPrefix, ...restArray] = key.split("_");
27+
const componentName = restArray.join("_");
28+
if (!acc[indexPrefix]) {
29+
acc[indexPrefix] = {};
30+
}
31+
acc[indexPrefix][componentName] = form[key];
32+
return acc;
33+
},
34+
{} as Record<string, Record<string, any>>,
35+
);
3336

3437
let argsArray: Array<Record<string, any>> = [];
3538

packages/nextjs/eslint.config.js

Lines changed: 84 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,84 @@
1+
import { FlatCompat } from "@eslint/eslintrc";
2+
import js from "@eslint/js";
3+
import typescriptEslint from "@typescript-eslint/eslint-plugin";
4+
import typescriptParser from "@typescript-eslint/parser";
5+
import prettierConfig from "eslint-config-prettier";
6+
import prettierPlugin from "eslint-plugin-prettier";
7+
import { dirname } from "path";
8+
import { fileURLToPath } from "url";
9+
10+
const __filename = fileURLToPath(import.meta.url);
11+
const __dirname = dirname(__filename);
12+
13+
const compat = new FlatCompat({
14+
baseDirectory: __dirname,
15+
recommendedConfig: js.configs.recommended,
16+
});
17+
18+
export default [
19+
{
20+
ignores: ["node_modules/**", ".next/**", "out/**", "build/**", "dist/**", "tsconfig.tsbuildinfo"],
21+
},
22+
...compat.extends("next/core-web-vitals"),
23+
js.configs.recommended,
24+
{
25+
files: ["**/*.{js,jsx,ts,tsx}"],
26+
languageOptions: {
27+
parser: typescriptParser,
28+
parserOptions: {
29+
ecmaVersion: "latest",
30+
sourceType: "module",
31+
ecmaFeatures: {
32+
jsx: true,
33+
},
34+
},
35+
globals: {
36+
React: "readonly",
37+
JSX: "readonly",
38+
NodeJS: "readonly",
39+
},
40+
},
41+
plugins: {
42+
"@typescript-eslint": typescriptEslint,
43+
prettier: prettierPlugin,
44+
},
45+
rules: {
46+
...typescriptEslint.configs.recommended.rules,
47+
"@typescript-eslint/no-unused-vars": ["error"],
48+
"@typescript-eslint/no-explicit-any": ["off"],
49+
"@typescript-eslint/ban-ts-comment": ["off"],
50+
"@typescript-eslint/triple-slash-reference": "off",
51+
"@typescript-eslint/no-require-imports": "off",
52+
"@next/next/no-html-link-for-pages": ["error", "pages/"],
53+
"no-undef": "off",
54+
"prettier/prettier": [
55+
"warn",
56+
{
57+
endOfLine: "auto",
58+
},
59+
],
60+
},
61+
},
62+
{
63+
files: ["cypress/**/*.ts"],
64+
languageOptions: {
65+
globals: {
66+
cy: "readonly",
67+
Cypress: "readonly",
68+
describe: "readonly",
69+
it: "readonly",
70+
expect: "readonly",
71+
beforeEach: "readonly",
72+
afterEach: "readonly",
73+
},
74+
},
75+
},
76+
{
77+
files: ["next.config.mjs", "tailwind.config.js"],
78+
rules: {
79+
"@typescript-eslint/no-var-requires": "off",
80+
"@typescript-eslint/no-require-imports": "off",
81+
},
82+
},
83+
prettierConfig,
84+
];

packages/nextjs/package.json

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -45,17 +45,18 @@
4545
"devDependencies": {
4646
"@eslint/eslintrc": "^3",
4747
"@trivago/prettier-plugin-sort-imports": "^4.1.1",
48-
"@types/node": "^18.19.50",
48+
"@types/node": "^24.3.0",
4949
"@types/react": "19.1.11",
5050
"@types/react-copy-to-clipboard": "^5.0.4",
51-
"@typescript-eslint/eslint-plugin": "^5.39.0",
51+
"@typescript-eslint/eslint-plugin": "^8.40.0",
52+
"@typescript-eslint/parser": "^8.40.0",
5253
"abitype": "1.0.6",
5354
"autoprefixer": "^10.4.12",
5455
"cypress": "^13.13.1",
55-
"eslint": "^8.15.0",
56+
"eslint": "^9.34.0",
5657
"eslint-config-next": "15.5.0",
57-
"eslint-config-prettier": "^8.5.0",
58-
"eslint-plugin-prettier": "^4.2.1",
58+
"eslint-config-prettier": "^10.1.8",
59+
"eslint-plugin-prettier": "^5.5.4",
5960
"postcss": "^8.4.16",
6061
"prettier": "^3.6.2",
6162
"tailwindcss": "^3.3.3",

packages/nextjs/pages/[contractAddress]/[network].tsx

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -93,12 +93,12 @@ const ContractDetailPage = ({ addressFromUrl, chainIdFromUrl }: ServerSideProps)
9393
contractAbi.length > 0
9494
? { abi: contractAbi, address: contractAddress }
9595
: isUseLocalAbi && localContractData
96-
? localContractData
97-
: fetchedContractData
98-
? { abi: fetchedContractData.abi, address: contractAddress }
99-
: decompiledAbi
100-
? { abi: decompiledAbi, address: contractAddress }
101-
: null;
96+
? localContractData
97+
: fetchedContractData
98+
? { abi: fetchedContractData.abi, address: contractAddress }
99+
: decompiledAbi
100+
? { abi: decompiledAbi, address: contractAddress }
101+
: null;
102102

103103
const error = isUseLocalAbi ? null : fetchError;
104104

packages/nextjs/pages/index.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -152,8 +152,8 @@ const Home: NextPage = () => {
152152
activeTab === tabValue
153153
? "translate-x-0"
154154
: activeTab < tabValue
155-
? "translate-x-full"
156-
: "-translate-x-full"
155+
? "translate-x-full"
156+
: "-translate-x-full"
157157
}`}
158158
>
159159
{tabValue === TabName.verifiedContract ? (

packages/nextjs/utils/scaffold-eth/contract.ts

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -156,16 +156,17 @@ type OptionalTupple<T> = T extends readonly [infer H, ...infer R] ? readonly [H
156156
type UseScaffoldArgsParam<
157157
TContractName extends ContractName,
158158
TFunctionName extends ExtractAbiFunctionNames<ContractAbi<TContractName>>,
159-
> = TFunctionName extends FunctionNamesWithInputs<TContractName>
160-
? {
161-
args: OptionalTupple<UnionToIntersection<AbiFunctionArguments<ContractAbi<TContractName>, TFunctionName>>>;
162-
value?: ExtractAbiFunction<ContractAbi<TContractName>, TFunctionName>["stateMutability"] extends "payable"
163-
? bigint | undefined
164-
: undefined;
165-
}
166-
: {
167-
args?: never;
168-
};
159+
> =
160+
TFunctionName extends FunctionNamesWithInputs<TContractName>
161+
? {
162+
args: OptionalTupple<UnionToIntersection<AbiFunctionArguments<ContractAbi<TContractName>, TFunctionName>>>;
163+
value?: ExtractAbiFunction<ContractAbi<TContractName>, TFunctionName>["stateMutability"] extends "payable"
164+
? bigint | undefined
165+
: undefined;
166+
}
167+
: {
168+
args?: never;
169+
};
169170

170171
export type UseScaffoldReadConfig<
171172
TContractName extends ContractName,

0 commit comments

Comments
 (0)