Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unused imports and parameters in generated hapi routes file #1528

Open
2 of 4 tasks
leonlaser opened this issue Dec 29, 2023 · 2 comments
Open
2 of 4 tasks

Unused imports and parameters in generated hapi routes file #1528

leonlaser opened this issue Dec 29, 2023 · 2 comments
Labels
good first issue This issue could be an easy PR for those looking to help contribute help wanted Pending feedback

Comments

@leonlaser
Copy link

leonlaser commented Dec 29, 2023

Hello 馃憢 I am a developor for project PIA and we are currently integrating tsoa into our hapi based services.

We are compiling with noUnusedLocals and noUnusedParameters set to true and stumbled upon the hapi route generator template having both, unused imports and unused parameters.

Sorting

  • I'm submitting a ...

    • bug report
    • feature request
    • support request
  • I confirm that I

    • used the search to make sure that a similar issue hasn't already been submit

Expected Behavior

The generated routes file for hapi should not trigger errors for unused imports and parameters, when the compilerOptions noUnusedLocals and noUnusedParameters are set to true.

Current Behavior

Errors are thrown when noUnusedLocals and noUnusedParameters are set to true.

Possible Solution

Our solution is to prepend the generated file with // @ts-nocheck. As the hapi.hbs template already has /* tslint:disable */ and /* eslint-disable */ modifiers, // @ts-nocheck could be added, too.

Steps to Reproduce

Setup tsoa.json with:

{
  "routes": {
    "middleware": "hapi",
    "routesDir": "src",
  }
}

Setup tsconfig.json with

{
  "compilerOptions": {
    "noUnusedLocals": true,
    "noUnusedParameters": true,
  }
}

Context (Environment)

Version of the library: 5.1.1
Version of NodeJS: 20.3.0

  • Confirm you were using yarn not npm: [ ]
Copy link

Hello there leonlaser 馃憢

Thank you for opening your very first issue in this project.

We will try to get back to you as soon as we can.馃憖

@WoH WoH added help wanted good first issue This issue could be an easy PR for those looking to help contribute labels Jan 12, 2024
@jackey8616
Copy link
Collaborator

@leonlaser
Hello, I would like to confirm the issue is causing by unused imports and parameters in hbs.

We published new version v6.2.0 which refactor hbs, you can give a shot.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue This issue could be an easy PR for those looking to help contribute help wanted Pending feedback
Projects
None yet
Development

No branches or pull requests

3 participants