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

Parser disables react/no-unused-prop-types #16

Closed
JamesHenry opened this issue Jan 15, 2019 · 3 comments
Closed

Parser disables react/no-unused-prop-types #16

JamesHenry opened this issue Jan 15, 2019 · 3 comments
Assignees
Labels
bug Something isn't working

Comments

@JamesHenry
Copy link
Member

This issue was initially reported here: eslint/typescript-eslint-parser#502


What version of TypeScript are you using?
2.9.2

What version of typescript-eslint-parser are you using?
16.0.1. Here are the other versions:

"eslint-config-airbnb": "17.0.0",
    "eslint-config-prettier": "2.9.0",
    "eslint-plugin-babel": "5.1.0",
    "eslint-plugin-import": "2.13.0",
    "eslint-plugin-jest": "21.15.0",
    "eslint-plugin-jsx-a11y": "6.1.1",
    "eslint-plugin-prettier": "2.6.2",
    "eslint-plugin-promise": "3.8.0",
    "eslint-plugin-react": "7.10.0",
    "eslint-plugin-typescript": "0.12.0",

What code were you trying to parse?

import React, { Fragment } from 'react';
import PropTypes from 'prop-types';
import { ChapterShape, VerseShape } from '../../shapes';
import VerseContainer from '../../containers/VerseContainer';

const propTypes = {
  chapter: ChapterShape.isRequired,
  isEndOfSurah: PropTypes.bool.isRequired,
  currentVerse: PropTypes.string,
  isLoading: PropTypes.bool.isRequired,
  isSingleVerse: PropTypes.bool.isRequired,
  verses: PropTypes.objectOf(VerseShape),
  extra: PropTypes.bool.isRequired,
};

type Props = {
  chapter: ChapterShape;
  verses: { [verseKey: string]: VerseShape };
};

const ListView: React.SFC<Props> = ({ chapter, verses }: Props) => (
  <Fragment>
    {Object.values(verses).map((verse: VerseShape) => (
      <VerseContainer
        verse={verse}
        chapter={chapter}
        key={`${verse.chapterId}-${verse.id}-verse`}
      />
    ))}
  </Fragment>
);

ListView.propTypes = propTypes;

export default ListView;

What did you expect to happen?
I should get error for extra as 'extra' PropType is defined but prop is never used. This only works when I don't use typescript-eslint-parser.

What happened?

@JamesHenry JamesHenry added the package: parser Issues related to @typescript-eslint/parser label Jan 18, 2019
@bradzacher bradzacher added bug Something isn't working triage Waiting for maintainers to take a look and removed package: parser Issues related to @typescript-eslint/parser labels Jan 18, 2019
@armano2 armano2 self-assigned this Jan 21, 2019
@armano2
Copy link
Member

armano2 commented Jan 21, 2019

@mmahalwy i tested it against @typescript-eslint/eslint-plugin@1.0.0 and issue seems to be solved

it was related to ecmaFeatures.jsx and solved in #85

right now on this code i'm have following errors:

'isEndOfSurah' PropType is defined but prop is never used
'currentVerse' PropType is defined but prop is never used
'isLoading' PropType is defined but prop is never used
'isSingleVerse' PropType is defined but prop is never used
'extra' PropType is defined but prop is never used

@armano2 armano2 closed this as completed Jan 21, 2019
@armano2 armano2 removed the triage Waiting for maintainers to take a look label Jan 21, 2019
@n1xn
Copy link

n1xn commented Jan 26, 2019

@JamesHenry could you please share your package.json and .eslintrc.json files? I would like to use react with typescript and airbnb style guide but dont know how to set it up.

@bradzacher
Copy link
Member

@NikoMontana - please avoid leaving unrelated comments on old, closed issues.

Feel free to open a new issue for this if you want to ask a question.

Note that this issue was copied from the old repo, and was not originally logged by James.

@typescript-eslint typescript-eslint locked as resolved and limited conversation to collaborators Feb 21, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

4 participants