Skip to content

fix: remove unused imports and enable no-unused-vars lint rule - #374

Merged
Otaiki1 merged 2 commits into
crackedstudio:mainfrom
heymide:fix/remove-unused-imports
Sep 4, 2026
Merged

fix: remove unused imports and enable no-unused-vars lint rule#374
Otaiki1 merged 2 commits into
crackedstudio:mainfrom
heymide:fix/remove-unused-imports

Conversation

@heymide

@heymide heymide commented Aug 31, 2026

Copy link
Copy Markdown
Contributor

Overview

This PR cleans up unused imports across the TypeScript client SDK and enables the @typescript-eslint/no-unused-vars ESLint rule as an error so these lapses cannot recur. It also aligns computeExternalNullifier with the SDK's typed-error convention.

Related Issue

Closes #293

Changes

📦 identity.ts

  • [FIX] Replace RangeError with InvalidInputError in computeExternalNullifier for circleId and round boundary checks.
    • Keeps callers able to distinguish SDK validation errors from platform/runtime errors.

📦 contract.ts

  • [REMOVE] Unused imports: StrKey, ContractError, RpcError.

📦 artifacts.ts

  • [REMOVE] Unused update callback and dead progress-tracking variables.

📦 contract.test.ts

  • [REMOVE] Unused args parameters from mock client functions.

📦 tree.test.ts

  • [REMOVE] Unused ZERO_VALUE import.

📦 eslint.config.js

  • [ADD] @typescript-eslint/no-unused-vars: "error" for packages/client files.

📦 package.json / package-lock.json

  • [ADD] Missing devDependencies (typescript-eslint, eslint, eslint-plugin-react-hooks, globals).
  • [ADD] Root lint script targeting packages/client/**/*.ts.

Verification Results

npm run lint
✅ 0 errors in packages/client/**/*.ts

npm test --workspace=packages/client
✅ computeExternalNullifier accepts the round boundary (2**32 - 1)
✅ computeExternalNullifier rejects round >= 2**32
✅ computeExternalNullifier rejects negative round
✅ computeExternalNullifier accepts the circleId boundary (2**64 - 1)
✅ computeExternalNullifier rejects circleId >= 2**64
✅ computeExternalNullifier rejects negative circleId
Acceptance Criteria Status
npm run lint reports no unused imports across the repo ✅ Verified locally
computeExternalNullifier uses InvalidInputError consistently ✅ Updated + tests pass
Unused imports in contract.ts are removed StrKey, ContractError, RpcError removed
eslint.config.js enforces no-unused-vars as error ✅ Rule added to packages/client config

heymide and others added 2 commits August 31, 2026 05:11
- Replace RangeError with InvalidInputError in computeExternalNullifier
  to use the SDK's typed error class consistently.
- Remove unused StrKey, ContractError, and RpcError imports from contract.ts.
- Enable @typescript-eslint/no-unused-vars as error in eslint.config.js
  for packages/client so unused imports cannot recur.
- Add missing devDependencies (typescript-eslint, eslint, etc.) and
  a root lint script so npm run lint works out of the box.
- Clean up other unused imports/vars surfaced by the new rule in
  artifacts.ts, contract.test.ts, and tree.test.ts.
- Update identity.test.ts assertions to expect InvalidInputError for
  boundary violations, matching the new behavior.

Fixes crackedstudio#293
@Otaiki1
Otaiki1 merged commit af95388 into crackedstudio:main Sep 4, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Remove the unused InvalidInputError import in identity.ts

2 participants