From a0d74281c088634088acd625f4f14708c0df2968 Mon Sep 17 00:00:00 2001 From: Giacomo Date: Mon, 12 Aug 2024 20:02:33 +0200 Subject: [PATCH] fix: repo and ts configs --- .../{hardhat.config.js => hardhat.config.ts} | 13 ++++++++----- packages/coordinator/tests/app.test.ts | 3 +-- packages/coordinator/tsconfig.build.json | 2 +- packages/coordinator/tsconfig.json | 2 +- tsconfig.json | 12 +++++------- 5 files changed, 16 insertions(+), 16 deletions(-) rename packages/coordinator/{hardhat.config.js => hardhat.config.ts} (72%) diff --git a/packages/coordinator/hardhat.config.js b/packages/coordinator/hardhat.config.ts similarity index 72% rename from packages/coordinator/hardhat.config.js rename to packages/coordinator/hardhat.config.ts index c26fed08..330bf493 100644 --- a/packages/coordinator/hardhat.config.js +++ b/packages/coordinator/hardhat.config.ts @@ -1,19 +1,20 @@ /* eslint-disable @typescript-eslint/no-var-requires */ -require("@nomicfoundation/hardhat-toolbox"); -const dotenv = require("dotenv"); +import "@nomicfoundation/hardhat-toolbox"; +import * as dotenv from "dotenv"; +import { HardhatUserConfig } from "hardhat/types"; -const path = require("path"); +import * as path from "path"; dotenv.config(); const parentDir = __dirname.includes("build") ? ".." : ""; const TEST_MNEMONIC = "test test test test test test test test test test test junk"; -module.exports = { +const config: HardhatUserConfig = { defaultNetwork: "localhost", networks: { localhost: { - url: process.env.COORDINATOR_RPC_URL, + url: process.env.COORDINATOR_RPC_URL || "", accounts: { mnemonic: TEST_MNEMONIC, path: "m/44'/60'/0'/0", @@ -31,3 +32,5 @@ module.exports = { artifacts: path.resolve(__dirname, parentDir, "./node_modules/maci-contracts/build/artifacts"), }, }; + +export default config; diff --git a/packages/coordinator/tests/app.test.ts b/packages/coordinator/tests/app.test.ts index db411264..fd2c9ac7 100644 --- a/packages/coordinator/tests/app.test.ts +++ b/packages/coordinator/tests/app.test.ts @@ -16,8 +16,7 @@ import { mergeMessages, mergeSignups, } from "maci-cli"; -import { Proof, TallyData } from "maci-contracts"; -import { Poll__factory as PollFactory } from "maci-contracts/typechain-types"; +import { Proof, TallyData, Poll__factory as PollFactory } from "maci-contracts"; import { Keypair } from "maci-domainobjs"; import { io, Socket } from "socket.io-client"; import request from "supertest"; diff --git a/packages/coordinator/tsconfig.build.json b/packages/coordinator/tsconfig.build.json index 792baa42..efe68365 100644 --- a/packages/coordinator/tsconfig.build.json +++ b/packages/coordinator/tsconfig.build.json @@ -7,5 +7,5 @@ "allowJs": true }, "include": ["./ts", "./scripts", "./tests"], - "files": ["./hardhat.config.js"] + "files": ["./hardhat.config.ts"] } diff --git a/packages/coordinator/tsconfig.json b/packages/coordinator/tsconfig.json index 994b405e..474eb52a 100644 --- a/packages/coordinator/tsconfig.json +++ b/packages/coordinator/tsconfig.json @@ -6,5 +6,5 @@ "experimentalDecorators": true }, "include": ["./ts", "./scripts", "./tests"], - "files": ["hardhat.config.js"] + "files": ["hardhat.config.ts"] } diff --git a/tsconfig.json b/tsconfig.json index 3badb422..a2716455 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -1,14 +1,12 @@ { "compilerOptions": { - "target": "ESNext", - "module": "Node16", - "lib": ["ESNext", "DOM"], - "strict": true, + "target": "ES2020", + "module": "commonjs", "esModuleInterop": true, - "skipLibCheck": true, "forceConsistentCasingInFileNames": true, - "moduleResolution": "node16", - "allowJs": true + "strict": true, + "skipLibCheck": true, + "resolveJsonModule": true }, "exclude": ["node_modules"], "include": ["packages/coordinator/ts", "packages/coordinator/scripts", "./packages/interface/src"]