Skip to content

[no-unused-vars] false positive on styled component props #2452

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

Closed
geniou opened this issue Sep 1, 2020 · 3 comments · Fixed by #2492
Closed

[no-unused-vars] false positive on styled component props #2452

geniou opened this issue Sep 1, 2020 · 3 comments · Fixed by #2492
Assignees
Labels
bug Something isn't working has pr there is a PR raised to close this package: eslint-plugin Issues related to @typescript-eslint/eslint-plugin

Comments

@geniou
Copy link

geniou commented Sep 1, 2020

When trying to update from 3.10.1 to 4.0.1 I get false positive for

type PaymentsProps = {
  isValid: boolean
}

const StyledPayment = styled.div<StyledPaymentProps>``

.eslintrc.js

    '@typescript-eslint/no-unused-vars': ['error', { argsIgnorePattern: '^_' }],

Expected Result

I should get no error.

Actual Result

I get

  'StyledPaymentProps' is defined but never used  @typescript-eslint/no-unused-vars

Versions

package version
@typescript-eslint/eslint-plugin 4.0.1
@typescript-eslint/parser 4.0.1
TypeScript 4.0.2
ESLint 7.8.0
node 12.18.1
@geniou geniou added package: eslint-plugin Issues related to @typescript-eslint/eslint-plugin triage Waiting for team members to take a look labels Sep 1, 2020
@bradzacher bradzacher added bug Something isn't working and removed triage Waiting for team members to take a look labels Sep 1, 2020
@geniou geniou changed the title [no-unused-vars] false positive on styled compotnent props [no-unused-vars] false positive on styled component props Sep 1, 2020
@alexkatz
Copy link

alexkatz commented Sep 3, 2020

Also the case for interface in addition to type:

interface UserRowProps {
  $isEven: boolean;
}

const UserRow = styled.div<UserRowProps>`...`

An unused variable is detected here, as well:

warning 'UserRowProps' is defined but never used @typescript-eslint/no-unused-vars

@ghost
Copy link

ghost commented Sep 4, 2020

I'm also having the same issue. It started after upgrading to 4.0.1 😕

@TrevorSayre
Copy link

This was fixed with https://github.com/typescript-eslint/typescript-eslint/releases/tag/v4.1.0 🎉

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Oct 10, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Something isn't working has pr there is a PR raised to close this package: eslint-plugin Issues related to @typescript-eslint/eslint-plugin
Projects
None yet
4 participants