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

Bug: 'variable' is defined but never used (@typescript-eslint/no-unused-vars) but is actually used. #85

Closed
theoludwig opened this issue Aug 26, 2020 · 4 comments

Comments

@theoludwig
Copy link
Member

Hey 馃憢,

I had a bug with ts-standard, I have a file called global.d.ts that look like this :

import { UserRequest } from '../models/User'

declare global {
  namespace Express {
    interface Request {
      user?: UserRequest
    }
  }
}

Where UserRequest is a simple interface, with that setup as I said in the title I've got 'UserRequest' is defined but never used. (@typescript-eslint/no-unused-vars) error, but I shouldn't have this error because I'm actually using it.

For the moment my workaround (not really pretty) is to do something like this :

// eslint-disable-next-line
import { UserRequest } from '../models/User'

Looking forward to discuss the bug, thank you.

@toddbluhm
Copy link
Collaborator

So ts-standard is just a wrapper around https://github.com/standard/eslint-config-standard-with-typescript and https://github.com/typescript-eslint/typescript-eslint

This seems like a parsing/linting issue. I would recommend posting your issue on the https://github.com/typescript-eslint/typescript-eslint project where the typescript parser lives.

if you think this might instead be a configuration issue with how ts-standard passes options to eslint, the best way to test that out would be to install eslint, typescript-eslint, and the eslint-config-standard-with-typescript, configure it all manually, and run it to see if the error still exists. If the error is gone, then posting your configuration would be extremely helpful and we can figure out which options need to be passed to eslint from ts-standard 馃槃

@theoludwig
Copy link
Member Author

theoludwig commented Aug 27, 2020

As I can see, It's a known issue with typescript-eslint for quite some time : typescript-eslint/typescript-eslint#1856
Apparently the issue will be fixed in the 4.0 release : typescript-eslint/typescript-eslint#2330.

Is ts-standard will upgrade typescript-eslint for the 4.0 version when ready ?

@toddbluhm
Copy link
Collaborator

Yes, whenever typescript-eslint releases a new update, ts-standard will be updated appropriately 馃槃

@theoludwig
Copy link
Member Author

Alright, since it's not really an issue related to ts-standard, I'll close this for now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Archived in project
Development

No branches or pull requests

2 participants