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

require-default-props - fixing an edge case where linting stops early #1380

Merged
merged 1 commit into from Aug 17, 2017

Conversation

brgibson
Copy link
Contributor

@brgibson brgibson commented Aug 17, 2017

This is to fix an edge case where linting stops when it finds a component without props. Instead it should move on to the next component in the file.

@@ -1306,7 +1306,26 @@ ruleTester.run('require-default-props', rule, {
column: 3
}]
},

//
// component with no pros followed by a failing component
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Typo.

Also is the empty // needed?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was just following the pattern in the rest of the file, I have deleted it now though, since it does seem unnecessary 👍

// component with no pros followed by a failing component
{
code: [
'var ComponentWithNoProps = ({ bar = "bar" }) => {',
Copy link
Contributor

@jseminck jseminck Aug 17, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It reads a bit confusing. It says component with no props, but this component actually has two props: bar and foo. I guess that you actually mean; component with no declared prop types (since there is no .propTypes) for the first component.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

updated the comment and fixed typo:

"component with no declared props followed by a failing component"

@jseminck
Copy link
Contributor

Nice find!

The fix looks good to me. I added a few comments about the tests.

…it finds a component without props - should move on to the next component in the file
@ljharb ljharb added the bug label Aug 17, 2017
@ljharb ljharb merged commit 48e8dc1 into jsx-eslint:master Aug 17, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Development

Successfully merging this pull request may close these issues.

None yet

3 participants