Skip to content

Commit

Permalink
update tsconfig
Browse files Browse the repository at this point in the history
  • Loading branch information
DenisCarriere committed Oct 25, 2023
1 parent 33c80fc commit 84c412e
Show file tree
Hide file tree
Showing 11 changed files with 31 additions and 51 deletions.
6 changes: 3 additions & 3 deletions index.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// from: https://github.com/pinax-network/substreams-clock-api/blob/main/index.ts
import { config } from "./src/config";
import { logger } from "./src/logger";
import GET from "./src/fetch/GET";
import { config } from "./src/config.js";
import { logger } from "./src/logger.js";
import GET from "./src/fetch/GET.js";
import * as prometheus from "./src/prometheus.js";

if (config.verbose) logger.enable();
Expand Down
4 changes: 2 additions & 2 deletions src/clickhouse/createClient.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// from: https://github.com/pinax-network/substreams-clock-api/blob/main/src/clickhouse/createClient.ts
import { createClient } from "@clickhouse/client-web";
import { ping } from "./ping";
import { APP_NAME, config } from "../config";
import { ping } from "./ping.js";
import { APP_NAME, config } from "../config.js";

const client = createClient({
...config,
Expand Down
6 changes: 3 additions & 3 deletions src/clickhouse/makeQuery.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// from: https://github.com/pinax-network/substreams-clock-api/blob/main/src/clickhouse/makeQuery.ts
import { logger } from "../logger";
import * as prometheus from "../prometheus";
import client from "./createClient";
import { logger } from "../logger.js";
import * as prometheus from "../prometheus.js";
import client from "./createClient.js";

export interface Meta {
name: string,
Expand Down
2 changes: 1 addition & 1 deletion src/clickhouse/ping.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// from: https://github.com/pinax-network/substreams-clock-api/blob/main/src/clickhouse/ping.ts
import { PingResult } from "@clickhouse/client-web";
import client from "./createClient";
import client from "./createClient.js";

// Does not work with Bun's implementation of Node streams.
export async function ping(): Promise<PingResult> {
Expand Down
8 changes: 4 additions & 4 deletions src/fetch/openapi.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@
import pkg from "../../package.json" assert { type: "json" };

import { OpenApiBuilder, SchemaObject, ExampleObject, ParameterObject } from "openapi3-ts/oas31";
import { config } from "../config";
import { getBalanceChanges, getContracts, getTotalSupply } from "../queries";
import { registry } from "../prometheus";
import { makeQuery } from "../clickhouse/makeQuery";
import { config } from "../config.js";
import { getBalanceChanges, getContracts, getTotalSupply } from "../queries.js";
import { registry } from "../prometheus.js";
import { makeQuery } from "../clickhouse/makeQuery.js";
import { supportedChainsQuery } from "./chains.js";

const TAGS = {
Expand Down
2 changes: 1 addition & 1 deletion src/queries.spec.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// from: https://github.com/pinax-network/substreams-clock-api/blob/main/src/queries.spec.ts

import { expect, test } from "bun:test";
import { getContracts, getChain, getTotalSupply, getBalanceChanges } from "./queries";
import { getContracts, getChain, getTotalSupply, getBalanceChanges } from "./queries.js";

const chain = "eth";
const address = 'dac17f958d2ee523a2206206994597c13d831ec7'
Expand Down
4 changes: 2 additions & 2 deletions src/queries.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { DEFAULT_SORT_BY } from "./config";
import { getAddress, parseLimit } from "./utils";
import { DEFAULT_SORT_BY } from "./config.js";
import { getAddress, parseLimit } from "./utils.js";

export function getTotalSupply(searchParams: URLSearchParams) {
// Params
Expand Down
File renamed without changes.
2 changes: 1 addition & 1 deletion src/utils.spec.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { expect, test } from "bun:test";
import { formatAddress, checkValidAddress, getAddress } from "./utils";
import { formatAddress, checkValidAddress, getAddress } from "./utils.js";

const address = "0xdac17f958d2ee523a2206206994597c13d831ec7";

Expand Down
2 changes: 1 addition & 1 deletion src/utils.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { ethers } from "ethers";
import { config } from "./config";
import { config } from "./config.js";

export function getAddress(searchParams: URLSearchParams, key: string, required: boolean = false) {
const address = formatAddress(searchParams.get(key));
Expand Down
46 changes: 13 additions & 33 deletions tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,38 +1,18 @@
{
"compilerOptions": {
// add Bun type definitions
"types": ["bun-types"],

// enable latest features
"lib": ["ESNext"],
"module": "esnext",
"target": "esnext",

// if TS 5.x+
"moduleResolution": "bundler",
"noEmit": true,
"allowImportingTsExtensions": true,
"moduleDetection": "force",
// if TS 4.x or earlier
// "moduleResolution": "nodenext",

"jsx": "react-jsx", // support JSX
"allowJs": true, // allow importing `.js` from `.ts`

// best practices
"target": "ESNext",
"module": "NodeNext",
"moduleResolution": "NodeNext",
"resolveJsonModule": true,
"declaration": true,
"declarationMap": true,
"sourceMap": true,
"outDir": "./dist/",
"strict": true,
"forceConsistentCasingInFileNames": true,
"noImplicitAny": true,
"strictNullChecks": true,
"alwaysStrict": true,
"skipLibCheck": true,
"composite": true,
"downlevelIteration": true,
"allowSyntheticDefaultImports": true
},
"include": [
"src/**/*.ts",
"package.json"
],
"exclude": [
"node_modules",
"src/tests/*.spec.ts"
]
"types": ["bun-types"]
}
}

0 comments on commit 84c412e

Please sign in to comment.