cli icon indicating copy to clipboard operation
cli copied to clipboard

fix: remove unnecessary await from startPreview call

Open ashutoshsao opened this issue 2 weeks ago • 2 comments

This PR resolves a SonarCloud code quality issue as part of the effort to fix SonarCloud issues reported in https://github.com/asyncapi/cli/issues/1881.

Description

  • Removed unnecessary await keyword from startPreview call in the preview command
  • The startPreview function returns void, not a Promise, so awaiting it was incorrect and triggered a linter error: "Unexpected await of a non-Promise (non-"Thenable") value"
  • This change aligns the preview command with the pattern used in the studio command, where startStudio (also returning void) is called without await on line 58 of studio.ts

Testing

The change is minimal and syntactically correct:

  • Removed await from line 40 in src/apps/cli/commands/start/preview.ts
  • The function signature in Preview.ts confirms startPreview returns void
  • The change matches the existing pattern in studio.ts where startStudio is called without await
  • No functional changes - the preview command behavior remains the same, only the linter error is resolved

Documentation

No documentation updates required:

  • The documentation in docs/usage.md is auto-generated from the command definitions
  • This is an internal code fix that doesn't change the user-facing API or behavior
  • The command usage, flags, and descriptions remain unchanged

Related issue(s)

Fixes https://github.com/asyncapi/cli/issues/1881

ashutoshsao avatar Dec 05 '25 08:12 ashutoshsao

🦋 Changeset detected

Latest commit: 8bfc87db096aa6de2e1c70a893d2117d2a5822ab

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@asyncapi/cli Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

changeset-bot[bot] avatar Dec 05 '25 08:12 changeset-bot[bot]