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’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unused imports typescript error #412

Open
amazzalel-habib opened this issue Mar 4, 2019 · 4 comments
Open

Unused imports typescript error #412

amazzalel-habib opened this issue Mar 4, 2019 · 4 comments

Comments

@amazzalel-habib
Copy link

The generated files contains some errors. You have imported the decorators NotNull and Override and commented their usage, is there a way to uncomment them or remove the imports without me touching the file manualy?

@sharwell
Copy link
Member

sharwell commented Mar 4, 2019

Are you sure this is an error and not just a linter warning?

With that said, the imports could be commented out to match the uses.

@amazzalel-habib
Copy link
Author

In my case it is an error because I want to use noUnusedLocals for my ts files. And there is no way to ignore them for just the generated files.

@amazzalel-habib
Copy link
Author

It'd be better if the imports are commented as well, or add some option (experimentalDecorators) to let the user select whether to add the decorators or not. also there is a variable that isn't used in the parser/Lexer generated files.
Thanks alot,

bradleyayers added a commit to bradleyayers/pgtyped that referenced this issue May 23, 2021
This enables noUnusedLocals and noUnusedParameters TypeScript compiler
options to check for unused parameters, imports, and variables.
Unfortunately the antlr4ts generator creates code that violates this, so
it's necessary to make a trade-off and pick the lesser evil. Given how
many other places in the code-base had dead code, I think it's more
valuable to have it enabled and deal with manually editing the antlr4ts
output. There's an open issue about it
tunnelvisionlabs/antlr4ts#412 so it might
eventually be fixed upstream.
bradleyayers added a commit to bradleyayers/pgtyped that referenced this issue Jul 17, 2021
This enables tslint no-unused-variable options to check for unused
parameters, imports, and variables.

Ideally we'd use TypeScript's native `noUnusedLocals` and
`noUnusedParameters`, but unfortunately antlr4ts generates code that
violates this. There's an open issue about this
tunnelvisionlabs/antlr4ts#412 so if it's
eventually fixed we can swap to `noUnusedLocals`.
bradleyayers added a commit to bradleyayers/pgtyped that referenced this issue Jul 17, 2021
This enables tslint no-unused-variable options to check for unused
parameters, imports, and variables.

Ideally we'd use TypeScript's native `noUnusedLocals` and
`noUnusedParameters`, but unfortunately antlr4ts generates code that
violates this. There's an open issue about this
tunnelvisionlabs/antlr4ts#412 so if it's
eventually fixed we can swap to `noUnusedLocals`.
@hieunguyen2211
Copy link

I met this issue in my project. It violates noUnusedLocals in ts compile options, that cannot be changed. Is there any solution or workaround for it now?

adelsz added a commit to adelsz/pgtyped that referenced this issue Sep 16, 2021
* chore: remove unused code

This enables tslint no-unused-variable options to check for unused
parameters, imports, and variables.

Ideally we'd use TypeScript's native `noUnusedLocals` and
`noUnusedParameters`, but unfortunately antlr4ts generates code that
violates this. There's an open issue about this
tunnelvisionlabs/antlr4ts#412 so if it's
eventually fixed we can swap to `noUnusedLocals`.

* Keep wire helper types

* Revert generated files

Co-authored-by: Adel <adel.m.salah@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants