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

eslint showing error when using variable from parent scope #12004

Closed
afucher opened this issue Jul 18, 2019 · 2 comments
Closed

eslint showing error when using variable from parent scope #12004

afucher opened this issue Jul 18, 2019 · 2 comments
Labels
archived due to age This issue has been archived; please open a new issue for any further discussion auto closed The bot closed this issue question This issue asks a question about ESLint

Comments

@afucher
Copy link

afucher commented Jul 18, 2019

Tell us about your environment

  • ESLint Version: 6.0.1
  • Node Version: v10.15.3
  • npm Version: 6.4.1

What parser (default, Babel-ESLint, etc.) are you using?
default
Please show your full configuration:

Configuration

What did you do? Please include the actual source code causing the issue, as well as the command that you used to run ESLint.

import React from 'react';

interface Props {
    readonly history: number[];
}

export const MyHistory = (props: Props) => {
    const renderContent = () => {
        if (props.history.length > 0) {
            return <div> My history here</div>
        }
        return <div> No historical events</div>
    };

    return renderContent();
};
npm run eslint --fix --ext .tsx --ext .ts src

What did you expect to happen?
eslint show no errors

What actually happened? Please include the actual, raw output from ESLint.

  9:19  error  'history' is missing in props validation         react/prop-types
  9:27  error  'history.length' is missing in props validation  react/prop-types

Are you willing to submit a pull request to fix this bug?

@afucher afucher added bug ESLint is working incorrectly triage An ESLint team member will look at this issue soon labels Jul 18, 2019
@platinumazure
Copy link
Member

Hi @afucher, thanks for the issue.

This seems to be an issue with eslint-plugin-react. Would you mind opening a new issue there?

@platinumazure platinumazure added question This issue asks a question about ESLint and removed bug ESLint is working incorrectly triage An ESLint team member will look at this issue soon labels Jul 18, 2019
@eslint-deprecated eslint-deprecated bot added the auto closed The bot closed this issue label Aug 18, 2019
@eslint-deprecated
Copy link

It looks like the conversation is stalled here. As this is a question rather
than an action item, I'm closing the issue. If you still need help, please send
a message to our mailing list or
chatroom. Thanks!
[//]: # (auto-close)

@eslint-deprecated eslint-deprecated bot locked and limited conversation to collaborators Feb 15, 2020
@eslint-deprecated eslint-deprecated bot added the archived due to age This issue has been archived; please open a new issue for any further discussion label Feb 15, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
archived due to age This issue has been archived; please open a new issue for any further discussion auto closed The bot closed this issue question This issue asks a question about ESLint
Projects
None yet
Development

No branches or pull requests

2 participants