Skip to content

fix: resolve lint errors across repo and strengthen CI enforcement#5228

Open
bootcodes wants to merge 72 commits intohiero-ledger:mainfrom
bootcodes:4700-resolve-eslint
Open

fix: resolve lint errors across repo and strengthen CI enforcement#5228
bootcodes wants to merge 72 commits intohiero-ledger:mainfrom
bootcodes:4700-resolve-eslint

Conversation

@bootcodes
Copy link
Copy Markdown
Contributor

@bootcodes bootcodes commented Apr 7, 2026

Description

This PR strengthens the CI pipeline by adding automated lint checks and resolves all lint errors across the codebase.

1. Lint Error Resolution:

  • Fixed all lint errors

2. Eslint config:

  • Scoped the eslint to src/ and test/ folder

3. CI Pipeline Enhancement

  • Created new .github/workflows/lint.yml workflow that runs on every PR
  • Lint checks now block PR merges if any errors are found
  • Adds a separate lint-type-aware CI job that runs no-floating-promises and no-misused-promises on PRs only via eslint.config.ci.mjs. Keeps local linting fast by deferring expensive type-aware rules to CI.

4. Husky hook

  • Added pre-push hook to run npm build

Related issue(s)

Fixes #4700

Testing Guide

  1. Verify Lint Status: npm run lint
  2. Verify Type Checking: npx tsc --noEmit
  3. Verify Build: npm run build

Changes from original design (optional)

Scoped eslint config to src and test folder - see eslint.config.mjs

Additional work needed (optional)

N/A

Checklist

  • I've assigned an assignee to this PR and related issue(s) (if applicable)
  • I've assigned a label to this PR and related issue(s) (if applicable)
  • I've assigned a milestone to this PR and related issue(s) (if applicable)
  • I've updated documentation (code comments, README, etc. if applicable)
  • I've done sufficient testing (unit, integration, etc.)

@codacy-production
Copy link
Copy Markdown

codacy-production bot commented Apr 7, 2026

Not up to standards ⛔

🟢 Issues 0 issues

Results:
0 new issues

View in Codacy

🟢 Metrics 0 complexity · 0 duplication

Metric Results
Complexity 0
Duplication 0

View in Codacy

TIP This summary will be updated as you push new changes. Give us feedback

@bootcodes bootcodes self-assigned this Apr 7, 2026
@bootcodes bootcodes added the enhancement New feature or request label Apr 7, 2026
@bootcodes bootcodes modified the milestones: 0.78.0, 0.77.0 Apr 7, 2026
@bootcodes bootcodes marked this pull request as ready for review April 8, 2026 10:31
@bootcodes bootcodes requested review from a team as code owners April 8, 2026 10:31
@codecov
Copy link
Copy Markdown

codecov bot commented Apr 8, 2026

Codecov Report

❌ Patch coverage is 30.49645% with 98 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
eslint.config.ci.mjs 0.00% 29 Missing ⚠️
eslint.config.mjs 0.00% 18 Missing ⚠️
src/relay/lib/clients/mirrorNodeClient.ts 52.00% 12 Missing ⚠️
...thService/transactionService/TransactionService.ts 0.00% 7 Missing ⚠️
src/index.ts 0.00% 6 Missing ⚠️
src/relay/lib/model.ts 0.00% 4 Missing ⚠️
...elay/lib/services/lockService/LocalLockStrategy.ts 0.00% 3 Missing ⚠️
src/config-service/commands/printEnvs.ts 0.00% 2 Missing ⚠️
src/config-service/services/index.ts 33.33% 0 Missing and 2 partials ⚠️
src/relay/lib/precheck.ts 0.00% 2 Missing ⚠️
... and 10 more

❌ Your patch check has failed because the patch coverage (30.49%) is below the target coverage (80.00%). You can increase the patch coverage or adjust the target coverage.
❌ Your project check has failed because the head coverage (73.50%) is below the target coverage (80.00%). You can increase the head coverage or adjust the target coverage.

❗ There is a different number of reports uploaded between BASE (c95f3f9) and HEAD (4a9acd4). Click for more details.

HEAD has 18 uploads less than BASE
Flag BASE (c95f3f9) HEAD (4a9acd4)
22 4
@@             Coverage Diff             @@
##             main    #5228       +/-   ##
===========================================
- Coverage   95.93%   73.50%   -22.43%     
===========================================
  Files         146      147        +1     
  Lines       25140    25181       +41     
  Branches     2044      848     -1196     
===========================================
- Hits        24117    18510     -5607     
- Misses       1001     6646     +5645     
- Partials       22       25        +3     
Files with missing lines Coverage Δ
src/relay/lib/clients/cache/localLRUCache.ts 72.23% <100.00%> (-27.17%) ⬇️
src/relay/lib/clients/sdkClient.ts 55.22% <100.00%> (-40.89%) ⬇️
src/relay/lib/constants.ts 100.00% <100.00%> (ø)
src/relay/lib/db/types/hbarLimiter/errors.ts 79.31% <100.00%> (-20.69%) ⬇️
src/relay/lib/decorators/rpcMethod.decorator.ts 100.00% <100.00%> (ø)
src/relay/lib/factories/blockFactory.ts 47.03% <100.00%> (-51.78%) ⬇️
src/relay/lib/factories/cacheClientFactory.ts 100.00% <100.00%> (ø)
...ervices/ethService/accountService/accountWorker.ts 65.09% <100.00%> (-32.08%) ⬇️
...b/services/ethService/blockService/BlockService.ts 74.60% <100.00%> (-23.83%) ⬇️
...ib/services/ethService/blockService/blockWorker.ts 64.96% <100.00%> (-30.57%) ⬇️
... and 23 more

... and 61 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@bootcodes bootcodes changed the title fix: Resolve Lint Errors Across Packages and Strengthen CI Enforcement fix: resolve lint errors across repo and strengthen CI enforcement Apr 8, 2026
Copy link
Copy Markdown
Contributor

@jasuwienas jasuwienas left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Overall, it looks great. I’m just not sure whether it’s correct to treat null the same as undefined in places where we previously distinguished between the two. I don’t think this PR should introduce business-level changes to the application, even if they make sense.

@bootcodes bootcodes added github_actions Pull requests that update Github Actions code. labels Apr 9, 2026
Copy link
Copy Markdown
Contributor

@quiet-node quiet-node left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great work overall! Left some items

Comment on lines +865 to 869
response != null &&
response.transaction_index != null &&
response.block_number != null &&
response.block_hash !== constants.EMPTY_HEX &&
response.result === 'SUCCESS'
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I supposed these are changed because the linting is complaining?

Copy link
Copy Markdown
Contributor Author

@bootcodes bootcodes Apr 10, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes they are : It's not a problem here though
> null != undefined false
It won't pass the condition if null or undefined values are encountered

.husky/pre-push Outdated
@@ -0,0 +1 @@
npm run build
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would it make sense to run npm run lint here instead of the full npm run build? A full build on every push might slow down the local development workflow significantly. The build check could be deferred to CI where it already runs.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Well actually doesn't the pre-commit hook already handles linting via lint-staged for each commit? If it doesn't work should we just fix it instead of adding a new hook?

Copy link
Copy Markdown
Contributor Author

@bootcodes bootcodes Apr 10, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

npm run lint on pre-push would be redundant with lint-staged on pre-commit hook. But npm run build isn't the right gate either. I'm more inclined to have tsc --noEmit on pre-push hook, as currently it doesn't invoke tsc so type errors slip through and only appear in CI. We could catch those errors early without significant bottleneck on local development

Signed-off-by: Thomas Boot <thomas.boot@swirldslabs.com>
Signed-off-by: Thomas Boot <thomas.boot@swirldslabs.com>
Signed-off-by: Thomas Boot <thomas.boot@swirldslabs.com>
Signed-off-by: Thomas Boot <thomas.boot@swirldslabs.com>
Signed-off-by: Thomas Boot <thomas.boot@swirldslabs.com>
Signed-off-by: Thomas Boot <thomas.boot@swirldslabs.com>
… src/relay/lib/db/types/hbarLimiter/errors.ts

Signed-off-by: Thomas Boot <thomas.boot@swirldslabs.com>
Signed-off-by: Thomas Boot <thomas.boot@swirldslabs.com>
… rpcParamLayoutConfig.decorator.ts

Signed-off-by: Thomas Boot <thomas.boot@swirldslabs.com>
bootcodes and others added 28 commits April 10, 2026 10:59
Signed-off-by: Thomas Boot <thomas.boot@swirldslabs.com>
…d-vars from BlockService.ts

Signed-off-by: Thomas Boot <thomas.boot@swirldslabs.com>
Signed-off-by: Thomas Boot <thomas.boot@swirldslabs.com>
Signed-off-by: Thomas Boot <thomas.boot@swirldslabs.com>
Signed-off-by: Thomas Boot <thomas.boot@swirldslabs.com>
Signed-off-by: Thomas Boot <thomas.boot@swirldslabs.com>
…hiero-ledger#4792)

Signed-off-by: Mariusz Jasuwienas <jasuwienas@gmail.com>
Signed-off-by: Thomas Boot <thomas.boot@swirldslabs.com>
Signed-off-by: Thomas Boot <thomas.boot@swirldslabs.com>
Signed-off-by: Thomas Boot <thomas.boot@swirldslabs.com>
Signed-off-by: Thomas Boot <thomas.boot@swirldslabs.com>
Signed-off-by: Thomas Boot <thomas.boot@swirldslabs.com>
Signed-off-by: Thomas Boot <thomas.boot@swirldslabs.com>
Signed-off-by: Thomas Boot <thomas.boot@swirldslabs.com>
Signed-off-by: Thomas Boot <thomas.boot@swirldslabs.com>
Signed-off-by: Thomas Boot <thomas.boot@swirldslabs.com>
Signed-off-by: Thomas Boot <thomas.boot@swirldslabs.com>
Signed-off-by: Thomas Boot <thomas.boot@swirldslabs.com>
Signed-off-by: Thomas Boot <thomas.boot@swirldslabs.com>
Signed-off-by: Thomas Boot <thomas.boot@swirldslabs.com>
Signed-off-by: Thomas Boot <thomas.boot@swirldslabs.com>
Signed-off-by: Thomas Boot <thomas.boot@swirldslabs.com>
…iero-ledger#5140)

Signed-off-by: Bartosz Solka <bartosz.solka@blockydevs.com>
Signed-off-by: Thomas Boot <thomas.boot@swirldslabs.com>
Signed-off-by: Thomas Boot <thomas.boot@swirldslabs.com>
Signed-off-by: Thomas Boot <thomas.boot@swirldslabs.com>
Signed-off-by: Thomas Boot <thomas.boot@swirldslabs.com>
Signed-off-by: Thomas Boot <thomas.boot@swirldslabs.com>
Signed-off-by: Thomas Boot <thomas.boot@swirldslabs.com>
Signed-off-by: Thomas Boot <thomas.boot@swirldslabs.com>
@bootcodes bootcodes force-pushed the 4700-resolve-eslint branch from da73fc8 to dd85ed6 Compare April 10, 2026 08:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request github_actions Pull requests that update Github Actions code.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Resolve Lint Errors Across Packages and Strengthen CI Enforcement

4 participants