Skip to content

fix: Resolve ESLint issues to improve code quality [DEV-4792] - #274

Merged
filipdjokic merged 18 commits into
developfrom
lint-fixes
Mar 14, 2025
Merged

fix: Resolve ESLint issues to improve code quality [DEV-4792]#274
filipdjokic merged 18 commits into
developfrom
lint-fixes

Conversation

@ankurdotb

@ankurdotb ankurdotb commented Mar 13, 2025

Copy link
Copy Markdown
Collaborator
  • Automatic fixes suggested on npm run lint:fix
  • Specific linting fixes for list of issues below
ankur@Heart-of-Gold ~/w/t/data-api (lint-fixes)> npm run lint:fix

> data-api@2.0.0 lint:fix
> eslint . --fix --config .github/linters/eslint.config.mjs


/Users/ankur/workspace/tools/data-api/src/handlers/analytics.ts
  149:2  error  'ctx' is defined but never used. Allowed unused args must match /^_/u  @typescript-eslint/no-unused-vars

/Users/ankur/workspace/tools/data-api/src/handlers/circulatingSupply.ts
  4:31  error  'request' is defined but never used. Allowed unused args must match /^_/u  @typescript-eslint/no-unused-vars

/Users/ankur/workspace/tools/data-api/src/handlers/totalStakedCoins.ts
  6:31  error  'request' is defined but never used. Allowed unused args must match /^_/u  @typescript-eslint/no-unused-vars

/Users/ankur/workspace/tools/data-api/src/handlers/totalSupply.ts
  6:31  error  'request' is defined but never used. Allowed unused args must match /^_/u  @typescript-eslint/no-unused-vars

/Users/ankur/workspace/tools/data-api/src/handlers/webhookTriggers.ts
  29:10  error  'getRandomGroup' is defined but never used. Allowed unused vars must match /^_/u  @typescript-eslint/no-unused-vars

/Users/ankur/workspace/tools/data-api/src/helpers/analytics.ts
  77:32  error  Unexpected any. Specify a different type  @typescript-eslint/no-explicit-any

/Users/ankur/workspace/tools/data-api/src/helpers/circulating.ts
  32:11  error  'e' is defined but never used. Allowed unused caught errors must match /^_/u  @typescript-eslint/no-unused-vars
  46:14  error  Unexpected any. Specify a different type                                      @typescript-eslint/no-explicit-any
  76:14  error  Unexpected any. Specify a different type                                      @typescript-eslint/no-explicit-any

/Users/ankur/workspace/tools/data-api/src/helpers/csv.ts
   8:36  error  Unexpected any. Specify a different type  @typescript-eslint/no-explicit-any
  95:39  error  Unexpected any. Specify a different type  @typescript-eslint/no-explicit-any
  95:45  error  Unexpected any. Specify a different type  @typescript-eslint/no-explicit-any

/Users/ankur/workspace/tools/data-api/src/helpers/graphql.ts
   4:55  error  Unexpected any. Specify a different type  @typescript-eslint/no-explicit-any
   5:41  error  Unexpected any. Specify a different type  @typescript-eslint/no-explicit-any
  21:39  error  Unexpected any. Specify a different type  @typescript-eslint/no-explicit-any

/Users/ankur/workspace/tools/data-api/src/helpers/identity.ts
   20:6   error  Unexpected any. Specify a different type                                                 @typescript-eslint/no-explicit-any
   28:8   error  Unexpected any. Specify a different type                                                 @typescript-eslint/no-explicit-any
   29:13  error  Unexpected any. Specify a different type                                                 @typescript-eslint/no-explicit-any
   30:10  error  Unexpected any. Specify a different type                                                 @typescript-eslint/no-explicit-any
   31:19  error  Unexpected any. Specify a different type                                                 @typescript-eslint/no-explicit-any
  220:11  error  'insertResult' is assigned a value but never used. Allowed unused vars must match /^_/u  @typescript-eslint/no-unused-vars

/Users/ankur/workspace/tools/data-api/src/index.ts
  39:18  error  'controller' is defined but never used. Allowed unused args must match /^_/u  @typescript-eslint/no-unused-vars
  39:61  error  'ctx' is defined but never used. Allowed unused args must match /^_/u         @typescript-eslint/no-unused-vars

/Users/ankur/workspace/tools/data-api/src/routes/analytics.ts
   8:49  error  Unexpected any. Specify a different type  @typescript-eslint/no-explicit-any
  44:47  error  Unexpected any. Specify a different type  @typescript-eslint/no-explicit-any

/Users/ankur/workspace/tools/data-api/src/types/analytics.ts
  16:9  error  Unexpected any. Specify a different type  @typescript-eslint/no-explicit-any

/Users/ankur/workspace/tools/data-api/src/types/node.ts
  106:26  error  Unexpected any. Specify a different type  @typescript-eslint/no-explicit-any

/Users/ankur/workspace/tools/data-api/src/worker-types.d.ts
  26:30  error  Unexpected any. Specify a different type  @typescript-eslint/no-explicit-any

✖ 28 problems (28 errors, 0 warnings)

First set of fixes are the automatic fixes suggested on `npm run lint:fix`
@ankurdotb

Copy link
Copy Markdown
Collaborator Author

Task linked: DEV-4792 Code quality improvements

This helps resolve "'request' is defined but never used" linting errors.
Need to retain the parameters for structure but suppress linting error.
We can invoke the DB insert directly, since the value of `insertResult` is never used
Worker Types: Changing Promise<any> to Promise<unknown> maintains compatibility while being more type-safe. The unknown type can hold any value just like any, but requires type checking before use, which is actually safer.
Node Types: The ValidatorRewards type directly models the existing data structure based on how it's used.
This was breaking the structure of CSV response
Comment thread src/helpers/csv.ts Outdated
@filipdjokic
filipdjokic merged commit 0c2c7ba into develop Mar 14, 2025
@filipdjokic
filipdjokic deleted the lint-fixes branch March 14, 2025 16:14
cheqd-bot Bot pushed a commit that referenced this pull request Mar 14, 2025
## [2.0.1-develop.1](2.0.0...2.0.1-develop.1) (2025-03-14)

### Bug Fixes

* Resolve ESLint issues to improve code quality [DEV-4792] ([#274](#274)) ([0c2c7ba](0c2c7ba))
@cheqd-bot

cheqd-bot Bot commented Mar 14, 2025

Copy link
Copy Markdown

🎉 This PR is included in version 2.0.1-develop.1 🎉

The release is available on GitHub release

Your semantic-release bot 📦🚀

cheqd-bot Bot pushed a commit that referenced this pull request Mar 14, 2025
## [2.0.1](2.0.0...2.0.1) (2025-03-14)

### Bug Fixes

* Resolve ESLint issues to improve code quality [DEV-4792] ([#274](#274)) ([0c2c7ba](0c2c7ba))
@cheqd-bot

cheqd-bot Bot commented Mar 14, 2025

Copy link
Copy Markdown

🎉 This PR is included in version 2.0.1 🎉

The release is available on GitHub release

Your semantic-release bot 📦🚀

@cheqd-bot cheqd-bot Bot added the released label Mar 14, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Development

Successfully merging this pull request may close these issues.

2 participants