Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update ts, eslint, prettier #963

Open
wants to merge 17 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 9 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
"hardhat:lint": "yarn workspace @se-2/hardhat lint",
"hardhat:lint-staged": "yarn workspace @se-2/hardhat lint-staged",
"hardhat:format": "yarn workspace @se-2/hardhat format",
"hardhat:check-types": "yarn workspace @se-2/hardhat check-types",
"hardhat:test": "yarn workspace @se-2/hardhat test",
"test": "yarn hardhat:test",
"format": "yarn next:format && yarn hardhat:format",
Expand Down
3 changes: 3 additions & 0 deletions packages/hardhat/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -23,5 +23,8 @@ cache-zk
# deployments
deployments/localhost

# typescript
*.tsbuildinfo

# other
temp
2 changes: 1 addition & 1 deletion packages/hardhat/deploy/99_generateTsAbis.ts
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ const generateTsAbis: DeployFunction = async function () {
}
fs.writeFileSync(
`${TARGET_DIR}deployedContracts.ts`,
prettier.format(
await prettier.format(
`${generatedContractComment} import { GenericContractsDeclaration } from "~~/utils/scaffold-eth/contract"; \n\n
const deployedContracts = {${fileContent}} as const; \n\n export default deployedContracts satisfies GenericContractsDeclaration`,
{
Expand Down
19 changes: 10 additions & 9 deletions packages/hardhat/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
"scripts": {
"account": "hardhat run scripts/listAccount.ts",
"chain": "hardhat node --network hardhat --no-deploy",
"check-types": "tsc --noEmit --incremental",
"compile": "hardhat compile",
"deploy": "hardhat deploy",
"fork": "MAINNET_FORKING_ENABLED=true hardhat node --network hardhat --no-deploy",
Expand All @@ -25,26 +26,26 @@
"@nomicfoundation/hardhat-verify": "^2.0.10",
"@typechain/ethers-v5": "^11.1.2",
"@typechain/hardhat": "^9.1.0",
"@types/eslint": "^8",
"@types/eslint": "^8.56.12",
"@types/mocha": "^10.0.8",
"@types/prettier": "^2",
"@types/prettier": "^3.0.0",
"@types/qrcode": "^1",
"@typescript-eslint/eslint-plugin": "latest",
"@typescript-eslint/parser": "latest",
"@typescript-eslint/eslint-plugin": "^8.8.1",
"@typescript-eslint/parser": "^8.8.1",
"chai": "^4.5.0",
"eslint": "^8.26.0",
"eslint-config-prettier": "^8.5.0",
"eslint-plugin-prettier": "^4.2.1",
"eslint": "^8.57.1",
"eslint-config-prettier": "^8.10.0",
"eslint-plugin-prettier": "^5.2.1",
"ethers": "^6.13.2",
"hardhat": "^2.22.10",
"hardhat-deploy": "^0.12.4",
"hardhat-deploy-ethers": "^0.4.2",
"hardhat-gas-reporter": "^2.2.1",
"prettier": "^2.8.4",
"prettier": "^3.3.3",
"solidity-coverage": "^0.8.13",
"ts-node": "^10.9.1",
"typechain": "^8.1.0",
"typescript": "^5.1.6"
"typescript": "^5.6.3"
rin-st marked this conversation as resolved.
Show resolved Hide resolved
},
"dependencies": {
"@openzeppelin/contracts": "^5.0.2",
Expand Down
1 change: 1 addition & 0 deletions packages/hardhat/scripts/listAccount.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ async function main() {
console.log("--", networkName, "-- 📡");
console.log(" balance:", +ethers.formatEther(balance));
console.log(" nonce:", +(await provider.getTransactionCount(address)));
// eslint-disable-next-line @typescript-eslint/no-unused-vars
} catch (e) {
console.log("Can't connect to network", networkName);
}
Expand Down
3 changes: 2 additions & 1 deletion packages/nextjs/.prettierrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,6 @@
"tabWidth": 2,
"trailingComma": "all",
"importOrder": ["^react$", "^next/(.*)$", "<THIRD_PARTY_MODULES>", "^@heroicons/(.*)$", "^~~/(.*)$"],
"importOrderSortSpecifiers": true
"importOrderSortSpecifiers": true,
"plugins": ["@trivago/prettier-plugin-sort-imports"]
}
21 changes: 12 additions & 9 deletions packages/nextjs/app/debug/_components/contract/TupleArray.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,15 +21,18 @@ export const TupleArray = ({ abiTupleParameter, setParentForm, parentStateObject

useEffect(() => {
// Extract and group fields based on index prefix
const groupedFields = Object.keys(form).reduce((acc, key) => {
const [indexPrefix, ...restArray] = key.split("_");
const componentName = restArray.join("_");
if (!acc[indexPrefix]) {
acc[indexPrefix] = {};
}
acc[indexPrefix][componentName] = form[key];
return acc;
}, {} as Record<string, Record<string, any>>);
const groupedFields = Object.keys(form).reduce(
(acc, key) => {
const [indexPrefix, ...restArray] = key.split("_");
const componentName = restArray.join("_");
if (!acc[indexPrefix]) {
acc[indexPrefix] = {};
}
acc[indexPrefix][componentName] = form[key];
return acc;
},
{} as Record<string, Record<string, any>>,
);

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

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ const isJsonString = (str: string) => {
try {
JSON.parse(str);
return true;
// eslint-disable-next-line @typescript-eslint/no-unused-vars
} catch (e) {
return false;
}
Expand All @@ -23,6 +24,7 @@ const isBigInt = (str: string) => {
try {
BigInt(str);
return true;
// eslint-disable-next-line @typescript-eslint/no-unused-vars
} catch (e) {
return false;
}
Expand Down
1 change: 1 addition & 0 deletions packages/nextjs/components/scaffold-eth/Input/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,7 @@ export const isValidInteger = (dataType: IntegerVariant, value: string) => {
let valueAsBigInt;
try {
valueAsBigInt = BigInt(value);
// eslint-disable-next-line @typescript-eslint/no-unused-vars
} catch (e) {}
if (typeof valueAsBigInt !== "bigint") {
if (!value || typeof value !== "string") {
Expand Down
15 changes: 7 additions & 8 deletions packages/nextjs/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -37,21 +37,20 @@
"zustand": "^4.1.2"
},
"devDependencies": {
"@trivago/prettier-plugin-sort-imports": "^4.1.1",
"@trivago/prettier-plugin-sort-imports": "^4.3.0",
"@types/node": "^18.19.50",
"@types/react": "^18.3.5",
"@typescript-eslint/eslint-plugin": "^5.39.0",
"abitype": "1.0.6",
"autoprefixer": "^10.4.20",
"eslint": "^8.15.0",
"eslint-config-next": "^14.0.4",
"eslint-config-prettier": "^8.5.0",
"eslint-plugin-prettier": "^4.2.1",
"eslint": "^8.57.1",
"eslint-config-next": "^14.2.15",
"eslint-config-prettier": "^8.10.0",
"eslint-plugin-prettier": "^5.2.1",
"postcss": "^8.4.45",
"prettier": "^2.8.4",
"prettier": "^3.3.3",
"tailwindcss": "^3.4.11",
"type-fest": "^4.6.0",
"typescript": "5.5.3",
"typescript": "5.6.3",
rin-st marked this conversation as resolved.
Show resolved Hide resolved
"vercel": "^37.4.2"
}
}
27 changes: 14 additions & 13 deletions packages/nextjs/utils/scaffold-eth/contract.ts
Original file line number Diff line number Diff line change
Expand Up @@ -154,16 +154,17 @@ type OptionalTuple<T> = T extends readonly [infer H, ...infer R] ? readonly [H |
type UseScaffoldArgsParam<
TContractName extends ContractName,
TFunctionName extends ExtractAbiFunctionNames<ContractAbi<TContractName>>,
> = TFunctionName extends FunctionNamesWithInputs<TContractName>
? {
args: OptionalTuple<UnionToIntersection<AbiFunctionArguments<ContractAbi<TContractName>, TFunctionName>>>;
value?: ExtractAbiFunction<ContractAbi<TContractName>, TFunctionName>["stateMutability"] extends "payable"
? bigint | undefined
: undefined;
}
: {
args?: never;
};
> =
TFunctionName extends FunctionNamesWithInputs<TContractName>
? {
args: OptionalTuple<UnionToIntersection<AbiFunctionArguments<ContractAbi<TContractName>, TFunctionName>>>;
value?: ExtractAbiFunction<ContractAbi<TContractName>, TFunctionName>["stateMutability"] extends "payable"
? bigint | undefined
: undefined;
}
: {
args?: never;
};

export type UseScaffoldReadConfig<
TContractName extends ContractName,
Expand Down Expand Up @@ -305,9 +306,9 @@ export type UseScaffoldEventHistoryData<
IndexedOnly: false;
}
>;
block: TBlockData extends true ? Block<bigint, true> : null;
receipt: TReceiptData extends true ? GetTransactionReturnType : null;
transaction: TTransactionData extends true ? GetTransactionReceiptReturnType : null;
blockData: TBlockData extends true ? Block<bigint, true> : null;
receiptData: TReceiptData extends true ? GetTransactionReturnType : null;
transactionData: TTransactionData extends true ? GetTransactionReceiptReturnType : null;
}[]
>
| undefined;
Expand Down
Loading