diff --git a/.eslintignore b/.eslintignore new file mode 100644 index 0000000..e5d6392 --- /dev/null +++ b/.eslintignore @@ -0,0 +1,4 @@ +dist/ +node_modules/ +.vscode +.github \ No newline at end of file diff --git a/package.json b/package.json index 0f94067..b38f63a 100644 --- a/package.json +++ b/package.json @@ -1,13 +1,13 @@ { "name": "use-defi-monorepo", - "version": "0.2.3", + "version": "0.2.4", "description": "React hooks library to use with enso shortcuts infrastructure", "main": "index.js", "scripts": { "preinstall": "npx only-allow pnpm", "postinstall": "pnpm generate", - "lint": "pnpm eslint src/*", - "test": "pnpm vitest run --root ./test --config ./vitest.config.ts", + "lint": "pnpm eslint .", + "test": "pnpm vitest run --root ./use-defi/test --config ./vitest.config.ts", "generate": "npx openapi-typescript https://api.enso.finance/api-json -o use-defi/src/generated/api.d.ts", "build": "pnpm generate && pnpm build:setup && rollup -c", "build:setup": "pnpm gts clean && mkdir dist && jq 'del(.scripts) | del(.devDependencies) | del(.private) | del(.pnpm)' package.json > dist/package.json && cp README.md dist/README.md", diff --git a/playground/src/App.tsx b/playground/src/App.tsx index 097422a..5d112ff 100644 --- a/playground/src/App.tsx +++ b/playground/src/App.tsx @@ -57,16 +57,16 @@ function App() { )} - + {hasRoute ? ( <>
Route found for shortcut. Click to run
{!!executionDetails?.approvals?.length && ( - + )} - +
diff --git a/playground/tsconfig.json b/playground/tsconfig.json index 7801fdd..0f7b6c8 100644 --- a/playground/tsconfig.json +++ b/playground/tsconfig.json @@ -3,13 +3,14 @@ "compilerOptions": { "paths": { "@ensofinance/use-defi": [ - "../use-defi/src/index.ts" + "./use-defi/src/index.ts" ] } }, "include": [ "src", - "../use-defi/src" + "../use-defi/src", + "vite.config.ts" ], "references": [ { diff --git a/tsconfig.json b/tsconfig.json index 585d2d0..79513d9 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -21,6 +21,7 @@ "noUnusedLocals": true, "emitDeclarationOnly": true, "allowJs": true, + "composite": true, "forceConsistentCasingInFileNames": true, "isolatedModules": true, "outDir": "./dist", @@ -28,6 +29,7 @@ "vitest/globals" ], }, + "include": [], "files": [], "references": [ { diff --git a/use-defi/.eslintrc.cjs b/use-defi/.eslintrc.cjs index dff88cc..1cedd82 100644 --- a/use-defi/.eslintrc.cjs +++ b/use-defi/.eslintrc.cjs @@ -23,4 +23,10 @@ module.exports = { '@typescript-eslint/no-explicit-any': ['warn'], '@typescript-eslint/no-unsafe-assignment': 'off', }, + overrides: [ + { + files: ['src/**/*.ts', 'test/**/*.ts'], + excludedFiles: ['.eslintrc.cjs', 'package.json'], + }, + ], }; diff --git a/use-defi/package.json b/use-defi/package.json index 19054f8..6171d84 100644 --- a/use-defi/package.json +++ b/use-defi/package.json @@ -1,6 +1,6 @@ { "name": "@ensofinance/use-defi", - "version": "0.2.3", + "version": "0.2.4", "description": "React hooks library to use with enso shortcuts infrastructure", "main": "index.js", "module": "index.esm.js", diff --git a/use-defi/src/utils/fetch.ts b/use-defi/src/utils/fetch.ts index 717ea74..7fbfb0d 100644 --- a/use-defi/src/utils/fetch.ts +++ b/use-defi/src/utils/fetch.ts @@ -1,11 +1,9 @@ -import { URLSearchParams } from 'url'; - import { ENSO_API } from '../constants'; import { parseApiErrorOrReturn } from './parseApiError'; export const apiFetchGet = async (apiPath: string, qsParams: Record): Promise => { - const response = await fetch(`${ENSO_API}/${apiPath}?${new URLSearchParams(qsParams).toString()}`); + const response = await fetch(`${ENSO_API}/${apiPath}?${new window.URLSearchParams(qsParams).toString()}`); const data = await response.json(); return parseApiErrorOrReturn(data as T); @@ -24,7 +22,7 @@ export const apiFetchPost = async ( headers.set('Authorization', `Bearer ${apiKey}`); } - const response = await fetch(`${ENSO_API}/${apiPath}?${new URLSearchParams(qsParams).toString()}`, { + const response = await fetch(`${ENSO_API}/${apiPath}?${new window.URLSearchParams(qsParams).toString()}`, { method: 'POST', headers, body: body ? JSON.stringify(body) : undefined, diff --git a/use-defi/tsconfig.json b/use-defi/tsconfig.json index 56a6e12..4a5a177 100644 --- a/use-defi/tsconfig.json +++ b/use-defi/tsconfig.json @@ -1,7 +1,16 @@ { "extends": "../tsconfig.json", - "compilerOptions": {}, + "compilerOptions": { + "paths": { + "@ensofinance/use-defi": [ + "./use-defi/src/index.ts" + ] + } + }, "include": [ - "**/*.ts" + "src/**/*.ts", + "src/**/*.tsx", + "test/**/*.ts", + "vitest.config.ts" ] } \ No newline at end of file