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

react/no-unused-prop-types false positives with prop alias [TS] #2686

Closed
awwit opened this issue Jun 29, 2020 · 2 comments · Fixed by #2690
Closed

react/no-unused-prop-types false positives with prop alias [TS] #2686

awwit opened this issue Jun 29, 2020 · 2 comments · Fixed by #2690

Comments

@awwit
Copy link

awwit commented Jun 29, 2020

I have a similar code:

import * as React from 'react'

interface Props {
  'aria-label': string // 'undefined' PropType is defined but prop is never used eslint(react/no-unused-prop-types)
  // 'undefined' PropType is defined but prop is never used eslint(react-redux/no-unused-prop-types)
}

export default function Component({
  'aria-label': ariaLabel, // 'aria-label' is missing in props validation eslint(react/prop-types)
}: Props): JSX.Element {
  return <div aria-label={ariaLabel} />
}

I get a false positive on the aria-label property (and on any other property enclosed in quotation marks where non-standard characters are used).

eslint@7.3.1
eslint-plugin-react@7.20.2
eslint-plugin-react-redux@3.0.3

@hank121314
Copy link
Contributor

This issue is caused by string literal.
eslint-plugin-react does not support string literal for interface key currently.
I will make a pr to fix it soon.

@ljharb
Copy link
Member

ljharb commented Jun 30, 2020

v7.20.3 is released.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
3 participants