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

usage of react components not recognized #872

Closed
rogergl opened this issue Apr 30, 2017 · 8 comments

Comments

@rogergl
Copy link

commented Apr 30, 2017

The following code results in two warnings: React and Article unused. Is this expected ?

import React from 'react'
import Article from './components/article/Article'
import PropTypes from 'prop-types'

function ArticleList ({data, itemState}) {
  const listElements = data.map(p => <li key={p.id}><Article data={p.attributes} state={itemState(p.id)}/></li>)
  return (<ul className="results">
    {listElements}
  </ul>)
}

ArticleList.propTypes = {
  data: PropTypes.array,
  itemState: PropTypes.func
}

export default ArticleList

@yoshuawuyts

This comment has been minimized.

Copy link
Contributor

commented Apr 30, 2017

@rogergl

This comment has been minimized.

Copy link
Author

commented Apr 30, 2017

No, I'm using Article inside the map function and React is required to make things work. It seems that usages of React components like <Article/> are never recognized.

@yoshuawuyts

This comment has been minimized.

Copy link
Contributor

commented Apr 30, 2017

Oops dang, yeah you're right. Nope, no clue what's up haha. Perhaps someone that uses JSX can help you out (:

@dyegolara

This comment has been minimized.

Copy link

commented May 9, 2017

It's not necessary to use JSX in React, the issue is on the .js files too

@hhsadiq

This comment has been minimized.

Copy link

commented Aug 11, 2017

@rogergl so how you were able to fix that. Want to use standard with react, but unused var errors are becoming blockers.

@oskarhane

This comment has been minimized.

@Flet

This comment has been minimized.

Copy link
Member

commented Dec 15, 2017

It looks like this is fixed in the latest version of standard!

Could you give it a try? npm install standard@beta

@Flet Flet added the v11 release label Dec 15, 2017

@feross feross added this to the standard v11 milestone Feb 17, 2018

@feross

This comment has been minimized.

Copy link
Member

commented Feb 19, 2018

🗣 Standard 11 is released! Run npm install standard@latest --save-dev to update to the latest version. This will also update the version in package.json

Changelog: https://github.com/standard/standard/blob/master/CHANGELOG.md#1100---2018-02-18

@feross feross closed this Feb 19, 2018

@lock lock bot locked as resolved and limited conversation to collaborators May 25, 2018

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
7 participants
You can’t perform that action at this time.