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
Support recursive type annotations, fixes #913 #1653
Conversation
Originally written by @phpnode as part of jsx-eslint#1138
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks, this LGTM overall
lib/rules/prop-types.js
Outdated
@@ -466,11 +466,22 @@ module.exports = { | |||
* @return {Object} The representation of the declaration, empty object means | |||
* the property is declared without the need for further analysis. | |||
*/ | |||
function buildTypeAnnotationDeclarationTypes(annotation) { | |||
function buildTypeAnnotationDeclarationTypes(annotation, seen) { | |||
if (seen === void 0) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
typeof seen === 'undefined'
please :-) either way, there's no need for void 0
in code that only runs in a node environment.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
Originally written by @phpnode as part of #1138
That PR was closed in favor of #1377, which does not appear to include a solution for the recursive type definition issue.
This allows for code like
to run without triggering an infinite loop.