diff --git a/.changeset/small-corners-win.md b/.changeset/small-corners-win.md new file mode 100644 index 0000000000..eb16776526 --- /dev/null +++ b/.changeset/small-corners-win.md @@ -0,0 +1,41 @@ +--- +'@learncard/simple-signing-service': patch +'@learncard/simple-signing-client': patch +'@learncard/learn-cloud-service': patch +'@learncard/network-brain-service': patch +'@learncard/network-brain-client': patch +'@learncard/learn-cloud-client': patch +'@learncard/simple-signing-plugin': patch +'@learncard/network-plugin': patch +'@learncard/claimable-boosts-plugin': patch +'@learncard/create-http-bridge': patch +'@learncard/did-web-plugin': patch +'@learncard/dynamic-loader-plugin': patch +'learn-card-discord-bot': patch +'@learncard/vc-templates-plugin': patch +'@learncard/learn-cloud-plugin': patch +'@learncard/snap-chapi-example': patch +'@learncard/helpers': patch +'@learncard/encryption-plugin': patch +'@learncard/expiration-plugin': patch +'@learncard/learn-card-plugin': patch +'@learncard/snap-example-dapp': patch +'@learncard/types': patch +'@learncard/ethereum-plugin': patch +'@learncard/react': patch +'@learncard/core': patch +'@learncard/init': patch +'@learncard/ceramic-plugin': patch +'@learncard/crypto-plugin': patch +'@learncard/didkey-plugin': patch +'@learncard/didkit-plugin': patch +'@learncard/vc-api-plugin': patch +'@learncard/meta-mask-snap': patch +'@learncard/chapi-example': patch +'@learncard/chapi-plugin': patch +'@learncard/vpqr-plugin': patch +'@learncard/idx-plugin': patch +'@learncard/vc-plugin': patch +--- + +Add oxlint diff --git a/.eslintrc.js b/.eslintrc.js deleted file mode 100644 index 977bce8de4..0000000000 --- a/.eslintrc.js +++ /dev/null @@ -1,66 +0,0 @@ -module.exports = { - root: true, - parser: '@typescript-eslint/parser', - env: { - browser: true, - es2020: true, - }, - extends: ['plugin:react/recommended', 'airbnb-typescript', 'prettier'], - parserOptions: { - ecmaFeatures: { - jsx: true, - }, - ecmaVersion: 2020, - sourceType: 'module', - project: './tsconfig.json', - }, - plugins: ['react', 'prettier', '@typescript-eslint'], - rules: { - indent: 'off', - curly: ['warn', 'multi-line'], - radix: 'off', - 'arrow-parens': 'off', - 'react/jsx-indent': ['error', 4], - 'react/jsx-indent-props': ['error', 4], - 'react/jsx-filename-extension': 'off', - 'react/prop-types': 'off', - 'import/extensions': 'off', - 'import/no-unresolved': 'off', - 'import/no-cycle': 'off', - 'import/no-absolute-path': 'off', - 'no-prototype-builtins': 'off', - 'prettier/prettier': 'error', - 'no-param-reassign': 'off', - 'no-underscore-dangle': 'off', - // TODO - Get team preferences on below rules - 'nonblock-statement-body-position': ['error', 'beside'], - 'no-trailing-spaces': 'off', - 'operator-linebreak': 'off', - 'no-shadow': 'off', - '@typescript-eslint/no-shadow': 'warn', - 'max-len': 'off', - 'comma-dangle': 'off', - 'no-console': 'off', - 'function-paren-newline': 'off', - 'implicit-arrow-linebreak': 'off', - 'arrow-body-style': 'off', - 'one-var': 'off', - 'consistent-return': 'off', - 'jsx-a11y/click-events-have-key-events': 'off', - 'jsx-a11y/no-static-element-interactions': 'off', - 'object-curly-newline': 'off', - 'react/no-array-index-key': 'off', - 'react/no-unescaped-entities': 'off', - 'no-use-before-define': 'off', - 'no-alert': 'off', - 'class-methods-use-this': 'off', - 'no-fallthrough': 'off', - 'react/jsx-props-no-spreading': 'warn', - camelcase: 'off', - 'prefer-arrow-callback': ['warn', { allowNamedFunctions: true }], - '@typescript-eslint/naming-convention': 'off', - 'react/require-default-props': 'off', - 'import/no-extraneous-dependencies': 'off', - '@typescript-eslint/no-unused-vars': 'off', - }, -}; diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 910c57403a..3cec491436 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -1,11 +1,15 @@ -name: Test Runner +name: CI on: pull_request: types: [opened, synchronize] +permissions: + contents: write + pull-requests: read + jobs: - Test: + test: runs-on: ubuntu-latest steps: @@ -46,7 +50,38 @@ jobs: - name: Install dependencies run: pnpm install --no-frozen-lockfile + - name: Run lint fix + id: lintfix + continue-on-error: true + run: | + pnpm lint:fix + status=$? + if [[ -n $(git status --porcelain) ]]; then + echo "changes=true" >> $GITHUB_OUTPUT + fi + echo "exitcode=$status" >> $GITHUB_OUTPUT + + - name: Commit and push lint fixes + if: steps.lintfix.outputs.changes == 'true' + run: | + git config user.name "github-actions[bot]" + git config user.email "github-actions[bot]@users.noreply.github.com" + git add -A + git commit -m "chore: auto lint fixes" + git push + + - name: Fail due to remaining lint errors + if: steps.lintfix.outputs.exitcode != '0' + run: | + echo "Unfixable lint errors remain. Failing CI early." + exit 1 + + - name: Skip tests after lint commit + if: steps.lintfix.outputs.changes == 'true' && steps.lintfix.outputs.exitcode == '0' + run: echo "Lint fixes pushed; skipping tests." + - name: Run tests + if: steps.lintfix.outputs.changes != 'true' && steps.lintfix.outputs.exitcode == '0' uses: nick-fields/retry@v2 with: timeout_minutes: 10 diff --git a/.oxlintrc.json b/.oxlintrc.json new file mode 100644 index 0000000000..0fb4392a09 --- /dev/null +++ b/.oxlintrc.json @@ -0,0 +1,63 @@ +{ + "categories": { + "correctness": "error", + "suspicious": "warn", + "style": "warn" + }, + "env": { + "browser": true, + "node": true, + "es2024": true + }, + "ignorePatterns": [ + "**/node_modules/**", + "**/dist/**", + "**/build/**", + "pnpm-lock.yaml", + "**/playwright-report/**", + "**/test-results/**", + "**/swagger-ui/**", + "**/*.spec.ts", + "**/*.test.ts", + "**/*wasm*" + ], + "rules": { + "no-plusplus": [ + "error", + { + "allowForLoopAfterthoughts": true + } + ], + "no-console": "off", + "no-explicit-any": "off", + "no-null": "off", + "filename-case": "off", + "curly": "off", + "sort-imports": "off", + "func-style": "off", + "no-ternary": "off", + "no-magic-numbers": "off", + "sort-keys": "off", + "prefer-global-this": "off", + "no-await-expression-member": "off", + "init-declarations": "off", + "max-params": "off", + "yoda": ["warn", "never"], + "consistent-type-definitions": ["warn", "type"], + "consistent-indexed-object-style": ["warn", "record"], + "no-nested-ternary": "off", + "no-continue": "off", + "consistent-type-imports": [ + "warn", + { + "prefer": "type-imports", + "fixStyle": "inline-type-imports" + } + ], + "number-literal-case": "off", + "no-instanceof-builtins": "off", + "no-async-endpoint-handlers": "off", + "func-names": "off", + "prefer-object-has-own": "off" + } +} diff --git a/.vscode/extensions.json b/.vscode/extensions.json new file mode 100644 index 0000000000..1f08ac7c14 --- /dev/null +++ b/.vscode/extensions.json @@ -0,0 +1,5 @@ +{ + "recommendations": [ + "oxc.oxc-vscode" + ] +} diff --git a/examples/chapi-example/astro.config.mjs b/examples/chapi-example/astro.config.mjs index c7b2640ff5..8e4a877313 100644 --- a/examples/chapi-example/astro.config.mjs +++ b/examples/chapi-example/astro.config.mjs @@ -1,5 +1,4 @@ import { defineConfig } from 'astro/config'; -import GlobalPolyfill from '@esbuild-plugins/node-globals-polyfill'; import stdlibbrowser from 'node-stdlib-browser'; import basicSsl from '@vitejs/plugin-basic-ssl'; import react from '@astrojs/react'; diff --git a/examples/chapi-example/src/layouts/Layout.astro b/examples/chapi-example/src/layouts/Layout.astro index 5bf20ecafa..b68d93f33a 100644 --- a/examples/chapi-example/src/layouts/Layout.astro +++ b/examples/chapi-example/src/layouts/Layout.astro @@ -1,5 +1,5 @@ --- -export interface Props { +export type Props = { title: string; } diff --git a/examples/chapi-example/src/pages/login.astro b/examples/chapi-example/src/pages/login.astro index 659b7eee25..78f6b0e8c3 100644 --- a/examples/chapi-example/src/pages/login.astro +++ b/examples/chapi-example/src/pages/login.astro @@ -54,12 +54,12 @@ import Layout from '@layouts/Layout.astro'; const seed = seedInput.value; if (seed.length === 0 || seed.length > 64) { - errorDisplay.innerText = 'Please enter a seed between 1 and 64 characters long'; + errorDisplay.textContent = 'Please enter a seed between 1 and 64 characters long'; return; } if (!isHex(seed)) { - errorDisplay.innerText = 'Please enter a valid hex string (i.e. only numbers and A-F)'; + errorDisplay.textContent = 'Please enter a valid hex string (i.e. only numbers and A-F)'; return; } @@ -67,6 +67,6 @@ import Layout from '@layouts/Layout.astro'; window.location.href = '/'; }; - form.onsubmit = onSubmit; + form.addEventListener('submit', onSubmit); seedInput.value = randomKey(); diff --git a/examples/snap-chapi-example/package.json b/examples/snap-chapi-example/package.json index 35420fdcb4..16acd802a3 100644 --- a/examples/snap-chapi-example/package.json +++ b/examples/snap-chapi-example/package.json @@ -13,7 +13,9 @@ "dependencies": { "@astrojs/react": "^1.1.3", "@astrojs/tailwind": "^2.0.1", + "@learncard/chapi-plugin": "workspace:*", "@learncard/core": "workspace:*", + "@learncard/init": "workspace:*", "@learncard/helpers": "workspace:*", "@learncard/meta-mask-snap": "workspace:*", "@learncard/react": "workspace:*", diff --git a/examples/snap-chapi-example/src/components/CredentialStorage.tsx b/examples/snap-chapi-example/src/components/CredentialStorage.tsx index 6e69deef92..6cb5ff7425 100644 --- a/examples/snap-chapi-example/src/components/CredentialStorage.tsx +++ b/examples/snap-chapi-example/src/components/CredentialStorage.tsx @@ -1,6 +1,7 @@ import React, { useState, useEffect } from 'react'; import { useStore } from '@nanostores/react'; -import { initLearnCard, CredentialStoreEvent } from '@learncard/core'; +import { initLearnCard } from '@learncard/init'; +import type { CredentialStoreEvent } from '@learncard/chapi-plugin'; import { VCCard } from '@learncard/react'; import '@learncard/react/dist/main.css'; diff --git a/examples/snap-chapi-example/src/layouts/Layout.astro b/examples/snap-chapi-example/src/layouts/Layout.astro index 57bacc1d07..784894296a 100644 --- a/examples/snap-chapi-example/src/layouts/Layout.astro +++ b/examples/snap-chapi-example/src/layouts/Layout.astro @@ -1,5 +1,5 @@ --- -export interface Props { +export type Props = { title: string; } diff --git a/examples/snap-chapi-example/src/pages/login.astro b/examples/snap-chapi-example/src/pages/login.astro index 4163696080..948f64dc46 100644 --- a/examples/snap-chapi-example/src/pages/login.astro +++ b/examples/snap-chapi-example/src/pages/login.astro @@ -54,12 +54,12 @@ import Layout from '../layouts/Layout.astro'; const seed = seedInput.value; if (seed.length === 0 || seed.length > 64) { - errorDisplay.innerText = 'Please enter a seed between 1 and 64 characters long'; + errorDisplay.textContent = 'Please enter a seed between 1 and 64 characters long'; return; } if (!isHex(seed)) { - errorDisplay.innerText = 'Please enter a valid hex string (i.e. only numbers and A-F)'; + errorDisplay.textContent = 'Please enter a valid hex string (i.e. only numbers and A-F)'; return; } @@ -67,6 +67,6 @@ import Layout from '../layouts/Layout.astro'; window.location.href = '/'; }; - form.onsubmit = onSubmit; + form.addEventListener('submit', onSubmit); seedInput.value = randomKey(); diff --git a/examples/snap-chapi-example/src/pages/wallet-worker.astro b/examples/snap-chapi-example/src/pages/wallet-worker.astro index 90b7b00be8..f1d02067ae 100644 --- a/examples/snap-chapi-example/src/pages/wallet-worker.astro +++ b/examples/snap-chapi-example/src/pages/wallet-worker.astro @@ -15,8 +15,8 @@ import Layout from '../layouts/Layout.astro'; try { await wallet.installChapiHandler(); - } catch (e) { - console.error('Error in loadOnce:', e); + } catch (error) { + console.error('Error in loadOnce:', error); } wallet.activateChapiHandler({ diff --git a/examples/snap-chapi-example/src/stores/walletStore.ts b/examples/snap-chapi-example/src/stores/walletStore.ts index d7b6229a13..850cd0c6fd 100644 --- a/examples/snap-chapi-example/src/stores/walletStore.ts +++ b/examples/snap-chapi-example/src/stores/walletStore.ts @@ -1,4 +1,4 @@ -import { LearnCard } from '@learncard/core'; +import type { LearnCard } from '@learncard/core'; import { atom } from 'nanostores'; import { persistentAtom } from '@nanostores/persistent'; diff --git a/examples/snap-chapi-example/tsconfig.json b/examples/snap-chapi-example/tsconfig.json index db94294641..487b942766 100644 --- a/examples/snap-chapi-example/tsconfig.json +++ b/examples/snap-chapi-example/tsconfig.json @@ -2,6 +2,7 @@ "extends": "astro/tsconfigs/strictest", "compilerOptions": { "jsx": "react", + "moduleResolution": "node", "baseUrl": ".", "paths": { "@components/*": ["./src/components/*"], diff --git a/examples/snap-example-dapp/src/components/Did.tsx b/examples/snap-example-dapp/src/components/Did.tsx index f7058f83fe..87dbcb91c9 100644 --- a/examples/snap-example-dapp/src/components/Did.tsx +++ b/examples/snap-example-dapp/src/components/Did.tsx @@ -1,5 +1,5 @@ import React, { useState, useEffect } from 'react'; -import { DidMethod } from '@learncard/didkit-plugin'; +import type { DidMethod } from '@learncard/didkit-plugin'; import DidSelector from '@components/DidSelector'; diff --git a/examples/snap-example-dapp/src/components/DidSelector.tsx b/examples/snap-example-dapp/src/components/DidSelector.tsx index 925b0a2ac7..4bcd4a611c 100644 --- a/examples/snap-example-dapp/src/components/DidSelector.tsx +++ b/examples/snap-example-dapp/src/components/DidSelector.tsx @@ -1,5 +1,5 @@ import React from 'react'; -import { DidMethod } from '@learncard/didkit-plugin'; +import type { DidMethod } from '@learncard/didkit-plugin'; type DidSelectorProps = { did: string; diff --git a/examples/snap-example-dapp/src/components/GetCredential.tsx b/examples/snap-example-dapp/src/components/GetCredential.tsx index 3e58a092e0..c68cfb71d6 100644 --- a/examples/snap-example-dapp/src/components/GetCredential.tsx +++ b/examples/snap-example-dapp/src/components/GetCredential.tsx @@ -1,5 +1,5 @@ import React, { useState } from 'react'; -import { VC } from '@learncard/types'; +import type { VC } from '@learncard/types'; import TextBox from '@components/input/TextBox'; diff --git a/examples/snap-example-dapp/src/components/GetCredentials.tsx b/examples/snap-example-dapp/src/components/GetCredentials.tsx index 966d167099..a69af8ccfd 100644 --- a/examples/snap-example-dapp/src/components/GetCredentials.tsx +++ b/examples/snap-example-dapp/src/components/GetCredentials.tsx @@ -1,5 +1,5 @@ import React, { useState, useEffect } from 'react'; -import { VC } from '@learncard/types'; +import type { VC } from '@learncard/types'; import { useIsSnapReady } from '@state/snapState'; diff --git a/examples/snap-example-dapp/src/components/GetCredentialsList.tsx b/examples/snap-example-dapp/src/components/GetCredentialsList.tsx index 3a7bfba06b..15d03355e6 100644 --- a/examples/snap-example-dapp/src/components/GetCredentialsList.tsx +++ b/examples/snap-example-dapp/src/components/GetCredentialsList.tsx @@ -1,5 +1,5 @@ import React, { useState, useEffect } from 'react'; -import { CredentialRecord } from '@learncard/types'; +import type { CredentialRecord } from '@learncard/types'; import { useIsSnapReady } from '@state/snapState'; diff --git a/examples/snap-example-dapp/src/components/IssueCredential.tsx b/examples/snap-example-dapp/src/components/IssueCredential.tsx index 2c4b0a9d31..0707ec26ca 100644 --- a/examples/snap-example-dapp/src/components/IssueCredential.tsx +++ b/examples/snap-example-dapp/src/components/IssueCredential.tsx @@ -1,5 +1,5 @@ import React, { useState, useEffect } from 'react'; -import { UnsignedVC, VC } from '@learncard/types'; +import type { UnsignedVC, VC } from '@learncard/types'; import TextBox from '@components/input/TextBox'; diff --git a/examples/snap-example-dapp/src/components/IssuePresentation.tsx b/examples/snap-example-dapp/src/components/IssuePresentation.tsx index 39af5866f0..985e2350a1 100644 --- a/examples/snap-example-dapp/src/components/IssuePresentation.tsx +++ b/examples/snap-example-dapp/src/components/IssuePresentation.tsx @@ -1,5 +1,5 @@ import React, { useState } from 'react'; -import { UnsignedVP, VP } from '@learncard/types'; +import type { UnsignedVP, VP } from '@learncard/types'; import TextBox from '@components/input/TextBox'; diff --git a/examples/snap-example-dapp/src/components/PublishCredential.tsx b/examples/snap-example-dapp/src/components/PublishCredential.tsx index 0120b3d5e7..dfdc601c79 100644 --- a/examples/snap-example-dapp/src/components/PublishCredential.tsx +++ b/examples/snap-example-dapp/src/components/PublishCredential.tsx @@ -1,5 +1,5 @@ import React, { useState } from 'react'; -import { VC } from '@learncard/types'; +import type { VC } from '@learncard/types'; import TextBox from '@components/input/TextBox'; diff --git a/examples/snap-example-dapp/src/components/ReadFromCeramic.tsx b/examples/snap-example-dapp/src/components/ReadFromCeramic.tsx index 35d2621e68..b1c89ff549 100644 --- a/examples/snap-example-dapp/src/components/ReadFromCeramic.tsx +++ b/examples/snap-example-dapp/src/components/ReadFromCeramic.tsx @@ -1,5 +1,5 @@ import React, { useState } from 'react'; -import { VC } from '@learncard/types'; +import type { VC } from '@learncard/types'; import TextBox from '@components/input/TextBox'; diff --git a/examples/snap-example-dapp/src/components/SnapInfo.tsx b/examples/snap-example-dapp/src/components/SnapInfo.tsx index d6e8893b24..d26f1358bc 100644 --- a/examples/snap-example-dapp/src/components/SnapInfo.tsx +++ b/examples/snap-example-dapp/src/components/SnapInfo.tsx @@ -37,15 +37,6 @@ const options = Object.keys(Tabs).map(option => ( )); -const Button: React.FC<{ component: JSX.Element }> = ({ component, children }) => ( - modalComponent.set(component)} - > - {children} - -); const SnapInfo: React.FC = () => { const [tab, setTab] = useState('View Dids'); diff --git a/examples/snap-example-dapp/src/components/VerifyCredential.tsx b/examples/snap-example-dapp/src/components/VerifyCredential.tsx index 11213f01a4..17113f4f50 100644 --- a/examples/snap-example-dapp/src/components/VerifyCredential.tsx +++ b/examples/snap-example-dapp/src/components/VerifyCredential.tsx @@ -1,5 +1,5 @@ import React, { useState } from 'react'; -import { VC, VerificationItem } from '@learncard/types'; +import type { VC, VerificationItem } from '@learncard/types'; import TextBox from '@components/input/TextBox'; diff --git a/examples/snap-example-dapp/src/components/VerifyPresentation.tsx b/examples/snap-example-dapp/src/components/VerifyPresentation.tsx index fbc784d561..5dfb3afffb 100644 --- a/examples/snap-example-dapp/src/components/VerifyPresentation.tsx +++ b/examples/snap-example-dapp/src/components/VerifyPresentation.tsx @@ -1,5 +1,5 @@ import React, { useState } from 'react'; -import { VP, VerificationCheck } from '@learncard/types'; +import type { VP, VerificationCheck } from '@learncard/types'; import TextBox from '@components/input/TextBox'; diff --git a/examples/snap-example-dapp/src/layouts/Layout.astro b/examples/snap-example-dapp/src/layouts/Layout.astro index 7b55d27407..cd1aaaccc4 100644 --- a/examples/snap-example-dapp/src/layouts/Layout.astro +++ b/examples/snap-example-dapp/src/layouts/Layout.astro @@ -1,5 +1,5 @@ --- -export interface Props { +export type Props = { title: string; } diff --git a/package.json b/package.json index 3b5edf734e..a7886967b9 100644 --- a/package.json +++ b/package.json @@ -3,24 +3,19 @@ "private": true, "version": "1.0.1", "scripts": { - "preinstall": "npx only-allow pnpm" + "preinstall": "npx only-allow pnpm", + "lint": "oxlint .", + "lint:fix": "oxlint . --fix --fix-suggestions" }, "devDependencies": { "@changesets/changelog-github": "^0.4.8", "@changesets/cli": "^2.26.0", - "@typescript-eslint/eslint-plugin": "^5.54.0", - "@typescript-eslint/parser": "^5.54.0", "esbuild-jest": "^0.5.0", - "eslint": "^8.35.0", - "eslint-config-airbnb-typescript": "^17.0.0", - "eslint-import-resolver-typescript": "^2.7.1", - "eslint-plugin-import": "^2.27.5", - "eslint-plugin-prettier": "^4.2.1", - "eslint-plugin-react": "^7.32.2", "jest": "^29.5.0", "jest-environment-jsdom": "^29.5.0", "jest-silent-reporter": "^0.5.0", "nx": "16.1.4", + "oxlint": "^1.1.0", "prettier": "^2.8.4", "prettier-plugin-astro": "^0.5.5", "ts-jest": "^29.0.5", diff --git a/packages/learn-card-bridge-http/cli/App.tsx b/packages/learn-card-bridge-http/cli/App.tsx index 9129263920..ed5513bfb9 100644 --- a/packages/learn-card-bridge-http/cli/App.tsx +++ b/packages/learn-card-bridge-http/cli/App.tsx @@ -13,7 +13,7 @@ import Info from './Info'; import { generateRandomSeed } from './random'; -import { FormState } from './types'; +import type { FormState } from './types'; type Step = 'form' | 'cloning' | 'info'; diff --git a/packages/learn-card-bridge-http/cli/Button.tsx b/packages/learn-card-bridge-http/cli/Button.tsx index 3967f03230..e0629e0d99 100644 --- a/packages/learn-card-bridge-http/cli/Button.tsx +++ b/packages/learn-card-bridge-http/cli/Button.tsx @@ -1,5 +1,5 @@ -import React, { ComponentPropsWithRef } from 'react'; -import { Text, Box, useFocus, useFocusManager, useInput, DOMElement } from 'ink'; +import React, { type ComponentPropsWithRef } from 'react'; +import { Text, Box, useFocus, useFocusManager, useInput, type DOMElement } from 'ink'; type RawButtonProps = ComponentPropsWithRef & { autoFocus?: boolean; diff --git a/packages/learn-card-bridge-http/cli/Form.tsx b/packages/learn-card-bridge-http/cli/Form.tsx index 5e8d96d37d..98013156fc 100644 --- a/packages/learn-card-bridge-http/cli/Form.tsx +++ b/packages/learn-card-bridge-http/cli/Form.tsx @@ -1,13 +1,13 @@ import React from 'react'; import { Box, useFocusManager } from 'ink'; -import { Updater } from 'use-immer'; +import type { Updater } from 'use-immer'; import { curriedStateSlice } from './curriedStateSlice'; import Input from './Input'; import Button from './Button'; -import { FormState } from './types'; +import type { FormState } from './types'; import { generateRandomSeed } from './random'; type FormProps = { diff --git a/packages/learn-card-bridge-http/cli/Input.tsx b/packages/learn-card-bridge-http/cli/Input.tsx index a877e49ccb..4474faf194 100644 --- a/packages/learn-card-bridge-http/cli/Input.tsx +++ b/packages/learn-card-bridge-http/cli/Input.tsx @@ -1,5 +1,5 @@ -import React, { ComponentPropsWithRef } from 'react'; -import { Text, Box, useFocus, DOMElement } from 'ink'; +import React, { type ComponentPropsWithRef } from 'react'; +import { Text, Box, useFocus, type DOMElement } from 'ink'; import TextInput from 'ink-text-input'; type InputProps = ComponentPropsWithRef & { diff --git a/packages/learn-card-bridge-http/cli/curriedStateSlice.ts b/packages/learn-card-bridge-http/cli/curriedStateSlice.ts index 6c86ec5236..385cad304a 100644 --- a/packages/learn-card-bridge-http/cli/curriedStateSlice.ts +++ b/packages/learn-card-bridge-http/cli/curriedStateSlice.ts @@ -1,8 +1,8 @@ -import { SetStateAction } from 'react'; -import produce, { Draft, castDraft } from 'immer'; -import { DraftFunction, Updater } from 'use-immer'; +import type { SetStateAction } from 'react'; +import produce, { castDraft, type Draft } from 'immer'; +import type { DraftFunction, Updater } from 'use-immer'; -import { SetState } from './types'; +import type { SetState } from './types'; // Inlined version of the hopefully one day npm package curriedStateSlice @@ -137,7 +137,7 @@ export const curriedInnerImmerOuterImmer = field: Field, value?: ValueArg ) => - innerImmerOuterImmer(setState, field, value); + innerImmerOuterImmer(setState, field, value!) as any; export function innerReactOuterImmer< State, @@ -194,6 +194,8 @@ export function innerReactOuterImmer< ? (value(oldState[field]) as Draft[Field]) : (value as Draft[Field]); }); + + return; } /** @@ -221,7 +223,7 @@ export const curriedInnerReactOuterImmer = field: Field, value?: ValueArg ) => - innerReactOuterImmer(setState, field, value); + innerReactOuterImmer(setState, field, value!) as any; export function innerImmerOuterReact< State, @@ -268,14 +270,16 @@ export function innerImmerOuterReact< if (value === undefined) { return (innerValue: NonNullable) => { if (innerValue instanceof Function) { - setState(produce(oldState => innerValue(oldState[field]))); + setState(produce((oldState: any) => innerValue(oldState[field]))); } else setState(oldState => ({ ...oldState, [field]: innerValue })); }; } if (value instanceof Function) { - setState(produce(oldState => value(oldState[field]))); + setState(produce((oldState: any) => value(oldState[field]))); } else setState(oldState => ({ ...oldState, [field]: value })); + + return; } /** @@ -308,7 +312,7 @@ export const curriedInnerImmerOuterReact = field: Field, value?: ValueArg ) => - innerImmerOuterReact(setState, field, value); + innerImmerOuterReact(setState, field, value!) as any; export function innerReactOuterReact< State, @@ -363,6 +367,8 @@ export function innerReactOuterReact< ...oldState, [field]: value instanceof Function ? value(oldState[field]) : value, })); + + return; } /** @@ -393,7 +399,7 @@ export const curriedInnerReactOuterReact = field: Field, value?: ValueArg ) => - innerReactOuterReact(setState, field, value); + innerReactOuterReact(setState, field, value!) as any; export function curriedStateSlice(setState: Updater): InnerImmerOuterImmer; export function curriedStateSlice( diff --git a/packages/learn-card-bridge-http/cli/types.ts b/packages/learn-card-bridge-http/cli/types.ts index a1effa2b7f..983f07cce5 100644 --- a/packages/learn-card-bridge-http/cli/types.ts +++ b/packages/learn-card-bridge-http/cli/types.ts @@ -1,4 +1,4 @@ -import { Dispatch, SetStateAction } from 'react'; +import type { Dispatch, SetStateAction } from 'react'; export type FormState = { name: string; diff --git a/packages/learn-card-bridge-http/lambda.ts b/packages/learn-card-bridge-http/lambda.ts index 5476b11a15..997241c08a 100644 --- a/packages/learn-card-bridge-http/lambda.ts +++ b/packages/learn-card-bridge-http/lambda.ts @@ -1,4 +1,4 @@ -import { APIGatewayProxyHandlerV2 } from 'aws-lambda'; +import type { APIGatewayProxyHandlerV2 } from 'aws-lambda'; import serverlessHttp from 'serverless-http'; import app from './src/app'; diff --git a/packages/learn-card-bridge-http/src/app.ts b/packages/learn-card-bridge-http/src/app.ts index ed712928f6..4d8c80dba7 100644 --- a/packages/learn-card-bridge-http/src/app.ts +++ b/packages/learn-card-bridge-http/src/app.ts @@ -1,17 +1,17 @@ import express from 'express'; import cors from 'cors'; -import { VP, VPValidator } from '@learncard/types'; +import { VPValidator, type VP } from '@learncard/types'; -import { TypedRequest } from './types.helpers'; +import type { TypedRequest } from './types.helpers'; import { - IssueEndpoint, IssueEndpointValidator, IssuePresentationEndpointValidator, - UpdateStatusEndpoint, - VerifyCredentialEndpoint, VerifyCredentialEndpointValidator, - VerifyPresentationEndpoint, VerifyPresentationEndpointValidator, + type IssueEndpoint, + type UpdateStatusEndpoint, + type VerifyCredentialEndpoint, + type VerifyPresentationEndpoint, } from './validators'; import { getLearnCard } from './learn-card'; @@ -57,9 +57,9 @@ app.post('/credentials/issue', async (req: TypedRequest, res) => if (!validationResult.success) { console.error( - '[/credentials/issue] Validation error: ', + '[/credentials/issue] Validation error:', validationResult.error.message, - '(received: ', + '(received:', req.body, ')' ); @@ -68,7 +68,7 @@ app.post('/credentials/issue', async (req: TypedRequest, res) => const validatedBody = validationResult.data; const learnCard = await getLearnCard(); - const { credentialStatus, ...options } = validatedBody.options ?? {}; + const { credentialStatus: _credentialStatus, ...options } = validatedBody.options ?? {}; const issuedCredential = await learnCard.invoke.issueCredential( validatedBody.credential, @@ -77,7 +77,7 @@ app.post('/credentials/issue', async (req: TypedRequest, res) => return res.status(201).json(issuedCredential); } catch (error) { - console.error('[/credentials/issue] Caught error: ', error, '(received: ', req.body); + console.error('[/credentials/issue] Caught error:', error, '(received:', req.body); return res.status(400).json(`Invalid input: ${error}`); } }); @@ -92,9 +92,9 @@ app.post('/credentials/verify', async (req: TypedRequest 0) { console.error( - '[/credentials/verify] Verification error(s): ', + '[/credentials/verify] Verification error(s):', verificationResult.errors, - '(received: ', + '(received:', req.body ); return res.status(400).json(verificationResult); @@ -126,7 +126,7 @@ app.post('/credentials/verify', async (req: TypedRequest, res) = if (!validationResult.success) { console.error( - '[/presentations/issue] Validation error: ', + '[/presentations/issue] Validation error:', validationResult.error.message, - '(received: ', + '(received:', req.body, ')' ); @@ -161,7 +161,7 @@ app.post('/presentations/issue', async (req: TypedRequest, res) = return res.status(201).json(issuedPresentation); } catch (error) { - console.error('[/presentations/issue] Caught error: ', error, '(received: ', req.body); + console.error('[/presentations/issue] Caught error:', error, '(received:', req.body); return res.status(400).json(`Invalid input: ${error}`); } }); @@ -172,9 +172,9 @@ app.post('/presentations/verify', async (req: TypedRequest 0) { console.error( - '[/presentations/verify] Verification error(s): ', + '[/presentations/verify] Verification error(s):', verificationResult.errors, - '(received: ', + '(received:', req.body ); return res.status(400).json(verificationResult); @@ -203,7 +203,7 @@ app.post('/presentations/verify', async (req: TypedRequest if (!validationResult.success) { console.error( - '[/exchanges/:uri] Validation error: ', + '[/exchanges/:uri] Validation error:', validationResult.error.message, - '(received: ', + '(received:', req.body, ')' ); @@ -252,9 +252,9 @@ app.post('/exchanges/:uri', async (req: TypedRequest if (verification.warnings.length > 0 || verification.errors.length > 0) { console.error( - '[/exchanges/:uri] Validation error: ', + '[/exchanges/:uri] Validation error:', verification, - '(received: ', + '(received:', req.body, ')' ); @@ -265,7 +265,7 @@ app.post('/exchanges/:uri', async (req: TypedRequest const subject = validatedBody.holder; - const credential = await learnCard.read.get(req.params.uri); + const credential = (await learnCard.read.get(req.params.uri))!; credential.issuer = { ...(typeof credential.issuer === 'string' ? {} : credential.issuer), @@ -277,13 +277,13 @@ app.post('/exchanges/:uri', async (req: TypedRequest credential.credentialSubject.id = subject; } - delete credential.proof; + delete (credential as any).proof; - const newVc = await learnCard.invoke.issueCredential(credential); + const newVc = await learnCard.invoke.issueCredential(credential as any); return res.status(201).json(newVc); } catch (error) { - console.error('[/exchanges/:uri] Caught error: ', error, '(received: ', req.body); + console.error('[/exchanges/:uri] Caught error:', error, '(received:', req.body); return res.status(400).json(`Invalid input: ${error}`); } }); diff --git a/packages/learn-card-bridge-http/src/learn-card.ts b/packages/learn-card-bridge-http/src/learn-card.ts index fec3aaca1b..0a7a1ba0b9 100644 --- a/packages/learn-card-bridge-http/src/learn-card.ts +++ b/packages/learn-card-bridge-http/src/learn-card.ts @@ -1,5 +1,4 @@ -import fs from 'fs/promises'; -import { initLearnCard, LearnCardFromSeed } from '@learncard/init'; +import { initLearnCard, type LearnCardFromSeed } from '@learncard/init'; import didkit from './didkit_wasm_bg.wasm'; export const getLearnCard = async (): Promise => { diff --git a/packages/learn-card-bridge-http/src/types.helpers.ts b/packages/learn-card-bridge-http/src/types.helpers.ts index 62dfcbb6c4..3fd2ee7d9c 100644 --- a/packages/learn-card-bridge-http/src/types.helpers.ts +++ b/packages/learn-card-bridge-http/src/types.helpers.ts @@ -1,7 +1,7 @@ -import Express from 'express'; -import { Query } from 'express-serve-static-core'; +import type Express from 'express'; +import type { Query } from 'express-serve-static-core'; -export interface TypedRequest extends Express.Request { +export type TypedRequest = { body: T; query: U; -} +} & Express.Request diff --git a/packages/learn-card-cli/src/index.tsx b/packages/learn-card-cli/src/index.tsx index 558bb114f1..9449e1f0ac 100644 --- a/packages/learn-card-cli/src/index.tsx +++ b/packages/learn-card-cli/src/index.tsx @@ -3,7 +3,8 @@ import dns from 'node:dns'; import repl from 'pretty-repl'; import { getTestCache } from '@learncard/core'; -import { initLearnCard, emptyLearnCard, learnCardFromSeed } from '@learncard/init'; +import { emptyLearnCard, learnCardFromSeed } from '@learncard/init'; +import { initLearnCard } from '@learncard/init'; import types from '@learncard/types'; import gradient from 'gradient-string'; import figlet from 'figlet'; diff --git a/packages/learn-card-core/aqu.config.ts b/packages/learn-card-core/aqu.config.ts index 85462d4a83..66b78f500a 100644 --- a/packages/learn-card-core/aqu.config.ts +++ b/packages/learn-card-core/aqu.config.ts @@ -1,4 +1,4 @@ -import { BuildOptions, Plugin } from 'esbuild'; +import { type BuildOptions } from 'esbuild'; import { copy } from 'esbuild-plugin-copy'; const buildOptions: BuildOptions = { diff --git a/packages/learn-card-core/package.json b/packages/learn-card-core/package.json index 375bde12db..3ac6fdd433 100644 --- a/packages/learn-card-core/package.json +++ b/packages/learn-card-core/package.json @@ -17,8 +17,7 @@ "scripts": { "build": "node ./scripts/build.mjs && shx cp ./scripts/mixedEntypoint.js ./dist/index.cjs && tsc --p tsconfig.build.json && tsc-alias", "start": "aqu watch", - "lint": "aqu lint", - "lint:fix": "aqu lint --fix", + "lint": "oxlint .", "test": "jest", "test:watch": "jest --watch", "test:coverage": "jest --silent --ci --coverage --coverageReporters=\"text\" --coverageReporters=\"text-summary\"" diff --git a/packages/learn-card-core/scripts/.eslintrc b/packages/learn-card-core/scripts/.eslintrc deleted file mode 100644 index 2097369a2f..0000000000 --- a/packages/learn-card-core/scripts/.eslintrc +++ /dev/null @@ -1,10 +0,0 @@ -{ - "root": false, - "env": { - "node": true - }, - "rules": { - "no-console": "off", - "@typescript-eslint/no-var-requires": "off" - } -} diff --git a/packages/learn-card-core/scripts/build.mjs b/packages/learn-card-core/scripts/build.mjs index 60ba154ba4..14dc220fc9 100644 --- a/packages/learn-card-core/scripts/build.mjs +++ b/packages/learn-card-core/scripts/build.mjs @@ -81,7 +81,7 @@ await Promise.all( }) ); -await Promise.all(configurations.map(config => esbuild.build(config))).catch(err => { +await Promise.all(configurations.map(config => esbuild.build(config))).catch(() => { console.error('❌ Build failed'); process.exit(1); }); diff --git a/packages/learn-card-core/src/index.ts b/packages/learn-card-core/src/index.ts index f9f6b675c2..8ea4edebed 100644 --- a/packages/learn-card-core/src/index.ts +++ b/packages/learn-card-core/src/index.ts @@ -1,5 +1,3 @@ -/// - import './polyfills'; export { LearnCard, Plugin } from 'types/wallet'; diff --git a/packages/learn-card-core/src/types/LearnCard.ts b/packages/learn-card-core/src/types/LearnCard.ts index 5c926a2432..ef75a0ffec 100644 --- a/packages/learn-card-core/src/types/LearnCard.ts +++ b/packages/learn-card-core/src/types/LearnCard.ts @@ -1,4 +1,4 @@ -import { LearnCard, Plugin } from 'types/wallet'; +import type { LearnCard, Plugin } from 'types/wallet'; export type GetPlugins> = LC['plugins']; diff --git a/packages/learn-card-core/src/types/planes.ts b/packages/learn-card-core/src/types/planes.ts index e68eaa8a3e..aaed2a0816 100644 --- a/packages/learn-card-core/src/types/planes.ts +++ b/packages/learn-card-core/src/types/planes.ts @@ -1,8 +1,8 @@ -import { CredentialRecord, VC, VP, JWKWithPrivateKey } from '@learncard/types'; -import { Query } from 'sift'; -import { Plugin } from './wallet'; -import { OmitNevers } from './helpers'; -import { DeepPartial } from './utilities'; +import type { CredentialRecord, VC, VP, JWKWithPrivateKey } from '@learncard/types'; +import type { Query } from 'sift'; +import type { Plugin } from './wallet'; +import type { OmitNevers } from './helpers'; +import type { DeepPartial } from './utilities'; export type CacheStrategy = 'cache-only' | 'cache-first' | 'skip-cache'; diff --git a/packages/learn-card-core/src/types/wallet.ts b/packages/learn-card-core/src/types/wallet.ts index 475076348f..8cbcd8b275 100644 --- a/packages/learn-card-core/src/types/wallet.ts +++ b/packages/learn-card-core/src/types/wallet.ts @@ -1,4 +1,4 @@ -import { +import type { ControlPlane, GetPlanesForPlugins, PluginReadPlane, @@ -14,7 +14,7 @@ import { LearnCardIdPlane, LearnCardContextPlane, } from './planes'; -import { UnionToIntersection, MergeObjects, IsAnyOrNever } from './utilities'; +import type { UnionToIntersection, MergeObjects, IsAnyOrNever } from './utilities'; export type GenerateLearnCard< NewControlPlanes extends ControlPlane = never, diff --git a/packages/learn-card-core/src/wallet/base/helpers.ts b/packages/learn-card-core/src/wallet/base/helpers.ts index 9ffaf6509f..9e9d346c22 100644 --- a/packages/learn-card-core/src/wallet/base/helpers.ts +++ b/packages/learn-card-core/src/wallet/base/helpers.ts @@ -1,5 +1,5 @@ -import { LearnCard, Plugin } from 'types/wallet'; -import { ControlPlane } from 'types/planes'; +import type { LearnCard, Plugin } from 'types/wallet'; +import type { ControlPlane } from 'types/planes'; /** Type guard for removing null/undefined */ export const isNotNull = (item?: T | null): item is T => !!item; diff --git a/packages/learn-card-core/src/wallet/base/wallet.ts b/packages/learn-card-core/src/wallet/base/wallet.ts index b796064782..6c807865fc 100644 --- a/packages/learn-card-core/src/wallet/base/wallet.ts +++ b/packages/learn-card-core/src/wallet/base/wallet.ts @@ -1,8 +1,8 @@ -import { CredentialRecord } from '@learncard/types'; -import { Query } from 'sift'; +import type { CredentialRecord } from '@learncard/types'; +import type { Query } from 'sift'; -import { Plugin, LearnCard, GetPluginMethods, AddImplicitLearnCardArgument } from 'types/wallet'; -import { +import type { Plugin, LearnCard, GetPluginMethods, AddImplicitLearnCardArgument } from 'types/wallet'; +import type { ControlPlane, GetPlanesForPlugins, GetPlaneProviders, @@ -484,7 +484,7 @@ const generateCachePlane = < const index = results.find(isFulfilledAndNotEmpty)?.value; return index; - } catch (error) { + } catch { return undefined; } }, @@ -536,7 +536,7 @@ const generateCachePlane = < const index = results.find(isFulfilledAndNotEmpty)?.value; return index; - } catch (error) { + } catch { return undefined; } }, @@ -585,7 +585,7 @@ const generateCachePlane = < const index = results.find(isFulfilledAndNotEmpty)?.value; return index; - } catch (error) { + } catch { return undefined; } }, @@ -636,7 +636,7 @@ const generateCachePlane = < const vc = results.find(isFulfilledAndNotEmpty)?.value; return vc; - } catch (error) { + } catch { return undefined; } }, @@ -690,7 +690,7 @@ const generateIdPlane = < if (!pluginImplementsPlane(plugin, 'id')) return undefined; return plugin.id.did(learnCard as any, method); - } catch (error) { + } catch { return undefined; } }); @@ -707,7 +707,7 @@ const generateIdPlane = < if (!pluginImplementsPlane(plugin, 'id')) return undefined; return plugin.id.keypair(learnCard as any, algorithm); - } catch (error) { + } catch { return undefined; } }); @@ -791,7 +791,7 @@ export const generateLearnCard = async < context: {} as LearnCardContextPlane, plugins: plugins as Plugins, invoke: pluginMethods, - addPlugin: function (plugin) { + addPlugin: function addPlugin(plugin) { return addPluginToLearnCard(this as any, plugin); }, debug: _learnCard.debug, diff --git a/packages/learn-card-core/src/wallet/plugins/test-cache/index.ts b/packages/learn-card-core/src/wallet/plugins/test-cache/index.ts index d3cea4309e..2b825a0452 100644 --- a/packages/learn-card-core/src/wallet/plugins/test-cache/index.ts +++ b/packages/learn-card-core/src/wallet/plugins/test-cache/index.ts @@ -1,5 +1,5 @@ -import { CredentialRecord, VC, VP } from '@learncard/types'; -import { TestCachePlugin } from './types'; +import type { CredentialRecord, VC, VP } from '@learncard/types'; +import type { TestCachePlugin } from './types'; export const getTestCache = (): TestCachePlugin => { let index: Record = {}; diff --git a/packages/learn-card-core/src/wallet/plugins/test-cache/types.ts b/packages/learn-card-core/src/wallet/plugins/test-cache/types.ts index 920f78eb61..c97c80d4f2 100644 --- a/packages/learn-card-core/src/wallet/plugins/test-cache/types.ts +++ b/packages/learn-card-core/src/wallet/plugins/test-cache/types.ts @@ -1,3 +1,3 @@ -import { Plugin } from 'types/wallet'; +import type { Plugin } from 'types/wallet'; export type TestCachePlugin = Plugin<'Test Cache', 'cache'>; diff --git a/packages/learn-card-core/src/wallet/plugins/test-index/index.ts b/packages/learn-card-core/src/wallet/plugins/test-index/index.ts index 4d108e6b44..dbe4e3cd43 100644 --- a/packages/learn-card-core/src/wallet/plugins/test-index/index.ts +++ b/packages/learn-card-core/src/wallet/plugins/test-index/index.ts @@ -1,5 +1,5 @@ -import { CredentialRecord, VC } from '@learncard/types'; -import { TestIndexPlugin } from './types'; +import type { CredentialRecord } from '@learncard/types'; +import type { TestIndexPlugin } from './types'; export const getTestIndex = (): TestIndexPlugin => { let index: CredentialRecord[] = []; diff --git a/packages/learn-card-core/src/wallet/plugins/test-index/types.ts b/packages/learn-card-core/src/wallet/plugins/test-index/types.ts index d3a35a2670..fac78ecd0e 100644 --- a/packages/learn-card-core/src/wallet/plugins/test-index/types.ts +++ b/packages/learn-card-core/src/wallet/plugins/test-index/types.ts @@ -1,3 +1,3 @@ -import { Plugin } from 'types/wallet'; +import { type Plugin } from 'types/wallet'; export type TestIndexPlugin = Plugin<'Test Index', 'index'>; diff --git a/packages/learn-card-core/src/wallet/plugins/test-storage/index.ts b/packages/learn-card-core/src/wallet/plugins/test-storage/index.ts index 669e3dfcfa..c52a9897ff 100644 --- a/packages/learn-card-core/src/wallet/plugins/test-storage/index.ts +++ b/packages/learn-card-core/src/wallet/plugins/test-storage/index.ts @@ -1,5 +1,5 @@ -import { CredentialRecord, VC, VP } from '@learncard/types'; -import { TestStoragePlugin } from './types'; +import type { CredentialRecord, VC, VP } from '@learncard/types'; +import type { TestStoragePlugin } from './types'; export const getTestStorage = (): TestStoragePlugin => { let index: CredentialRecord[] = []; diff --git a/packages/learn-card-core/src/wallet/plugins/test-storage/types.ts b/packages/learn-card-core/src/wallet/plugins/test-storage/types.ts index 2081c1bc16..18931304c6 100644 --- a/packages/learn-card-core/src/wallet/plugins/test-storage/types.ts +++ b/packages/learn-card-core/src/wallet/plugins/test-storage/types.ts @@ -1,3 +1,3 @@ -import { Plugin } from 'types/wallet'; +import type { Plugin } from 'types/wallet'; export type TestStoragePlugin = Plugin<'Test Storage', 'read' | 'store' | 'index'>; diff --git a/packages/learn-card-core/test/fixtures/vc.ts b/packages/learn-card-core/test/fixtures/vc.ts index 3d47160472..77a29f8a22 100644 --- a/packages/learn-card-core/test/fixtures/vc.ts +++ b/packages/learn-card-core/test/fixtures/vc.ts @@ -1,4 +1,4 @@ -import { VC } from '@learncard/types'; +import type { VC } from '@learncard/types'; export const testVc: VC = { '@context': ['https://www.w3.org/2018/credentials/v1'], diff --git a/packages/learn-card-helpers/package.json b/packages/learn-card-helpers/package.json index 03674d31f7..ec796fa504 100644 --- a/packages/learn-card-helpers/package.json +++ b/packages/learn-card-helpers/package.json @@ -10,8 +10,7 @@ "scripts": { "build": "node ./scripts/build.mjs && shx cp ./scripts/mixedEntypoint.js ./dist/index.js && dts-bundle-generator src/index.ts -o dist/helpers.d.ts --no-check", "start": "aqu watch", - "lint": "aqu lint", - "lint:fix": "aqu lint --fix", + "lint": "oxlint .", "test": "jest", "test:watch": "jest --watch", "test:coverage": "jest --silent --ci --coverage --coverageReporters=\"text\" --coverageReporters=\"text-summary\"" diff --git a/packages/learn-card-helpers/scripts/.eslintrc b/packages/learn-card-helpers/scripts/.eslintrc deleted file mode 100644 index 2b88e1c5e2..0000000000 --- a/packages/learn-card-helpers/scripts/.eslintrc +++ /dev/null @@ -1,10 +0,0 @@ -{ - "root": false, - "env": { - "node": true - }, - "rules": { - "no-console": "off", - "@typescript-eslint/no-var-requires": "off" - } -} \ No newline at end of file diff --git a/packages/learn-card-helpers/scripts/build.mjs b/packages/learn-card-helpers/scripts/build.mjs index 43d873e7b0..beb079cc94 100644 --- a/packages/learn-card-helpers/scripts/build.mjs +++ b/packages/learn-card-helpers/scripts/build.mjs @@ -1,5 +1,4 @@ import path from 'path'; -import fs from 'fs/promises'; import esbuild from 'esbuild'; import { NodeResolvePlugin } from '@esbuild-plugins/node-resolve'; @@ -7,7 +6,7 @@ import rimraf from 'rimraf'; const nodeResolveExternal = NodeResolvePlugin({ extensions: ['.ts', '.js', '.tsx', '.jsx', '.cjs', '.mjs'], - onResolved: (resolved) => { + onResolved: resolved => { if (resolved.includes('node_modules')) { return { external: true, @@ -56,7 +55,7 @@ const configurations = [ function asyncRimraf(path) { return new Promise((resolve, reject) => { - rimraf(path, (err) => { + rimraf(path, err => { if (err) { reject(err); } else { @@ -67,20 +66,18 @@ function asyncRimraf(path) { } await Promise.all( - configurations.map(async (config) => { + configurations.map(async config => { var dir = config.outdir || path.dirname(config.outfile); await asyncRimraf(dir).catch(() => { console.log('Unable to delete directory', dir); }); - }), + }) ); -await Promise.all(configurations.map((config) => esbuild.build(config))).catch( - (err) => { - console.error('❌ Build failed'); - process.exit(1); - }, -); +await Promise.all(configurations.map(config => esbuild.build(config))).catch(() => { + console.error('❌ Build failed'); + process.exit(1); +}); console.log('✔ Build successful'); process.exit(0); diff --git a/packages/learn-card-helpers/src/index.ts b/packages/learn-card-helpers/src/index.ts index 7a162e51cc..438ee4caea 100644 --- a/packages/learn-card-helpers/src/index.ts +++ b/packages/learn-card-helpers/src/index.ts @@ -1,4 +1,4 @@ -import { JWE, JWEValidator } from '@learncard/types'; +import { JWEValidator, type JWE } from '@learncard/types'; import type { DataTransformer } from '@trpc/server'; /** diff --git a/packages/learn-card-init/aqu.config.ts b/packages/learn-card-init/aqu.config.ts index ca7726864d..63d22e51cb 100644 --- a/packages/learn-card-init/aqu.config.ts +++ b/packages/learn-card-init/aqu.config.ts @@ -1,4 +1,4 @@ -import { BuildOptions, Plugin } from 'esbuild'; +import { type BuildOptions } from 'esbuild'; import { copy } from 'esbuild-plugin-copy'; const buildOptions: BuildOptions = { diff --git a/packages/learn-card-init/package.json b/packages/learn-card-init/package.json index 49eaea8602..c91663cd3c 100644 --- a/packages/learn-card-init/package.json +++ b/packages/learn-card-init/package.json @@ -17,8 +17,7 @@ "scripts": { "build": "node ./scripts/build.mjs && shx cp ./scripts/mixedEntypoint.js ./dist/index.cjs && tsc --p tsconfig.build.json", "start": "aqu watch", - "lint": "aqu lint", - "lint:fix": "aqu lint --fix", + "lint": "oxlint .", "test": "vitest" }, "author": "Learning Economy Foundation (www.learningeconomy.io)", diff --git a/packages/learn-card-init/scripts/.eslintrc b/packages/learn-card-init/scripts/.eslintrc deleted file mode 100644 index 2097369a2f..0000000000 --- a/packages/learn-card-init/scripts/.eslintrc +++ /dev/null @@ -1,10 +0,0 @@ -{ - "root": false, - "env": { - "node": true - }, - "rules": { - "no-console": "off", - "@typescript-eslint/no-var-requires": "off" - } -} diff --git a/packages/learn-card-init/scripts/build.mjs b/packages/learn-card-init/scripts/build.mjs index 00846baa49..11152240ce 100644 --- a/packages/learn-card-init/scripts/build.mjs +++ b/packages/learn-card-init/scripts/build.mjs @@ -1,23 +1,9 @@ import path from 'path'; -import fs from 'fs/promises'; import esbuild from 'esbuild'; import { copy } from 'esbuild-plugin-copy'; -import { NodeResolvePlugin } from '@esbuild-plugins/node-resolve'; import rimraf from 'rimraf'; -const nodeResolveExternal = NodeResolvePlugin({ - extensions: ['.ts', '.js', '.tsx', '.jsx', '.cjs', '.mjs'], - onResolved: resolved => { - if (resolved.includes('node_modules')) { - return { - external: true, - }; - } - return resolved; - }, -}); - const buildOptions = { // target: 'es6', target: 'es2020', @@ -102,7 +88,7 @@ await Promise.all( }) ); -await Promise.all(configurations.map(config => esbuild.build(config))).catch(err => { +await Promise.all(configurations.map(config => esbuild.build(config))).catch(() => { console.error('❌ Build failed'); process.exit(1); }); diff --git a/packages/learn-card-init/src/defaults.ts b/packages/learn-card-init/src/defaults.ts index d403562914..aa5d34f25a 100644 --- a/packages/learn-card-init/src/defaults.ts +++ b/packages/learn-card-init/src/defaults.ts @@ -1,4 +1,4 @@ -import { EthereumConfig } from '@learncard/ethereum-plugin'; +import type { EthereumConfig } from '@learncard/ethereum-plugin'; export const defaultEthereumArgs: EthereumConfig = { infuraProjectId: '', diff --git a/packages/learn-card-init/src/init.ts b/packages/learn-card-init/src/init.ts index eace2bb8f6..cdccb1ca63 100644 --- a/packages/learn-card-init/src/init.ts +++ b/packages/learn-card-init/src/init.ts @@ -6,7 +6,7 @@ import { didWebLearnCardFromSeed } from './initializers/didWebLearnCardFromSeed' import { didWebNetworkLearnCardFromSeed } from './initializers/didWebNetworkLearnCardFromSeed'; import { learnCardFromApiUrl } from './initializers/apiLearnCard'; -import { +import type { InitLearnCard, EmptyLearnCard, LearnCardFromSeed, diff --git a/packages/learn-card-init/src/initializers/apiLearnCard.ts b/packages/learn-card-init/src/initializers/apiLearnCard.ts index 15cca563ef..890327204c 100644 --- a/packages/learn-card-init/src/initializers/apiLearnCard.ts +++ b/packages/learn-card-init/src/initializers/apiLearnCard.ts @@ -6,7 +6,7 @@ import { getVCTemplatesPlugin } from '@learncard/vc-templates-plugin'; import { getCHAPIPlugin } from '@learncard/chapi-plugin'; import { getLearnCardPlugin } from '@learncard/learn-card-plugin'; -import { LearnCardFromVcApi } from '../types/LearnCard'; +import type { LearnCardFromVcApi } from '../types/LearnCard'; /** * Generates a LearnCard Wallet from a 64 character seed string diff --git a/packages/learn-card-init/src/initializers/customLearnCard.ts b/packages/learn-card-init/src/initializers/customLearnCard.ts index e12b9d488a..74fcc4dd23 100644 --- a/packages/learn-card-init/src/initializers/customLearnCard.ts +++ b/packages/learn-card-init/src/initializers/customLearnCard.ts @@ -1,5 +1,5 @@ import { generateLearnCard } from '@learncard/core'; -import { CustomLearnCard } from '../types/LearnCard'; +import type { CustomLearnCard } from '../types/LearnCard'; /** * Generates a custom LearnCard with no plugins added diff --git a/packages/learn-card-init/src/initializers/didWebLearnCardFromSeed.ts b/packages/learn-card-init/src/initializers/didWebLearnCardFromSeed.ts index b385abd69e..dbf4f44002 100644 --- a/packages/learn-card-init/src/initializers/didWebLearnCardFromSeed.ts +++ b/packages/learn-card-init/src/initializers/didWebLearnCardFromSeed.ts @@ -1,7 +1,7 @@ import { generateLearnCard } from '@learncard/core'; import { DynamicLoaderPlugin } from '@learncard/dynamic-loader-plugin'; import { CryptoPlugin } from '@learncard/crypto-plugin'; -import { DidMethod, getDidKitPlugin } from '@learncard/didkit-plugin'; +import { getDidKitPlugin, type DidMethod } from '@learncard/didkit-plugin'; import { getDidKeyPlugin } from '@learncard/didkey-plugin'; import { getEncryptionPlugin } from '@learncard/encryption-plugin'; import { getVCPlugin } from '@learncard/vc-plugin'; @@ -14,7 +14,7 @@ import { getCHAPIPlugin } from '@learncard/chapi-plugin'; import { getLearnCardPlugin } from '@learncard/learn-card-plugin'; import { getDidWebPlugin } from '@learncard/did-web-plugin'; -import { DidWebLearnCardFromSeed } from '../types/LearnCard'; +import type { DidWebLearnCardFromSeed } from '../types/LearnCard'; import { defaultEthereumArgs } from '../defaults'; /** diff --git a/packages/learn-card-init/src/initializers/didWebNetworkLearnCardFromSeed.ts b/packages/learn-card-init/src/initializers/didWebNetworkLearnCardFromSeed.ts index d00d64aecb..1706fbf967 100644 --- a/packages/learn-card-init/src/initializers/didWebNetworkLearnCardFromSeed.ts +++ b/packages/learn-card-init/src/initializers/didWebNetworkLearnCardFromSeed.ts @@ -1,7 +1,7 @@ import { generateLearnCard } from '@learncard/core'; import { DynamicLoaderPlugin } from '@learncard/dynamic-loader-plugin'; import { CryptoPlugin } from '@learncard/crypto-plugin'; -import { DidMethod, getDidKitPlugin } from '@learncard/didkit-plugin'; +import { getDidKitPlugin, type DidMethod } from '@learncard/didkit-plugin'; import { getDidKeyPlugin } from '@learncard/didkey-plugin'; import { getEncryptionPlugin } from '@learncard/encryption-plugin'; import { getVCPlugin } from '@learncard/vc-plugin'; @@ -15,7 +15,7 @@ import { getVerifyBoostPlugin, getLearnCardNetworkPlugin } from '@learncard/netw import { getLearnCardPlugin } from '@learncard/learn-card-plugin'; import { getDidWebPlugin } from '@learncard/did-web-plugin'; -import { DidWebNetworkLearnCardFromSeed } from '../types/LearnCard'; +import type { DidWebNetworkLearnCardFromSeed } from '../types/LearnCard'; import { defaultEthereumArgs } from '../defaults'; /** diff --git a/packages/learn-card-init/src/initializers/emptyLearnCard.ts b/packages/learn-card-init/src/initializers/emptyLearnCard.ts index 7ad1f4f44b..b4f757fdd4 100644 --- a/packages/learn-card-init/src/initializers/emptyLearnCard.ts +++ b/packages/learn-card-init/src/initializers/emptyLearnCard.ts @@ -7,7 +7,7 @@ import { getVCTemplatesPlugin } from '@learncard/vc-templates-plugin'; import { getCHAPIPlugin } from '@learncard/chapi-plugin'; import { getLearnCardPlugin } from '@learncard/learn-card-plugin'; -import { EmptyLearnCard } from '../types/LearnCard'; +import type { EmptyLearnCard } from '../types/LearnCard'; /** * Generates an empty wallet with no key material diff --git a/packages/learn-card-init/src/initializers/learnCardFromSeed.ts b/packages/learn-card-init/src/initializers/learnCardFromSeed.ts index 6aff585904..2993e3d254 100644 --- a/packages/learn-card-init/src/initializers/learnCardFromSeed.ts +++ b/packages/learn-card-init/src/initializers/learnCardFromSeed.ts @@ -1,7 +1,7 @@ import { generateLearnCard } from '@learncard/core'; import { DynamicLoaderPlugin } from '@learncard/dynamic-loader-plugin'; import { CryptoPlugin } from '@learncard/crypto-plugin'; -import { DidMethod, getDidKitPlugin } from '@learncard/didkit-plugin'; +import { getDidKitPlugin, type DidMethod } from '@learncard/didkit-plugin'; import { getDidKeyPlugin } from '@learncard/didkey-plugin'; import { getEncryptionPlugin } from '@learncard/encryption-plugin'; import { getVCPlugin } from '@learncard/vc-plugin'; @@ -13,7 +13,7 @@ import { getVpqrPlugin } from '@learncard/vpqr-plugin'; import { getCHAPIPlugin } from '@learncard/chapi-plugin'; import { getLearnCardPlugin } from '@learncard/learn-card-plugin'; -import { LearnCardFromSeed } from '../types/LearnCard'; +import type { LearnCardFromSeed } from '../types/LearnCard'; import { defaultEthereumArgs } from '../defaults'; /** diff --git a/packages/learn-card-init/src/initializers/networkLearnCardFromSeed.ts b/packages/learn-card-init/src/initializers/networkLearnCardFromSeed.ts index d75caae0c3..732eee4526 100644 --- a/packages/learn-card-init/src/initializers/networkLearnCardFromSeed.ts +++ b/packages/learn-card-init/src/initializers/networkLearnCardFromSeed.ts @@ -1,7 +1,7 @@ import { generateLearnCard } from '@learncard/core'; import { DynamicLoaderPlugin } from '@learncard/dynamic-loader-plugin'; import { CryptoPlugin } from '@learncard/crypto-plugin'; -import { DidMethod, getDidKitPlugin } from '@learncard/didkit-plugin'; +import { getDidKitPlugin, type DidMethod } from '@learncard/didkit-plugin'; import { getDidKeyPlugin } from '@learncard/didkey-plugin'; import { getEncryptionPlugin } from '@learncard/encryption-plugin'; import { getVCPlugin } from '@learncard/vc-plugin'; @@ -14,7 +14,7 @@ import { getCHAPIPlugin } from '@learncard/chapi-plugin'; import { getVerifyBoostPlugin, getLearnCardNetworkPlugin } from '@learncard/network-plugin'; import { getLearnCardPlugin } from '@learncard/learn-card-plugin'; -import { NetworkLearnCardFromSeed } from '../types/LearnCard'; +import type { NetworkLearnCardFromSeed } from '../types/LearnCard'; import { defaultEthereumArgs } from '../defaults'; /** diff --git a/packages/learn-card-init/src/types/LearnCard.ts b/packages/learn-card-init/src/types/LearnCard.ts index 1129b42d8c..88b504cef6 100644 --- a/packages/learn-card-init/src/types/LearnCard.ts +++ b/packages/learn-card-init/src/types/LearnCard.ts @@ -1,24 +1,24 @@ -import { LearnCard } from '@learncard/core'; -import { InitInput } from '@learncard/types'; +import type { LearnCard } from '@learncard/core'; +import type { InitInput } from '@learncard/types'; -import { CryptoPluginType } from '@learncard/crypto-plugin'; -import { DIDKitPlugin, DidMethod } from '@learncard/didkit-plugin'; -import { DidKeyPlugin } from '@learncard/didkey-plugin'; -import { DynamicLoaderPluginType } from '@learncard/dynamic-loader-plugin'; -import { VCPlugin } from '@learncard/vc-plugin'; -import { VCTemplatePlugin } from '@learncard/vc-templates-plugin'; -import { LearnCloudPlugin } from '@learncard/learn-cloud-plugin'; -import { ExpirationPlugin } from '@learncard/expiration-plugin'; -import { EthereumPlugin, EthereumConfig } from '@learncard/ethereum-plugin'; -import { VpqrPlugin } from '@learncard/vpqr-plugin'; -import { CHAPIPlugin } from '@learncard/chapi-plugin'; -import { VCAPIPlugin } from '@learncard/vc-api-plugin'; -import { LearnCardPlugin } from '@learncard/learn-card-plugin'; -import { VerifyBoostPlugin, LearnCardNetworkPlugin } from '@learncard/network-plugin'; -import { DidWebPlugin } from '@learncard/did-web-plugin'; -import { EncryptionPluginType } from '@learncard/encryption-plugin'; +import type { CryptoPluginType } from '@learncard/crypto-plugin'; +import type { DIDKitPlugin, DidMethod } from '@learncard/didkit-plugin'; +import type { DidKeyPlugin } from '@learncard/didkey-plugin'; +import type { DynamicLoaderPluginType } from '@learncard/dynamic-loader-plugin'; +import type { VCPlugin } from '@learncard/vc-plugin'; +import type { VCTemplatePlugin } from '@learncard/vc-templates-plugin'; +import type { LearnCloudPlugin } from '@learncard/learn-cloud-plugin'; +import type { ExpirationPlugin } from '@learncard/expiration-plugin'; +import type { EthereumPlugin, EthereumConfig } from '@learncard/ethereum-plugin'; +import type { VpqrPlugin } from '@learncard/vpqr-plugin'; +import type { CHAPIPlugin } from '@learncard/chapi-plugin'; +import type { VCAPIPlugin } from '@learncard/vc-api-plugin'; +import type { LearnCardPlugin } from '@learncard/learn-card-plugin'; +import type { VerifyBoostPlugin, LearnCardNetworkPlugin } from '@learncard/network-plugin'; +import type { DidWebPlugin } from '@learncard/did-web-plugin'; +import type { EncryptionPluginType } from '@learncard/encryption-plugin'; -import { InitFunction, GenericInitFunction } from './helpers'; +import type { InitFunction, GenericInitFunction } from './helpers'; /** @group LearnCard */ export type LearnCardConfig = { diff --git a/packages/learn-card-init/src/types/helpers.ts b/packages/learn-card-init/src/types/helpers.ts index 96e5c136d0..cd2b767fc6 100644 --- a/packages/learn-card-init/src/types/helpers.ts +++ b/packages/learn-card-init/src/types/helpers.ts @@ -1,5 +1,5 @@ -import { LearnCardConfig } from './LearnCard'; -import { LearnCard } from '@learncard/core'; +import type { LearnCardConfig } from './LearnCard'; +import type { LearnCard } from '@learncard/core'; export type InitFunction< Args extends Record = Record, diff --git a/packages/learn-card-init/test/build-step/test-types.ts b/packages/learn-card-init/test/build-step/test-types.ts deleted file mode 100644 index 6f74fa9a47..0000000000 --- a/packages/learn-card-init/test/build-step/test-types.ts +++ /dev/null @@ -1,18 +0,0 @@ -// /Users/jackson/Documents/Projects/LEStudios/LearnCard/packages/learn-card-init/test-types.ts - -// This import should resolve to your local package's types if your tsconfig is set up -// or if you're testing in a way that mimics a consumer. -// For a quick local check, you might point directly to the built types, -// but ideally, you'd test this in a separate project that `npm link`s this one. - -// Assuming your package is linked or you are in a context where '@learncard/init' resolves -// to the current package. For a direct check: -import { initializeLearnCard } from '../../dist/index.d.ts'; // or just './dist' if index.d.ts exports everything - -// Check if the types are recognized -// const result = initializeLearnCard({ /* options if any */ }); // Example usage - -// If initializeLearnCard is a function, this should not cause a type error: -let myFunc: typeof initializeLearnCard; - -console.log('TypeScript can see the exports (compile-time check).'); diff --git a/packages/learn-card-init/test/mocks/persistence.ts b/packages/learn-card-init/test/mocks/persistence.ts index a61ef1f981..ed85f92679 100644 --- a/packages/learn-card-init/test/mocks/persistence.ts +++ b/packages/learn-card-init/test/mocks/persistence.ts @@ -1,4 +1,4 @@ -import { VC, CredentialRecord } from '@learncard/types'; +import type { VC, CredentialRecord } from '@learncard/types'; export const persistenceMocks = () => { let credentials: CredentialRecord[] = []; diff --git a/packages/learn-card-network/brain-client/scripts/.eslintrc b/packages/learn-card-network/brain-client/scripts/.eslintrc deleted file mode 100644 index 2b88e1c5e2..0000000000 --- a/packages/learn-card-network/brain-client/scripts/.eslintrc +++ /dev/null @@ -1,10 +0,0 @@ -{ - "root": false, - "env": { - "node": true - }, - "rules": { - "no-console": "off", - "@typescript-eslint/no-var-requires": "off" - } -} \ No newline at end of file diff --git a/packages/learn-card-network/brain-client/scripts/build.mjs b/packages/learn-card-network/brain-client/scripts/build.mjs index 596b287b3e..8584316fbe 100644 --- a/packages/learn-card-network/brain-client/scripts/build.mjs +++ b/packages/learn-card-network/brain-client/scripts/build.mjs @@ -1,9 +1,10 @@ import path from 'path'; import esbuild from 'esbuild'; -import { NodeResolvePlugin } from '@esbuild-plugins/node-resolve'; import rimraf from 'rimraf'; +import { NodeResolvePlugin } from '@esbuild-plugins/node-resolve'; + const nodeResolveExternal = NodeResolvePlugin({ extensions: ['.ts', '.js', '.tsx', '.jsx', '.cjs', '.mjs'], onResolved: resolved => { @@ -74,7 +75,7 @@ await Promise.all( }) ); -await Promise.all(configurations.map(config => esbuild.build(config))).catch(err => { +await Promise.all(configurations.map(config => esbuild.build(config))).catch(() => { console.error('❌ Build failed'); process.exit(1); }); diff --git a/packages/learn-card-network/brain-client/src/callbackLink.ts b/packages/learn-card-network/brain-client/src/callbackLink.ts index 35285ab966..73ea89478e 100644 --- a/packages/learn-card-network/brain-client/src/callbackLink.ts +++ b/packages/learn-card-network/brain-client/src/callbackLink.ts @@ -1,5 +1,5 @@ -import { TRPCLink } from '@trpc/client'; -import { observable, Unsubscribable } from '@trpc/server/observable'; +import type { TRPCLink } from '@trpc/client'; +import { observable, type Unsubscribable } from '@trpc/server/observable'; import type { AppRouter } from '@learncard/network-brain-service'; export const callbackLink = (callback: () => Promise): TRPCLink => { diff --git a/packages/learn-card-network/brain-client/src/index.ts b/packages/learn-card-network/brain-client/src/index.ts index 670c59d4ea..3fe90803e4 100644 --- a/packages/learn-card-network/brain-client/src/index.ts +++ b/packages/learn-card-network/brain-client/src/index.ts @@ -1,5 +1,5 @@ import { RegExpTransformer } from '@learncard/helpers'; -import { createTRPCClient, TRPCClient, httpBatchLink } from '@trpc/client'; +import { createTRPCClient, httpBatchLink, type TRPCClient } from '@trpc/client'; import type { AppRouter } from '@learncard/network-brain-service'; import { callbackLink } from './callbackLink'; diff --git a/packages/learn-card-network/cloud-client/scripts/.eslintrc b/packages/learn-card-network/cloud-client/scripts/.eslintrc deleted file mode 100644 index 2b88e1c5e2..0000000000 --- a/packages/learn-card-network/cloud-client/scripts/.eslintrc +++ /dev/null @@ -1,10 +0,0 @@ -{ - "root": false, - "env": { - "node": true - }, - "rules": { - "no-console": "off", - "@typescript-eslint/no-var-requires": "off" - } -} \ No newline at end of file diff --git a/packages/learn-card-network/cloud-client/scripts/build.mjs b/packages/learn-card-network/cloud-client/scripts/build.mjs index 181f5688ae..21ca571606 100644 --- a/packages/learn-card-network/cloud-client/scripts/build.mjs +++ b/packages/learn-card-network/cloud-client/scripts/build.mjs @@ -1,9 +1,10 @@ import path from 'path'; import esbuild from 'esbuild'; -import { NodeResolvePlugin } from '@esbuild-plugins/node-resolve'; import rimraf from 'rimraf'; +import { NodeResolvePlugin } from '@esbuild-plugins/node-resolve'; + const nodeResolveExternal = NodeResolvePlugin({ extensions: ['.ts', '.js', '.tsx', '.jsx', '.cjs', '.mjs'], onResolved: resolved => { @@ -74,7 +75,7 @@ await Promise.all( }) ); -await Promise.all(configurations.map(config => esbuild.build(config))).catch(err => { +await Promise.all(configurations.map(config => esbuild.build(config))).catch(() => { console.error('❌ Build failed'); process.exit(1); }); diff --git a/packages/learn-card-network/cloud-client/src/callbackLink.ts b/packages/learn-card-network/cloud-client/src/callbackLink.ts index 0410a7bc71..c02a172d20 100644 --- a/packages/learn-card-network/cloud-client/src/callbackLink.ts +++ b/packages/learn-card-network/cloud-client/src/callbackLink.ts @@ -1,5 +1,5 @@ -import { TRPCLink } from '@trpc/client'; -import { observable, Unsubscribable } from '@trpc/server/observable'; +import type { TRPCLink } from '@trpc/client'; +import { observable, type Unsubscribable } from '@trpc/server/observable'; import type { AppRouter } from '@learncard/learn-cloud-service'; export const callbackLink = (callback: () => Promise): TRPCLink => { diff --git a/packages/learn-card-network/cloud-client/src/index.ts b/packages/learn-card-network/cloud-client/src/index.ts index 6e1649f76a..02e710bfe3 100644 --- a/packages/learn-card-network/cloud-client/src/index.ts +++ b/packages/learn-card-network/cloud-client/src/index.ts @@ -1,4 +1,4 @@ -import { createTRPCClient, TRPCClient, httpBatchLink } from '@trpc/client'; +import { createTRPCClient, httpBatchLink, type TRPCClient } from '@trpc/client'; import type { AppRouter } from '@learncard/learn-cloud-service'; import { callbackLink } from './callbackLink'; diff --git a/packages/learn-card-network/simple-signing-client/scripts/.eslintrc b/packages/learn-card-network/simple-signing-client/scripts/.eslintrc deleted file mode 100644 index 2b88e1c5e2..0000000000 --- a/packages/learn-card-network/simple-signing-client/scripts/.eslintrc +++ /dev/null @@ -1,10 +0,0 @@ -{ - "root": false, - "env": { - "node": true - }, - "rules": { - "no-console": "off", - "@typescript-eslint/no-var-requires": "off" - } -} \ No newline at end of file diff --git a/packages/learn-card-network/simple-signing-client/scripts/build.mjs b/packages/learn-card-network/simple-signing-client/scripts/build.mjs index b99f2edf44..5bf8cdac6b 100644 --- a/packages/learn-card-network/simple-signing-client/scripts/build.mjs +++ b/packages/learn-card-network/simple-signing-client/scripts/build.mjs @@ -1,9 +1,10 @@ import path from 'path'; import esbuild from 'esbuild'; -import { NodeResolvePlugin } from '@esbuild-plugins/node-resolve'; import rimraf from 'rimraf'; +import { NodeResolvePlugin } from '@esbuild-plugins/node-resolve'; + const nodeResolveExternal = NodeResolvePlugin({ extensions: ['.ts', '.js', '.tsx', '.jsx', '.cjs', '.mjs'], onResolved: resolved => { @@ -79,7 +80,7 @@ function main() { console.log('✔ Build successful'); process.exit(0); }) - .catch(err => { + .catch(() => { console.error('❌ Build failed'); process.exit(1); }); diff --git a/packages/learn-card-network/simple-signing-client/src/callbackLink.ts b/packages/learn-card-network/simple-signing-client/src/callbackLink.ts index 5a31bc9086..77f323807d 100644 --- a/packages/learn-card-network/simple-signing-client/src/callbackLink.ts +++ b/packages/learn-card-network/simple-signing-client/src/callbackLink.ts @@ -1,5 +1,5 @@ -import { TRPCLink } from '@trpc/client'; -import { observable, Unsubscribable } from '@trpc/server/observable'; +import type { TRPCLink } from '@trpc/client'; +import { observable, type Unsubscribable } from '@trpc/server/observable'; import type { AppRouter } from '@learncard/simple-signing-service'; export const callbackLink = (callback: () => Promise): TRPCLink => { diff --git a/packages/learn-card-network/simple-signing-client/src/index.ts b/packages/learn-card-network/simple-signing-client/src/index.ts index 07fac36ea2..449e94223a 100644 --- a/packages/learn-card-network/simple-signing-client/src/index.ts +++ b/packages/learn-card-network/simple-signing-client/src/index.ts @@ -1,4 +1,4 @@ -import { createTRPCProxyClient, CreateTRPCProxyClient, httpBatchLink } from '@trpc/client'; +import { createTRPCProxyClient, httpBatchLink, type CreateTRPCProxyClient } from '@trpc/client'; import type { AppRouter } from '@learncard/simple-signing-service'; import { callbackLink } from './callbackLink'; diff --git a/packages/learn-card-types/scripts/.eslintrc b/packages/learn-card-types/scripts/.eslintrc deleted file mode 100644 index 2b88e1c5e2..0000000000 --- a/packages/learn-card-types/scripts/.eslintrc +++ /dev/null @@ -1,10 +0,0 @@ -{ - "root": false, - "env": { - "node": true - }, - "rules": { - "no-console": "off", - "@typescript-eslint/no-var-requires": "off" - } -} \ No newline at end of file diff --git a/packages/learn-card-types/scripts/build.mjs b/packages/learn-card-types/scripts/build.mjs index 600c71bd61..37f6a13247 100644 --- a/packages/learn-card-types/scripts/build.mjs +++ b/packages/learn-card-types/scripts/build.mjs @@ -1,9 +1,10 @@ import path from 'path'; import esbuild from 'esbuild'; -import { NodeResolvePlugin } from '@esbuild-plugins/node-resolve'; import rimraf from 'rimraf'; +import { NodeResolvePlugin } from '@esbuild-plugins/node-resolve'; + const nodeResolveExternal = NodeResolvePlugin({ extensions: ['.ts', '.js', '.tsx', '.jsx', '.cjs', '.mjs'], onResolved: resolved => { @@ -71,7 +72,7 @@ await Promise.all( }) ); -await Promise.all(configurations.map(config => esbuild.build(config))).catch(err => { +await Promise.all(configurations.map(config => esbuild.build(config))).catch(() => { console.error('❌ Build failed'); process.exit(1); }); diff --git a/packages/plugins/ceramic/scripts/.eslintrc b/packages/plugins/ceramic/scripts/.eslintrc deleted file mode 100644 index 2b88e1c5e2..0000000000 --- a/packages/plugins/ceramic/scripts/.eslintrc +++ /dev/null @@ -1,10 +0,0 @@ -{ - "root": false, - "env": { - "node": true - }, - "rules": { - "no-console": "off", - "@typescript-eslint/no-var-requires": "off" - } -} \ No newline at end of file diff --git a/packages/plugins/ceramic/scripts/build.mjs b/packages/plugins/ceramic/scripts/build.mjs index 8d4c45f50c..df03c916d6 100644 --- a/packages/plugins/ceramic/scripts/build.mjs +++ b/packages/plugins/ceramic/scripts/build.mjs @@ -71,7 +71,7 @@ await Promise.all( }) ); -await Promise.all(configurations.map(config => esbuild.build(config))).catch(err => { +await Promise.all(configurations.map(config => esbuild.build(config))).catch(() => { console.error('❌ Build failed'); process.exit(1); }); diff --git a/packages/plugins/ceramic/src/ceramic.ts b/packages/plugins/ceramic/src/ceramic.ts index 08bf2027a0..32b717dde6 100644 --- a/packages/plugins/ceramic/src/ceramic.ts +++ b/packages/plugins/ceramic/src/ceramic.ts @@ -1,26 +1,25 @@ import _ from 'lodash'; -import { DID, DIDResolutionResult } from 'dids'; +import { DID, type DIDResolutionResult } from 'dids'; import type { JWE } from 'did-jwt'; import { toUint8Array } from 'hex-lite'; import KeyDidResolver from 'key-did-resolver'; import { Ed25519Provider } from 'key-did-provider-ed25519'; import { TileLoader } from '@glazed/tile-loader'; import { CeramicClient } from '@ceramicnetwork/http-client'; -import { CreateOpts } from '@ceramicnetwork/common'; -import { TileDocument, TileMetadataArgs } from '@ceramicnetwork/stream-tile'; -import { LearnCard } from '@learncard/core'; -import { InputMetadata } from '@learncard/didkit-plugin'; -import { VCValidator, VC, VPValidator, VP } from '@learncard/types'; +import type { CreateOpts } from '@ceramicnetwork/common'; +import { TileDocument, type TileMetadataArgs } from '@ceramicnetwork/stream-tile'; +import type { LearnCard } from '@learncard/core'; +import type { InputMetadata } from '@learncard/didkit-plugin'; +import { VCValidator, VPValidator, type VC, type VP } from '@learncard/types'; import { streamIdToCeramicURI } from './helpers'; -import type { - CeramicEncryptionParams, - CeramicPlugin, - CeramicPluginDependentMethods, - CeramicArgs, +import { + CeramicURIValidator, + type CeramicEncryptionParams, + type CeramicPlugin, + type CeramicPluginDependentMethods, + type CeramicArgs, } from './types'; - -import { CeramicURIValidator } from './types'; import { DEFAULT_CERAMIC_ARGS } from './defaults'; /** @@ -107,10 +106,10 @@ export const getCeramicPlugin = async ( if (content?.ciphertext) { try { return await did.decryptDagJWE(content as JWE); - } catch (e) { + } catch (error) { learnCard.debug?.( 'learnCard.read.get.readContentFromCeramic - Could not decrypt credential - DID not authorized.', - e + error ); throw new Error('Could not decrypt credential - DID not authorized.'); } @@ -161,8 +160,8 @@ export const getCeramicPlugin = async ( return await VCValidator.or(VPValidator).parseAsync( await readContentFromCeramic(streamId) ); - } catch (e) { - _learnCard.debug?.(e); + } catch (error) { + _learnCard.debug?.(error); return undefined; } }, diff --git a/packages/plugins/ceramic/src/defaults.ts b/packages/plugins/ceramic/src/defaults.ts index 0b07a37b62..46b06f4261 100644 --- a/packages/plugins/ceramic/src/defaults.ts +++ b/packages/plugins/ceramic/src/defaults.ts @@ -1,4 +1,4 @@ -import { CeramicArgs } from './types'; +import type { CeramicArgs } from './types'; export const DEFAULT_CERAMIC_ARGS: CeramicArgs = { ceramicEndpoint: 'https://ceramic-node.welibrary.io:7007', diff --git a/packages/plugins/ceramic/src/helpers.ts b/packages/plugins/ceramic/src/helpers.ts index 41e687b636..f4210ba761 100644 --- a/packages/plugins/ceramic/src/helpers.ts +++ b/packages/plugins/ceramic/src/helpers.ts @@ -1,5 +1,5 @@ -import { StreamID } from '@ceramicnetwork/streamid'; +import type { StreamID } from '@ceramicnetwork/streamid'; -import { CeramicURI } from './types'; +import type { CeramicURI } from './types'; export const streamIdToCeramicURI = (id: string | StreamID): CeramicURI => `lc:ceramic:${id}`; diff --git a/packages/plugins/ceramic/src/types.ts b/packages/plugins/ceramic/src/types.ts index 7c32ddc144..ab12ba999b 100644 --- a/packages/plugins/ceramic/src/types.ts +++ b/packages/plugins/ceramic/src/types.ts @@ -1,8 +1,8 @@ import type { DID, CreateJWEOptions, DIDResolutionResult } from 'dids'; import { z } from 'zod'; -import { CeramicClient } from '@ceramicnetwork/http-client'; -import { Plugin } from '@learncard/core'; -import { InputMetadata } from '@learncard/didkit-plugin'; +import type { CeramicClient } from '@ceramicnetwork/http-client'; +import type { Plugin } from '@learncard/core'; +import type { InputMetadata } from '@learncard/didkit-plugin'; /** @group CeramicPlugin */ export type CeramicArgs = { @@ -18,10 +18,12 @@ export const CeramicURIValidator = z .string() .refine( string => string.split(':').length === 3 && string.split(':')[0] === 'lc', + // oxlint-disable-next-line no-template-curly-in-string 'URI must be of the form lc:${storage}:${url}' ) .refine( string => string.split(':')[1] === 'ceramic', + // oxlint-disable-next-line no-template-curly-in-string 'URI must use storage type ceramic (i.e. must be lc:ceramic:${streamID})' ); diff --git a/packages/plugins/chapi/scripts/.eslintrc b/packages/plugins/chapi/scripts/.eslintrc deleted file mode 100644 index 2b88e1c5e2..0000000000 --- a/packages/plugins/chapi/scripts/.eslintrc +++ /dev/null @@ -1,10 +0,0 @@ -{ - "root": false, - "env": { - "node": true - }, - "rules": { - "no-console": "off", - "@typescript-eslint/no-var-requires": "off" - } -} \ No newline at end of file diff --git a/packages/plugins/chapi/scripts/build.mjs b/packages/plugins/chapi/scripts/build.mjs index 6dc6ee6ebd..7fdb8a8b21 100644 --- a/packages/plugins/chapi/scripts/build.mjs +++ b/packages/plugins/chapi/scripts/build.mjs @@ -71,7 +71,7 @@ await Promise.all( }) ); -await Promise.all(configurations.map(config => esbuild.build(config))).catch(err => { +await Promise.all(configurations.map(config => esbuild.build(config))).catch(() => { console.error('❌ Build failed'); process.exit(1); }); diff --git a/packages/plugins/chapi/src/chapi.ts b/packages/plugins/chapi/src/chapi.ts index 397a3418da..675b31c48a 100644 --- a/packages/plugins/chapi/src/chapi.ts +++ b/packages/plugins/chapi/src/chapi.ts @@ -1,7 +1,7 @@ import { loadOnce } from 'credential-handler-polyfill'; import { installHandler, activateHandler, receiveCredentialEvent } from 'web-credential-handler'; -import { CHAPIPlugin } from './types'; +import type { CHAPIPlugin } from './types'; /** * @group Plugins @@ -90,8 +90,7 @@ export const getCHAPIPlugin = async (): Promise => { // If sending multiple credentials through CHAPI if (Array.isArray(credential)) { - for (let x = 0; x < credential.length; x++) { - const cred = credential[x]; + for (const cred of credential) { if (!Array.isArray(cred.credentialSubject)) { cred.credentialSubject.id = subject; } diff --git a/packages/plugins/chapi/src/types.ts b/packages/plugins/chapi/src/types.ts index e1c61a18b0..4068ab063b 100644 --- a/packages/plugins/chapi/src/types.ts +++ b/packages/plugins/chapi/src/types.ts @@ -1,6 +1,6 @@ -import { UnsignedVC, VC, UnsignedVP, VP, VerificationCheck } from '@learncard/types'; -import { Plugin } from '@learncard/core'; -import { ProofOptions } from '@learncard/didkit-plugin'; +import type { UnsignedVC, VC, UnsignedVP, VP, VerificationCheck } from '@learncard/types'; +import type { Plugin } from '@learncard/core'; +import type { ProofOptions } from '@learncard/didkit-plugin'; /** @group CHAPI Plugin */ export type WebCredential = { diff --git a/packages/plugins/claimable-boosts/scripts/.eslintrc b/packages/plugins/claimable-boosts/scripts/.eslintrc deleted file mode 100644 index 2b88e1c5e2..0000000000 --- a/packages/plugins/claimable-boosts/scripts/.eslintrc +++ /dev/null @@ -1,10 +0,0 @@ -{ - "root": false, - "env": { - "node": true - }, - "rules": { - "no-console": "off", - "@typescript-eslint/no-var-requires": "off" - } -} \ No newline at end of file diff --git a/packages/plugins/claimable-boosts/scripts/build.mjs b/packages/plugins/claimable-boosts/scripts/build.mjs index 3b0a732347..52640b6ce5 100644 --- a/packages/plugins/claimable-boosts/scripts/build.mjs +++ b/packages/plugins/claimable-boosts/scripts/build.mjs @@ -71,7 +71,7 @@ await Promise.all( }) ); -await Promise.all(configurations.map(config => esbuild.build(config))).catch(err => { +await Promise.all(configurations.map(config => esbuild.build(config))).catch(() => { console.error('❌ Build failed'); process.exit(1); }); diff --git a/packages/plugins/claimable-boosts/src/index.ts b/packages/plugins/claimable-boosts/src/index.ts index 08bfd16f40..e03fa10660 100644 --- a/packages/plugins/claimable-boosts/src/index.ts +++ b/packages/plugins/claimable-boosts/src/index.ts @@ -1,11 +1,11 @@ -import { LCNBoostClaimLinkOptionsType } from '@learncard/types'; -import { +import type { LCNBoostClaimLinkOptionsType } from '@learncard/types'; +import type { ClaimableBoostsPlugin, ClaimableBoostsPluginDependentMethods, SigningAuthorityType, } from './types'; -import { LearnCard } from '@learncard/core'; +import type { LearnCard } from '@learncard/core'; export * from './types'; @@ -15,7 +15,7 @@ const DEFAULT_RELATIONSHIP_NAME = 'lca-sa'; * @group Plugins */ export const getClaimableBoostsPlugin = ( - learnCard: LearnCard + _learnCard: LearnCard ): ClaimableBoostsPlugin => { return { name: 'ClaimableBoosts', diff --git a/packages/plugins/claimable-boosts/src/types.ts b/packages/plugins/claimable-boosts/src/types.ts index b910eb15f0..1d05c8448c 100644 --- a/packages/plugins/claimable-boosts/src/types.ts +++ b/packages/plugins/claimable-boosts/src/types.ts @@ -1,7 +1,6 @@ import { z } from 'zod'; -import { Plugin } from '@learncard/core'; -import { LCNBoostClaimLinkOptionsType } from '@learncard/types'; -import { LCNSigningAuthorityForUserType } from '@learncard/types'; +import type { Plugin } from '@learncard/core'; +import type { LCNBoostClaimLinkOptionsType, LCNSigningAuthorityForUserType } from '@learncard/types'; export const SigningAuthorityValidator = z.object({ _id: z.string().optional(), diff --git a/packages/plugins/crypto/scripts/.eslintrc b/packages/plugins/crypto/scripts/.eslintrc deleted file mode 100644 index 2b88e1c5e2..0000000000 --- a/packages/plugins/crypto/scripts/.eslintrc +++ /dev/null @@ -1,10 +0,0 @@ -{ - "root": false, - "env": { - "node": true - }, - "rules": { - "no-console": "off", - "@typescript-eslint/no-var-requires": "off" - } -} \ No newline at end of file diff --git a/packages/plugins/crypto/scripts/build.mjs b/packages/plugins/crypto/scripts/build.mjs index c8bfa8a2e4..a117d83f8c 100644 --- a/packages/plugins/crypto/scripts/build.mjs +++ b/packages/plugins/crypto/scripts/build.mjs @@ -71,7 +71,7 @@ await Promise.all( }) ); -await Promise.all(configurations.map(config => esbuild.build(config))).catch(err => { +await Promise.all(configurations.map(config => esbuild.build(config))).catch(() => { console.error('❌ Build failed'); process.exit(1); }); diff --git a/packages/plugins/crypto/src/index.ts b/packages/plugins/crypto/src/index.ts index 71f1a62c36..96f6e4a412 100644 --- a/packages/plugins/crypto/src/index.ts +++ b/packages/plugins/crypto/src/index.ts @@ -1,4 +1,4 @@ -import { CryptoPluginType } from './types'; +import type { CryptoPluginType } from './types'; import crypto from './crypto'; diff --git a/packages/plugins/crypto/src/types.ts b/packages/plugins/crypto/src/types.ts index ed46801d46..cea333f84b 100644 --- a/packages/plugins/crypto/src/types.ts +++ b/packages/plugins/crypto/src/types.ts @@ -1,4 +1,4 @@ -import { Plugin } from '@learncard/core'; +import type { Plugin } from '@learncard/core'; export type CryptoPluginMethods = { crypto: () => Crypto; diff --git a/packages/plugins/did-web-plugin/scripts/.eslintrc b/packages/plugins/did-web-plugin/scripts/.eslintrc deleted file mode 100644 index 2b88e1c5e2..0000000000 --- a/packages/plugins/did-web-plugin/scripts/.eslintrc +++ /dev/null @@ -1,10 +0,0 @@ -{ - "root": false, - "env": { - "node": true - }, - "rules": { - "no-console": "off", - "@typescript-eslint/no-var-requires": "off" - } -} \ No newline at end of file diff --git a/packages/plugins/did-web-plugin/scripts/build.mjs b/packages/plugins/did-web-plugin/scripts/build.mjs index d1b5dd509c..205ec204af 100644 --- a/packages/plugins/did-web-plugin/scripts/build.mjs +++ b/packages/plugins/did-web-plugin/scripts/build.mjs @@ -71,7 +71,7 @@ await Promise.all( }) ); -await Promise.all(configurations.map(config => esbuild.build(config))).catch(err => { +await Promise.all(configurations.map(config => esbuild.build(config))).catch(() => { console.error('❌ Build failed'); process.exit(1); }); diff --git a/packages/plugins/did-web-plugin/src/plugin.ts b/packages/plugins/did-web-plugin/src/plugin.ts index 813267d2bd..2a89047f58 100644 --- a/packages/plugins/did-web-plugin/src/plugin.ts +++ b/packages/plugins/did-web-plugin/src/plugin.ts @@ -1,6 +1,6 @@ -import { LearnCard } from '@learncard/core'; +import type { LearnCard } from '@learncard/core'; -import { DidWebPluginDependentMethods, DidWebPlugin } from './types'; +import type { DidWebPluginDependentMethods, DidWebPlugin } from './types'; export * from './types'; /** diff --git a/packages/plugins/did-web-plugin/src/types.ts b/packages/plugins/did-web-plugin/src/types.ts index 67c1458ebd..63ae39b791 100644 --- a/packages/plugins/did-web-plugin/src/types.ts +++ b/packages/plugins/did-web-plugin/src/types.ts @@ -1,4 +1,4 @@ -import { Plugin } from '@learncard/core'; +import type { Plugin } from '@learncard/core'; /** @group DID Web Plugin */ export type DidWebPluginDependentMethods = {}; diff --git a/packages/plugins/didkey/scripts/.eslintrc b/packages/plugins/didkey/scripts/.eslintrc deleted file mode 100644 index 2b88e1c5e2..0000000000 --- a/packages/plugins/didkey/scripts/.eslintrc +++ /dev/null @@ -1,10 +0,0 @@ -{ - "root": false, - "env": { - "node": true - }, - "rules": { - "no-console": "off", - "@typescript-eslint/no-var-requires": "off" - } -} \ No newline at end of file diff --git a/packages/plugins/didkey/scripts/build.mjs b/packages/plugins/didkey/scripts/build.mjs index f47872f000..e4512db70c 100644 --- a/packages/plugins/didkey/scripts/build.mjs +++ b/packages/plugins/didkey/scripts/build.mjs @@ -71,7 +71,7 @@ await Promise.all( }) ); -await Promise.all(configurations.map(config => esbuild.build(config))).catch(err => { +await Promise.all(configurations.map(config => esbuild.build(config))).catch(() => { console.error('❌ Build failed'); process.exit(1); }); diff --git a/packages/plugins/didkey/src/helpers.ts b/packages/plugins/didkey/src/helpers.ts index fdcbae75d0..06bdf09ab5 100644 --- a/packages/plugins/didkey/src/helpers.ts +++ b/packages/plugins/didkey/src/helpers.ts @@ -1,4 +1,4 @@ -import { Algorithm } from './types'; +import type { Algorithm } from './types'; export const ED25519_METHODS = ['key', 'tz', 'pkh:tz', 'pkh:tezos', 'pkh:sol', 'pkh:solana']; diff --git a/packages/plugins/didkey/src/index.ts b/packages/plugins/didkey/src/index.ts index f2a36cf129..00e9505cd1 100644 --- a/packages/plugins/didkey/src/index.ts +++ b/packages/plugins/didkey/src/index.ts @@ -1,11 +1,11 @@ import { toUint8Array } from 'hex-lite'; import { isHex } from '@learncard/helpers'; -import { JWKWithPrivateKey } from '@learncard/types'; -import { LearnCard } from '@learncard/core'; +import type { JWKWithPrivateKey } from '@learncard/types'; +import type { LearnCard } from '@learncard/core'; import { getAlgorithmForDidMethod } from './helpers'; -import { DidKeyPlugin, DependentMethods, Algorithm } from './types'; +import type { DidKeyPlugin, DependentMethods, Algorithm } from './types'; export * from './types'; diff --git a/packages/plugins/didkey/src/types.ts b/packages/plugins/didkey/src/types.ts index 078181b0a4..fb87e6267e 100644 --- a/packages/plugins/didkey/src/types.ts +++ b/packages/plugins/didkey/src/types.ts @@ -1,5 +1,5 @@ -import { Plugin } from '@learncard/core'; -import { JWKWithPrivateKey } from '@learncard/types'; +import type { Plugin } from '@learncard/core'; +import type { JWKWithPrivateKey } from '@learncard/types'; /** @group DidKey Plugin */ export type Algorithm = 'ed25519' | 'secp256k1'; diff --git a/packages/plugins/didkit/scripts/.eslintrc b/packages/plugins/didkit/scripts/.eslintrc deleted file mode 100644 index 2b88e1c5e2..0000000000 --- a/packages/plugins/didkit/scripts/.eslintrc +++ /dev/null @@ -1,10 +0,0 @@ -{ - "root": false, - "env": { - "node": true - }, - "rules": { - "no-console": "off", - "@typescript-eslint/no-var-requires": "off" - } -} \ No newline at end of file diff --git a/packages/plugins/didkit/scripts/build.mjs b/packages/plugins/didkit/scripts/build.mjs index 6e3dba3d4a..6cf4f18374 100644 --- a/packages/plugins/didkit/scripts/build.mjs +++ b/packages/plugins/didkit/scripts/build.mjs @@ -76,7 +76,7 @@ await Promise.all( }) ); -await Promise.all(configurations.map(config => esbuild.build(config))).catch(err => { +await Promise.all(configurations.map(config => esbuild.build(config))).catch(() => { console.error('❌ Build failed'); process.exit(1); }); diff --git a/packages/plugins/didkit/src/didkit/index.ts b/packages/plugins/didkit/src/didkit/index.ts index 9ca6cb396e..0673ce889e 100644 --- a/packages/plugins/didkit/src/didkit/index.ts +++ b/packages/plugins/didkit/src/didkit/index.ts @@ -1,4 +1,4 @@ -import _init, { InitInput } from './pkg/didkit_wasm'; +import _init, { type InitInput } from './pkg/didkit_wasm'; export * from './pkg/didkit_wasm'; diff --git a/packages/plugins/didkit/src/didkit/pkg/didkit_wasm.d.ts b/packages/plugins/didkit/src/didkit/pkg/didkit_wasm.d.ts index e243a4f0fd..6c2a8689ef 100644 --- a/packages/plugins/didkit/src/didkit/pkg/didkit_wasm.d.ts +++ b/packages/plugins/didkit/src/didkit/pkg/didkit_wasm.d.ts @@ -1,4 +1,3 @@ -/* tslint:disable */ /* eslint-disable */ export function getVersion(): string; export function clearCache(): Promise; diff --git a/packages/plugins/didkit/src/didkit/pkg/didkit_wasm.js b/packages/plugins/didkit/src/didkit/pkg/didkit_wasm.js index 53267f5878..c5fed93385 100644 --- a/packages/plugins/didkit/src/didkit/pkg/didkit_wasm.js +++ b/packages/plugins/didkit/src/didkit/pkg/didkit_wasm.js @@ -1,6 +1,6 @@ let wasm; -const cachedTextDecoder = (typeof TextDecoder !== 'undefined' ? new TextDecoder('utf-8', { ignoreBOM: true, fatal: true }) : { decode: () => { throw Error('TextDecoder not available') } } ); +const cachedTextDecoder = (typeof TextDecoder !== 'undefined' ? new TextDecoder('utf8', { ignoreBOM: true, fatal: true }) : { decode: () => { throw new Error('TextDecoder not available') } } ); if (typeof TextDecoder !== 'undefined') { cachedTextDecoder.decode(); }; @@ -14,7 +14,7 @@ function getUint8ArrayMemory0() { } function getStringFromWasm0(ptr, len) { - ptr = ptr >>> 0; + ptr >>>= 0; return cachedTextDecoder.decode(getUint8ArrayMemory0().subarray(ptr, ptr + len)); } @@ -27,14 +27,14 @@ function addToExternrefTable0(obj) { function handleError(f, args) { try { return f.apply(this, args); - } catch (e) { - const idx = addToExternrefTable0(e); + } catch (error) { + const idx = addToExternrefTable0(error); wasm.__wbindgen_exn_store(idx); } } function getArrayU8FromWasm0(ptr, len) { - ptr = ptr >>> 0; + ptr >>>= 0; return getUint8ArrayMemory0().subarray(ptr / 1, ptr / 1 + len); } @@ -44,7 +44,7 @@ function isLikeNone(x) { let WASM_VECTOR_LEN = 0; -const cachedTextEncoder = (typeof TextEncoder !== 'undefined' ? new TextEncoder('utf-8') : { encode: () => { throw Error('TextEncoder not available') } } ); +const cachedTextEncoder = (typeof TextEncoder !== 'undefined' ? new TextEncoder('utf8') : { encode: () => { throw new Error('TextEncoder not available') } } ); const encodeString = (typeof cachedTextEncoder.encodeInto === 'function' ? function (arg, view) { @@ -191,7 +191,7 @@ function debugString(val) { // easier than looping through ownProperties of `val`. try { return 'Object(' + JSON.stringify(val) + ')'; - } catch (_) { + } catch { return 'Object'; } } @@ -827,12 +827,12 @@ async function __wbg_load(module, imports) { try { return await WebAssembly.instantiateStreaming(module, imports); - } catch (e) { + } catch (error) { if (module.headers.get('Content-Type') != 'application/wasm') { - console.warn("`WebAssembly.instantiateStreaming` failed because your server does not serve Wasm with `application/wasm` MIME type. Falling back to `WebAssembly.instantiate` which is slower. Original error:\n", e); + console.warn("`WebAssembly.instantiateStreaming` failed because your server does not serve Wasm with `application/wasm` MIME type. Falling back to `WebAssembly.instantiate` which is slower. Original error:\n", error); } else { - throw e; + throw error; } } } @@ -855,163 +855,163 @@ async function __wbg_load(module, imports) { function __wbg_get_imports() { const imports = {}; imports.wbg = {}; - imports.wbg.__wbg_abort_775ef1d17fc65868 = function(arg0) { + imports.wbg.__wbg_abort_775ef1d17fc65868 = function __wbg_abort_775ef1d17fc65868(arg0) { arg0.abort(); }; - imports.wbg.__wbg_append_8c7dd8d641a5f01b = function() { return handleError(function (arg0, arg1, arg2, arg3, arg4) { + imports.wbg.__wbg_append_8c7dd8d641a5f01b = function __wbg_append_8c7dd8d641a5f01b() { return handleError(function (arg0, arg1, arg2, arg3, arg4) { arg0.append(getStringFromWasm0(arg1, arg2), getStringFromWasm0(arg3, arg4)); }, arguments) }; - imports.wbg.__wbg_arrayBuffer_d1b44c4390db422f = function() { return handleError(function (arg0) { + imports.wbg.__wbg_arrayBuffer_d1b44c4390db422f = function __wbg_arrayBuffer_d1b44c4390db422f() { return handleError(function (arg0) { const ret = arg0.arrayBuffer(); return ret; }, arguments) }; - imports.wbg.__wbg_buffer_609cc3eee51ed158 = function(arg0) { + imports.wbg.__wbg_buffer_609cc3eee51ed158 = function __wbg_buffer_609cc3eee51ed158(arg0) { const ret = arg0.buffer; return ret; }; - imports.wbg.__wbg_call_672a4d21634d4a24 = function() { return handleError(function (arg0, arg1) { + imports.wbg.__wbg_call_672a4d21634d4a24 = function __wbg_call_672a4d21634d4a24() { return handleError(function (arg0, arg1) { const ret = arg0.call(arg1); return ret; }, arguments) }; - imports.wbg.__wbg_call_7cccdd69e0791ae2 = function() { return handleError(function (arg0, arg1, arg2) { + imports.wbg.__wbg_call_7cccdd69e0791ae2 = function __wbg_call_7cccdd69e0791ae2() { return handleError(function (arg0, arg1, arg2) { const ret = arg0.call(arg1, arg2); return ret; }, arguments) }; - imports.wbg.__wbg_crypto_038798f665f985e2 = function(arg0) { + imports.wbg.__wbg_crypto_038798f665f985e2 = function __wbg_crypto_038798f665f985e2(arg0) { const ret = arg0.crypto; return ret; }; - imports.wbg.__wbg_crypto_ed58b8e10a292839 = function(arg0) { + imports.wbg.__wbg_crypto_ed58b8e10a292839 = function __wbg_crypto_ed58b8e10a292839(arg0) { const ret = arg0.crypto; return ret; }; - imports.wbg.__wbg_done_769e5ede4b31c67b = function(arg0) { + imports.wbg.__wbg_done_769e5ede4b31c67b = function __wbg_done_769e5ede4b31c67b(arg0) { const ret = arg0.done; return ret; }; - imports.wbg.__wbg_entries_3265d4158b33e5dc = function(arg0) { + imports.wbg.__wbg_entries_3265d4158b33e5dc = function __wbg_entries_3265d4158b33e5dc(arg0) { const ret = Object.entries(arg0); return ret; }; - imports.wbg.__wbg_fetch_509096533071c657 = function(arg0, arg1) { + imports.wbg.__wbg_fetch_509096533071c657 = function __wbg_fetch_509096533071c657(arg0, arg1) { const ret = arg0.fetch(arg1); return ret; }; - imports.wbg.__wbg_fetch_f1856afdb49415d1 = function(arg0) { + imports.wbg.__wbg_fetch_f1856afdb49415d1 = function __wbg_fetch_f1856afdb49415d1(arg0) { const ret = fetch(arg0); return ret; }; - imports.wbg.__wbg_from_2a5d3e218e67aa85 = function(arg0) { - const ret = Array.from(arg0); + imports.wbg.__wbg_from_2a5d3e218e67aa85 = function __wbg_from_2a5d3e218e67aa85(arg0) { + const ret = [...arg0]; return ret; }; - imports.wbg.__wbg_getRandomValues_371e7ade8bd92088 = function(arg0, arg1) { + imports.wbg.__wbg_getRandomValues_371e7ade8bd92088 = function __wbg_getRandomValues_371e7ade8bd92088(arg0, arg1) { arg0.getRandomValues(arg1); }; - imports.wbg.__wbg_getRandomValues_7dfe5bd1b67c9ca1 = function(arg0) { + imports.wbg.__wbg_getRandomValues_7dfe5bd1b67c9ca1 = function __wbg_getRandomValues_7dfe5bd1b67c9ca1(arg0) { const ret = arg0.getRandomValues; return ret; }; - imports.wbg.__wbg_getRandomValues_bcb4912f16000dc4 = function() { return handleError(function (arg0, arg1) { + imports.wbg.__wbg_getRandomValues_bcb4912f16000dc4 = function __wbg_getRandomValues_bcb4912f16000dc4() { return handleError(function (arg0, arg1) { arg0.getRandomValues(arg1); }, arguments) }; - imports.wbg.__wbg_getTime_46267b1c24877e30 = function(arg0) { + imports.wbg.__wbg_getTime_46267b1c24877e30 = function __wbg_getTime_46267b1c24877e30(arg0) { const ret = arg0.getTime(); return ret; }; - imports.wbg.__wbg_get_67b2ba62fc30de12 = function() { return handleError(function (arg0, arg1) { + imports.wbg.__wbg_get_67b2ba62fc30de12 = function __wbg_get_67b2ba62fc30de12() { return handleError(function (arg0, arg1) { const ret = Reflect.get(arg0, arg1); return ret; }, arguments) }; - imports.wbg.__wbg_get_b9b93047fe3cf45b = function(arg0, arg1) { + imports.wbg.__wbg_get_b9b93047fe3cf45b = function __wbg_get_b9b93047fe3cf45b(arg0, arg1) { const ret = arg0[arg1 >>> 0]; return ret; }; - imports.wbg.__wbg_has_a5ea9117f258a0ec = function() { return handleError(function (arg0, arg1) { + imports.wbg.__wbg_has_a5ea9117f258a0ec = function __wbg_has_a5ea9117f258a0ec() { return handleError(function (arg0, arg1) { const ret = Reflect.has(arg0, arg1); return ret; }, arguments) }; - imports.wbg.__wbg_headers_9cb51cfd2ac780a4 = function(arg0) { + imports.wbg.__wbg_headers_9cb51cfd2ac780a4 = function __wbg_headers_9cb51cfd2ac780a4(arg0) { const ret = arg0.headers; return ret; }; - imports.wbg.__wbg_instanceof_ArrayBuffer_e14585432e3737fc = function(arg0) { + imports.wbg.__wbg_instanceof_ArrayBuffer_e14585432e3737fc = function __wbg_instanceof_ArrayBuffer_e14585432e3737fc(arg0) { let result; try { result = arg0 instanceof ArrayBuffer; - } catch (_) { + } catch { result = false; } const ret = result; return ret; }; - imports.wbg.__wbg_instanceof_Map_f3469ce2244d2430 = function(arg0) { + imports.wbg.__wbg_instanceof_Map_f3469ce2244d2430 = function __wbg_instanceof_Map_f3469ce2244d2430(arg0) { let result; try { result = arg0 instanceof Map; - } catch (_) { + } catch { result = false; } const ret = result; return ret; }; - imports.wbg.__wbg_instanceof_Response_f2cc20d9f7dfd644 = function(arg0) { + imports.wbg.__wbg_instanceof_Response_f2cc20d9f7dfd644 = function __wbg_instanceof_Response_f2cc20d9f7dfd644(arg0) { let result; try { result = arg0 instanceof Response; - } catch (_) { + } catch { result = false; } const ret = result; return ret; }; - imports.wbg.__wbg_instanceof_Uint8Array_17156bcf118086a9 = function(arg0) { + imports.wbg.__wbg_instanceof_Uint8Array_17156bcf118086a9 = function __wbg_instanceof_Uint8Array_17156bcf118086a9(arg0) { let result; try { result = arg0 instanceof Uint8Array; - } catch (_) { + } catch { result = false; } const ret = result; return ret; }; - imports.wbg.__wbg_isArray_a1eab7e0d067391b = function(arg0) { + imports.wbg.__wbg_isArray_a1eab7e0d067391b = function __wbg_isArray_a1eab7e0d067391b(arg0) { const ret = Array.isArray(arg0); return ret; }; - imports.wbg.__wbg_isSafeInteger_343e2beeeece1bb0 = function(arg0) { + imports.wbg.__wbg_isSafeInteger_343e2beeeece1bb0 = function __wbg_isSafeInteger_343e2beeeece1bb0(arg0) { const ret = Number.isSafeInteger(arg0); return ret; }; - imports.wbg.__wbg_iterator_9a24c88df860dc65 = function() { + imports.wbg.__wbg_iterator_9a24c88df860dc65 = function __wbg_iterator_9a24c88df860dc65() { const ret = Symbol.iterator; return ret; }; - imports.wbg.__wbg_length_a446193dc22c12f8 = function(arg0) { + imports.wbg.__wbg_length_a446193dc22c12f8 = function __wbg_length_a446193dc22c12f8(arg0) { const ret = arg0.length; return ret; }; - imports.wbg.__wbg_length_e2d2a49132c1b256 = function(arg0) { + imports.wbg.__wbg_length_e2d2a49132c1b256 = function __wbg_length_e2d2a49132c1b256(arg0) { const ret = arg0.length; return ret; }; - imports.wbg.__wbg_msCrypto_0a36e2ec3a343d26 = function(arg0) { + imports.wbg.__wbg_msCrypto_0a36e2ec3a343d26 = function __wbg_msCrypto_0a36e2ec3a343d26(arg0) { const ret = arg0.msCrypto; return ret; }; - imports.wbg.__wbg_msCrypto_ff35fce085fab2a3 = function(arg0) { + imports.wbg.__wbg_msCrypto_ff35fce085fab2a3 = function __wbg_msCrypto_ff35fce085fab2a3(arg0) { const ret = arg0.msCrypto; return ret; }; - imports.wbg.__wbg_new0_f788a2397c7ca929 = function() { + imports.wbg.__wbg_new0_f788a2397c7ca929 = function __wbg_new0_f788a2397c7ca929() { const ret = new Date(); return ret; }; - imports.wbg.__wbg_new_018dcc2d6c8c2f6a = function() { return handleError(function () { + imports.wbg.__wbg_new_018dcc2d6c8c2f6a = function __wbg_new_018dcc2d6c8c2f6a() { return handleError(function () { const ret = new Headers(); return ret; }, arguments) }; - imports.wbg.__wbg_new_23a2665fac83c611 = function(arg0, arg1) { + imports.wbg.__wbg_new_23a2665fac83c611 = function __wbg_new_23a2665fac83c611(arg0, arg1) { try { var state0 = {a: arg0, b: arg1}; var cb0 = (arg0, arg1) => { @@ -1029,205 +1029,205 @@ function __wbg_get_imports() { state0.a = state0.b = 0; } }; - imports.wbg.__wbg_new_405e22f390576ce2 = function() { + imports.wbg.__wbg_new_405e22f390576ce2 = function __wbg_new_405e22f390576ce2() { const ret = new Object(); return ret; }; - imports.wbg.__wbg_new_5e0be73521bc8c17 = function() { + imports.wbg.__wbg_new_5e0be73521bc8c17 = function __wbg_new_5e0be73521bc8c17() { const ret = new Map(); return ret; }; - imports.wbg.__wbg_new_78feb108b6472713 = function() { + imports.wbg.__wbg_new_78feb108b6472713 = function __wbg_new_78feb108b6472713() { const ret = new Array(); return ret; }; - imports.wbg.__wbg_new_a12002a7f91c75be = function(arg0) { + imports.wbg.__wbg_new_a12002a7f91c75be = function __wbg_new_a12002a7f91c75be(arg0) { const ret = new Uint8Array(arg0); return ret; }; - imports.wbg.__wbg_new_e25e5aab09ff45db = function() { return handleError(function () { + imports.wbg.__wbg_new_e25e5aab09ff45db = function __wbg_new_e25e5aab09ff45db() { return handleError(function () { const ret = new AbortController(); return ret; }, arguments) }; - imports.wbg.__wbg_newnoargs_105ed471475aaf50 = function(arg0, arg1) { + imports.wbg.__wbg_newnoargs_105ed471475aaf50 = function __wbg_newnoargs_105ed471475aaf50(arg0, arg1) { const ret = new Function(getStringFromWasm0(arg0, arg1)); return ret; }; - imports.wbg.__wbg_newwithbyteoffsetandlength_d97e637ebe145a9a = function(arg0, arg1, arg2) { + imports.wbg.__wbg_newwithbyteoffsetandlength_d97e637ebe145a9a = function __wbg_newwithbyteoffsetandlength_d97e637ebe145a9a(arg0, arg1, arg2) { const ret = new Uint8Array(arg0, arg1 >>> 0, arg2 >>> 0); return ret; }; - imports.wbg.__wbg_newwithlength_a381634e90c276d4 = function(arg0) { + imports.wbg.__wbg_newwithlength_a381634e90c276d4 = function __wbg_newwithlength_a381634e90c276d4(arg0) { const ret = new Uint8Array(arg0 >>> 0); return ret; }; - imports.wbg.__wbg_newwithstrandinit_06c535e0a867c635 = function() { return handleError(function (arg0, arg1, arg2) { + imports.wbg.__wbg_newwithstrandinit_06c535e0a867c635 = function __wbg_newwithstrandinit_06c535e0a867c635() { return handleError(function (arg0, arg1, arg2) { const ret = new Request(getStringFromWasm0(arg0, arg1), arg2); return ret; }, arguments) }; - imports.wbg.__wbg_next_25feadfc0913fea9 = function(arg0) { + imports.wbg.__wbg_next_25feadfc0913fea9 = function __wbg_next_25feadfc0913fea9(arg0) { const ret = arg0.next; return ret; }; - imports.wbg.__wbg_next_6574e1a8a62d1055 = function() { return handleError(function (arg0) { + imports.wbg.__wbg_next_6574e1a8a62d1055 = function __wbg_next_6574e1a8a62d1055() { return handleError(function (arg0) { const ret = arg0.next(); return ret; }, arguments) }; - imports.wbg.__wbg_node_02999533c4ea02e3 = function(arg0) { + imports.wbg.__wbg_node_02999533c4ea02e3 = function __wbg_node_02999533c4ea02e3(arg0) { const ret = arg0.node; return ret; }; - imports.wbg.__wbg_now_d18023d54d4e5500 = function(arg0) { + imports.wbg.__wbg_now_d18023d54d4e5500 = function __wbg_now_d18023d54d4e5500(arg0) { const ret = arg0.now(); return ret; }; - imports.wbg.__wbg_process_5c1d670bc53614b8 = function(arg0) { + imports.wbg.__wbg_process_5c1d670bc53614b8 = function __wbg_process_5c1d670bc53614b8(arg0) { const ret = arg0.process; return ret; }; - imports.wbg.__wbg_queueMicrotask_97d92b4fcc8a61c5 = function(arg0) { + imports.wbg.__wbg_queueMicrotask_97d92b4fcc8a61c5 = function __wbg_queueMicrotask_97d92b4fcc8a61c5(arg0) { queueMicrotask(arg0); }; - imports.wbg.__wbg_queueMicrotask_d3219def82552485 = function(arg0) { + imports.wbg.__wbg_queueMicrotask_d3219def82552485 = function __wbg_queueMicrotask_d3219def82552485(arg0) { const ret = arg0.queueMicrotask; return ret; }; - imports.wbg.__wbg_randomFillSync_994ac6d9ade7a695 = function(arg0, arg1, arg2) { + imports.wbg.__wbg_randomFillSync_994ac6d9ade7a695 = function __wbg_randomFillSync_994ac6d9ade7a695(arg0, arg1, arg2) { arg0.randomFillSync(getArrayU8FromWasm0(arg1, arg2)); }; - imports.wbg.__wbg_randomFillSync_ab2cfe79ebbf2740 = function() { return handleError(function (arg0, arg1) { + imports.wbg.__wbg_randomFillSync_ab2cfe79ebbf2740 = function __wbg_randomFillSync_ab2cfe79ebbf2740() { return handleError(function (arg0, arg1) { arg0.randomFillSync(arg1); }, arguments) }; - imports.wbg.__wbg_require_0d6aeaec3c042c88 = function(arg0, arg1, arg2) { + imports.wbg.__wbg_require_0d6aeaec3c042c88 = function __wbg_require_0d6aeaec3c042c88(arg0, arg1, arg2) { const ret = arg0.require(getStringFromWasm0(arg1, arg2)); return ret; }; - imports.wbg.__wbg_require_79b1e9274cde3c87 = function() { return handleError(function () { + imports.wbg.__wbg_require_79b1e9274cde3c87 = function __wbg_require_79b1e9274cde3c87() { return handleError(function () { const ret = module.require; return ret; }, arguments) }; - imports.wbg.__wbg_resolve_4851785c9c5f573d = function(arg0) { + imports.wbg.__wbg_resolve_4851785c9c5f573d = function __wbg_resolve_4851785c9c5f573d(arg0) { const ret = Promise.resolve(arg0); return ret; }; - imports.wbg.__wbg_self_25aabeb5a7b41685 = function() { return handleError(function () { + imports.wbg.__wbg_self_25aabeb5a7b41685 = function __wbg_self_25aabeb5a7b41685() { return handleError(function () { const ret = self.self; return ret; }, arguments) }; - imports.wbg.__wbg_set_37837023f3d740e8 = function(arg0, arg1, arg2) { + imports.wbg.__wbg_set_37837023f3d740e8 = function __wbg_set_37837023f3d740e8(arg0, arg1, arg2) { arg0[arg1 >>> 0] = arg2; }; - imports.wbg.__wbg_set_3f1d0b984ed272ed = function(arg0, arg1, arg2) { + imports.wbg.__wbg_set_3f1d0b984ed272ed = function __wbg_set_3f1d0b984ed272ed(arg0, arg1, arg2) { arg0[arg1] = arg2; }; - imports.wbg.__wbg_set_65595bdd868b3009 = function(arg0, arg1, arg2) { + imports.wbg.__wbg_set_65595bdd868b3009 = function __wbg_set_65595bdd868b3009(arg0, arg1, arg2) { arg0.set(arg1, arg2 >>> 0); }; - imports.wbg.__wbg_set_8fc6bf8a5b1071d1 = function(arg0, arg1, arg2) { + imports.wbg.__wbg_set_8fc6bf8a5b1071d1 = function __wbg_set_8fc6bf8a5b1071d1(arg0, arg1, arg2) { const ret = arg0.set(arg1, arg2); return ret; }; - imports.wbg.__wbg_setbody_5923b78a95eedf29 = function(arg0, arg1) { + imports.wbg.__wbg_setbody_5923b78a95eedf29 = function __wbg_setbody_5923b78a95eedf29(arg0, arg1) { arg0.body = arg1; }; - imports.wbg.__wbg_setcredentials_c3a22f1cd105a2c6 = function(arg0, arg1) { + imports.wbg.__wbg_setcredentials_c3a22f1cd105a2c6 = function __wbg_setcredentials_c3a22f1cd105a2c6(arg0, arg1) { arg0.credentials = __wbindgen_enum_RequestCredentials[arg1]; }; - imports.wbg.__wbg_setheaders_834c0bdb6a8949ad = function(arg0, arg1) { + imports.wbg.__wbg_setheaders_834c0bdb6a8949ad = function __wbg_setheaders_834c0bdb6a8949ad(arg0, arg1) { arg0.headers = arg1; }; - imports.wbg.__wbg_setmethod_3c5280fe5d890842 = function(arg0, arg1, arg2) { + imports.wbg.__wbg_setmethod_3c5280fe5d890842 = function __wbg_setmethod_3c5280fe5d890842(arg0, arg1, arg2) { arg0.method = getStringFromWasm0(arg1, arg2); }; - imports.wbg.__wbg_setmode_5dc300b865044b65 = function(arg0, arg1) { + imports.wbg.__wbg_setmode_5dc300b865044b65 = function __wbg_setmode_5dc300b865044b65(arg0, arg1) { arg0.mode = __wbindgen_enum_RequestMode[arg1]; }; - imports.wbg.__wbg_setsignal_75b21ef3a81de905 = function(arg0, arg1) { + imports.wbg.__wbg_setsignal_75b21ef3a81de905 = function __wbg_setsignal_75b21ef3a81de905(arg0, arg1) { arg0.signal = arg1; }; - imports.wbg.__wbg_signal_aaf9ad74119f20a4 = function(arg0) { + imports.wbg.__wbg_signal_aaf9ad74119f20a4 = function __wbg_signal_aaf9ad74119f20a4(arg0) { const ret = arg0.signal; return ret; }; - imports.wbg.__wbg_static_accessor_GLOBAL_88a902d13a557d07 = function() { + imports.wbg.__wbg_static_accessor_GLOBAL_88a902d13a557d07 = function __wbg_static_accessor_GLOBAL_88a902d13a557d07() { const ret = typeof global === 'undefined' ? null : global; return isLikeNone(ret) ? 0 : addToExternrefTable0(ret); }; - imports.wbg.__wbg_static_accessor_GLOBAL_THIS_56578be7e9f832b0 = function() { + imports.wbg.__wbg_static_accessor_GLOBAL_THIS_56578be7e9f832b0 = function __wbg_static_accessor_GLOBAL_THIS_56578be7e9f832b0() { const ret = typeof globalThis === 'undefined' ? null : globalThis; return isLikeNone(ret) ? 0 : addToExternrefTable0(ret); }; - imports.wbg.__wbg_static_accessor_MODULE_ef3aa2eb251158a5 = function() { + imports.wbg.__wbg_static_accessor_MODULE_ef3aa2eb251158a5 = function __wbg_static_accessor_MODULE_ef3aa2eb251158a5() { const ret = module; return ret; }; - imports.wbg.__wbg_static_accessor_SELF_37c5d418e4bf5819 = function() { + imports.wbg.__wbg_static_accessor_SELF_37c5d418e4bf5819 = function __wbg_static_accessor_SELF_37c5d418e4bf5819() { const ret = typeof self === 'undefined' ? null : self; return isLikeNone(ret) ? 0 : addToExternrefTable0(ret); }; - imports.wbg.__wbg_static_accessor_WINDOW_5de37043a91a9c40 = function() { + imports.wbg.__wbg_static_accessor_WINDOW_5de37043a91a9c40 = function __wbg_static_accessor_WINDOW_5de37043a91a9c40() { const ret = typeof window === 'undefined' ? null : window; return isLikeNone(ret) ? 0 : addToExternrefTable0(ret); }; - imports.wbg.__wbg_status_f6360336ca686bf0 = function(arg0) { + imports.wbg.__wbg_status_f6360336ca686bf0 = function __wbg_status_f6360336ca686bf0(arg0) { const ret = arg0.status; return ret; }; - imports.wbg.__wbg_stringify_f7ed6987935b4a24 = function() { return handleError(function (arg0) { + imports.wbg.__wbg_stringify_f7ed6987935b4a24 = function __wbg_stringify_f7ed6987935b4a24() { return handleError(function (arg0) { const ret = JSON.stringify(arg0); return ret; }, arguments) }; - imports.wbg.__wbg_subarray_aa9065fa9dc5df96 = function(arg0, arg1, arg2) { + imports.wbg.__wbg_subarray_aa9065fa9dc5df96 = function __wbg_subarray_aa9065fa9dc5df96(arg0, arg1, arg2) { const ret = arg0.subarray(arg1 >>> 0, arg2 >>> 0); return ret; }; - imports.wbg.__wbg_then_44b73946d2fb3e7d = function(arg0, arg1) { + imports.wbg.__wbg_then_44b73946d2fb3e7d = function __wbg_then_44b73946d2fb3e7d(arg0, arg1) { const ret = arg0.then(arg1); return ret; }; - imports.wbg.__wbg_then_48b406749878a531 = function(arg0, arg1, arg2) { + imports.wbg.__wbg_then_48b406749878a531 = function __wbg_then_48b406749878a531(arg0, arg1, arg2) { const ret = arg0.then(arg1, arg2); return ret; }; - imports.wbg.__wbg_url_ae10c34ca209681d = function(arg0, arg1) { + imports.wbg.__wbg_url_ae10c34ca209681d = function __wbg_url_ae10c34ca209681d(arg0, arg1) { const ret = arg1.url; const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc); const len1 = WASM_VECTOR_LEN; getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true); getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true); }; - imports.wbg.__wbg_value_cd1ffa7b1ab794f1 = function(arg0) { + imports.wbg.__wbg_value_cd1ffa7b1ab794f1 = function __wbg_value_cd1ffa7b1ab794f1(arg0) { const ret = arg0.value; return ret; }; - imports.wbg.__wbg_versions_c71aa1626a93e0a1 = function(arg0) { + imports.wbg.__wbg_versions_c71aa1626a93e0a1 = function __wbg_versions_c71aa1626a93e0a1(arg0) { const ret = arg0.versions; return ret; }; - imports.wbg.__wbindgen_bigint_from_i128 = function(arg0, arg1) { + imports.wbg.__wbindgen_bigint_from_i128 = function __wbindgen_bigint_from_i128(arg0, arg1) { const ret = arg0 << BigInt(64) | BigInt.asUintN(64, arg1); return ret; }; - imports.wbg.__wbindgen_bigint_from_i64 = function(arg0) { + imports.wbg.__wbindgen_bigint_from_i64 = function __wbindgen_bigint_from_i64(arg0) { const ret = arg0; return ret; }; - imports.wbg.__wbindgen_bigint_from_u64 = function(arg0) { + imports.wbg.__wbindgen_bigint_from_u64 = function __wbindgen_bigint_from_u64(arg0) { const ret = BigInt.asUintN(64, arg0); return ret; }; - imports.wbg.__wbindgen_bigint_get_as_i64 = function(arg0, arg1) { + imports.wbg.__wbindgen_bigint_get_as_i64 = function __wbindgen_bigint_get_as_i64(arg0, arg1) { const v = arg1; const ret = typeof(v) === 'bigint' ? v : undefined; getDataViewMemory0().setBigInt64(arg0 + 8 * 1, isLikeNone(ret) ? BigInt(0) : ret, true); getDataViewMemory0().setInt32(arg0 + 4 * 0, !isLikeNone(ret), true); }; - imports.wbg.__wbindgen_boolean_get = function(arg0) { + imports.wbg.__wbindgen_boolean_get = function __wbindgen_boolean_get(arg0) { const v = arg0; const ret = typeof(v) === 'boolean' ? (v ? 1 : 0) : 2; return ret; }; - imports.wbg.__wbindgen_cb_drop = function(arg0) { + imports.wbg.__wbindgen_cb_drop = function __wbindgen_cb_drop(arg0) { const obj = arg0.original; if (obj.cnt-- == 1) { obj.a = 0; @@ -1236,26 +1236,26 @@ function __wbg_get_imports() { const ret = false; return ret; }; - imports.wbg.__wbindgen_closure_wrapper12542 = function(arg0, arg1, arg2) { + imports.wbg.__wbindgen_closure_wrapper12542 = function __wbindgen_closure_wrapper12542(arg0, arg1, arg2) { const ret = makeMutClosure(arg0, arg1, 4131, __wbg_adapter_52); return ret; }; - imports.wbg.__wbindgen_debug_string = function(arg0, arg1) { + imports.wbg.__wbindgen_debug_string = function __wbindgen_debug_string(arg0, arg1) { const ret = debugString(arg1); const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc); const len1 = WASM_VECTOR_LEN; getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true); getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true); }; - imports.wbg.__wbindgen_error_new = function(arg0, arg1) { + imports.wbg.__wbindgen_error_new = function __wbindgen_error_new(arg0, arg1) { const ret = new Error(getStringFromWasm0(arg0, arg1)); return ret; }; - imports.wbg.__wbindgen_in = function(arg0, arg1) { + imports.wbg.__wbindgen_in = function __wbindgen_in(arg0, arg1) { const ret = arg0 in arg1; return ret; }; - imports.wbg.__wbindgen_init_externref_table = function() { + imports.wbg.__wbindgen_init_externref_table = function __wbindgen_init_externref_table() { const table = wasm.__wbindgen_export_2; const offset = table.grow(4); table.set(0, undefined); @@ -1265,50 +1265,50 @@ function __wbg_get_imports() { table.set(offset + 3, false); ; }; - imports.wbg.__wbindgen_is_bigint = function(arg0) { + imports.wbg.__wbindgen_is_bigint = function __wbindgen_is_bigint(arg0) { const ret = typeof(arg0) === 'bigint'; return ret; }; - imports.wbg.__wbindgen_is_function = function(arg0) { + imports.wbg.__wbindgen_is_function = function __wbindgen_is_function(arg0) { const ret = typeof(arg0) === 'function'; return ret; }; - imports.wbg.__wbindgen_is_object = function(arg0) { + imports.wbg.__wbindgen_is_object = function __wbindgen_is_object(arg0) { const val = arg0; const ret = typeof(val) === 'object' && val !== null; return ret; }; - imports.wbg.__wbindgen_is_string = function(arg0) { + imports.wbg.__wbindgen_is_string = function __wbindgen_is_string(arg0) { const ret = typeof(arg0) === 'string'; return ret; }; - imports.wbg.__wbindgen_is_undefined = function(arg0) { + imports.wbg.__wbindgen_is_undefined = function __wbindgen_is_undefined(arg0) { const ret = arg0 === undefined; return ret; }; - imports.wbg.__wbindgen_jsval_eq = function(arg0, arg1) { + imports.wbg.__wbindgen_jsval_eq = function __wbindgen_jsval_eq(arg0, arg1) { const ret = arg0 === arg1; return ret; }; - imports.wbg.__wbindgen_jsval_loose_eq = function(arg0, arg1) { + imports.wbg.__wbindgen_jsval_loose_eq = function __wbindgen_jsval_loose_eq(arg0, arg1) { const ret = arg0 == arg1; return ret; }; - imports.wbg.__wbindgen_memory = function() { + imports.wbg.__wbindgen_memory = function __wbindgen_memory() { const ret = wasm.memory; return ret; }; - imports.wbg.__wbindgen_number_get = function(arg0, arg1) { + imports.wbg.__wbindgen_number_get = function __wbindgen_number_get(arg0, arg1) { const obj = arg1; const ret = typeof(obj) === 'number' ? obj : undefined; getDataViewMemory0().setFloat64(arg0 + 8 * 1, isLikeNone(ret) ? 0 : ret, true); getDataViewMemory0().setInt32(arg0 + 4 * 0, !isLikeNone(ret), true); }; - imports.wbg.__wbindgen_number_new = function(arg0) { + imports.wbg.__wbindgen_number_new = function __wbindgen_number_new(arg0) { const ret = arg0; return ret; }; - imports.wbg.__wbindgen_string_get = function(arg0, arg1) { + imports.wbg.__wbindgen_string_get = function __wbindgen_string_get(arg0, arg1) { const obj = arg1; const ret = typeof(obj) === 'string' ? obj : undefined; var ptr1 = isLikeNone(ret) ? 0 : passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc); @@ -1316,20 +1316,18 @@ function __wbg_get_imports() { getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true); getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true); }; - imports.wbg.__wbindgen_string_new = function(arg0, arg1) { + imports.wbg.__wbindgen_string_new = function __wbindgen_string_new(arg0, arg1) { const ret = getStringFromWasm0(arg0, arg1); return ret; }; - imports.wbg.__wbindgen_throw = function(arg0, arg1) { + imports.wbg.__wbindgen_throw = function __wbindgen_throw(arg0, arg1) { throw new Error(getStringFromWasm0(arg0, arg1)); }; return imports; } -function __wbg_init_memory(imports, memory) { - -} +function __wbg_init_memory(imports, memory) {} function __wbg_finalize_init(instance, module) { wasm = instance.exports; diff --git a/packages/plugins/didkit/src/didkit/pkg/didkit_wasm_bg.wasm.d.ts b/packages/plugins/didkit/src/didkit/pkg/didkit_wasm_bg.wasm.d.ts index 481d318531..8b80b5cb74 100644 --- a/packages/plugins/didkit/src/didkit/pkg/didkit_wasm_bg.wasm.d.ts +++ b/packages/plugins/didkit/src/didkit/pkg/didkit_wasm_bg.wasm.d.ts @@ -1,4 +1,3 @@ -/* tslint:disable */ /* eslint-disable */ export const memory: WebAssembly.Memory; export const getVersion: () => [number, number]; diff --git a/packages/plugins/didkit/src/helpers.ts b/packages/plugins/didkit/src/helpers.ts index cff2c08971..4816ef78d0 100644 --- a/packages/plugins/didkit/src/helpers.ts +++ b/packages/plugins/didkit/src/helpers.ts @@ -1,4 +1,4 @@ -import { LearnCard } from '@learncard/core'; +import type { LearnCard } from '@learncard/core'; export const getContextURIs = (jsonld: Record) => { const contexts: string[] = []; diff --git a/packages/plugins/didkit/src/plugin.ts b/packages/plugins/didkit/src/plugin.ts index 56f96c8838..1d6685f0d9 100644 --- a/packages/plugins/didkit/src/plugin.ts +++ b/packages/plugins/didkit/src/plugin.ts @@ -1,5 +1,4 @@ import init, { - InitInput, generateEd25519KeyFromBytes, generateSecp256k1KeyFromBytes, keyToDID, @@ -17,10 +16,11 @@ import init, { createDagJwe, decryptDagJwe, clearCache, + type InitInput, } from './didkit/index'; import { getDocumentMap } from './helpers'; -import { DIDKitPlugin, DidMethod } from './types'; +import type { DIDKitPlugin } from './types'; /** j @@ -32,8 +32,6 @@ export const getDidKitPlugin = async ( ): Promise => { await init(input); - const memoizedDids: Partial> = {}; - return { name: 'DIDKit', displayName: 'DIDKit', @@ -116,12 +114,12 @@ export const getDidKitPlugin = async ( isJwt ? '{}' : JSON.stringify( - await getDocumentMap( - _learnCard, - presentation, - allowRemoteContexts - ) - ) + await getDocumentMap( + _learnCard, + presentation, + allowRemoteContexts + ) + ) ) ); }, @@ -179,7 +177,9 @@ export const getDidKitPlugin = async ( const result: Record = {}; for (const key in obj) { - result[key] = convertBigIntsToNumbers(obj[key]); + if (key in obj) { + result[key] = convertBigIntsToNumbers(obj[key]); + } } return result; }; diff --git a/packages/plugins/didkit/src/types.ts b/packages/plugins/didkit/src/types.ts index e77be0d415..5bd62dcb75 100644 --- a/packages/plugins/didkit/src/types.ts +++ b/packages/plugins/didkit/src/types.ts @@ -1,4 +1,4 @@ -import { +import type { JWE, JWKWithPrivateKey, UnsignedVC, @@ -9,7 +9,7 @@ import { DidDocument, } from '@learncard/types'; import type { DIDResolutionResult } from 'dids'; -import { Plugin } from '@learncard/core'; +import type { Plugin } from '@learncard/core'; /** @group DIDKit Plugin */ export type DidMethod = diff --git a/packages/plugins/dynamic-loader/scripts/.eslintrc b/packages/plugins/dynamic-loader/scripts/.eslintrc deleted file mode 100644 index 2b88e1c5e2..0000000000 --- a/packages/plugins/dynamic-loader/scripts/.eslintrc +++ /dev/null @@ -1,10 +0,0 @@ -{ - "root": false, - "env": { - "node": true - }, - "rules": { - "no-console": "off", - "@typescript-eslint/no-var-requires": "off" - } -} \ No newline at end of file diff --git a/packages/plugins/dynamic-loader/scripts/build.mjs b/packages/plugins/dynamic-loader/scripts/build.mjs index 1cf7602ac7..66d62d1195 100644 --- a/packages/plugins/dynamic-loader/scripts/build.mjs +++ b/packages/plugins/dynamic-loader/scripts/build.mjs @@ -71,7 +71,7 @@ await Promise.all( }) ); -await Promise.all(configurations.map(config => esbuild.build(config))).catch(err => { +await Promise.all(configurations.map(config => esbuild.build(config))).catch(() => { console.error('❌ Build failed'); process.exit(1); }); diff --git a/packages/plugins/dynamic-loader/src/index.ts b/packages/plugins/dynamic-loader/src/index.ts index aef11d4b4b..c4ac03ab96 100644 --- a/packages/plugins/dynamic-loader/src/index.ts +++ b/packages/plugins/dynamic-loader/src/index.ts @@ -1,4 +1,4 @@ -import { DynamicLoaderPluginType } from './types'; +import type { DynamicLoaderPluginType } from './types'; export * from './types'; diff --git a/packages/plugins/dynamic-loader/src/types.ts b/packages/plugins/dynamic-loader/src/types.ts index 1745d8a43b..143d9ec468 100644 --- a/packages/plugins/dynamic-loader/src/types.ts +++ b/packages/plugins/dynamic-loader/src/types.ts @@ -1,3 +1,3 @@ -import { Plugin } from '@learncard/core'; +import type { Plugin } from '@learncard/core'; export type DynamicLoaderPluginType = Plugin<'Dynamic Loader', 'context'>; diff --git a/packages/plugins/encryption/scripts/.eslintrc b/packages/plugins/encryption/scripts/.eslintrc deleted file mode 100644 index 2b88e1c5e2..0000000000 --- a/packages/plugins/encryption/scripts/.eslintrc +++ /dev/null @@ -1,10 +0,0 @@ -{ - "root": false, - "env": { - "node": true - }, - "rules": { - "no-console": "off", - "@typescript-eslint/no-var-requires": "off" - } -} \ No newline at end of file diff --git a/packages/plugins/encryption/scripts/build.mjs b/packages/plugins/encryption/scripts/build.mjs index 53135e69e1..6e9fb42b9a 100644 --- a/packages/plugins/encryption/scripts/build.mjs +++ b/packages/plugins/encryption/scripts/build.mjs @@ -70,7 +70,7 @@ await Promise.all( }) ); -await Promise.all(configurations.map(config => esbuild.build(config))).catch(err => { +await Promise.all(configurations.map(config => esbuild.build(config))).catch(() => { console.error('❌ Build failed'); process.exit(1); }); diff --git a/packages/plugins/encryption/src/index.ts b/packages/plugins/encryption/src/index.ts index 2653ca1a0c..07080a17b5 100644 --- a/packages/plugins/encryption/src/index.ts +++ b/packages/plugins/encryption/src/index.ts @@ -1,4 +1,4 @@ -import { EncryptionPluginType, EncryptionDependentLearnCard } from './types'; +import type { EncryptionPluginType, EncryptionDependentLearnCard } from './types'; export * from './types'; diff --git a/packages/plugins/encryption/src/types.ts b/packages/plugins/encryption/src/types.ts index 351db54df1..9e4ea4fc43 100644 --- a/packages/plugins/encryption/src/types.ts +++ b/packages/plugins/encryption/src/types.ts @@ -1,5 +1,5 @@ -import { LearnCard, Plugin } from '@learncard/core'; -import { JWE, JWKWithPrivateKey } from '@learncard/types'; +import type { LearnCard, Plugin } from '@learncard/core'; +import type { JWE, JWKWithPrivateKey } from '@learncard/types'; export type EncryptionPluginMethods = { createJwe: (cleartext: string, recipients?: string[]) => Promise; diff --git a/packages/plugins/ethereum/scripts/.eslintrc b/packages/plugins/ethereum/scripts/.eslintrc deleted file mode 100644 index 2b88e1c5e2..0000000000 --- a/packages/plugins/ethereum/scripts/.eslintrc +++ /dev/null @@ -1,10 +0,0 @@ -{ - "root": false, - "env": { - "node": true - }, - "rules": { - "no-console": "off", - "@typescript-eslint/no-var-requires": "off" - } -} \ No newline at end of file diff --git a/packages/plugins/ethereum/scripts/build.mjs b/packages/plugins/ethereum/scripts/build.mjs index 74fa6443d7..2891496e3f 100644 --- a/packages/plugins/ethereum/scripts/build.mjs +++ b/packages/plugins/ethereum/scripts/build.mjs @@ -71,7 +71,7 @@ await Promise.all( }) ); -await Promise.all(configurations.map(config => esbuild.build(config))).catch(err => { +await Promise.all(configurations.map(config => esbuild.build(config))).catch(() => { console.error('❌ Build failed'); process.exit(1); }); diff --git a/packages/plugins/ethereum/src/helpers.ts b/packages/plugins/ethereum/src/helpers.ts index 7f2ba2d456..a1d6a3c8e0 100644 --- a/packages/plugins/ethereum/src/helpers.ts +++ b/packages/plugins/ethereum/src/helpers.ts @@ -1,6 +1,6 @@ import { ethers } from 'ethers'; -import { Token, TokenList } from './types'; +import type { Token, TokenList } from './types'; export const isAddress = (maybeAddress: string) => { return maybeAddress.startsWith('0x') && maybeAddress.length === 42; diff --git a/packages/plugins/ethereum/src/index.ts b/packages/plugins/ethereum/src/index.ts index 1d6669edde..757a1d0ed6 100644 --- a/packages/plugins/ethereum/src/index.ts +++ b/packages/plugins/ethereum/src/index.ts @@ -1,9 +1,9 @@ import { Buffer } from 'buffer'; -import { LearnCard } from '@learncard/core'; +import type { LearnCard } from '@learncard/core'; import { ethers } from 'ethers'; -import { EthereumConfig, EthereumPlugin, TokenList } from './types'; +import type { EthereumConfig, EthereumPlugin, TokenList } from './types'; import { formatUnits, parseUnits, @@ -51,9 +51,10 @@ export const getEthereumPlugin = ( let provider: ethers.providers.Provider; const getDefaultTokenList = (): TokenList => { - return require('@uniswap/default-token-list/build/uniswap-default.tokenlist.json').tokens.concat( - hardcodedTokens - ); + return [ + ...require('@uniswap/default-token-list/build/uniswap-default.tokenlist.json').tokens, + ...hardcodedTokens, + ]; }; const defaultTokenList: TokenList = getDefaultTokenList(); @@ -103,7 +104,7 @@ export const getEthereumPlugin = ( const tokenAddress = await getTokenAddress(tokenSymbolOrAddress); if (!tokenAddress) { - throw new Error(`Unable to determine token address for \"${tokenSymbolOrAddress}\"`); + throw new Error(`Unable to determine token address for "${tokenSymbolOrAddress}"`); } const balance = await getErc20TokenBalance(tokenAddress, walletAddress); @@ -140,7 +141,7 @@ export const getEthereumPlugin = ( const tokenAddress = await getTokenAddress(tokenSymbolOrAddress); if (!tokenAddress) { throw new Error( - `Unable to determine token address for \"${tokenSymbolOrAddress}\"` + `Unable to determine token address for "${tokenSymbolOrAddress}"` ); } @@ -174,10 +175,10 @@ export const getEthereumPlugin = ( try { network = _network; provider = getProvider(); - } catch (e) { + } catch (error) { network = oldNetwork; provider = getProvider(); - throw e; + throw error; } }, addInfuraProjectId: (_learnCard, infuraProjectIdToAdd) => { diff --git a/packages/plugins/ethereum/src/types.ts b/packages/plugins/ethereum/src/types.ts index f0adb89103..62e4b83750 100644 --- a/packages/plugins/ethereum/src/types.ts +++ b/packages/plugins/ethereum/src/types.ts @@ -1,5 +1,5 @@ -import { providers } from 'ethers'; -import { Plugin } from '@learncard/core'; +import type { providers } from 'ethers'; +import type { Plugin } from '@learncard/core'; /** @group Ethereum Plugin */ export type EthereumPluginMethods = { diff --git a/packages/plugins/expiration/scripts/.eslintrc b/packages/plugins/expiration/scripts/.eslintrc deleted file mode 100644 index 2b88e1c5e2..0000000000 --- a/packages/plugins/expiration/scripts/.eslintrc +++ /dev/null @@ -1,10 +0,0 @@ -{ - "root": false, - "env": { - "node": true - }, - "rules": { - "no-console": "off", - "@typescript-eslint/no-var-requires": "off" - } -} \ No newline at end of file diff --git a/packages/plugins/expiration/scripts/build.mjs b/packages/plugins/expiration/scripts/build.mjs index f6eac4d054..4a7c9917be 100644 --- a/packages/plugins/expiration/scripts/build.mjs +++ b/packages/plugins/expiration/scripts/build.mjs @@ -71,7 +71,7 @@ await Promise.all( }) ); -await Promise.all(configurations.map(config => esbuild.build(config))).catch(err => { +await Promise.all(configurations.map(config => esbuild.build(config))).catch(() => { console.error('❌ Build failed'); process.exit(1); }); diff --git a/packages/plugins/expiration/src/index.ts b/packages/plugins/expiration/src/index.ts index 50f3b2007a..c7514c98d3 100644 --- a/packages/plugins/expiration/src/index.ts +++ b/packages/plugins/expiration/src/index.ts @@ -1,6 +1,6 @@ -import { VerifyExtension } from '@learncard/vc-plugin'; -import { LearnCard } from '@learncard/core'; -import { ExpirationPlugin } from './types'; +import type { VerifyExtension } from '@learncard/vc-plugin'; +import type { LearnCard } from '@learncard/core'; +import type { ExpirationPlugin } from './types'; export * from './types'; diff --git a/packages/plugins/expiration/src/types.ts b/packages/plugins/expiration/src/types.ts index 54cf046656..50af904a6b 100644 --- a/packages/plugins/expiration/src/types.ts +++ b/packages/plugins/expiration/src/types.ts @@ -1,4 +1,4 @@ -import { Plugin } from '@learncard/core'; -import { VerifyExtension } from '@learncard/vc-plugin'; +import type { Plugin } from '@learncard/core'; +import type { VerifyExtension } from '@learncard/vc-plugin'; export type ExpirationPlugin = Plugin<'Expiration', any, VerifyExtension>; diff --git a/packages/plugins/idx/scripts/.eslintrc b/packages/plugins/idx/scripts/.eslintrc deleted file mode 100644 index 2b88e1c5e2..0000000000 --- a/packages/plugins/idx/scripts/.eslintrc +++ /dev/null @@ -1,10 +0,0 @@ -{ - "root": false, - "env": { - "node": true - }, - "rules": { - "no-console": "off", - "@typescript-eslint/no-var-requires": "off" - } -} \ No newline at end of file diff --git a/packages/plugins/idx/scripts/build.mjs b/packages/plugins/idx/scripts/build.mjs index c51dcd9077..07d1666227 100644 --- a/packages/plugins/idx/scripts/build.mjs +++ b/packages/plugins/idx/scripts/build.mjs @@ -71,7 +71,7 @@ await Promise.all( }) ); -await Promise.all(configurations.map(config => esbuild.build(config))).catch(err => { +await Promise.all(configurations.map(config => esbuild.build(config))).catch(() => { console.error('❌ Build failed'); process.exit(1); }); diff --git a/packages/plugins/idx/src/defaults.ts b/packages/plugins/idx/src/defaults.ts index 8da14d59b6..40b8b29dd4 100644 --- a/packages/plugins/idx/src/defaults.ts +++ b/packages/plugins/idx/src/defaults.ts @@ -1,4 +1,4 @@ -import { IDXArgs } from './types'; +import type { IDXArgs } from './types'; export const DEFAULT_IDX_ARGS: IDXArgs = { modelData: { diff --git a/packages/plugins/idx/src/idx.ts b/packages/plugins/idx/src/idx.ts index f3449a32e4..6448dbfa9b 100644 --- a/packages/plugins/idx/src/idx.ts +++ b/packages/plugins/idx/src/idx.ts @@ -1,16 +1,21 @@ import { DIDDataStore } from '@glazed/did-datastore'; -import { CredentialRecordValidator, VC, CredentialRecord, VCValidator } from '@learncard/types'; -import { LearnCard } from '@learncard/core'; +import { + CredentialRecordValidator, + VCValidator, + type VC, + type CredentialRecord, +} from '@learncard/types'; +import type { LearnCard } from '@learncard/core'; import { streamIdToCeramicURI } from '@learncard/ceramic-plugin'; import { - IDXPlugin, - CredentialsList, CredentialsListValidator, - IDXPluginDependentMethods, - IDXArgs, BackwardsCompatCredentialsListValidator, + type IDXPlugin, + type CredentialsList, + type IDXPluginDependentMethods, + type IDXArgs, } from './types'; import { DEFAULT_IDX_ARGS } from './defaults'; @@ -44,7 +49,7 @@ export const getIDXPlugin = async ( const newCreds = oldCreds.map(cred => { if ('uri' in cred) return cred as CredentialRecord; - const { title, id, storageType, ...rest } = cred; + const { title, id, storageType: _storageType, ...rest } = cred; return { ...rest, @@ -90,7 +95,7 @@ export const getIDXPlugin = async ( if (!record) throw new Error('record is required'); - if (!record.uri) throw Error('No URI provided'); + if (!record.uri) throw new Error('No URI provided'); // Make sure URI can be resolved await learnCard.read.get(record.uri); @@ -101,7 +106,7 @@ export const getIDXPlugin = async ( return credential.id === record.id; }); - if (indexOfExistingCredential > -1) { + if (indexOfExistingCredential !== -1) { existing.credentials[indexOfExistingCredential] = record; } else existing.credentials.push(record); @@ -124,7 +129,7 @@ export const getIDXPlugin = async ( return credential.id === record.id; }); - if (indexOfExistingCredential > -1) { + if (indexOfExistingCredential !== -1) { existing.credentials[indexOfExistingCredential] = record; } else existing.credentials.push(record); }) @@ -230,7 +235,7 @@ export const getIDXPlugin = async ( if (!record) throw new Error('record is required'); - if (!record.uri) throw Error('No URI provided'); + if (!record.uri) throw new Error('No URI provided'); // Make sure URI can be resolved await _learnCard.read.get(record.uri); @@ -241,7 +246,7 @@ export const getIDXPlugin = async ( return credential.id === record.id; }); - if (indexOfExistingCredential > -1) { + if (indexOfExistingCredential !== -1) { existing.credentials[indexOfExistingCredential] = record; } else existing.credentials.push(record); diff --git a/packages/plugins/idx/src/types.ts b/packages/plugins/idx/src/types.ts index b5e1b40efd..0d4ed0e930 100644 --- a/packages/plugins/idx/src/types.ts +++ b/packages/plugins/idx/src/types.ts @@ -1,9 +1,9 @@ -import { ModelAliases } from '@glazed/types'; +import type { ModelAliases } from '@glazed/types'; import { z } from 'zod'; -import { StreamID } from '@ceramicnetwork/streamid'; -import { Plugin } from '@learncard/core'; -import { VC, CredentialRecord, CredentialRecordValidator } from '@learncard/types'; -import { CeramicClient } from '@ceramicnetwork/http-client'; +import type { StreamID } from '@ceramicnetwork/streamid'; +import type { Plugin } from '@learncard/core'; +import { CredentialRecordValidator, type VC, type CredentialRecord } from '@learncard/types'; +import type { CeramicClient } from '@ceramicnetwork/http-client'; /** @group IDXPlugin */ export type IDXIndexObject< @@ -47,7 +47,7 @@ export type IDXPluginDependentMethods = { /** @group IDXPlugin */ export type CredentialsList = Record> = { - credentials: Array>; + credentials: CredentialRecord[]; }; /** @group IDXPlugin */ @@ -77,7 +77,7 @@ export const BackwardsCompatIDXCredentialValidator: z.ZodType = Record > = { - credentials: Array | BackwardsCompatIDXCredential>; + credentials: (CredentialRecord | BackwardsCompatIDXCredential)[]; }; /** @group IDXPlugin */ diff --git a/packages/plugins/learn-card-network/scripts/.eslintrc b/packages/plugins/learn-card-network/scripts/.eslintrc deleted file mode 100644 index 2b88e1c5e2..0000000000 --- a/packages/plugins/learn-card-network/scripts/.eslintrc +++ /dev/null @@ -1,10 +0,0 @@ -{ - "root": false, - "env": { - "node": true - }, - "rules": { - "no-console": "off", - "@typescript-eslint/no-var-requires": "off" - } -} \ No newline at end of file diff --git a/packages/plugins/learn-card-network/scripts/build.mjs b/packages/plugins/learn-card-network/scripts/build.mjs index 81db0254f6..3a4700a3a3 100644 --- a/packages/plugins/learn-card-network/scripts/build.mjs +++ b/packages/plugins/learn-card-network/scripts/build.mjs @@ -71,7 +71,7 @@ await Promise.all( }) ); -await Promise.all(configurations.map(config => esbuild.build(config))).catch(err => { +await Promise.all(configurations.map(config => esbuild.build(config))).catch(() => { console.error('❌ Build failed'); process.exit(1); }); diff --git a/packages/plugins/learn-card-network/src/plugin.ts b/packages/plugins/learn-card-network/src/plugin.ts index c75e760b8d..423625e57c 100644 --- a/packages/plugins/learn-card-network/src/plugin.ts +++ b/packages/plugins/learn-card-network/src/plugin.ts @@ -1,20 +1,19 @@ import { getClient } from '@learncard/network-brain-client'; import { JWEValidator, - LCNProfile, UnsignedVCValidator, VCValidator, VPValidator, - Profile, ConsentFlowContractValidator, ConsentFlowTermsValidator, - JWE, - AUTH_GRANT_AUDIENCE_DOMAIN_PREFIX, + type LCNProfile, + type Profile, + type JWE, } from '@learncard/types'; -import { LearnCard } from '@learncard/core'; -import { VerifyExtension } from '@learncard/vc-plugin'; +import type { LearnCard } from '@learncard/core'; +import type { VerifyExtension } from '@learncard/vc-plugin'; -import { +import type { LearnCardNetworkPluginDependentMethods, LearnCardNetworkPlugin, VerifyBoostPlugin, @@ -526,7 +525,7 @@ export const getLearnCardNetworkPlugin = async ( limit = 25, cursor = undefined, includeUnacceptedBoosts = true, - query + query = undefined ) => { if (!userData) throw new Error('Please make an account first!'); @@ -1071,7 +1070,7 @@ export const getVerifyBoostPlugin = async ( } } } - } catch (e) { + } catch { verificationCheck.errors.push('Boost authenticity could not be verified.'); } return verificationCheck; diff --git a/packages/plugins/learn-card-network/src/test/mocks/sample-vcs.ts b/packages/plugins/learn-card-network/src/test/mocks/sample-vcs.ts index 3b18e99b1c..b55213638b 100644 --- a/packages/plugins/learn-card-network/src/test/mocks/sample-vcs.ts +++ b/packages/plugins/learn-card-network/src/test/mocks/sample-vcs.ts @@ -1,4 +1,4 @@ -import { VC, CredentialRecord } from '@learncard/types'; +import { type VC } from '@learncard/types'; export const SAMPLE_VCS: Record = { VALID_BOOST: { diff --git a/packages/plugins/learn-card-network/src/types.ts b/packages/plugins/learn-card-network/src/types.ts index 3a55b09982..a5afde302e 100644 --- a/packages/plugins/learn-card-network/src/types.ts +++ b/packages/plugins/learn-card-network/src/types.ts @@ -1,5 +1,5 @@ import type { LCNClient } from '@learncard/network-brain-client'; -import { +import type { LCNProfile, LCNProfileManager, UnsignedVC, @@ -44,9 +44,9 @@ import { AuthGrantType, AuthGrantQuery, } from '@learncard/types'; -import { Plugin } from '@learncard/core'; -import { ProofOptions } from '@learncard/didkit-plugin'; -import { VerifyExtension } from '@learncard/vc-plugin'; +import type { Plugin } from '@learncard/core'; +import type { ProofOptions } from '@learncard/didkit-plugin'; +import type { VerifyExtension } from '@learncard/vc-plugin'; /** @group LearnCardNetwork Plugin */ export type LearnCardNetworkPluginDependentMethods = { @@ -356,7 +356,7 @@ export type LearnCardNetworkPluginMethods = { addDidMetadata: (metadata: Partial) => Promise; getDidMetadata: (id: string) => Promise | undefined>; - getMyDidMetadata: () => Promise & { id: string }>>; + getMyDidMetadata: () => Promise<(Partial & { id: string })[]>; updateDidMetadata: (id: string, updates: Partial) => Promise; deleteDidMetadata: (id: string) => Promise; diff --git a/packages/plugins/learn-card/scripts/.eslintrc b/packages/plugins/learn-card/scripts/.eslintrc deleted file mode 100644 index 2b88e1c5e2..0000000000 --- a/packages/plugins/learn-card/scripts/.eslintrc +++ /dev/null @@ -1,10 +0,0 @@ -{ - "root": false, - "env": { - "node": true - }, - "rules": { - "no-console": "off", - "@typescript-eslint/no-var-requires": "off" - } -} \ No newline at end of file diff --git a/packages/plugins/learn-card/scripts/build.mjs b/packages/plugins/learn-card/scripts/build.mjs index 99262abe70..ebd7e1bf22 100644 --- a/packages/plugins/learn-card/scripts/build.mjs +++ b/packages/plugins/learn-card/scripts/build.mjs @@ -71,7 +71,7 @@ await Promise.all( }) ); -await Promise.all(configurations.map(config => esbuild.build(config))).catch(err => { +await Promise.all(configurations.map(config => esbuild.build(config))).catch(_error => { console.error('❌ Build failed'); process.exit(1); }); diff --git a/packages/plugins/learn-card/src/index.ts b/packages/plugins/learn-card/src/index.ts index e4d74dd4bd..252a133288 100644 --- a/packages/plugins/learn-card/src/index.ts +++ b/packages/plugins/learn-card/src/index.ts @@ -1,5 +1,5 @@ -import { LearnCard } from '@learncard/core'; -import { LearnCardPluginDependentMethods, LearnCardPlugin } from './types'; +import type { LearnCard } from '@learncard/core'; +import type { LearnCardPluginDependentMethods, LearnCardPlugin } from './types'; import { verifyCredential } from './verify'; export * from './types'; diff --git a/packages/plugins/learn-card/src/types.ts b/packages/plugins/learn-card/src/types.ts index 1c0f06641b..09d5b404d4 100644 --- a/packages/plugins/learn-card/src/types.ts +++ b/packages/plugins/learn-card/src/types.ts @@ -1,6 +1,6 @@ -import { VC, VerificationCheck, VerificationItem } from '@learncard/types'; -import { Plugin } from '@learncard/core'; -import { ProofOptions } from '@learncard/didkit-plugin'; +import type { VC, VerificationCheck, VerificationItem } from '@learncard/types'; +import type { Plugin } from '@learncard/core'; +import type { ProofOptions } from '@learncard/didkit-plugin'; export type VerifyCredential = { (vc: VC, options?: Partial): Promise; diff --git a/packages/plugins/learn-card/src/verify.ts b/packages/plugins/learn-card/src/verify.ts index de765e50d3..92fc31a577 100644 --- a/packages/plugins/learn-card/src/verify.ts +++ b/packages/plugins/learn-card/src/verify.ts @@ -1,8 +1,8 @@ -import { VC, VerificationCheck, VerificationItem, VerificationStatusEnum } from '@learncard/types'; +import { VerificationStatusEnum, type VC, type VerificationCheck, type VerificationItem } from '@learncard/types'; import { format } from 'date-fns'; -import { LearnCard } from '@learncard/core'; -import { ProofOptions } from '@learncard/didkit-plugin'; +import type { LearnCard } from '@learncard/core'; +import type { ProofOptions } from '@learncard/didkit-plugin'; const transformErrorCheck = (error: string, _credential: VC): string => { const prefix = error.split(' error')[0]; diff --git a/packages/plugins/learn-cloud/scripts/.eslintrc b/packages/plugins/learn-cloud/scripts/.eslintrc deleted file mode 100644 index 2b88e1c5e2..0000000000 --- a/packages/plugins/learn-cloud/scripts/.eslintrc +++ /dev/null @@ -1,10 +0,0 @@ -{ - "root": false, - "env": { - "node": true - }, - "rules": { - "no-console": "off", - "@typescript-eslint/no-var-requires": "off" - } -} \ No newline at end of file diff --git a/packages/plugins/learn-cloud/scripts/build.mjs b/packages/plugins/learn-cloud/scripts/build.mjs index 9969169bfe..07612b0133 100644 --- a/packages/plugins/learn-cloud/scripts/build.mjs +++ b/packages/plugins/learn-cloud/scripts/build.mjs @@ -71,7 +71,7 @@ await Promise.all( }) ); -await Promise.all(configurations.map(config => esbuild.build(config))).catch(err => { +await Promise.all(configurations.map(config => esbuild.build(config))).catch(_error => { console.error('❌ Build failed'); process.exit(1); }); diff --git a/packages/plugins/learn-cloud/src/helpers.ts b/packages/plugins/learn-cloud/src/helpers.ts index 99b271ba78..43e10a184e 100644 --- a/packages/plugins/learn-cloud/src/helpers.ts +++ b/packages/plugins/learn-cloud/src/helpers.ts @@ -1,8 +1,8 @@ -import { JWE, EncryptedRecord } from '@learncard/types'; +import type { JWE, EncryptedRecord } from '@learncard/types'; import stringify from 'json-stringify-deterministic'; import pbkdf2Hmac from 'pbkdf2-hmac'; -import { LearnCloudDependentLearnCard } from './types'; +import type { LearnCloudDependentLearnCard } from './types'; export const hash = async ( learnCard: LearnCloudDependentLearnCard, @@ -28,7 +28,7 @@ export const hash = async ( const digestBuffer = await crypto.subtle.sign('HMAC', cryptoKey, uint8Message); - const digestArray = Array.from(new Uint8Array(digestBuffer)); + const digestArray = [...new Uint8Array(digestBuffer)]; return digestArray.map(byte => (byte as any).toString(16).padStart(2, '0')).join(''); }; diff --git a/packages/plugins/learn-cloud/src/plugin.ts b/packages/plugins/learn-cloud/src/plugin.ts index cfa6fc4353..ec6e74c313 100644 --- a/packages/plugins/learn-cloud/src/plugin.ts +++ b/packages/plugins/learn-cloud/src/plugin.ts @@ -1,17 +1,17 @@ import { chunk } from 'lodash'; -import { getClient, LearnCloudClient } from '@learncard/learn-cloud-client'; -import { LearnCard } from '@learncard/core'; +import { getClient, type LearnCloudClient } from '@learncard/learn-cloud-client'; +import type { LearnCard } from '@learncard/core'; import { isEncrypted } from '@learncard/helpers'; import { - CredentialRecord, - JWE, - PaginatedEncryptedRecordsType, - PaginatedEncryptedCredentialRecordsType, VCValidator, VPValidator, + type CredentialRecord, + type JWE, + type PaginatedEncryptedRecordsType, + type PaginatedEncryptedCredentialRecordsType, } from '@learncard/types'; -import { LearnCloudPluginDependentMethods, LearnCloudPlugin } from './types'; +import type { LearnCloudPluginDependentMethods, LearnCloudPlugin } from './types'; import { generateEncryptedRecord, generateEncryptedFieldsArray, @@ -336,7 +336,7 @@ export const getLearnCloudPlugin = async ( const fullUrl = ( uriUrl.startsWith('http') ? uriUrl - : `http${uriUrl.includes('http') || uriUrl.includes('localhost') ? '' : 's' + : `http${uriUrl.includes('localhost') ? '' : 's' }://${uriUrl}` ).replaceAll('%3A', ':'); diff --git a/packages/plugins/learn-cloud/src/test/mocks/sample-vcs.ts b/packages/plugins/learn-cloud/src/test/mocks/sample-vcs.ts index 3b18e99b1c..b55213638b 100644 --- a/packages/plugins/learn-cloud/src/test/mocks/sample-vcs.ts +++ b/packages/plugins/learn-cloud/src/test/mocks/sample-vcs.ts @@ -1,4 +1,4 @@ -import { VC, CredentialRecord } from '@learncard/types'; +import { type VC } from '@learncard/types'; export const SAMPLE_VCS: Record = { VALID_BOOST: { diff --git a/packages/plugins/learn-cloud/src/types.ts b/packages/plugins/learn-cloud/src/types.ts index fc660b93da..2d49ff33aa 100644 --- a/packages/plugins/learn-cloud/src/types.ts +++ b/packages/plugins/learn-cloud/src/types.ts @@ -1,5 +1,5 @@ import type { Filter } from '@learncard/learn-cloud-service'; -import { +import type { JWE, JWKWithPrivateKey, UnsignedVC, diff --git a/packages/plugins/simple-signing-plugin/scripts/.eslintrc b/packages/plugins/simple-signing-plugin/scripts/.eslintrc deleted file mode 100644 index 2b88e1c5e2..0000000000 --- a/packages/plugins/simple-signing-plugin/scripts/.eslintrc +++ /dev/null @@ -1,10 +0,0 @@ -{ - "root": false, - "env": { - "node": true - }, - "rules": { - "no-console": "off", - "@typescript-eslint/no-var-requires": "off" - } -} \ No newline at end of file diff --git a/packages/plugins/simple-signing-plugin/scripts/build.mjs b/packages/plugins/simple-signing-plugin/scripts/build.mjs index 0848cd3431..b033142f5e 100644 --- a/packages/plugins/simple-signing-plugin/scripts/build.mjs +++ b/packages/plugins/simple-signing-plugin/scripts/build.mjs @@ -76,7 +76,7 @@ function main() { console.log('✔ Build successful'); process.exit(0); }) - .catch(err => { + .catch(() => { console.error('❌ Build failed'); process.exit(1); }); diff --git a/packages/plugins/simple-signing-plugin/src/plugin.ts b/packages/plugins/simple-signing-plugin/src/plugin.ts index c100c54f3a..d7b5454005 100644 --- a/packages/plugins/simple-signing-plugin/src/plugin.ts +++ b/packages/plugins/simple-signing-plugin/src/plugin.ts @@ -1,7 +1,7 @@ import { getClient } from '@learncard/simple-signing-client'; -import { LearnCard } from '@learncard/core'; +import type { LearnCard } from '@learncard/core'; -import { SimpleSigningPluginDependentMethods, SimpleSigningPlugin } from './types'; +import type { SimpleSigningPluginDependentMethods, SimpleSigningPlugin } from './types'; export * from './types'; const getNewClient = async ( diff --git a/packages/plugins/simple-signing-plugin/src/types.ts b/packages/plugins/simple-signing-plugin/src/types.ts index d96c715991..67104aabd8 100644 --- a/packages/plugins/simple-signing-plugin/src/types.ts +++ b/packages/plugins/simple-signing-plugin/src/types.ts @@ -1,7 +1,7 @@ import { z } from 'zod'; -import { VP, LCNProfile } from '@learncard/types'; -import { Plugin } from '@learncard/core'; -import { ProofOptions } from '@learncard/didkit-plugin'; +import type { VP, LCNProfile } from '@learncard/types'; +import type { Plugin } from '@learncard/core'; +import type { ProofOptions } from '@learncard/didkit-plugin'; export const SigningAuthorityValidator = z.object({ _id: z.string().optional(), diff --git a/packages/plugins/vc-api/scripts/.eslintrc b/packages/plugins/vc-api/scripts/.eslintrc deleted file mode 100644 index 2b88e1c5e2..0000000000 --- a/packages/plugins/vc-api/scripts/.eslintrc +++ /dev/null @@ -1,10 +0,0 @@ -{ - "root": false, - "env": { - "node": true - }, - "rules": { - "no-console": "off", - "@typescript-eslint/no-var-requires": "off" - } -} \ No newline at end of file diff --git a/packages/plugins/vc-api/scripts/build.mjs b/packages/plugins/vc-api/scripts/build.mjs index 0565f4b851..c07182931e 100644 --- a/packages/plugins/vc-api/scripts/build.mjs +++ b/packages/plugins/vc-api/scripts/build.mjs @@ -71,7 +71,7 @@ await Promise.all( }) ); -await Promise.all(configurations.map(config => esbuild.build(config))).catch(err => { +await Promise.all(configurations.map(config => esbuild.build(config))).catch(() => { console.error('❌ Build failed'); process.exit(1); }); diff --git a/packages/plugins/vc-api/src/index.ts b/packages/plugins/vc-api/src/index.ts index df519eb3f1..db75824e64 100644 --- a/packages/plugins/vc-api/src/index.ts +++ b/packages/plugins/vc-api/src/index.ts @@ -6,7 +6,7 @@ import { VerificationCheckValidator, } from '@learncard/types'; -import { VCAPIPlugin } from './types'; +import type { VCAPIPlugin } from './types'; import { isSuccessful, post } from './helpers'; export * from './types'; diff --git a/packages/plugins/vc-api/src/types.ts b/packages/plugins/vc-api/src/types.ts index 1825a727ce..f71736cab3 100644 --- a/packages/plugins/vc-api/src/types.ts +++ b/packages/plugins/vc-api/src/types.ts @@ -1,5 +1,5 @@ -import { UnsignedVC, UnsignedVP, VC, VP, VerificationCheck } from '@learncard/types'; -import { Plugin } from '@learncard/core'; +import type { UnsignedVC, UnsignedVP, VC, VP, VerificationCheck } from '@learncard/types'; +import type { Plugin } from '@learncard/core'; /** @group VC-API Plugin */ export type APIOptions = { diff --git a/packages/plugins/vc-templates/scripts/.eslintrc b/packages/plugins/vc-templates/scripts/.eslintrc deleted file mode 100644 index 2b88e1c5e2..0000000000 --- a/packages/plugins/vc-templates/scripts/.eslintrc +++ /dev/null @@ -1,10 +0,0 @@ -{ - "root": false, - "env": { - "node": true - }, - "rules": { - "no-console": "off", - "@typescript-eslint/no-var-requires": "off" - } -} \ No newline at end of file diff --git a/packages/plugins/vc-templates/scripts/build.mjs b/packages/plugins/vc-templates/scripts/build.mjs index 207966bb48..5871e8f243 100644 --- a/packages/plugins/vc-templates/scripts/build.mjs +++ b/packages/plugins/vc-templates/scripts/build.mjs @@ -71,7 +71,7 @@ await Promise.all( }) ); -await Promise.all(configurations.map(config => esbuild.build(config))).catch(err => { +await Promise.all(configurations.map(config => esbuild.build(config))).catch(() => { console.error('❌ Build failed'); process.exit(1); }); diff --git a/packages/plugins/vc-templates/src/templates.ts b/packages/plugins/vc-templates/src/templates.ts index 9c46d0e4d3..8f104a821c 100644 --- a/packages/plugins/vc-templates/src/templates.ts +++ b/packages/plugins/vc-templates/src/templates.ts @@ -1,594 +1,594 @@ -import { UnsignedVC, UnsignedAchievementCredential } from '@learncard/types'; +import type { UnsignedVC, UnsignedAchievementCredential } from '@learncard/types'; -import { VcTemplates } from './types'; +import type { VcTemplates } from './types'; /** @group VC Templates Plugin */ export const VC_TEMPLATES: { [Key in keyof VcTemplates]: (args: VcTemplates[Key]) => UnsignedVC } = -{ - basic: ({ - did = 'did:example:d23dd687a7dc6787646f2eb98d0', - subject = 'did:example:d23dd687a7dc6787646f2eb98d0', - issuanceDate = '2020-08-19T21:41:50Z', - } = {}) => ({ - '@context': ['https://www.w3.org/2018/credentials/v1'], - id: 'http://example.org/credentials/3731', - type: ['VerifiableCredential'], - issuer: did, - issuanceDate, - credentialSubject: { id: subject }, - }), - achievement: ({ - did = 'did:example:d23dd687a7dc6787646f2eb98d0', - subject = 'did:example:d23dd687a7dc6787646f2eb98d0', - name = 'Teamwork Badge', - achievementName = 'Teamwork', - description = 'This badge recognizes the development of the capacity to collaborate within a group environment.', - criteriaNarrative = 'Team members are nominated for this badge by their peers and recognized upon review by Example Corp management.', - issuanceDate = '2020-08-19T21:41:50Z', - } = {}): UnsignedAchievementCredential => ({ - '@context': [ - 'https://www.w3.org/2018/credentials/v1', - 'https://purl.imsglobal.org/spec/ob/v3p0/context-3.0.2.json', - ], - id: 'http://example.com/credentials/3527', - type: ['VerifiableCredential', 'OpenBadgeCredential'], - issuer: did, - issuanceDate, - name, - credentialSubject: { - id: subject, - type: ['AchievementSubject'], - achievement: { - id: 'https://example.com/achievements/21st-century-skills/teamwork', - type: ['Achievement'], - criteria: { narrative: criteriaNarrative }, - description, - name: achievementName, - }, - }, - }), - jff2: ({ - did = 'did:example:d23dd687a7dc6787646f2eb98d0', - subject = 'did:example:d23dd687a7dc6787646f2eb98d0', - issuanceDate = '2020-08-19T21:41:50Z', - } = {}) => ({ - '@context': [ - 'https://www.w3.org/2018/credentials/v1', - 'https://purl.imsglobal.org/spec/ob/v3p0/context.json', - 'https://w3id.org/security/suites/ed25519-2020/v1', - ], - id: 'urn:uuid:a63a60be-f4af-491c-87fc-2c8fd3007a58', - type: ['VerifiableCredential', 'OpenBadgeCredential'], - name: 'JFF x vc-edu PlugFest 2 Interoperability', - issuer: { - type: ['Profile'], - id: did, - name: 'Jobs for the Future (JFF)', - image: { - id: 'https://w3c-ccg.github.io/vc-ed/plugfest-1-2022/images/JFF_LogoLockup.png', - type: 'Image', - }, - }, - issuanceDate: issuanceDate, - credentialSubject: { - type: ['AchievementSubject'], - id: subject, - achievement: { - id: 'urn:uuid:bd6d9316-f7ae-4073-a1e5-2f7f5bd22922', - type: ['Achievement'], - name: 'JFF x vc-edu PlugFest 2 Interoperability', - description: - 'This credential solution supports the use of OBv3 and w3c Verifiable Credentials and is interoperable with at least two other solutions. This was demonstrated successfully during JFF x vc-edu PlugFest 2.', - criteria: { - narrative: - 'Solutions providers earned this badge by demonstrating interoperability between multiple providers based on the OBv3 candidate final standard, with some additional required fields. Credential issuers earning this badge successfully issued a credential into at least two wallets. Wallet implementers earning this badge successfully displayed credentials issued by at least two different credential issuers.', + { + basic: ({ + did = 'did:example:d23dd687a7dc6787646f2eb98d0', + subject = 'did:example:d23dd687a7dc6787646f2eb98d0', + issuanceDate = '2020-08-19T21:41:50Z', + } = {}) => ({ + '@context': ['https://www.w3.org/2018/credentials/v1'], + id: 'http://example.org/credentials/3731', + type: ['VerifiableCredential'], + issuer: did, + issuanceDate, + credentialSubject: { id: subject }, + }), + achievement: ({ + did = 'did:example:d23dd687a7dc6787646f2eb98d0', + subject = 'did:example:d23dd687a7dc6787646f2eb98d0', + name = 'Teamwork Badge', + achievementName = 'Teamwork', + description = 'This badge recognizes the development of the capacity to collaborate within a group environment.', + criteriaNarrative = 'Team members are nominated for this badge by their peers and recognized upon review by Example Corp management.', + issuanceDate = '2020-08-19T21:41:50Z', + } = {}): UnsignedAchievementCredential => ({ + '@context': [ + 'https://www.w3.org/2018/credentials/v1', + 'https://purl.imsglobal.org/spec/ob/v3p0/context-3.0.2.json', + ], + id: 'http://example.com/credentials/3527', + type: ['VerifiableCredential', 'OpenBadgeCredential'], + issuer: did, + issuanceDate, + name, + credentialSubject: { + id: subject, + type: ['AchievementSubject'], + achievement: { + id: 'https://example.com/achievements/21st-century-skills/teamwork', + type: ['Achievement'], + criteria: { narrative: criteriaNarrative }, + description, + name: achievementName, }, + }, + }), + jff2: ({ + did = 'did:example:d23dd687a7dc6787646f2eb98d0', + subject = 'did:example:d23dd687a7dc6787646f2eb98d0', + issuanceDate = '2020-08-19T21:41:50Z', + } = {}) => ({ + '@context': [ + 'https://www.w3.org/2018/credentials/v1', + 'https://purl.imsglobal.org/spec/ob/v3p0/context.json', + 'https://w3id.org/security/suites/ed25519-2020/v1', + ], + id: 'urn:uuid:a63a60be-f4af-491c-87fc-2c8fd3007a58', + type: ['VerifiableCredential', 'OpenBadgeCredential'], + name: 'JFF x vc-edu PlugFest 2 Interoperability', + issuer: { + type: ['Profile'], + id: did, + name: 'Jobs for the Future (JFF)', image: { - id: 'https://w3c-ccg.github.io/vc-ed/plugfest-2-2022/images/JFF-VC-EDU-PLUGFEST2-badge-image.png', + id: 'https://w3c-ccg.github.io/vc-ed/plugfest-1-2022/images/JFF_LogoLockup.png', type: 'Image', }, }, - }, - }), - boost: ({ - did = 'did:example:d23dd687a7dc6787646f2eb98d0', - subject = 'did:example:d23dd687a7dc6787646f2eb98d0', - issuanceDate = '2020-08-19T21:41:50Z', - expirationDate, - boostName = 'Example Boost', - boostId = 'urn:uuid:boost:example:555', - boostImage, - achievementId = 'urn:uuid:123', - achievementType = 'Influencer', - achievementName = 'Awesome Badge', - achievementDescription = 'Awesome People Earn Awesome Badge', - achievementNarrative = 'Earned by being awesome.', - achievementImage = '', - attachments, - display, - familyTitles, - skills, - groupID = '', - } = {}) => ({ - '@context': [ - 'https://www.w3.org/2018/credentials/v1', - 'https://purl.imsglobal.org/spec/ob/v3p0/context-3.0.2.json', - { - // id: '@id', - type: '@type', - xsd: 'https://www.w3.org/2001/XMLSchema#', - lcn: 'https://docs.learncard.com/definitions#', - BoostCredential: { - '@id': 'lcn:boostCredential', - '@context': { - boostId: { - '@id': 'lcn:boostId', - '@type': 'xsd:string', - }, - display: { - '@id': 'lcn:boostDisplay', - '@context': { - backgroundImage: { - '@id': 'lcn:boostBackgroundImage', - '@type': 'xsd:string', - }, - backgroundColor: { - '@id': 'lcn:boostBackgroundColor', - '@type': 'xsd:string', - }, - displayType: { - '@id': 'lcn:boostDisplayType', - '@type': 'xsd:string', - }, - fadeBackgroundImage: { - '@id': 'lcn:boostFadeBackgroundImage', - '@type': 'xsd:boolean', - }, - repeatBackgroundImage: { - '@id': 'lcn:boostRepeatBackgroundImage', - '@type': 'xsd:boolean', - }, - emoji: { - '@id': 'lcn:boostEmoji', - '@context': { - activeSkinTone: { - '@id': 'lcn:boostEmojiActiveSkinTone', - '@type': 'xsd:string', - }, - unified: { - '@id': 'lcn:boostEmojiUnified', - '@type': 'xsd:string', - }, - unifiedWithoutSkinTone: { - '@id': 'lcn:boostEmojiUnifiedWithoutSkinTone', - '@type': 'xsd:string', - }, - names: { - '@id': 'lcn:boostEmojiNames', - '@container': '@set', - '@type': 'xsd:string', - }, - imageUrl: { - '@id': 'lcn:boostEmojiImageUrl', - '@type': 'xsd:string', + issuanceDate: issuanceDate, + credentialSubject: { + type: ['AchievementSubject'], + id: subject, + achievement: { + id: 'urn:uuid:bd6d9316-f7ae-4073-a1e5-2f7f5bd22922', + type: ['Achievement'], + name: 'JFF x vc-edu PlugFest 2 Interoperability', + description: + 'This credential solution supports the use of OBv3 and w3c Verifiable Credentials and is interoperable with at least two other solutions. This was demonstrated successfully during JFF x vc-edu PlugFest 2.', + criteria: { + narrative: + 'Solutions providers earned this badge by demonstrating interoperability between multiple providers based on the OBv3 candidate final standard, with some additional required fields. Credential issuers earning this badge successfully issued a credential into at least two wallets. Wallet implementers earning this badge successfully displayed credentials issued by at least two different credential issuers.', + }, + image: { + id: 'https://w3c-ccg.github.io/vc-ed/plugfest-2-2022/images/JFF-VC-EDU-PLUGFEST2-badge-image.png', + type: 'Image', + }, + }, + }, + }), + boost: ({ + did = 'did:example:d23dd687a7dc6787646f2eb98d0', + subject = 'did:example:d23dd687a7dc6787646f2eb98d0', + issuanceDate = '2020-08-19T21:41:50Z', + expirationDate, + boostName = 'Example Boost', + boostId: _boostId = 'urn:uuid:boost:example:555', + boostImage, + achievementId = 'urn:uuid:123', + achievementType = 'Influencer', + achievementName = 'Awesome Badge', + achievementDescription = 'Awesome People Earn Awesome Badge', + achievementNarrative = 'Earned by being awesome.', + achievementImage = '', + attachments, + display, + familyTitles, + skills, + groupID = '', + } = {}) => ({ + '@context': [ + 'https://www.w3.org/2018/credentials/v1', + 'https://purl.imsglobal.org/spec/ob/v3p0/context-3.0.2.json', + { + // id: '@id', + type: '@type', + xsd: 'https://www.w3.org/2001/XMLSchema#', + lcn: 'https://docs.learncard.com/definitions#', + BoostCredential: { + '@id': 'lcn:boostCredential', + '@context': { + boostId: { + '@id': 'lcn:boostId', + '@type': 'xsd:string', + }, + display: { + '@id': 'lcn:boostDisplay', + '@context': { + backgroundImage: { + '@id': 'lcn:boostBackgroundImage', + '@type': 'xsd:string', + }, + backgroundColor: { + '@id': 'lcn:boostBackgroundColor', + '@type': 'xsd:string', + }, + displayType: { + '@id': 'lcn:boostDisplayType', + '@type': 'xsd:string', + }, + fadeBackgroundImage: { + '@id': 'lcn:boostFadeBackgroundImage', + '@type': 'xsd:boolean', + }, + repeatBackgroundImage: { + '@id': 'lcn:boostRepeatBackgroundImage', + '@type': 'xsd:boolean', + }, + emoji: { + '@id': 'lcn:boostEmoji', + '@context': { + activeSkinTone: { + '@id': 'lcn:boostEmojiActiveSkinTone', + '@type': 'xsd:string', + }, + unified: { + '@id': 'lcn:boostEmojiUnified', + '@type': 'xsd:string', + }, + unifiedWithoutSkinTone: { + '@id': 'lcn:boostEmojiUnifiedWithoutSkinTone', + '@type': 'xsd:string', + }, + names: { + '@id': 'lcn:boostEmojiNames', + '@container': '@set', + '@type': 'xsd:string', + }, + imageUrl: { + '@id': 'lcn:boostEmojiImageUrl', + '@type': 'xsd:string', + }, }, }, }, }, - }, - familyTitles: { - '@id': 'lcn:familyTitles', - '@context': { - guardians: { - '@id': 'lcn:guardians', - '@container': '@set', - '@context': { - plural: { - '@id': 'lcn:plural', - '@type': 'xsd:string', - }, - singular: { - '@id': 'lcn:singular', - '@type': 'xsd:string', + familyTitles: { + '@id': 'lcn:familyTitles', + '@context': { + guardians: { + '@id': 'lcn:guardians', + '@container': '@set', + '@context': { + plural: { + '@id': 'lcn:plural', + '@type': 'xsd:string', + }, + singular: { + '@id': 'lcn:singular', + '@type': 'xsd:string', + }, }, }, - }, - dependents: { - '@id': 'lcn:dependents', - '@container': '@set', - '@context': { - plural: { - '@id': 'lcn:plural', - '@type': 'xsd:string', - }, - singular: { - '@id': 'lcn:singular', - '@type': 'xsd:string', + dependents: { + '@id': 'lcn:dependents', + '@container': '@set', + '@context': { + plural: { + '@id': 'lcn:plural', + '@type': 'xsd:string', + }, + singular: { + '@id': 'lcn:singular', + '@type': 'xsd:string', + }, }, }, }, }, - }, - attachments: { - '@id': 'lcn:boostAttachments', - '@container': '@set', - '@context': { - type: { - '@id': 'lcn:boostAttachmentType', - '@type': 'xsd:string', - }, - title: { - '@id': 'lcn:boostAttachmentTitle', - '@type': 'xsd:string', - }, - url: { - '@id': 'lcn:boostAttachmentUrl', - '@type': 'xsd:string', + attachments: { + '@id': 'lcn:boostAttachments', + '@container': '@set', + '@context': { + type: { + '@id': 'lcn:boostAttachmentType', + '@type': 'xsd:string', + }, + title: { + '@id': 'lcn:boostAttachmentTitle', + '@type': 'xsd:string', + }, + url: { + '@id': 'lcn:boostAttachmentUrl', + '@type': 'xsd:string', + }, }, }, - }, - address: { - '@id': 'https://purl.imsglobal.org/spec/vc/ob/vocab.html#Address', - }, - skills: { - '@id': 'lcn:boostSkills', - '@container': '@set', - '@context': { - category: { - '@id': 'lcn:boostSkillCategory', - '@type': 'xsd:string', - }, - skill: { - '@id': 'lcn:boostSkill', - '@type': 'xsd:string', - }, - subskills: { - '@id': 'lcn:boostSubskills', - '@container': '@set', - '@type': 'xsd:string', + address: { + '@id': 'https://purl.imsglobal.org/spec/vc/ob/vocab.html#Address', + }, + skills: { + '@id': 'lcn:boostSkills', + '@container': '@set', + '@context': { + category: { + '@id': 'lcn:boostSkillCategory', + '@type': 'xsd:string', + }, + skill: { + '@id': 'lcn:boostSkill', + '@type': 'xsd:string', + }, + subskills: { + '@id': 'lcn:boostSubskills', + '@container': '@set', + '@type': 'xsd:string', + }, }, }, - }, - groupID: { - '@id': 'lcn:groupID', - '@type': 'xsd:string', + groupID: { + '@id': 'lcn:groupID', + '@type': 'xsd:string', + }, }, }, }, - }, - ], - type: ['VerifiableCredential', 'OpenBadgeCredential', 'BoostCredential'], - issuer: did, - issuanceDate, - name: boostName, - expirationDate, - credentialSubject: { - id: subject, - type: ['AchievementSubject'], - achievement: { - id: achievementId, - type: ['Achievement'], - achievementType: achievementType, - name: achievementName, - description: achievementDescription, - image: achievementImage, - criteria: { - narrative: achievementNarrative, + ], + type: ['VerifiableCredential', 'OpenBadgeCredential', 'BoostCredential'], + issuer: did, + issuanceDate, + name: boostName, + expirationDate, + credentialSubject: { + id: subject, + type: ['AchievementSubject'], + achievement: { + id: achievementId, + type: ['Achievement'], + achievementType: achievementType, + name: achievementName, + description: achievementDescription, + image: achievementImage, + criteria: { + narrative: achievementNarrative, + }, }, }, - }, - display, - familyTitles, - image: boostImage, - attachments, - skills, - groupID, - }), - boostID: ({ - did = 'did:example:d23dd687a7dc6787646f2eb98d0', - subject = 'did:example:d23dd687a7dc6787646f2eb98d0', - issuanceDate = '2020-08-19T21:41:50Z', - expirationDate, - boostName = 'Example Boost', - boostId = 'urn:uuid:boost:example:555', - boostImage, - achievementId = 'urn:uuid:123', - achievementType = 'Influencer', - achievementName = 'Awesome Badge', - achievementDescription = 'Awesome People Earn Awesome Badge', - achievementNarrative = 'Earned by being awesome.', - achievementImage = '', - address, - attachments, - skills, - display, - familyTitles, - boostID, - groupID = '', - } = {}) => ({ - '@context': [ - 'https://www.w3.org/2018/credentials/v1', - 'https://purl.imsglobal.org/spec/ob/v3p0/context-3.0.2.json', - { - // id: '@id', - type: '@type', - xsd: 'https://www.w3.org/2001/XMLSchema#', - lcn: 'https://docs.learncard.com/definitions#', - BoostCredential: { - '@id': 'lcn:boostCredential', - '@context': { - boostId: { - '@id': 'lcn:boostId', - '@type': 'xsd:string', - }, - display: { - '@id': 'lcn:boostDisplay', - '@context': { - backgroundImage: { - '@id': 'lcn:boostBackgroundImage', - '@type': 'xsd:string', - }, - backgroundColor: { - '@id': 'lcn:boostBackgroundColor', - '@type': 'xsd:string', - }, - displayType: { - '@id': 'lcn:boostDisplayType', - '@type': 'xsd:string', - }, - fadeBackgroundImage: { - '@id': 'lcn:boostFadeBackgroundImage', - '@type': 'xsd:boolean', - }, - repeatBackgroundImage: { - '@id': 'lcn:boostRepeatBackgroundImage', - '@type': 'xsd:boolean', - }, - emoji: { - '@id': 'lcn:boostEmoji', - '@context': { - activeSkinTone: { - '@id': 'lcn:boostEmojiActiveSkinTone', - '@type': 'xsd:string', - }, - unified: { - '@id': 'lcn:boostEmojiUnified', - '@type': 'xsd:string', - }, - unifiedWithoutSkinTone: { - '@id': 'lcn:boostEmojiUnifiedWithoutSkinTone', - '@type': 'xsd:string', - }, - names: { - '@id': 'lcn:boostEmojiNames', - '@container': '@set', - '@type': 'xsd:string', - }, - imageUrl: { - '@id': 'lcn:boostEmojiImageUrl', - '@type': 'xsd:string', + display, + familyTitles, + image: boostImage, + attachments, + skills, + groupID, + }), + boostID: ({ + did = 'did:example:d23dd687a7dc6787646f2eb98d0', + subject = 'did:example:d23dd687a7dc6787646f2eb98d0', + issuanceDate = '2020-08-19T21:41:50Z', + expirationDate, + boostName = 'Example Boost', + boostId: _boostId = 'urn:uuid:boost:example:555', + boostImage, + achievementId = 'urn:uuid:123', + achievementType = 'Influencer', + achievementName = 'Awesome Badge', + achievementDescription = 'Awesome People Earn Awesome Badge', + achievementNarrative = 'Earned by being awesome.', + achievementImage = '', + address, + attachments, + skills, + display, + familyTitles, + boostID, + groupID = '', + } = {}) => ({ + '@context': [ + 'https://www.w3.org/2018/credentials/v1', + 'https://purl.imsglobal.org/spec/ob/v3p0/context-3.0.2.json', + { + // id: '@id', + type: '@type', + xsd: 'https://www.w3.org/2001/XMLSchema#', + lcn: 'https://docs.learncard.com/definitions#', + BoostCredential: { + '@id': 'lcn:boostCredential', + '@context': { + boostId: { + '@id': 'lcn:boostId', + '@type': 'xsd:string', + }, + display: { + '@id': 'lcn:boostDisplay', + '@context': { + backgroundImage: { + '@id': 'lcn:boostBackgroundImage', + '@type': 'xsd:string', + }, + backgroundColor: { + '@id': 'lcn:boostBackgroundColor', + '@type': 'xsd:string', + }, + displayType: { + '@id': 'lcn:boostDisplayType', + '@type': 'xsd:string', + }, + fadeBackgroundImage: { + '@id': 'lcn:boostFadeBackgroundImage', + '@type': 'xsd:boolean', + }, + repeatBackgroundImage: { + '@id': 'lcn:boostRepeatBackgroundImage', + '@type': 'xsd:boolean', + }, + emoji: { + '@id': 'lcn:boostEmoji', + '@context': { + activeSkinTone: { + '@id': 'lcn:boostEmojiActiveSkinTone', + '@type': 'xsd:string', + }, + unified: { + '@id': 'lcn:boostEmojiUnified', + '@type': 'xsd:string', + }, + unifiedWithoutSkinTone: { + '@id': 'lcn:boostEmojiUnifiedWithoutSkinTone', + '@type': 'xsd:string', + }, + names: { + '@id': 'lcn:boostEmojiNames', + '@container': '@set', + '@type': 'xsd:string', + }, + imageUrl: { + '@id': 'lcn:boostEmojiImageUrl', + '@type': 'xsd:string', + }, }, }, }, }, - }, - familyTitles: { - '@id': 'lcn:familyTitles', - '@context': { - guardians: { - '@id': 'lcn:guardians', - '@container': '@set', - '@context': { - plural: { - '@id': 'lcn:plural', - '@type': 'xsd:string', - }, - singular: { - '@id': 'lcn:singular', - '@type': 'xsd:string', + familyTitles: { + '@id': 'lcn:familyTitles', + '@context': { + guardians: { + '@id': 'lcn:guardians', + '@container': '@set', + '@context': { + plural: { + '@id': 'lcn:plural', + '@type': 'xsd:string', + }, + singular: { + '@id': 'lcn:singular', + '@type': 'xsd:string', + }, }, }, - }, - dependents: { - '@id': 'lcn:dependents', - '@container': '@set', - '@context': { - plural: { - '@id': 'lcn:plural', - '@type': 'xsd:string', - }, - singular: { - '@id': 'lcn:singular', - '@type': 'xsd:string', + dependents: { + '@id': 'lcn:dependents', + '@container': '@set', + '@context': { + plural: { + '@id': 'lcn:plural', + '@type': 'xsd:string', + }, + singular: { + '@id': 'lcn:singular', + '@type': 'xsd:string', + }, }, }, }, }, - }, - attachments: { - '@id': 'lcn:boostAttachments', - '@container': '@set', - '@context': { - type: { - '@id': 'lcn:boostAttachmentType', - '@type': 'xsd:string', - }, - title: { - '@id': 'lcn:boostAttachmentTitle', - '@type': 'xsd:string', - }, - url: { - '@id': 'lcn:boostAttachmentUrl', - '@type': 'xsd:string', + attachments: { + '@id': 'lcn:boostAttachments', + '@container': '@set', + '@context': { + type: { + '@id': 'lcn:boostAttachmentType', + '@type': 'xsd:string', + }, + title: { + '@id': 'lcn:boostAttachmentTitle', + '@type': 'xsd:string', + }, + url: { + '@id': 'lcn:boostAttachmentUrl', + '@type': 'xsd:string', + }, }, }, - }, - skills: { - '@id': 'lcn:boostSkills', - '@container': '@set', - '@context': { - category: { - '@id': 'lcn:boostSkillCategory', - '@type': 'xsd:string', - }, - skill: { - '@id': 'lcn:boostSkill', - '@type': 'xsd:string', - }, - subskills: { - '@id': 'lcn:boostSubskills', - '@container': '@set', - '@type': 'xsd:string', + skills: { + '@id': 'lcn:boostSkills', + '@container': '@set', + '@context': { + category: { + '@id': 'lcn:boostSkillCategory', + '@type': 'xsd:string', + }, + skill: { + '@id': 'lcn:boostSkill', + '@type': 'xsd:string', + }, + subskills: { + '@id': 'lcn:boostSubskills', + '@container': '@set', + '@type': 'xsd:string', + }, }, }, - }, - groupID: { - '@id': 'lcn:groupID', - '@type': 'xsd:string', - }, - address: { - '@id': 'https://purl.imsglobal.org/spec/vc/ob/vocab.html#Address', + groupID: { + '@id': 'lcn:groupID', + '@type': 'xsd:string', + }, + address: { + '@id': 'https://purl.imsglobal.org/spec/vc/ob/vocab.html#Address', + }, }, }, }, - }, - { - type: '@type', - xsd: 'https://www.w3.org/2001/XMLSchema#', - lcn: 'https://docs.learncard.com/definitions#', - BoostID: { - '@id': 'lcn:boostID', - '@context': { - boostID: { - '@id': 'lcn:boostIDField', - '@context': { - fontColor: { - '@id': 'lcn:boostIDFontColor', - '@type': 'xsd:string', - }, - accentColor: { - '@id': 'lcn:boostIDAccentColor', - '@type': 'xsd:string', - }, - backgroundImage: { - '@id': 'lcn:boostIDBackgroundImage', - '@type': 'xsd:string', - }, - dimBackgroundImage: { - '@id': 'lcn:boostIDDimBackgroundImage', - '@type': 'xsd:boolean', - }, - issuerThumbnail: { - '@id': 'lcn:boostIDIssuerThumbnail', - '@type': 'xsd:string', - }, - showIssuerThumbnail: { - '@id': 'lcn:boostIDShowIssuerThumbnail', - '@type': 'xsd:boolean', - }, - IDIssuerName: { - '@id': 'lcn:boostIDIssuerName', - '@type': 'xsd:string', - }, - idThumbnail: { - '@id': 'lcn:boostIDThumbnail', - '@type': 'xsd:string', - }, - accentFontColor: { - '@id': 'lcn:boostIDFontColor', - '@type': 'xsd:string', - }, - idBackgroundColor: { - '@id': 'lcn:boostIDBackgroundColor', - '@type': 'xsd:string', - }, - repeatIdBackgroundImage: { - '@id': 'lcn:boostIDRepeatIdBackgroundImage', - '@type': 'xsd:boolean', - }, - idDescription: { - '@id': 'lcn:boostIDDescription', - '@type': 'xsd:string', + { + type: '@type', + xsd: 'https://www.w3.org/2001/XMLSchema#', + lcn: 'https://docs.learncard.com/definitions#', + BoostID: { + '@id': 'lcn:boostID', + '@context': { + boostID: { + '@id': 'lcn:boostIDField', + '@context': { + fontColor: { + '@id': 'lcn:boostIDFontColor', + '@type': 'xsd:string', + }, + accentColor: { + '@id': 'lcn:boostIDAccentColor', + '@type': 'xsd:string', + }, + backgroundImage: { + '@id': 'lcn:boostIDBackgroundImage', + '@type': 'xsd:string', + }, + dimBackgroundImage: { + '@id': 'lcn:boostIDDimBackgroundImage', + '@type': 'xsd:boolean', + }, + issuerThumbnail: { + '@id': 'lcn:boostIDIssuerThumbnail', + '@type': 'xsd:string', + }, + showIssuerThumbnail: { + '@id': 'lcn:boostIDShowIssuerThumbnail', + '@type': 'xsd:boolean', + }, + IDIssuerName: { + '@id': 'lcn:boostIDIssuerName', + '@type': 'xsd:string', + }, + idThumbnail: { + '@id': 'lcn:boostIDThumbnail', + '@type': 'xsd:string', + }, + accentFontColor: { + '@id': 'lcn:boostIDFontColor', + '@type': 'xsd:string', + }, + idBackgroundColor: { + '@id': 'lcn:boostIDBackgroundColor', + '@type': 'xsd:string', + }, + repeatIdBackgroundImage: { + '@id': 'lcn:boostIDRepeatIdBackgroundImage', + '@type': 'xsd:boolean', + }, + idDescription: { + '@id': 'lcn:boostIDDescription', + '@type': 'xsd:string', + }, }, }, }, }, }, - }, - ], - type: ['VerifiableCredential', 'OpenBadgeCredential', 'BoostCredential', 'BoostID'], - issuer: did, - issuanceDate, - name: boostName, - expirationDate, - credentialSubject: { - id: subject, - type: ['AchievementSubject'], - achievement: { - id: achievementId, - type: ['Achievement'], - achievementType: achievementType, - name: achievementName, - description: achievementDescription, - image: achievementImage, - criteria: { - narrative: achievementNarrative, + ], + type: ['VerifiableCredential', 'OpenBadgeCredential', 'BoostCredential', 'BoostID'], + issuer: did, + issuanceDate, + name: boostName, + expirationDate, + credentialSubject: { + id: subject, + type: ['AchievementSubject'], + achievement: { + id: achievementId, + type: ['Achievement'], + achievementType: achievementType, + name: achievementName, + description: achievementDescription, + image: achievementImage, + criteria: { + narrative: achievementNarrative, + }, }, }, - }, - ...(address - ? { - address: { - type: ['Address'], - ...address, - ...(address.geo - ? { geo: { type: ['GeoCoordinates'], ...address.geo } } - : {}), - }, - } - : {}), - display, - familyTitles, - image: boostImage, - attachments, - skills, - boostID, - groupID, - }), - delegate: ({ - did = 'did:example:d23dd687a7dc6787646f2eb98d0', - subject = 'did:example:d23dd687a7dc6787646f2eb98d0', - issuanceDate = new Date().toISOString(), - access = ['read'], - } = {}) => ({ - '@context': [ - 'https://www.w3.org/2018/credentials/v1', + ...(address + ? { + address: { + type: ['Address'], + ...address, + ...(address.geo + ? { geo: { type: ['GeoCoordinates'], ...address.geo } } + : {}), + }, + } + : {}), + display, + familyTitles, + image: boostImage, + attachments, + skills, + boostID, + groupID, + }), + delegate: ({ + did = 'did:example:d23dd687a7dc6787646f2eb98d0', + subject = 'did:example:d23dd687a7dc6787646f2eb98d0', + issuanceDate = new Date().toISOString(), + access = ['read'], + } = {}) => ({ + '@context': [ + 'https://www.w3.org/2018/credentials/v1', - { - type: '@type', - xsd: 'https://www.w3.org/2001/XMLSchema#', - lcn: 'https://docs.learncard.com/definitions#', - DelegateCredential: { - '@id': 'lcn:delegateCredential', - '@context': { - permissions: { - '@id': 'lcn:delegateAccess', - '@context': { - statementAccess: { - '@id': 'lcn:delegateAccess', - '@container': '@set', - '@type': 'xsd:string', + { + type: '@type', + xsd: 'https://www.w3.org/2001/XMLSchema#', + lcn: 'https://docs.learncard.com/definitions#', + DelegateCredential: { + '@id': 'lcn:delegateCredential', + '@context': { + permissions: { + '@id': 'lcn:delegateAccess', + '@context': { + statementAccess: { + '@id': 'lcn:delegateAccess', + '@container': '@set', + '@type': 'xsd:string', + }, }, }, }, }, }, - }, - ], - type: ['VerifiableCredential', 'DelegateCredential'], - issuer: did, - issuanceDate, - credentialSubject: { id: subject }, - permissions: { statementAccess: access }, - }), -}; + ], + type: ['VerifiableCredential', 'DelegateCredential'], + issuer: did, + issuanceDate, + credentialSubject: { id: subject }, + permissions: { statementAccess: access }, + }), + }; diff --git a/packages/plugins/vc-templates/src/types.ts b/packages/plugins/vc-templates/src/types.ts index dc3d776858..6b3186878f 100644 --- a/packages/plugins/vc-templates/src/types.ts +++ b/packages/plugins/vc-templates/src/types.ts @@ -1,6 +1,6 @@ -import { UnsignedVC, VC, UnsignedVP } from '@learncard/types'; -import { DiscriminatedUnionize } from './type.helpers'; -import { Plugin } from '@learncard/core'; +import type { UnsignedVC, VC, UnsignedVP } from '@learncard/types'; +import type { DiscriminatedUnionize } from './type.helpers'; +import type { Plugin } from '@learncard/core'; /** @group VC Templates Plugin */ export type BoostAttachment = { diff --git a/packages/plugins/vc-templates/src/vc-templates.ts b/packages/plugins/vc-templates/src/vc-templates.ts index 851bf7a059..ec2a4accd7 100644 --- a/packages/plugins/vc-templates/src/vc-templates.ts +++ b/packages/plugins/vc-templates/src/vc-templates.ts @@ -1,6 +1,6 @@ import { VC_TEMPLATES } from './templates'; -import { VCTemplatePlugin } from './types'; +import type { VCTemplatePlugin } from './types'; /** * @group Plugins diff --git a/packages/plugins/vc/scripts/.eslintrc b/packages/plugins/vc/scripts/.eslintrc deleted file mode 100644 index 2b88e1c5e2..0000000000 --- a/packages/plugins/vc/scripts/.eslintrc +++ /dev/null @@ -1,10 +0,0 @@ -{ - "root": false, - "env": { - "node": true - }, - "rules": { - "no-console": "off", - "@typescript-eslint/no-var-requires": "off" - } -} \ No newline at end of file diff --git a/packages/plugins/vc/scripts/build.mjs b/packages/plugins/vc/scripts/build.mjs index 69550fa03f..d69a56de60 100644 --- a/packages/plugins/vc/scripts/build.mjs +++ b/packages/plugins/vc/scripts/build.mjs @@ -71,7 +71,7 @@ await Promise.all( }) ); -await Promise.all(configurations.map(config => esbuild.build(config))).catch(err => { +await Promise.all(configurations.map(config => esbuild.build(config))).catch(() => { console.error('❌ Build failed'); process.exit(1); }); diff --git a/packages/plugins/vc/src/helpers.ts b/packages/plugins/vc/src/helpers.ts index 39b0c4a6bf..531320eaad 100644 --- a/packages/plugins/vc/src/helpers.ts +++ b/packages/plugins/vc/src/helpers.ts @@ -1,4 +1,4 @@ -import { VCImplicitLearnCard } from './types'; +import type { VCImplicitLearnCard } from './types'; /** * Determines the default verification method to use for a given did by resolving it and looking diff --git a/packages/plugins/vc/src/issueCredential.ts b/packages/plugins/vc/src/issueCredential.ts index d2c092c873..ecfc032314 100644 --- a/packages/plugins/vc/src/issueCredential.ts +++ b/packages/plugins/vc/src/issueCredential.ts @@ -1,7 +1,7 @@ -import { UnsignedVC } from '@learncard/types'; +import type { UnsignedVC } from '@learncard/types'; -import { ProofOptions } from '@learncard/didkit-plugin'; -import { VCDependentLearnCard, VCImplicitLearnCard } from './types'; +import type { ProofOptions } from '@learncard/didkit-plugin'; +import type { VCDependentLearnCard, VCImplicitLearnCard } from './types'; import { getDefaultVerificationMethod } from './helpers'; export const issueCredential = (initLearnCard: VCDependentLearnCard) => { diff --git a/packages/plugins/vc/src/issuePresentation.ts b/packages/plugins/vc/src/issuePresentation.ts index 5119d746f8..ad98ac0fa2 100644 --- a/packages/plugins/vc/src/issuePresentation.ts +++ b/packages/plugins/vc/src/issuePresentation.ts @@ -1,7 +1,7 @@ -import { UnsignedVP } from '@learncard/types'; +import type { UnsignedVP } from '@learncard/types'; -import { ProofOptions } from '@learncard/didkit-plugin'; -import { VCDependentLearnCard, VCImplicitLearnCard } from './types'; +import type { ProofOptions } from '@learncard/didkit-plugin'; +import type { VCDependentLearnCard, VCImplicitLearnCard } from './types'; import { getDefaultVerificationMethod } from './helpers'; export const issuePresentation = (initLearnCard: VCDependentLearnCard) => { diff --git a/packages/plugins/vc/src/types.ts b/packages/plugins/vc/src/types.ts index a5964728dc..7636a6d0b1 100644 --- a/packages/plugins/vc/src/types.ts +++ b/packages/plugins/vc/src/types.ts @@ -1,4 +1,4 @@ -import { +import type { UnsignedVC, VC, UnsignedVP, @@ -7,8 +7,8 @@ import { DidDocument, JWKWithPrivateKey, } from '@learncard/types'; -import { Plugin, LearnCard } from '@learncard/core'; -import { ProofOptions, InputMetadata } from '@learncard/didkit-plugin'; +import type { Plugin, LearnCard } from '@learncard/core'; +import type { ProofOptions, InputMetadata } from '@learncard/didkit-plugin'; /** @group VC Plugin */ export type VCPluginDependentMethods = { diff --git a/packages/plugins/vc/src/vc.ts b/packages/plugins/vc/src/vc.ts index e9bbe372f0..e614964456 100644 --- a/packages/plugins/vc/src/vc.ts +++ b/packages/plugins/vc/src/vc.ts @@ -3,8 +3,8 @@ import { verifyCredential } from './verifyCredential'; import { issuePresentation } from './issuePresentation'; import { verifyPresentation } from './verifyPresentation'; -import { VCDependentLearnCard, VCPlugin } from './types'; -import { UnsignedVP } from '@learncard/types'; +import type { VCDependentLearnCard, VCPlugin } from './types'; +import type { UnsignedVP } from '@learncard/types'; /** * @group Plugins diff --git a/packages/plugins/vc/src/verifyCredential.ts b/packages/plugins/vc/src/verifyCredential.ts index ebdc8b6a0f..c412d62da6 100644 --- a/packages/plugins/vc/src/verifyCredential.ts +++ b/packages/plugins/vc/src/verifyCredential.ts @@ -1,7 +1,7 @@ -import { VC } from '@learncard/types'; +import type { VC } from '@learncard/types'; -import { ProofOptions } from '@learncard/didkit-plugin'; -import { VCDependentLearnCard, VCImplicitLearnCard } from './types'; +import type { ProofOptions } from '@learncard/didkit-plugin'; +import type { VCDependentLearnCard, VCImplicitLearnCard } from './types'; export const verifyCredential = (initLearnCard: VCDependentLearnCard) => { return async ( diff --git a/packages/plugins/vc/src/verifyPresentation.ts b/packages/plugins/vc/src/verifyPresentation.ts index af9932ef3c..90940d67a6 100644 --- a/packages/plugins/vc/src/verifyPresentation.ts +++ b/packages/plugins/vc/src/verifyPresentation.ts @@ -1,7 +1,7 @@ -import { VP } from '@learncard/types'; +import type { VP } from '@learncard/types'; -import { ProofOptions } from '@learncard/didkit-plugin'; -import { VCDependentLearnCard, VCImplicitLearnCard } from './types'; +import type { ProofOptions } from '@learncard/didkit-plugin'; +import type { VCDependentLearnCard, VCImplicitLearnCard } from './types'; export const verifyPresentation = (initLearnCard: VCDependentLearnCard) => { return async ( diff --git a/packages/plugins/vpqr/scripts/.eslintrc b/packages/plugins/vpqr/scripts/.eslintrc deleted file mode 100644 index 2b88e1c5e2..0000000000 --- a/packages/plugins/vpqr/scripts/.eslintrc +++ /dev/null @@ -1,10 +0,0 @@ -{ - "root": false, - "env": { - "node": true - }, - "rules": { - "no-console": "off", - "@typescript-eslint/no-var-requires": "off" - } -} \ No newline at end of file diff --git a/packages/plugins/vpqr/scripts/build.mjs b/packages/plugins/vpqr/scripts/build.mjs index bf28d1167a..82c8a7da6a 100644 --- a/packages/plugins/vpqr/scripts/build.mjs +++ b/packages/plugins/vpqr/scripts/build.mjs @@ -71,7 +71,7 @@ await Promise.all( }) ); -await Promise.all(configurations.map(config => esbuild.build(config))).catch(err => { +await Promise.all(configurations.map(config => esbuild.build(config))).catch(_error => { console.error('❌ Build failed'); process.exit(1); }); diff --git a/packages/plugins/vpqr/src/index.ts b/packages/plugins/vpqr/src/index.ts index 8062eeb67e..cd83caa24b 100644 --- a/packages/plugins/vpqr/src/index.ts +++ b/packages/plugins/vpqr/src/index.ts @@ -1,7 +1,7 @@ import { toQrCode, fromQrCode } from '@digitalbazaar/vpqr'; -import { VpqrPlugin, VpqrPluginDependentMethods } from './types'; -import { LearnCard } from '@learncard/core'; +import type { VpqrPlugin, VpqrPluginDependentMethods } from './types'; +import type { LearnCard } from '@learncard/core'; export * from './types'; diff --git a/packages/plugins/vpqr/src/types.ts b/packages/plugins/vpqr/src/types.ts index b97d439cdc..aa52a58fd0 100644 --- a/packages/plugins/vpqr/src/types.ts +++ b/packages/plugins/vpqr/src/types.ts @@ -1,5 +1,5 @@ -import { VP } from '@learncard/types'; -import { Plugin } from '@learncard/core'; +import type { VP } from '@learncard/types'; +import type { Plugin } from '@learncard/core'; /** @group VPQR Plugin */ export type VpqrPluginMethods = { diff --git a/packages/react-learn-card/src/components/AchievementCard/AchievementCard.stories.tsx b/packages/react-learn-card/src/components/AchievementCard/AchievementCard.stories.tsx index 6bc2ce44a2..ce5bbe4207 100644 --- a/packages/react-learn-card/src/components/AchievementCard/AchievementCard.stories.tsx +++ b/packages/react-learn-card/src/components/AchievementCard/AchievementCard.stories.tsx @@ -1,8 +1,8 @@ import React from 'react'; -import { Story, Meta } from '@storybook/react'; +import type { Story, Meta } from '@storybook/react'; import AchievementCard from './AchievementCard'; -import { AchievementCardProps } from '../../types'; +import type { AchievementCardProps } from '../../types'; export default { title: 'Achievement Display Card', diff --git a/packages/react-learn-card/src/components/AchievementCard/AchievementCard.tsx b/packages/react-learn-card/src/components/AchievementCard/AchievementCard.tsx index e9db9584b3..dc96aa6108 100644 --- a/packages/react-learn-card/src/components/AchievementCard/AchievementCard.tsx +++ b/packages/react-learn-card/src/components/AchievementCard/AchievementCard.tsx @@ -1,10 +1,9 @@ import React from 'react'; -import { AchievementCardProps } from '../../types'; import { RoundedPill } from '../RoundedPill'; import { CircleCheckButton } from '../CircleCheckButton'; import { Trophy } from '../svgs'; import { TYPE_TO_MINI_ICON } from '../../constants'; -import { LCSubtypes } from '../../types'; +import { LCSubtypes, type AchievementCardProps } from '../../types'; export const AchievementCard: React.FC = ({ title = 'Title Lorem Ipsum', diff --git a/packages/react-learn-card/src/components/BoostGenericCard/BoostGenericCard.stories.tsx b/packages/react-learn-card/src/components/BoostGenericCard/BoostGenericCard.stories.tsx index 7fc82516b5..3e5fb1bd34 100644 --- a/packages/react-learn-card/src/components/BoostGenericCard/BoostGenericCard.stories.tsx +++ b/packages/react-learn-card/src/components/BoostGenericCard/BoostGenericCard.stories.tsx @@ -1,7 +1,7 @@ import React from 'react'; -import { Story, Meta } from '@storybook/react'; +import type { Story, Meta } from '@storybook/react'; import BoostGenericCard from './BoostGenericCard'; -import { BoostGenericCardProps, WalletCategoryTypes } from '../../types'; +import { WalletCategoryTypes, type BoostGenericCardProps } from '../../types'; export default { title: 'Boost Generic Card', diff --git a/packages/react-learn-card/src/components/BoostGenericCard/BoostGenericCard.tsx b/packages/react-learn-card/src/components/BoostGenericCard/BoostGenericCard.tsx index 3c56573ca7..a64cc66735 100644 --- a/packages/react-learn-card/src/components/BoostGenericCard/BoostGenericCard.tsx +++ b/packages/react-learn-card/src/components/BoostGenericCard/BoostGenericCard.tsx @@ -1,5 +1,5 @@ import React from 'react'; -import { BoostGenericCardProps, WalletCategoryTypes } from '../../types'; +import { WalletCategoryTypes, type BoostGenericCardProps } from '../../types'; import { TYPE_TO_IMG_SRC, TYPE_TO_WALLET_DARK_COLOR } from '../../constants'; import { CircleCheckButton } from '../CircleCheckButton'; import ThreeDots from '../../assets/images/DotsThreeOutline.svg'; @@ -34,7 +34,6 @@ export const BoostGenericCard: React.FC = ({ : 'bg-grayscale-50'; const defaultThumbClass = `small-boost-card-thumb flex h-[110px] w-[110px] my-[10px] mx-auto ${thumbClass} overflow-hidden flex-col justify-center items-center rounded-full ${customThumbClass}`; const imgSrc = thumbImgSrc?.trim() !== '' ? thumbImgSrc : TYPE_TO_IMG_SRC[type]; - const headerBgColor = TYPE_TO_WALLET_DARK_COLOR[type] ? `bg-${TYPE_TO_WALLET_DARK_COLOR[type]}` : 'bg-grayscale-900'; const checkBtnClass = checkStatus ? 'generic-vc-card checked' : 'generic-vc-card unchecked'; const defaultHeaderClass = `flex generic-card-title w-full justify-center ${customHeaderClass}`; @@ -73,7 +72,7 @@ export const BoostGenericCard: React.FC = ({ className="boost-small-card inner-click-container z-10" onClick={handleInnerClick} > - {customThumbComponent && customThumbComponent} + {customThumbComponent} {!customThumbComponent && ( {thumbImgSrc && thumbImgSrc?.trim() !== '' && ( @@ -100,30 +99,30 @@ export const BoostGenericCard: React.FC = ({ )} - {customTitle && customTitle} + {customTitle} - {customIssuerName && customIssuerName} + {customIssuerName} {!customIssuerName && ( by {issuerName} )} - {customDateDisplay && customDateDisplay} + {customDateDisplay} {!customDateDisplay && ( {dateDisplay} )} {verifierBadge} - {isInSkillsModal && + {isInSkillsModal && ( - } + )} {showChecked && ( diff --git a/packages/react-learn-card/src/components/BoostSmallCard/BoostSmallCard.stories.tsx b/packages/react-learn-card/src/components/BoostSmallCard/BoostSmallCard.stories.tsx index 69bf78bdba..4f3a0a8737 100644 --- a/packages/react-learn-card/src/components/BoostSmallCard/BoostSmallCard.stories.tsx +++ b/packages/react-learn-card/src/components/BoostSmallCard/BoostSmallCard.stories.tsx @@ -1,7 +1,7 @@ import React from 'react'; -import { Story, Meta } from '@storybook/react'; +import type { Story, Meta } from '@storybook/react'; import BoostSmallCard from './BoostSmallCard'; -import { BoostSmallCardProps, WalletCategoryTypes } from '../../types'; +import { WalletCategoryTypes, type BoostSmallCardProps } from '../../types'; export default { title: 'Boost Small Card', diff --git a/packages/react-learn-card/src/components/BoostSmallCard/BoostSmallCard.tsx b/packages/react-learn-card/src/components/BoostSmallCard/BoostSmallCard.tsx index b10f49c50a..6667a79046 100644 --- a/packages/react-learn-card/src/components/BoostSmallCard/BoostSmallCard.tsx +++ b/packages/react-learn-card/src/components/BoostSmallCard/BoostSmallCard.tsx @@ -6,7 +6,7 @@ import AddAwardLight from '../../assets/images/addawardlight.svg'; import ThreeDots from '../../assets/images/DotsThreeOutline.svg'; import { CircleCheckButton } from '../CircleCheckButton'; -import { BoostSmallCardProps, WalletCategoryTypes } from '../../types'; +import { WalletCategoryTypes, type BoostSmallCardProps } from '../../types'; import { TYPE_TO_IMG_SRC, TYPE_TO_WALLET_DARK_COLOR } from '../../constants'; import { getDarkBGColor } from '../../helpers/color.helpers'; @@ -94,7 +94,7 @@ export const BoostSmallCard: React.FC = ({ )} - {customThumbComponent && customThumbComponent} + {customThumbComponent} {!customThumbComponent && ( {thumbImgSrc && thumbImgSrc?.trim() !== '' && ( @@ -113,7 +113,7 @@ export const BoostSmallCard: React.FC = ({ )} - {customTitle && customTitle} + {customTitle} {!customTitle && ( @@ -123,7 +123,7 @@ export const BoostSmallCard: React.FC = ({ )} - {customBodyComponent && customBodyComponent} + {customBodyComponent} {!customBodyComponent && issueHistory && issueHistory?.length > 0 && @@ -137,11 +137,11 @@ export const BoostSmallCard: React.FC = ({ - {customButtonComponent && customButtonComponent} + {customButtonComponent} {!customButtonComponent && ( - {customDraftComponent && customDraftComponent} + {customDraftComponent} BOOST diff --git a/packages/react-learn-card/src/components/Button/Button.stories.tsx b/packages/react-learn-card/src/components/Button/Button.stories.tsx index 104b5df805..6afdc37753 100644 --- a/packages/react-learn-card/src/components/Button/Button.stories.tsx +++ b/packages/react-learn-card/src/components/Button/Button.stories.tsx @@ -1,7 +1,7 @@ import React from 'react'; -import { Story, Meta } from '@storybook/react'; +import type { Story, Meta } from '@storybook/react'; -import Button, { ButtonProps } from './Button'; +import Button, { type ButtonProps } from './Button'; export default { title: 'Button', diff --git a/packages/react-learn-card/src/components/Button/Button.tsx b/packages/react-learn-card/src/components/Button/Button.tsx index 2690e6b01c..8ba39ec3a6 100644 --- a/packages/react-learn-card/src/components/Button/Button.tsx +++ b/packages/react-learn-card/src/components/Button/Button.tsx @@ -1,4 +1,4 @@ -import React, { MouseEventHandler } from 'react'; +import React, { type MouseEventHandler } from 'react'; export type ButtonProps = { text?: string; diff --git a/packages/react-learn-card/src/components/CertificateDisplayCard/CertificateBackFace.tsx b/packages/react-learn-card/src/components/CertificateDisplayCard/CertificateBackFace.tsx index 3162756494..38b6fcbf4b 100644 --- a/packages/react-learn-card/src/components/CertificateDisplayCard/CertificateBackFace.tsx +++ b/packages/react-learn-card/src/components/CertificateDisplayCard/CertificateBackFace.tsx @@ -1,11 +1,11 @@ import React from 'react'; import { getCategoryDarkColor, getInfoFromCredential } from '../../helpers/credential.helpers'; -import { VC, VerificationItem } from '@learncard/types'; +import type { VC, VerificationItem } from '@learncard/types'; import { - BoostAchievementCredential, LCCategoryEnum, - MediaMetadata, - VideoMetadata, + type BoostAchievementCredential, + type MediaMetadata, + type VideoMetadata, } from '../../types'; import VerificationsBox from './VerificationsBox'; import AlignmentsBox from './AlignmentsBox'; @@ -82,10 +82,11 @@ export const CertificateBackFace: React.FC = ({ Awarded on {createdAt} @@ -94,11 +95,7 @@ export const CertificateBackFace: React.FC = ({ {criteria && } {(credential.skills?.length ?? 0) > 0 && - (customSkillsComponent ? ( - customSkillsComponent - ) : ( - - ))} + (customSkillsComponent || )} {credential.attachments && credential.attachments.length > 0 && ( = ({ customBodyCardComponent, knownDIDRegistry, hideIssueDate, - customSkillsComponent, + customSkillsComponent: _customSkillsComponent, getFileMetadata, getVideoMetadata, diff --git a/packages/react-learn-card/src/components/CertificateDisplayCard/CertificateFrontFace.tsx b/packages/react-learn-card/src/components/CertificateDisplayCard/CertificateFrontFace.tsx index 326f30bbaf..26feda37ee 100644 --- a/packages/react-learn-card/src/components/CertificateDisplayCard/CertificateFrontFace.tsx +++ b/packages/react-learn-card/src/components/CertificateDisplayCard/CertificateFrontFace.tsx @@ -16,13 +16,12 @@ import { getCategoryDarkColor, } from '../../helpers/credential.helpers'; -import { VC, Profile } from '@learncard/types'; -import { BoostAchievementCredential, LCCategoryEnum } from '../../types'; +import type { VC, Profile } from '@learncard/types'; +import { LCCategoryEnum, type BoostAchievementCredential, type KnownDIDRegistryType } from '../../types'; import VerifierStateBadgeAndText, { - VerifierState, VERIFIER_STATES, + type VerifierState, } from './VerifierStateBadgeAndText'; -import { KnownDIDRegistryType } from '../../types'; type CertificateFrontFaceProps = { isFront?: boolean; diff --git a/packages/react-learn-card/src/components/CertificateDisplayCard/MediaAttachmentsBox.tsx b/packages/react-learn-card/src/components/CertificateDisplayCard/MediaAttachmentsBox.tsx index 00734da572..e34e3af147 100644 --- a/packages/react-learn-card/src/components/CertificateDisplayCard/MediaAttachmentsBox.tsx +++ b/packages/react-learn-card/src/components/CertificateDisplayCard/MediaAttachmentsBox.tsx @@ -6,9 +6,9 @@ import LinkIcon from '../svgs/LinkIcon'; import VideoIcon from '../svgs/VideoIcon'; import GenericDocumentIcon from '../svgs/GenericDocumentIcon'; -import { Attachment, MediaMetadata, VideoMetadata } from '../../types'; +import type { Attachment, MediaMetadata, VideoMetadata } from '../../types'; import { getBaseUrl } from '../../helpers/url.helpers'; -import { Lightbox, LightboxItem } from '../Lightbox'; +import { Lightbox, type LightboxItem } from '../Lightbox'; type MediaAttachmentsBoxProps = { attachments: Attachment[]; @@ -177,15 +177,15 @@ const MediaAttachmentsBox: React.FC = ({ if (media.type === 'video') { const metadata = videoMetadata[media.url]; title = (title || metadata?.title) ?? ''; - const baseUrl = getBaseUrl(media.url); innerContent = ( diff --git a/packages/react-learn-card/src/components/CertificateDisplayCard/VerificationRow.tsx b/packages/react-learn-card/src/components/CertificateDisplayCard/VerificationRow.tsx index 729244894b..1c1e8acea3 100644 --- a/packages/react-learn-card/src/components/CertificateDisplayCard/VerificationRow.tsx +++ b/packages/react-learn-card/src/components/CertificateDisplayCard/VerificationRow.tsx @@ -1,5 +1,5 @@ import React, { useState } from 'react'; -import { VerificationItem, VerificationStatusEnum } from '@learncard/types'; +import { VerificationStatusEnum, type VerificationItem } from '@learncard/types'; import { getColorForVerificationStatus } from '../../helpers/credential.helpers'; import InfoBox from './InfoBox'; diff --git a/packages/react-learn-card/src/components/CertificateDisplayCard/VerificationsBox.tsx b/packages/react-learn-card/src/components/CertificateDisplayCard/VerificationsBox.tsx index 802155e6a9..9bd0adfab1 100644 --- a/packages/react-learn-card/src/components/CertificateDisplayCard/VerificationsBox.tsx +++ b/packages/react-learn-card/src/components/CertificateDisplayCard/VerificationsBox.tsx @@ -4,7 +4,7 @@ import VerificationRow from './VerificationRow'; import InfoIcon from '../svgs/InfoIcon'; import InfoBox from './InfoBox'; -import { VerificationItem } from '@learncard/types'; +import type { VerificationItem } from '@learncard/types'; type VerificationsBoxProps = { verificationItems: VerificationItem[]; diff --git a/packages/react-learn-card/src/components/CircleCheckButton/CircleCheckButton.stories.tsx b/packages/react-learn-card/src/components/CircleCheckButton/CircleCheckButton.stories.tsx index bb8fb7df8c..5fcd3c41e1 100644 --- a/packages/react-learn-card/src/components/CircleCheckButton/CircleCheckButton.stories.tsx +++ b/packages/react-learn-card/src/components/CircleCheckButton/CircleCheckButton.stories.tsx @@ -1,6 +1,6 @@ import React from 'react'; -import { Story, Meta } from '@storybook/react'; -import { CircleCheckButtonProps } from '../../types'; +import type { Story, Meta } from '@storybook/react'; +import type { CircleCheckButtonProps } from '../../types'; import CircleCheckButton from './CircleCheckButton'; export default { diff --git a/packages/react-learn-card/src/components/CircleCheckButton/CircleCheckButton.tsx b/packages/react-learn-card/src/components/CircleCheckButton/CircleCheckButton.tsx index 530e860b0e..31c8af60d3 100644 --- a/packages/react-learn-card/src/components/CircleCheckButton/CircleCheckButton.tsx +++ b/packages/react-learn-card/src/components/CircleCheckButton/CircleCheckButton.tsx @@ -1,5 +1,5 @@ import React from 'react'; -import { CircleCheckButtonProps } from '../../types'; +import type { CircleCheckButtonProps } from '../../types'; import { CheckmarkSvg } from '../RoundedPill'; export const CircleCheckButton: React.FC = ({ @@ -8,7 +8,7 @@ export const CircleCheckButton: React.FC = ({ bgColor, className = '', }) => { - const backgroundColor = checked ? 'bg-emerald-700' : bgColor ? bgColor : 'bg-gray-50'; + const backgroundColor = checked ? 'bg-emerald-700' : (bgColor ?? 'bg-gray-50'); const handleClick = () => { onClick?.(); diff --git a/packages/react-learn-card/src/components/CircleIcon/__tests__/CircleIcon.test.tsx b/packages/react-learn-card/src/components/CircleIcon/__tests__/CircleIcon.test.tsx index eada104f30..f0c2595ad1 100644 --- a/packages/react-learn-card/src/components/CircleIcon/__tests__/CircleIcon.test.tsx +++ b/packages/react-learn-card/src/components/CircleIcon/__tests__/CircleIcon.test.tsx @@ -1,6 +1,5 @@ import React from 'react'; import '@testing-library/jest-dom'; -import userEvent from '@testing-library/user-event'; import { render, screen } from '@testing-library/react'; import CircleIcon from '../CircleIcon'; diff --git a/packages/react-learn-card/src/components/CourseCard/CourseCard.stories.tsx b/packages/react-learn-card/src/components/CourseCard/CourseCard.stories.tsx index 57c59a0e21..ab928ec58e 100644 --- a/packages/react-learn-card/src/components/CourseCard/CourseCard.stories.tsx +++ b/packages/react-learn-card/src/components/CourseCard/CourseCard.stories.tsx @@ -1,8 +1,8 @@ import React from 'react'; -import { Story, Meta } from '@storybook/react'; +import type { Story, Meta } from '@storybook/react'; import CourseCard from './CourseCard'; -import { CourseCardProps } from '../../types'; +import type { CourseCardProps } from '../../types'; export default { title: 'Course Card', diff --git a/packages/react-learn-card/src/components/CourseCard/CourseCard.tsx b/packages/react-learn-card/src/components/CourseCard/CourseCard.tsx index b48460dd40..e4c452d510 100644 --- a/packages/react-learn-card/src/components/CourseCard/CourseCard.tsx +++ b/packages/react-learn-card/src/components/CourseCard/CourseCard.tsx @@ -1,5 +1,5 @@ import React from 'react'; -import { CourseCardProps } from '../../types'; +import type { CourseCardProps } from '../../types'; import CourseCardPlaceholder from '../../assets/images/lhplaceholder.png'; import MiniTrophyIcon from '../../assets/images/minitrophy.svg'; @@ -48,7 +48,7 @@ export const CourseCard: React.FC = ({ semester = 'Fall 2022', jobCount = 1, achievementCount = 4, - thumbSrc, + thumbSrc: _thumbSrc, hideHeader = false, skillCount = 9, className, diff --git a/packages/react-learn-card/src/components/CourseVerticalCard/CourseVerticalCard.stories.tsx b/packages/react-learn-card/src/components/CourseVerticalCard/CourseVerticalCard.stories.tsx index b514f1048e..42908b4f3c 100644 --- a/packages/react-learn-card/src/components/CourseVerticalCard/CourseVerticalCard.stories.tsx +++ b/packages/react-learn-card/src/components/CourseVerticalCard/CourseVerticalCard.stories.tsx @@ -1,8 +1,8 @@ import React from 'react'; -import { Story, Meta } from '@storybook/react'; +import type { Story, Meta } from '@storybook/react'; import CourseVerticalCard from './CourseVerticalCard'; -import { CourseCardVerticalProps } from '../../types'; +import type { CourseCardVerticalProps } from '../../types'; export default { title: 'Course Vertical Card', diff --git a/packages/react-learn-card/src/components/CourseVerticalCard/CourseVerticalCard.tsx b/packages/react-learn-card/src/components/CourseVerticalCard/CourseVerticalCard.tsx index 05690f0ef7..ea5db5664d 100644 --- a/packages/react-learn-card/src/components/CourseVerticalCard/CourseVerticalCard.tsx +++ b/packages/react-learn-card/src/components/CourseVerticalCard/CourseVerticalCard.tsx @@ -1,12 +1,11 @@ import React from 'react'; -import { CourseCardVerticalProps } from '../../types'; import { CircleCheckButton } from '../CircleCheckButton'; import CourseCardPlaceholder from '../../assets/images/lhplaceholder.png'; import { RoundedPill } from '../RoundedPill'; import MiniTrophyIcon from '../../assets/images/minitrophy.svg'; import MiniJobIcon from '../../assets/images/minijob.svg'; import MiniPuzzleIcon from '../../assets/images/minipuzzle.svg'; -import { LCSubtypes } from '../../types'; +import { LCSubtypes, type CourseCardVerticalProps } from '../../types'; const TYPE_TO_COURSE_MINI_ICON: any = { ['job']: MiniJobIcon, @@ -47,7 +46,7 @@ const CourseCardStatBubble: React.FC = ({ export const CourseVerticalCard: React.FC = ({ className, title, - thumbImgSrc, + thumbImgSrc: _thumbImgSrc, showStatus, claimStatus = false, achievementCount = 0, diff --git a/packages/react-learn-card/src/components/GenericCard/GenericCard.stories.tsx b/packages/react-learn-card/src/components/GenericCard/GenericCard.stories.tsx index f24afcd99e..446f0f8dfd 100644 --- a/packages/react-learn-card/src/components/GenericCard/GenericCard.stories.tsx +++ b/packages/react-learn-card/src/components/GenericCard/GenericCard.stories.tsx @@ -1,7 +1,7 @@ import React from 'react'; -import { Story, Meta } from '@storybook/react'; +import type { Story, Meta } from '@storybook/react'; import GenericCard from './GenericCard'; -import { GenericCardProps, WalletCategoryTypes } from '../../types'; +import { WalletCategoryTypes, type GenericCardProps } from '../../types'; export default { title: 'Generic Card', diff --git a/packages/react-learn-card/src/components/GenericCard/GenericCard.tsx b/packages/react-learn-card/src/components/GenericCard/GenericCard.tsx index 6ed6767913..7577db8269 100644 --- a/packages/react-learn-card/src/components/GenericCard/GenericCard.tsx +++ b/packages/react-learn-card/src/components/GenericCard/GenericCard.tsx @@ -1,5 +1,5 @@ import React from 'react'; -import { GenericCardProps, WalletCategoryTypes } from '../../types'; +import { WalletCategoryTypes, type GenericCardProps } from '../../types'; import { TYPE_TO_IMG_SRC, TYPE_TO_WALLET_DARK_COLOR } from '../../constants'; import { CircleCheckButton } from '../CircleCheckButton'; @@ -10,7 +10,7 @@ export const GenericCard: React.FC = ({ customHeaderClass = '', type = WalletCategoryTypes.achievements, className, - onClick = () => { }, + onClick = () => {}, showChecked, checkStatus, flipped, diff --git a/packages/react-learn-card/src/components/JobHistoryCard/JobHistoryCard.stories.tsx b/packages/react-learn-card/src/components/JobHistoryCard/JobHistoryCard.stories.tsx index c035566489..f7ba5b3aeb 100644 --- a/packages/react-learn-card/src/components/JobHistoryCard/JobHistoryCard.stories.tsx +++ b/packages/react-learn-card/src/components/JobHistoryCard/JobHistoryCard.stories.tsx @@ -1,7 +1,7 @@ import React from 'react'; -import { Story, Meta } from '@storybook/react'; +import type { Story, Meta } from '@storybook/react'; import JobHistoryCard from './JobHistoryCard'; -import { JobHistoryCardProps } from '../../types'; +import type { JobHistoryCardProps } from '../../types'; export default { title: 'Job History Card', diff --git a/packages/react-learn-card/src/components/JobHistoryCard/JobHistoryCard.tsx b/packages/react-learn-card/src/components/JobHistoryCard/JobHistoryCard.tsx index a066547131..921b2bbe00 100644 --- a/packages/react-learn-card/src/components/JobHistoryCard/JobHistoryCard.tsx +++ b/packages/react-learn-card/src/components/JobHistoryCard/JobHistoryCard.tsx @@ -1,5 +1,5 @@ import React from 'react'; -import { JobHistoryCardProps } from '../../types'; +import type { JobHistoryCardProps } from '../../types'; import GenericArrow from '../svgs/GenericArrow'; export const JobHistoryCard: React.FC = ({ diff --git a/packages/react-learn-card/src/components/JobListCard/JobListCard.stories.tsx b/packages/react-learn-card/src/components/JobListCard/JobListCard.stories.tsx index a51e875c43..e968be158e 100644 --- a/packages/react-learn-card/src/components/JobListCard/JobListCard.stories.tsx +++ b/packages/react-learn-card/src/components/JobListCard/JobListCard.stories.tsx @@ -1,8 +1,8 @@ import React from 'react'; -import { Story, Meta } from '@storybook/react'; +import type { Story, Meta } from '@storybook/react'; import imgPlaceholder from '../../assets/images/photoplaceholder.png'; import JobListCard from './JobListCard'; -import { JobListCardProps } from '../../types'; +import type { JobListCardProps } from '../../types'; export default { title: 'Job List Card', @@ -25,7 +25,7 @@ const dummyQualificationDisplay = { }, }; -const customButtonTest = ( +const _customButtonTest = ( console.log('custom button clicked')}> BUTTON TEST{' '} diff --git a/packages/react-learn-card/src/components/JobListCard/JobListCard.tsx b/packages/react-learn-card/src/components/JobListCard/JobListCard.tsx index 6a2c0a1142..d76cee39ce 100644 --- a/packages/react-learn-card/src/components/JobListCard/JobListCard.tsx +++ b/packages/react-learn-card/src/components/JobListCard/JobListCard.tsx @@ -1,7 +1,6 @@ import React from 'react'; -import { JobListCardProps } from '../../types'; import { TYPE_TO_MINI_ICON } from '../../constants/'; -import { LCSubtypes } from '../../types'; +import { LCSubtypes, type JobListCardProps } from '../../types'; const TYPE_TO_COLOR: any = { course: 'bg-emerald-50', @@ -53,8 +52,8 @@ export const JobListCard: React.FC = ({ postDateDisplay, customButtonComponent, imgThumb, - isBookmarked, - onBookmark, + isBookmarked: _isBookmarked, + onBookmark: _onBookmark, onClick, }) => { const courseReqCount = qualificationDisplay?.courses?.totalRequiredCount; @@ -101,7 +100,7 @@ export const JobListCard: React.FC = ({ ); - const buttonComponent = customButtonComponent ? customButtonComponent : defaultButton; + const buttonComponent = customButtonComponent || defaultButton; return ( = ({ className, diff --git a/packages/react-learn-card/src/components/LearnCardCreditCardBackFace/__tests__/LearnCardCreditCardBackFace.test.tsx b/packages/react-learn-card/src/components/LearnCardCreditCardBackFace/__tests__/LearnCardCreditCardBackFace.test.tsx index 56f3770bbb..f3ec1a4159 100644 --- a/packages/react-learn-card/src/components/LearnCardCreditCardBackFace/__tests__/LearnCardCreditCardBackFace.test.tsx +++ b/packages/react-learn-card/src/components/LearnCardCreditCardBackFace/__tests__/LearnCardCreditCardBackFace.test.tsx @@ -3,7 +3,7 @@ import '@testing-library/jest-dom'; import { render, screen } from '@testing-library/react'; import LearnCardCreditCardBackFace from '../LearnCardCreditCardBackFace'; -import { LearnCardCreditCardUserProps, LearnCardCreditCardProps } from '../types'; +import type { LearnCardCreditCardUserProps, LearnCardCreditCardProps } from '../types'; describe('LearnCardCreditCardBackFace', () => { test('Checks LearnCardCreditCardBackFace renders with props', () => { diff --git a/packages/react-learn-card/src/components/LearnCardCreditCardFrontFace/LearnCardCreditCardFrontFace.stories.tsx b/packages/react-learn-card/src/components/LearnCardCreditCardFrontFace/LearnCardCreditCardFrontFace.stories.tsx index fab4ec78e7..1569230b84 100644 --- a/packages/react-learn-card/src/components/LearnCardCreditCardFrontFace/LearnCardCreditCardFrontFace.stories.tsx +++ b/packages/react-learn-card/src/components/LearnCardCreditCardFrontFace/LearnCardCreditCardFrontFace.stories.tsx @@ -1,9 +1,9 @@ import React from 'react'; -import { Story, Meta } from '@storybook/react'; +import type { Story, Meta } from '@storybook/react'; import LearnCardCreditCardFrontFace from './LearnCardCreditCardFrontFace'; -import { LearnCardCreditCardFrontFaceProps } from './types'; +import type { LearnCardCreditCardFrontFaceProps } from './types'; export default { title: 'LearnCardCreditCardFrontFace', diff --git a/packages/react-learn-card/src/components/LearnCardCreditCardFrontFace/LearnCardCreditCardFrontFace.tsx b/packages/react-learn-card/src/components/LearnCardCreditCardFrontFace/LearnCardCreditCardFrontFace.tsx index 81860b9ec2..0bf49592f0 100644 --- a/packages/react-learn-card/src/components/LearnCardCreditCardFrontFace/LearnCardCreditCardFrontFace.tsx +++ b/packages/react-learn-card/src/components/LearnCardCreditCardFrontFace/LearnCardCreditCardFrontFace.tsx @@ -1,7 +1,7 @@ import React from 'react'; import { QRCodeSVG } from 'qrcode.react'; -import { LearnCardCreditCardFrontFaceProps } from './types'; +import type { LearnCardCreditCardFrontFaceProps } from './types'; import CardChip from '../../assets/images/card-chip.svg'; import MasterCardLogo from '../../assets/images/master-card-logo.svg'; diff --git a/packages/react-learn-card/src/components/LearnPill/LearnPill.stories.tsx b/packages/react-learn-card/src/components/LearnPill/LearnPill.stories.tsx index c3ee1eb396..a6787630de 100644 --- a/packages/react-learn-card/src/components/LearnPill/LearnPill.stories.tsx +++ b/packages/react-learn-card/src/components/LearnPill/LearnPill.stories.tsx @@ -1,8 +1,7 @@ import React from 'react'; -import { Story, Meta } from '@storybook/react'; -import { LCSubtypes } from '../../types'; +import type { Story, Meta } from '@storybook/react'; +import { LCSubtypes, type LearnPillProps } from '../../types'; import LearnPill from './LearnPill'; -import { LearnPillProps } from '../../types'; export default { title: 'LearnPill', diff --git a/packages/react-learn-card/src/components/LearnPill/LearnPill.tsx b/packages/react-learn-card/src/components/LearnPill/LearnPill.tsx index a1fed43dd5..9112012ab9 100644 --- a/packages/react-learn-card/src/components/LearnPill/LearnPill.tsx +++ b/packages/react-learn-card/src/components/LearnPill/LearnPill.tsx @@ -1,5 +1,5 @@ import React from 'react'; -import { LearnPillProps, LCSubtypes } from '../../types'; +import { LCSubtypes, type LearnPillProps } from '../../types'; import { TYPE_TO_MINI_ICON } from '../../constants/'; const TYPE_TO_COLOR: any = { diff --git a/packages/react-learn-card/src/components/Loading/CircleSpinner.tsx b/packages/react-learn-card/src/components/Loading/CircleSpinner.tsx index 0263cd8e60..f4c33503b9 100644 --- a/packages/react-learn-card/src/components/Loading/CircleSpinner.tsx +++ b/packages/react-learn-card/src/components/Loading/CircleSpinner.tsx @@ -31,8 +31,8 @@ const CircleSpinner: React.FC = ({ // inner circle circumference is a ratio of the outer size // this is the actual spinning thing you see const spinnerStyles = { - height: `${Math.floor(size / 1.1111111)}px`, - width: `${Math.floor(size / 1.11111111)}px`, + height: `${Math.floor(size / 1.111_111_1)}px`, + width: `${Math.floor(size / 1.111_111_11)}px`, border: `${thickness}px solid #fff`, margin: `${marginOffset}px`, borderColor: `${color}${ diff --git a/packages/react-learn-card/src/components/MeritBadgeDisplayCard/MediaAttachmentsBox.tsx b/packages/react-learn-card/src/components/MeritBadgeDisplayCard/MediaAttachmentsBox.tsx index 14a0afe1a8..ae2fcb7d44 100644 --- a/packages/react-learn-card/src/components/MeritBadgeDisplayCard/MediaAttachmentsBox.tsx +++ b/packages/react-learn-card/src/components/MeritBadgeDisplayCard/MediaAttachmentsBox.tsx @@ -6,9 +6,9 @@ import LinkIcon from '../svgs/LinkIcon'; import VideoIcon from '../svgs/VideoIcon'; import GenericDocumentIcon from '../svgs/GenericDocumentIcon'; -import { Attachment, MediaMetadata, VideoMetadata } from '../../types'; +import type { Attachment, MediaMetadata, VideoMetadata } from '../../types'; import { getBaseUrl } from '../../helpers/url.helpers'; -import { Lightbox, LightboxItem } from '../Lightbox'; +import { Lightbox, type LightboxItem } from '../Lightbox'; type MediaAttachmentsBoxProps = { attachments: Attachment[]; @@ -177,7 +177,7 @@ const MediaAttachmentsBox: React.FC = ({ if (media.type === 'video') { const metadata = videoMetadata[media.url]; title = (title || metadata?.title) ?? ''; - const baseUrl = getBaseUrl(media.url); + const _baseUrl = getBaseUrl(media.url); innerContent = ( = ({ Awarded on {createdAt} @@ -94,11 +95,7 @@ export const MeritBadgeBackFace: React.FC = ({ {criteria && } {(credential.skills?.length ?? 0) > 0 && - (customSkillsComponent ? ( - customSkillsComponent - ) : ( - - ))} + (customSkillsComponent || )} {credential.attachments && credential.attachments.length > 0 && ( = ({ customBodyCardComponent, knownDIDRegistry, hideIssueDate, - customSkillsComponent, + customSkillsComponent: _customSkillsComponent, getFileMetadata, getVideoMetadata, diff --git a/packages/react-learn-card/src/components/MeritBadgeDisplayCard/MeritBadgeFrontFace.tsx b/packages/react-learn-card/src/components/MeritBadgeDisplayCard/MeritBadgeFrontFace.tsx index 9cefe130ea..9c056f7d0e 100644 --- a/packages/react-learn-card/src/components/MeritBadgeDisplayCard/MeritBadgeFrontFace.tsx +++ b/packages/react-learn-card/src/components/MeritBadgeDisplayCard/MeritBadgeFrontFace.tsx @@ -2,7 +2,6 @@ import React from 'react'; import MeritBadgeCornerIcon from './MeritBadgeCornerIcon'; import MeritBadgeImageDisplay from './MeritBadgeImageDisplay'; -import MeritBadgeSkillsCount from './MeritBadgeSkillsCount'; import MeritBadgeProfileImageDisplay from './MeritBadgeProfileImageDisplay'; import Smiley from '../svgs/Smiley'; @@ -16,13 +15,16 @@ import { getCategoryDarkColor, } from '../../helpers/credential.helpers'; -import { VC, Profile } from '@learncard/types'; -import { BoostAchievementCredential, LCCategoryEnum } from '../../types'; +import type { VC, Profile } from '@learncard/types'; +import { + LCCategoryEnum, + type BoostAchievementCredential, + type KnownDIDRegistryType, +} from '../../types'; import VerifierStateBadgeAndText, { - VerifierState, VERIFIER_STATES, + type VerifierState, } from '../CertificateDisplayCard/VerifierStateBadgeAndText'; -import { KnownDIDRegistryType } from '../../types'; type MeritBadgeFrontFaceProps = { isFront?: boolean; @@ -41,7 +43,6 @@ type MeritBadgeFrontFaceProps = { }; export const MeritBadgeFrontFace: React.FC = ({ - isFront, credential, categoryType, issuerOverride, @@ -50,9 +51,7 @@ export const MeritBadgeFrontFace: React.FC = ({ subjectImageComponent, issuerImageComponent, customBodyCardComponent, - hideIssueDate, handleViewBackFace, - showDetailsBtn = false, formattedDisplayType, }) => { const { @@ -67,8 +66,6 @@ export const MeritBadgeFrontFace: React.FC = ({ const issuee = issueeOverride || _issuee; const issuer = issuerOverride || _issuer; - const { description } = credentialSubject?.achievement ?? {}; - const credentialLightColor = getCategoryLightColor(categoryType); // 500 const credentialDarkColor = getCategoryDarkColor(categoryType); // 700 @@ -119,7 +116,6 @@ export const MeritBadgeFrontFace: React.FC = ({ verifierState = VERIFIER_STATES.unknownVerifier; } } - const isSelfVerified = verifierState === VERIFIER_STATES.selfVerified; const issueeImageExists = issueeImage || subjectImageComponent; diff --git a/packages/react-learn-card/src/components/MeritBadgeDisplayCard/VerificationRow.tsx b/packages/react-learn-card/src/components/MeritBadgeDisplayCard/VerificationRow.tsx index 729244894b..1c1e8acea3 100644 --- a/packages/react-learn-card/src/components/MeritBadgeDisplayCard/VerificationRow.tsx +++ b/packages/react-learn-card/src/components/MeritBadgeDisplayCard/VerificationRow.tsx @@ -1,5 +1,5 @@ import React, { useState } from 'react'; -import { VerificationItem, VerificationStatusEnum } from '@learncard/types'; +import { VerificationStatusEnum, type VerificationItem } from '@learncard/types'; import { getColorForVerificationStatus } from '../../helpers/credential.helpers'; import InfoBox from './InfoBox'; diff --git a/packages/react-learn-card/src/components/MeritBadgeDisplayCard/VerificationsBox.tsx b/packages/react-learn-card/src/components/MeritBadgeDisplayCard/VerificationsBox.tsx index 802155e6a9..9bd0adfab1 100644 --- a/packages/react-learn-card/src/components/MeritBadgeDisplayCard/VerificationsBox.tsx +++ b/packages/react-learn-card/src/components/MeritBadgeDisplayCard/VerificationsBox.tsx @@ -4,7 +4,7 @@ import VerificationRow from './VerificationRow'; import InfoIcon from '../svgs/InfoIcon'; import InfoBox from './InfoBox'; -import { VerificationItem } from '@learncard/types'; +import type { VerificationItem } from '@learncard/types'; type VerificationsBoxProps = { verificationItems: VerificationItem[]; diff --git a/packages/react-learn-card/src/components/MiniVCThumbnail/ MiniVCThumbnail.stories.tsx b/packages/react-learn-card/src/components/MiniVCThumbnail/ MiniVCThumbnail.stories.tsx index 618b220292..14dafdd639 100644 --- a/packages/react-learn-card/src/components/MiniVCThumbnail/ MiniVCThumbnail.stories.tsx +++ b/packages/react-learn-card/src/components/MiniVCThumbnail/ MiniVCThumbnail.stories.tsx @@ -1,8 +1,8 @@ import React from 'react'; -import { Story, Meta } from '@storybook/react'; +import type { Story, Meta } from '@storybook/react'; import MiniVCThumbnail from './MiniVCThumbnail'; -import { MiniVCThumbnailProps } from './types'; +import type { MiniVCThumbnailProps } from './types'; export default { title: 'MiniVCThumbnail', diff --git a/packages/react-learn-card/src/components/MiniVCThumbnail/MiniVCThumbnail.tsx b/packages/react-learn-card/src/components/MiniVCThumbnail/MiniVCThumbnail.tsx index 677c47c91f..09f3d8d96d 100644 --- a/packages/react-learn-card/src/components/MiniVCThumbnail/MiniVCThumbnail.tsx +++ b/packages/react-learn-card/src/components/MiniVCThumbnail/MiniVCThumbnail.tsx @@ -2,7 +2,7 @@ import React from 'react'; import VerifiedCheck from '../../assets/images/verified-check.png'; -import { MiniVCThumbnailProps } from './types'; +import type { MiniVCThumbnailProps } from './types'; export const MiniVCThumbnail: React.FC = ({ title, diff --git a/packages/react-learn-card/src/components/Notification/Notification.stories.tsx b/packages/react-learn-card/src/components/Notification/Notification.stories.tsx index 6af4245c93..e56dbe8a81 100644 --- a/packages/react-learn-card/src/components/Notification/Notification.stories.tsx +++ b/packages/react-learn-card/src/components/Notification/Notification.stories.tsx @@ -1,8 +1,8 @@ import React from 'react'; -import { Story, Meta } from '@storybook/react'; +import type { Story, Meta } from '@storybook/react'; import Notification from './Notification'; -import { NotificationProps } from './types'; +import type { NotificationProps } from './types'; import { NotificationTypeEnum } from '../../constants/notifications'; export default { diff --git a/packages/react-learn-card/src/components/Notification/Notification.tsx b/packages/react-learn-card/src/components/Notification/Notification.tsx index a30f3b55ed..aa17e282f3 100644 --- a/packages/react-learn-card/src/components/Notification/Notification.tsx +++ b/packages/react-learn-card/src/components/Notification/Notification.tsx @@ -1,6 +1,6 @@ import React, { useState, useEffect } from 'react'; -import { NotificationProps, NotificationTypeStyles } from './types'; +import { NotificationTypeStyles, type NotificationProps } from './types'; import { NotificationTypeEnum } from '../../constants/notifications'; import Checkmark from '../svgs/Checkmark'; @@ -39,7 +39,7 @@ export const Notification: React.FC = ({ const claimButtonStyles = isClaimed ? claimedButtonStyles : unclaimedButtonStyles; - let buttonText: string = ''; + let buttonText = ''; if (isClaimed) { buttonText = 'Claimed'; diff --git a/packages/react-learn-card/src/components/Notification/types.ts b/packages/react-learn-card/src/components/Notification/types.ts index e23048761a..0a19144de7 100644 --- a/packages/react-learn-card/src/components/Notification/types.ts +++ b/packages/react-learn-card/src/components/Notification/types.ts @@ -20,8 +20,9 @@ export type NotificationProps = { loadingState: boolean; }; -export const NotificationTypeStyles: { - [key: NotificationTypeEnum | string]: { +export const NotificationTypeStyles: Record< + NotificationTypeEnum | string, + { viewButtonStyles: string; unclaimedButtonStyles: string; claimedButtonStyles: string; @@ -29,8 +30,8 @@ export const NotificationTypeStyles: { iconCircleStyles: string; IconComponent: any; typeText: string; - }; -} = { + } +> = { [NotificationTypeEnum.Currency]: { viewButtonStyles: 'border-cyan-400 text-cyan-400', unclaimedButtonStyles: 'text-white bg-cyan-400 border-cyan-400 shadow-bottom', diff --git a/packages/react-learn-card/src/components/NotificationBoostCard/NotificationBoostCard.stories.tsx b/packages/react-learn-card/src/components/NotificationBoostCard/NotificationBoostCard.stories.tsx index f502ce9c10..0ba43308a3 100644 --- a/packages/react-learn-card/src/components/NotificationBoostCard/NotificationBoostCard.stories.tsx +++ b/packages/react-learn-card/src/components/NotificationBoostCard/NotificationBoostCard.stories.tsx @@ -1,8 +1,8 @@ import React from 'react'; -import { Story, Meta } from '@storybook/react'; +import type { Story, Meta } from '@storybook/react'; import NotificationBoostCard from './NotificationBoostCard'; -import { NotificationBoostCardProps } from './types'; +import type { NotificationBoostCardProps } from './types'; import { NotificationTypeEnum } from '../../constants/notifications'; export default { diff --git a/packages/react-learn-card/src/components/NotificationBoostCard/NotificationBoostCard.tsx b/packages/react-learn-card/src/components/NotificationBoostCard/NotificationBoostCard.tsx index ef1adfab3b..6c02b7d83b 100644 --- a/packages/react-learn-card/src/components/NotificationBoostCard/NotificationBoostCard.tsx +++ b/packages/react-learn-card/src/components/NotificationBoostCard/NotificationBoostCard.tsx @@ -1,6 +1,6 @@ import React, { useState, useEffect } from 'react'; import X from '../../assets/images/X.svg'; -import { NotificationBoostCardProps } from './types'; +import type { NotificationBoostCardProps } from './types'; import { NotificationTypeStyles } from '../Notification/types'; import { NotificationTypeEnum } from '../../constants/notifications'; import DefaultFace from '../../assets/images/default-face.jpeg'; @@ -23,8 +23,8 @@ export const NotificationBoostCard: React.FC = ({ showIssuerInfo = true, isArchived, }) => { - const [isClaimed, setIsClaimed] = useState(claimStatus || false); - const [isLoading, setIsLoading] = useState(loadingState || false); + const [isClaimed, setIsClaimed] = useState(claimStatus); + const [isLoading, setIsLoading] = useState(loadingState); useEffect(() => { setIsClaimed(claimStatus); @@ -45,11 +45,11 @@ export const NotificationBoostCard: React.FC = ({ const claimButtonStyles = isClaimed ? claimedButtonStyles : unclaimedButtonStyles; - let buttonText: string = ''; + let buttonText = ''; if (isClaimed) { buttonText = 'Claimed'; - } else if (!isClaimed) { + } else { buttonText = 'Claim'; } diff --git a/packages/react-learn-card/src/components/NotificationBoostCard/types.ts b/packages/react-learn-card/src/components/NotificationBoostCard/types.ts index fb249de44a..687a752c44 100644 --- a/packages/react-learn-card/src/components/NotificationBoostCard/types.ts +++ b/packages/react-learn-card/src/components/NotificationBoostCard/types.ts @@ -1,6 +1,6 @@ -import { NotificationTypeEnum } from '../../constants/notifications'; +import type { NotificationTypeEnum } from '../../constants/notifications'; -export interface NotificationIssuerMeta { +export type NotificationIssuerMeta = { image?: string; fullName?: string; profileId?: string; diff --git a/packages/react-learn-card/src/components/NotificationUserAcceptedBoostCard/NotificationUserAcceptedBoostCard.stories.tsx b/packages/react-learn-card/src/components/NotificationUserAcceptedBoostCard/NotificationUserAcceptedBoostCard.stories.tsx index 75f7028b3e..e927275abe 100644 --- a/packages/react-learn-card/src/components/NotificationUserAcceptedBoostCard/NotificationUserAcceptedBoostCard.stories.tsx +++ b/packages/react-learn-card/src/components/NotificationUserAcceptedBoostCard/NotificationUserAcceptedBoostCard.stories.tsx @@ -1,8 +1,8 @@ import React from 'react'; -import { Story, Meta } from '@storybook/react'; +import type { Story, Meta } from '@storybook/react'; import NotificationUserAcceptedBoostCard from './NotificationUserAcceptedBoostCard'; -import { NotificationUserAcceptedBoostCardProps } from './types'; +import type { NotificationUserAcceptedBoostCardProps } from './types'; import { UserNotificationTypeEnum } from '../../constants/notifications'; export default { diff --git a/packages/react-learn-card/src/components/NotificationUserAcceptedBoostCard/NotificationUserAcceptedBoostCard.tsx b/packages/react-learn-card/src/components/NotificationUserAcceptedBoostCard/NotificationUserAcceptedBoostCard.tsx index 90127aa7a8..0970ef8513 100644 --- a/packages/react-learn-card/src/components/NotificationUserAcceptedBoostCard/NotificationUserAcceptedBoostCard.tsx +++ b/packages/react-learn-card/src/components/NotificationUserAcceptedBoostCard/NotificationUserAcceptedBoostCard.tsx @@ -1,6 +1,6 @@ import React, { useState, useEffect } from 'react'; import X from '../../assets/images/X.svg'; -import { NotificationUserAcceptedBoostCardProps } from './types'; +import type { NotificationUserAcceptedBoostCardProps } from './types'; import { UserNotificationTypeStyles } from '../NotificationUserCard/types'; import { UserNotificationTypeEnum } from '../../constants/notifications'; @@ -19,7 +19,7 @@ export const NotificationUserAcceptedBoostCard: React.FC< handleCancelClick, isArchived, }) => { - const [isLoading, setIsLoading] = useState(loadingState || false); + const [_isLoading, setIsLoading] = useState(loadingState); useEffect(() => { setIsLoading(loadingState); diff --git a/packages/react-learn-card/src/components/NotificationUserAcceptedBoostCard/types.ts b/packages/react-learn-card/src/components/NotificationUserAcceptedBoostCard/types.ts index 27747316c6..390b955bb9 100644 --- a/packages/react-learn-card/src/components/NotificationUserAcceptedBoostCard/types.ts +++ b/packages/react-learn-card/src/components/NotificationUserAcceptedBoostCard/types.ts @@ -1,4 +1,4 @@ -import { UserNotificationTypeEnum } from '../../constants/notifications'; +import type { UserNotificationTypeEnum } from '../../constants/notifications'; export type NotificationUserAcceptedBoostCardProps = { className?: string; diff --git a/packages/react-learn-card/src/components/NotificationUserCard/NotificationUserCard.stories.tsx b/packages/react-learn-card/src/components/NotificationUserCard/NotificationUserCard.stories.tsx index 900b5b0b72..78a41b3e8c 100644 --- a/packages/react-learn-card/src/components/NotificationUserCard/NotificationUserCard.stories.tsx +++ b/packages/react-learn-card/src/components/NotificationUserCard/NotificationUserCard.stories.tsx @@ -1,8 +1,8 @@ import React from 'react'; -import { Story, Meta } from '@storybook/react'; +import type { Story, Meta } from '@storybook/react'; import NotificationUserCard from './NotificationUserCard'; -import { NotificationUserCardProps } from './types'; +import type { NotificationUserCardProps } from './types'; export default { title: 'NotificationUserCard', diff --git a/packages/react-learn-card/src/components/NotificationUserCard/NotificationUserCard.tsx b/packages/react-learn-card/src/components/NotificationUserCard/NotificationUserCard.tsx index f424d32447..e61328f333 100644 --- a/packages/react-learn-card/src/components/NotificationUserCard/NotificationUserCard.tsx +++ b/packages/react-learn-card/src/components/NotificationUserCard/NotificationUserCard.tsx @@ -1,9 +1,8 @@ import React, { useState, useEffect } from 'react'; import X from '../../assets/images/X.svg'; -import { NotificationUserCardProps, UserNotificationTypeStyles } from './types'; +import { UserNotificationTypeStyles, type NotificationUserCardProps } from './types'; import { UserNotificationTypeEnum } from '../../constants/notifications'; -import DefaultFace from '../../assets/images/default-face.jpeg'; import Checkmark from '../svgs/Checkmark'; import ArrowArcLeft from '../../assets/images/ArrowArcLeft.svg'; @@ -35,7 +34,7 @@ export const NotificationUserCard: React.FC = ({ const claimButtonStyles = isAccepted ? claimedButtonStyles : unclaimedButtonStyles; - let buttonText: string = ''; + let buttonText = ''; if (isAccepted) { buttonText = 'Accepted'; diff --git a/packages/react-learn-card/src/components/NotificationUserCard/types.ts b/packages/react-learn-card/src/components/NotificationUserCard/types.ts index 7b4f5ebc3d..0bc034ea3b 100644 --- a/packages/react-learn-card/src/components/NotificationUserCard/types.ts +++ b/packages/react-learn-card/src/components/NotificationUserCard/types.ts @@ -14,16 +14,17 @@ export type NotificationUserCardProps = { isArchived?: boolean; }; -export const UserNotificationTypeStyles: { - [key: UserNotificationTypeEnum | string]: { +export const UserNotificationTypeStyles: Record< + UserNotificationTypeEnum | string, + { viewButtonStyles: string; unclaimedButtonStyles: string; claimedButtonStyles: string; textStyles: string; iconCircleStyles: string; typeText?: string; - }; -} = { + } +> = { [UserNotificationTypeEnum.ConnectionRequest]: { viewButtonStyles: 'border-indigo-600 text-indigo-400', unclaimedButtonStyles: 'text-white bg-indigo-600 border-indigo-600 shadow-bottom', diff --git a/packages/react-learn-card/src/components/QRCodeCard/QRCodeCard.stories.tsx b/packages/react-learn-card/src/components/QRCodeCard/QRCodeCard.stories.tsx index 7a8c4bafe3..f88fad4e79 100644 --- a/packages/react-learn-card/src/components/QRCodeCard/QRCodeCard.stories.tsx +++ b/packages/react-learn-card/src/components/QRCodeCard/QRCodeCard.stories.tsx @@ -1,9 +1,9 @@ import React from 'react'; -import { Story, Meta } from '@storybook/react'; +import type { Story, Meta } from '@storybook/react'; import QRCodeCard from './QRCodeCard'; -import { QRCodeCardProps } from './types'; +import type { QRCodeCardProps } from './types'; export default { title: 'QRCodeCard', diff --git a/packages/react-learn-card/src/components/QRCodeCard/QRCodeCard.tsx b/packages/react-learn-card/src/components/QRCodeCard/QRCodeCard.tsx index 0e6bbc9b61..168e510b29 100644 --- a/packages/react-learn-card/src/components/QRCodeCard/QRCodeCard.tsx +++ b/packages/react-learn-card/src/components/QRCodeCard/QRCodeCard.tsx @@ -1,7 +1,7 @@ import React from 'react'; import { QRCodeSVG } from 'qrcode.react'; -import { QRCodeCardProps } from './types'; +import type { QRCodeCardProps } from './types'; export const QRCodeCard: React.FC = ({ userHandle, diff --git a/packages/react-learn-card/src/components/RoundedPill/RoundedPill.stories.tsx b/packages/react-learn-card/src/components/RoundedPill/RoundedPill.stories.tsx index cec6779b7e..5b0c7151ff 100644 --- a/packages/react-learn-card/src/components/RoundedPill/RoundedPill.stories.tsx +++ b/packages/react-learn-card/src/components/RoundedPill/RoundedPill.stories.tsx @@ -1,8 +1,8 @@ import React from 'react'; -import { Story, Meta } from '@storybook/react'; +import type { Story, Meta } from '@storybook/react'; import RoundedPill from './RoundedPill'; -import { RoundedPillProps } from '../../types'; +import type { RoundedPillProps } from '../../types'; export default { title: 'Rounded Pill', diff --git a/packages/react-learn-card/src/components/RoundedPill/RoundedPill.tsx b/packages/react-learn-card/src/components/RoundedPill/RoundedPill.tsx index 9ebf8c113e..29bbf0b83f 100644 --- a/packages/react-learn-card/src/components/RoundedPill/RoundedPill.tsx +++ b/packages/react-learn-card/src/components/RoundedPill/RoundedPill.tsx @@ -1,6 +1,6 @@ import React from 'react'; import { TYPE_TO_ICON } from '../../constants/icons'; -import { RoundedPillProps } from '../../types'; +import type { RoundedPillProps } from '../../types'; const TYPE_TO_BG_COLOR_CLASS: any = { skill: 'indigo-50', diff --git a/packages/react-learn-card/src/components/RoundedSquare/RoundedSquare.stories.tsx b/packages/react-learn-card/src/components/RoundedSquare/RoundedSquare.stories.tsx index 0162c6d79a..c0f959161a 100644 --- a/packages/react-learn-card/src/components/RoundedSquare/RoundedSquare.stories.tsx +++ b/packages/react-learn-card/src/components/RoundedSquare/RoundedSquare.stories.tsx @@ -1,8 +1,8 @@ import React from 'react'; -import { Story, Meta } from '@storybook/react'; +import type { Story, Meta } from '@storybook/react'; import RoundedSquare from './RoundedSquare'; -import { RoundedSquareProps, Icons, WalletCategoryTypes } from '../../types'; +import { Icons, WalletCategoryTypes, type RoundedSquareProps } from '../../types'; import { ICONS_TO_SOURCE } from '../../constants/icons'; export default { diff --git a/packages/react-learn-card/src/components/RoundedSquare/constants.ts b/packages/react-learn-card/src/components/RoundedSquare/constants.ts index 75f5b59d4f..6ef3cba4c4 100644 --- a/packages/react-learn-card/src/components/RoundedSquare/constants.ts +++ b/packages/react-learn-card/src/components/RoundedSquare/constants.ts @@ -1,6 +1,5 @@ import coinsGraphic from '../../assets/images/walletcurrency.webp'; import idsGraphic from '../../assets/images/walletids.webp'; -import jobhistoryGraphic from '../../assets/images/walletjobhistory.webp'; import learningHistoryGraphic from '../../assets/images/backpack.png'; import skillsGraphic from '../../assets/images/walletskills.webp'; import achievementsGraphic from '../../assets/images/walletTrophy.png'; diff --git a/packages/react-learn-card/src/components/SchoolIdCard/SchoolIDCard.stories.tsx b/packages/react-learn-card/src/components/SchoolIdCard/SchoolIDCard.stories.tsx index 568fc7961d..77cf8ab7f3 100644 --- a/packages/react-learn-card/src/components/SchoolIdCard/SchoolIDCard.stories.tsx +++ b/packages/react-learn-card/src/components/SchoolIdCard/SchoolIDCard.stories.tsx @@ -1,9 +1,9 @@ import React from 'react'; -import { Story, Meta } from '@storybook/react'; +import type { Story, Meta } from '@storybook/react'; import MotlowBuckCardBG from '../../assets/images/motlow-buckcard-bg.svg'; import SchoolIDCard from './SchoolIDCard'; -import { SchoolIDCardProps } from './types'; +import type { SchoolIDCardProps } from './types'; export default { title: 'SchoolIDCard', diff --git a/packages/react-learn-card/src/components/SchoolIdCard/SchoolIDCard.tsx b/packages/react-learn-card/src/components/SchoolIdCard/SchoolIDCard.tsx index 552a9d0473..64c7e1a137 100644 --- a/packages/react-learn-card/src/components/SchoolIdCard/SchoolIDCard.tsx +++ b/packages/react-learn-card/src/components/SchoolIdCard/SchoolIDCard.tsx @@ -2,7 +2,7 @@ import React from 'react'; import Barcode from 'react-barcode'; -import { SchoolIDCardProps } from './types'; +import type { SchoolIDCardProps } from './types'; export const SchoolIDCard: React.FC = ({ userImage, @@ -49,7 +49,7 @@ export const SchoolIDCard: React.FC = ({ {issueeImageEl} {userName && {userName}} - {textEl && textEl} + {textEl} diff --git a/packages/react-learn-card/src/components/SkillTabCard/SkillTabCard.stories.tsx b/packages/react-learn-card/src/components/SkillTabCard/SkillTabCard.stories.tsx index 2228bf9fc9..66400458b5 100644 --- a/packages/react-learn-card/src/components/SkillTabCard/SkillTabCard.stories.tsx +++ b/packages/react-learn-card/src/components/SkillTabCard/SkillTabCard.stories.tsx @@ -1,7 +1,7 @@ import React from 'react'; -import { Story, Meta } from '@storybook/react'; +import type { Story, Meta } from '@storybook/react'; import SkillTabCard from './SkillTabCard'; -import { SkillTabCardProps } from '../../types'; +import type { SkillTabCardProps } from '../../types'; export default { title: 'SkillTabCard', diff --git a/packages/react-learn-card/src/components/SkillTabCard/SkillTabCard.tsx b/packages/react-learn-card/src/components/SkillTabCard/SkillTabCard.tsx index 6e2120e610..d904a39666 100644 --- a/packages/react-learn-card/src/components/SkillTabCard/SkillTabCard.tsx +++ b/packages/react-learn-card/src/components/SkillTabCard/SkillTabCard.tsx @@ -1,8 +1,7 @@ import React from 'react'; import { RoundedPill } from '../RoundedPill'; -import { LCSubtypes } from '../../types'; import { CircleCheckButton } from '../CircleCheckButton'; -import { SkillTabCardProps } from '../../types'; +import { LCSubtypes, type SkillTabCardProps } from '../../types'; export const SkillTabCard: React.FC = ({ title, diff --git a/packages/react-learn-card/src/components/SkillVerticalCard/SkillVerticalCard.stories.tsx b/packages/react-learn-card/src/components/SkillVerticalCard/SkillVerticalCard.stories.tsx index 16f9895811..780d0a098f 100644 --- a/packages/react-learn-card/src/components/SkillVerticalCard/SkillVerticalCard.stories.tsx +++ b/packages/react-learn-card/src/components/SkillVerticalCard/SkillVerticalCard.stories.tsx @@ -1,8 +1,8 @@ import React from 'react'; -import { Story, Meta } from '@storybook/react'; +import type { Story, Meta } from '@storybook/react'; import SkillVerticalCard from './SkillVerticalCard'; -import { SkillVerticalCardProps } from '../../types'; +import type { SkillVerticalCardProps } from '../../types'; export default { title: 'Skill Vertical Card', diff --git a/packages/react-learn-card/src/components/SkillVerticalCard/SkillVerticalCard.tsx b/packages/react-learn-card/src/components/SkillVerticalCard/SkillVerticalCard.tsx index e3ce9db8a8..ee7a11b697 100644 --- a/packages/react-learn-card/src/components/SkillVerticalCard/SkillVerticalCard.tsx +++ b/packages/react-learn-card/src/components/SkillVerticalCard/SkillVerticalCard.tsx @@ -1,5 +1,5 @@ import React from 'react'; -import { SkillVerticalCardProps } from '../../types'; +import type { SkillVerticalCardProps } from '../../types'; import SkillPlaceholder from '../../assets/images/skillplaceholder.png'; export const SkillVerticalCard: React.FC = ({ diff --git a/packages/react-learn-card/src/components/SkillsCard/SkillsCard.stories.tsx b/packages/react-learn-card/src/components/SkillsCard/SkillsCard.stories.tsx index a75bb6da4b..9bc0c8c5e0 100644 --- a/packages/react-learn-card/src/components/SkillsCard/SkillsCard.stories.tsx +++ b/packages/react-learn-card/src/components/SkillsCard/SkillsCard.stories.tsx @@ -1,8 +1,8 @@ import React from 'react'; -import { Story, Meta } from '@storybook/react'; +import type { Story, Meta } from '@storybook/react'; import SkillsCard from './SkillsCard'; -import { SkillsCardProps } from '../../types'; +import type { SkillsCardProps } from '../../types'; export default { title: 'Skills Card', diff --git a/packages/react-learn-card/src/components/SkillsCard/SkillsCard.tsx b/packages/react-learn-card/src/components/SkillsCard/SkillsCard.tsx index 856f5dde18..e21509784f 100644 --- a/packages/react-learn-card/src/components/SkillsCard/SkillsCard.tsx +++ b/packages/react-learn-card/src/components/SkillsCard/SkillsCard.tsx @@ -1,5 +1,5 @@ import React from 'react'; -import { SkillsCardProps } from '../../types'; +import type { SkillsCardProps } from '../../types'; type SkillsMeterSegmentProps = { filled?: boolean; @@ -9,7 +9,7 @@ type SkillsMeterSegmentProps = { export const SkillsMeterSegment: React.FC = ({ filled = false, - className, + className: _className, skillColor = 'bg-cyan-700', }) => { const bgColor = filled ? skillColor : 'bg-gray-200'; diff --git a/packages/react-learn-card/src/components/SkillsStatsCard/SkillsStatsCard.stories.tsx b/packages/react-learn-card/src/components/SkillsStatsCard/SkillsStatsCard.stories.tsx index 2e28c0247d..a97423bcc1 100644 --- a/packages/react-learn-card/src/components/SkillsStatsCard/SkillsStatsCard.stories.tsx +++ b/packages/react-learn-card/src/components/SkillsStatsCard/SkillsStatsCard.stories.tsx @@ -1,8 +1,8 @@ import React from 'react'; -import { Story, Meta } from '@storybook/react'; +import type { Story, Meta } from '@storybook/react'; import SkillsStatsCard from './SkillsStatsCard'; -import { SkillsStatsCardProps } from '../../types'; +import type { SkillsStatsCardProps } from '../../types'; const dummySkills = [ { diff --git a/packages/react-learn-card/src/components/SkillsStatsCard/SkillsStatsCard.tsx b/packages/react-learn-card/src/components/SkillsStatsCard/SkillsStatsCard.tsx index 01e1038426..9ae77e46fc 100644 --- a/packages/react-learn-card/src/components/SkillsStatsCard/SkillsStatsCard.tsx +++ b/packages/react-learn-card/src/components/SkillsStatsCard/SkillsStatsCard.tsx @@ -1,5 +1,5 @@ import React from 'react'; -import { SkillsStatsCardProps } from '../../types'; +import type { SkillsStatsCardProps } from '../../types'; import SkillGraphPlaceholder from '../../assets/images/skillgraph.svg'; type SkillStatListItemProps = { @@ -28,7 +28,7 @@ const SkillStatListItemIndicator: React.FC = ({ ); }; -const SkillStatListItem: React.FC = ({ name, percent, className }) => { +const SkillStatListItem: React.FC = ({ name, percent, className: _className }) => { const colorIndicator = ; return ( @@ -41,7 +41,7 @@ const SkillStatListItem: React.FC = ({ name, percent, cl ); }; -const MoreSkillsListItem: React.FC = ({ count, percent, className }) => { +const MoreSkillsListItem: React.FC = ({ count, percent, className: _className }) => { const colorIndicator = ; return ( diff --git a/packages/react-learn-card/src/components/SmallAchievementCard/SmallAchievementCard.stories.tsx b/packages/react-learn-card/src/components/SmallAchievementCard/SmallAchievementCard.stories.tsx index 625da8ee47..6663291dff 100644 --- a/packages/react-learn-card/src/components/SmallAchievementCard/SmallAchievementCard.stories.tsx +++ b/packages/react-learn-card/src/components/SmallAchievementCard/SmallAchievementCard.stories.tsx @@ -1,8 +1,8 @@ import React from 'react'; -import { Story, Meta } from '@storybook/react'; +import type { Story, Meta } from '@storybook/react'; import SmallVCCard from './SmallAchievementCard'; -import { SmallAchievementCardProps } from '../../types'; +import type { SmallAchievementCardProps } from '../../types'; export default { title: 'Mini Achievement Display Card', diff --git a/packages/react-learn-card/src/components/SmallAchievementCard/SmallAchievementCard.tsx b/packages/react-learn-card/src/components/SmallAchievementCard/SmallAchievementCard.tsx index 467f8fcbcc..03063de9a3 100644 --- a/packages/react-learn-card/src/components/SmallAchievementCard/SmallAchievementCard.tsx +++ b/packages/react-learn-card/src/components/SmallAchievementCard/SmallAchievementCard.tsx @@ -1,13 +1,12 @@ import React from 'react'; -import { SmallAchievementCardProps } from '../../types'; -import { RoundedPill } from '../RoundedPill'; +import type { SmallAchievementCardProps } from '../../types'; import { Trophy } from '../svgs'; export const SmallAchievementCard: React.FC = ({ title = 'Title Lorem Ipsum', thumbImgSrc, date = 'Apr 20, 2022', - showStatus = false, + showStatus: _showStatus = false, onClick = () => {}, }) => { const thumbClass = thumbImgSrc ? 'bg-grayscale-50' : 'bg-indigo-200'; diff --git a/packages/react-learn-card/src/components/VCCard/VCCard.stories.tsx b/packages/react-learn-card/src/components/VCCard/VCCard.stories.tsx index 5d7e7304fb..a120ac4f57 100644 --- a/packages/react-learn-card/src/components/VCCard/VCCard.stories.tsx +++ b/packages/react-learn-card/src/components/VCCard/VCCard.stories.tsx @@ -1,7 +1,7 @@ import React from 'react'; -import { Story, Meta } from '@storybook/react'; +import type { Story, Meta } from '@storybook/react'; -import VCCard, { VCCardProps } from './VCCard'; +import VCCard, { type VCCardProps } from './VCCard'; import { JffCredential, // simpleConvertTagsToSkills, diff --git a/packages/react-learn-card/src/components/VCCard/VCCard.tsx b/packages/react-learn-card/src/components/VCCard/VCCard.tsx index 09c8751576..dd2429577e 100644 --- a/packages/react-learn-card/src/components/VCCard/VCCard.tsx +++ b/packages/react-learn-card/src/components/VCCard/VCCard.tsx @@ -1,14 +1,14 @@ import React, { useState, useEffect } from 'react'; import { initLearnCard } from '@learncard/init'; -import { VC, Profile, VerificationItem } from '@learncard/types'; +import type { VC, Profile, VerificationItem } from '@learncard/types'; import { VCDisplayCard } from '../VCDisplayCard'; import { VCDisplayCard2, - CredentialIconType, + type CredentialIconType, } from '../VCDisplayCard2'; -import { MediaMetadata, VideoMetadata } from '../../types'; +import type { MediaMetadata, VideoMetadata } from '../../types'; export type VCCardProps = { credential: VC; diff --git a/packages/react-learn-card/src/components/VCDisplayBackFace/VCDisplayBackFace.tsx b/packages/react-learn-card/src/components/VCDisplayBackFace/VCDisplayBackFace.tsx index dc670457a3..23f5d757d3 100644 --- a/packages/react-learn-card/src/components/VCDisplayBackFace/VCDisplayBackFace.tsx +++ b/packages/react-learn-card/src/components/VCDisplayBackFace/VCDisplayBackFace.tsx @@ -1,5 +1,5 @@ import React from 'react'; -import { VCDisplayCardProps } from '../../types'; +import type { VCDisplayCardProps } from '../../types'; import { VCVerificationCheckWithText } from '../VCVerificationCheck/VCVerificationCheck'; import VCVerificationPill from '../VCVerificationPill/VCVerificationPill'; import FlipArrowRight from '../../assets/images/ArrowArcRight.svg'; @@ -55,7 +55,7 @@ export const VCDisplayBackFace: React.FC = ({ > ); - const renderDetails = overrideDetailsComponent ? overrideDetailsComponent : defaultDetails; + const renderDetails = overrideDetailsComponent ?? defaultDetails; return ( = ({ - + {verification.map(item => ( diff --git a/packages/react-learn-card/src/components/VCDisplayCard/VCDisplayCard.stories.tsx b/packages/react-learn-card/src/components/VCDisplayCard/VCDisplayCard.stories.tsx index 9b40df4e3c..4728cb2fd7 100644 --- a/packages/react-learn-card/src/components/VCDisplayCard/VCDisplayCard.stories.tsx +++ b/packages/react-learn-card/src/components/VCDisplayCard/VCDisplayCard.stories.tsx @@ -1,7 +1,7 @@ import React from 'react'; -import { Story, Meta } from '@storybook/react'; +import type { Story, Meta } from '@storybook/react'; -import VCDisplayCard, { VCDisplayCardPropsReal } from './VCDisplayCard'; +import VCDisplayCard, { type VCDisplayCardPropsReal } from './VCDisplayCard'; import { VerificationStatusEnum } from '@learncard/types'; import { VC2CredentialWithValidFrom, VC2CredentialNoDate } from '../../helpers/test.helpers'; diff --git a/packages/react-learn-card/src/components/VCDisplayCard/VCDisplayCard.tsx b/packages/react-learn-card/src/components/VCDisplayCard/VCDisplayCard.tsx index 2b81b6d253..7f01a7bbf0 100644 --- a/packages/react-learn-card/src/components/VCDisplayCard/VCDisplayCard.tsx +++ b/packages/react-learn-card/src/components/VCDisplayCard/VCDisplayCard.tsx @@ -1,5 +1,5 @@ import React, { useState } from 'react'; -import { AchievementCredential, VC, Profile, VerificationItem } from '@learncard/types'; +import type { AchievementCredential, VC, Profile, VerificationItem } from '@learncard/types'; import FlippyCard from '../FlippyCard/FlippyCard'; import VCDisplayFrontFace from '../VCDisplayFrontFace/VCDisplayFrontFace'; diff --git a/packages/react-learn-card/src/components/VCDisplayCard2/FitText.tsx b/packages/react-learn-card/src/components/VCDisplayCard2/FitText.tsx index 2f1f0a3772..6cf6fb6afb 100644 --- a/packages/react-learn-card/src/components/VCDisplayCard2/FitText.tsx +++ b/packages/react-learn-card/src/components/VCDisplayCard2/FitText.tsx @@ -1,6 +1,6 @@ import React, { useEffect, useRef } from 'react'; -interface FitTextProps { +type FitTextProps = { text: string; width: string; className?: string; diff --git a/packages/react-learn-card/src/components/VCDisplayCard2/IssueHistoryBox.tsx b/packages/react-learn-card/src/components/VCDisplayCard2/IssueHistoryBox.tsx index c2e79d40b5..51efe92310 100644 --- a/packages/react-learn-card/src/components/VCDisplayCard2/IssueHistoryBox.tsx +++ b/packages/react-learn-card/src/components/VCDisplayCard2/IssueHistoryBox.tsx @@ -1,7 +1,7 @@ -import React, { useState } from 'react'; +import React from 'react'; import DefaultFace from '../../assets/images/default-face.jpeg'; -import { IssueHistory } from '../../types'; +import type { IssueHistory } from '../../types'; type SkillsBoxProps = { issueHistory: IssueHistory[]; @@ -40,7 +40,7 @@ const IssueHistoryBox: React.FC = ({ return ( Issue Log - {!customIssueHistoryComponent ? renderIssueHistory : customIssueHistoryComponent} + {customIssueHistoryComponent ?? renderIssueHistory} ); }; diff --git a/packages/react-learn-card/src/components/VCDisplayCard2/MediaAttachmentsBox.tsx b/packages/react-learn-card/src/components/VCDisplayCard2/MediaAttachmentsBox.tsx index ed364fd9f2..31aee21b53 100644 --- a/packages/react-learn-card/src/components/VCDisplayCard2/MediaAttachmentsBox.tsx +++ b/packages/react-learn-card/src/components/VCDisplayCard2/MediaAttachmentsBox.tsx @@ -6,9 +6,9 @@ import LinkIcon from '../svgs/LinkIcon'; import VideoIcon from '../svgs/VideoIcon'; import GenericDocumentIcon from '../svgs/GenericDocumentIcon'; -import { Attachment, MediaMetadata, VideoMetadata } from '../../types'; +import type { Attachment, MediaMetadata, VideoMetadata } from '../../types'; import { getBaseUrl } from '../../helpers/url.helpers'; -import { Lightbox, LightboxItem } from '../Lightbox'; +import { Lightbox, type LightboxItem } from '../Lightbox'; type MediaAttachmentsBoxProps = { attachments: Attachment[]; diff --git a/packages/react-learn-card/src/components/VCDisplayCard2/SelectedSkills.tsx b/packages/react-learn-card/src/components/VCDisplayCard2/SelectedSkills.tsx index 663d655b28..a6733de642 100644 --- a/packages/react-learn-card/src/components/VCDisplayCard2/SelectedSkills.tsx +++ b/packages/react-learn-card/src/components/VCDisplayCard2/SelectedSkills.tsx @@ -4,12 +4,10 @@ import TopLevelSkill from './TopLevelSkill'; import Subskill from './Subskill'; import { - boostCMSSKillCategories, - BoostCMSSKillsCategoryEnum, - BoostCMSCategorySkillEnum, - BoostCMSSubSkillEnum, - CATEGORY_TO_SKILLS, SKILLS_TO_SUBSKILLS, + type BoostCMSSKillsCategoryEnum, + type BoostCMSCategorySkillEnum, + type BoostCMSSubSkillEnum } from '../../constants/skills'; export const SelectedSkills: React.FC<{ diff --git a/packages/react-learn-card/src/components/VCDisplayCard2/SkillsBox.tsx b/packages/react-learn-card/src/components/VCDisplayCard2/SkillsBox.tsx index 534f29513a..2eb276e90a 100644 --- a/packages/react-learn-card/src/components/VCDisplayCard2/SkillsBox.tsx +++ b/packages/react-learn-card/src/components/VCDisplayCard2/SkillsBox.tsx @@ -1,10 +1,10 @@ -import React, { useState } from 'react'; +import React from 'react'; import { boostCMSSKillCategories, - BoostCMSSKillsCategoryEnum, CATEGORY_TO_SKILLS, SKILLS_TO_SUBSKILLS, + type BoostCMSSKillsCategoryEnum, } from '../../constants/skills'; import SelectedSkills from './SelectedSkills'; @@ -25,13 +25,13 @@ const SkillsBox: React.FC<{ {skills.length > 0 && ( {skills.map((_skill, index) => { - const category = boostCMSSKillCategories.find( + const _category = boostCMSSKillCategories.find( c => c.type === _skill.category ); const skill: any = CATEGORY_TO_SKILLS[ _skill.category as BoostCMSSKillsCategoryEnum ].find(s => s.type === _skill.skill); - const subSkills = SKILLS_TO_SUBSKILLS[_skill.skill]; + const _subSkills = SKILLS_TO_SUBSKILLS[_skill.skill]; const selectedSkills = skills ?? []; const skillSelected: any = selectedSkills.find(s => s.skill === skill.type); diff --git a/packages/react-learn-card/src/components/VCDisplayCard2/Subskill.tsx b/packages/react-learn-card/src/components/VCDisplayCard2/Subskill.tsx index 5017a95723..ccf5767e47 100644 --- a/packages/react-learn-card/src/components/VCDisplayCard2/Subskill.tsx +++ b/packages/react-learn-card/src/components/VCDisplayCard2/Subskill.tsx @@ -1,10 +1,10 @@ import React from 'react'; import { - BoostCMSCategorySkillEnum, boostCMSSKillCategories, - BoostCMSSKillsCategoryEnum, - BoostCMSSubSkillEnum, + type BoostCMSCategorySkillEnum, + type BoostCMSSKillsCategoryEnum, + type BoostCMSSubSkillEnum, } from '../../constants/skills'; const Subskill: React.FC<{ @@ -23,8 +23,8 @@ const Subskill: React.FC<{ type: BoostCMSSubSkillEnum | string; }; subskillSelected: boolean; -}> = ({ subskillSelected, skill, subSkill }) => { - const { title, IconComponent, type, category } = skill; +}> = ({ subskillSelected: _subskillSelected, skill, subSkill }) => { + const { title: _title, IconComponent, type: _type, category } = skill; const _category = boostCMSSKillCategories.find(c => c.type === category); diff --git a/packages/react-learn-card/src/components/VCDisplayCard2/TopLevelSkill.tsx b/packages/react-learn-card/src/components/VCDisplayCard2/TopLevelSkill.tsx index 3fbe59f112..e36557686a 100644 --- a/packages/react-learn-card/src/components/VCDisplayCard2/TopLevelSkill.tsx +++ b/packages/react-learn-card/src/components/VCDisplayCard2/TopLevelSkill.tsx @@ -1,10 +1,10 @@ import React from 'react'; import { - BoostCMSCategorySkillEnum, boostCMSSKillCategories, - BoostCMSSKillsCategoryEnum, - BoostCMSSubSkillEnum, + type BoostCMSCategorySkillEnum, + type BoostCMSSKillsCategoryEnum, + type BoostCMSSubSkillEnum, } from '../../constants/skills'; const TopLevelSkill: React.FC<{ @@ -25,7 +25,7 @@ const TopLevelSkill: React.FC<{ handleExpandSubSkills?: () => void; }> = ({ skillSelected, skill, handleExpandSubSkills }) => { - const { title, IconComponent, type, category } = skill; + const { title, IconComponent, type: _type, category } = skill; const _category = boostCMSSKillCategories.find(c => c.type === category); diff --git a/packages/react-learn-card/src/components/VCDisplayCard2/VC2BackFace.tsx b/packages/react-learn-card/src/components/VCDisplayCard2/VC2BackFace.tsx index f9d53d3960..34404cc3f2 100644 --- a/packages/react-learn-card/src/components/VCDisplayCard2/VC2BackFace.tsx +++ b/packages/react-learn-card/src/components/VCDisplayCard2/VC2BackFace.tsx @@ -1,15 +1,15 @@ import React from 'react'; import { format } from 'date-fns'; -import { Flipper, Flipped } from 'react-flip-toolkit'; +import { Flipped } from 'react-flip-toolkit'; import MediaAttachmentsBox from './MediaAttachmentsBox'; import TruncateTextBox from './TruncateTextBox'; import SkillsBox from './SkillsBox'; import IssueHistoryBox from './IssueHistoryBox'; -import { VC, VerificationItem } from '@learncard/types'; +import type { VC, VerificationItem } from '@learncard/types'; import VerificationsBox from './VerificationsBox'; import AlignmentsBox from '../CertificateDisplayCard/AlignmentsBox'; -import { +import type { BoostAchievementCredential, IssueHistory, MediaMetadata, @@ -135,11 +135,7 @@ const VC2BackFace: React.FC = ({ /> )} {(credential.skills?.length ?? 0) > 0 && - (customSkillsComponent ? ( - customSkillsComponent - ) : ( - - ))} + (customSkillsComponent ?? )} {issueHistory && issueHistory?.length > 0 && ( = ({ /> )} - {customThumbComponent && customThumbComponent} + {customThumbComponent} - {customBodyCardComponent && customBodyCardComponent} + {customBodyCardComponent} {!customBodyCardComponent && ( <> diff --git a/packages/react-learn-card/src/components/VCDisplayCard2/VCDisplayCard2.stories.tsx b/packages/react-learn-card/src/components/VCDisplayCard2/VCDisplayCard2.stories.tsx index d0366cfe6f..b4b2f218b0 100644 --- a/packages/react-learn-card/src/components/VCDisplayCard2/VCDisplayCard2.stories.tsx +++ b/packages/react-learn-card/src/components/VCDisplayCard2/VCDisplayCard2.stories.tsx @@ -1,7 +1,7 @@ import React from 'react'; -import { Story, Meta } from '@storybook/react'; +import type { Story, Meta } from '@storybook/react'; -import VCDisplayCard2, { VCDisplayCard2Props } from './VCDisplayCard2'; +import VCDisplayCard2, { type VCDisplayCard2Props } from './VCDisplayCard2'; import { JffCredential, SuperSkillsOprahCredential, diff --git a/packages/react-learn-card/src/components/VCDisplayCard2/VCDisplayCard2.tsx b/packages/react-learn-card/src/components/VCDisplayCard2/VCDisplayCard2.tsx index 404c40a98a..a509408bc9 100644 --- a/packages/react-learn-card/src/components/VCDisplayCard2/VCDisplayCard2.tsx +++ b/packages/react-learn-card/src/components/VCDisplayCard2/VCDisplayCard2.tsx @@ -13,21 +13,26 @@ import VCDisplayCardCategoryType from './VCDisplayCardCategoryType'; import VCDisplayCardSkillsCount from './VCDisplayCardSkillsCount'; import VCIDDisplayCard from './VCIDDIsplayCard'; -import { Profile, VC, VerificationItem, VerificationStatusEnum } from '@learncard/types'; +import { + VerificationStatusEnum, + type Profile, + type VC, + type VerificationItem, +} from '@learncard/types'; import { getColorForVerificationStatus, getInfoFromCredential, } from '../../helpers/credential.helpers'; import { - BoostAchievementCredential, - IssueHistory, LCCategoryEnum, - MediaMetadata, - VideoMetadata, + type BoostAchievementCredential, + type IssueHistory, + type MediaMetadata, + type VideoMetadata, + type KnownDIDRegistryType, } from '../../types'; import { CertificateDisplayCard } from '../CertificateDisplayCard'; import { MeritBadgeDisplayCard } from '../MeritBadgeDisplayCard'; -import { KnownDIDRegistryType } from '../../types'; export type CredentialIconType = { image?: React.ReactNode; @@ -133,7 +138,7 @@ export const VCDisplayCard2: React.FC = ({ const isFront = isFrontOverride ?? _isFront; const setIsFront = setIsFrontOverride ?? _setIsFront; - const [headerHeight, setHeaderHeight] = useState(100); // 79 is the height if the header is one line + const [_headerHeight, setHeaderHeight] = useState(100); // 79 is the height if the header is one line const [headerWidth, setHeaderWidth] = useState(0); const headerRef = useRef(null); @@ -305,7 +310,7 @@ export const VCDisplayCard2: React.FC = ({ className={`${headerClassName} absolute`} style={{ wordBreak: 'break-word' }} > - {customRibbonCategoryComponent && customRibbonCategoryComponent} + {customRibbonCategoryComponent} {!customRibbonCategoryComponent && ( )} @@ -344,7 +349,7 @@ export const VCDisplayCard2: React.FC = ({ className={`${headerClassName} invisible`} style={{ wordBreak: 'break-word' }} > - {customRibbonCategoryComponent && customRibbonCategoryComponent} + {customRibbonCategoryComponent} {!customRibbonCategoryComponent && ( )} @@ -438,9 +443,7 @@ export const VCDisplayCard2: React.FC = ({
{dateDisplay}
@@ -123,7 +123,7 @@ export const BoostSmallCard: React.FC = ({ )} - {customBodyComponent && customBodyComponent} + {customBodyComponent} {!customBodyComponent && issueHistory && issueHistory?.length > 0 && @@ -137,11 +137,11 @@ export const BoostSmallCard: React.FC = ({
{userName}