fix: remove unused imports and enable no-unused-vars lint rule - #374
Merged
Conversation
- 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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Overview
This PR cleans up unused imports across the TypeScript client SDK and enables the
@typescript-eslint/no-unused-varsESLint rule as an error so these lapses cannot recur. It also alignscomputeExternalNullifierwith the SDK's typed-error convention.Related Issue
Closes #293
Changes
📦 identity.ts
RangeErrorwithInvalidInputErrorincomputeExternalNullifierforcircleIdandroundboundary checks.📦 contract.ts
StrKey,ContractError,RpcError.📦 artifacts.ts
updatecallback and dead progress-tracking variables.📦 contract.test.ts
argsparameters from mock client functions.📦 tree.test.ts
ZERO_VALUEimport.📦 eslint.config.js
@typescript-eslint/no-unused-vars: "error"forpackages/clientfiles.📦 package.json / package-lock.json
typescript-eslint,eslint,eslint-plugin-react-hooks,globals).lintscript targetingpackages/client/**/*.ts.Verification Results
npm run lintreports no unused imports across the repocomputeExternalNullifierusesInvalidInputErrorconsistentlycontract.tsare removedStrKey,ContractError,RpcErrorremovedeslint.config.jsenforcesno-unused-varsas errorpackages/clientconfig