-
Notifications
You must be signed in to change notification settings - Fork 657
Conversation
catch up with base
catch up to base
catch up with base
if ( | ||
( | ||
node.type === 'JSXElement' && | ||
node.attributes.find(attribute => (attribute as JSXAttribute).name.name === 'children') |
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.
Could you hoist the closure to the top level?
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.
Also don't use as
. We're losing type precision here for no reason and I suspect this will fail accessing an unknown property on JSXSpreadAttribute
.
node.callee.property.value.type === 'Identifier' && | ||
node.callee.property.value.name === 'createElement' && | ||
node.arguments[1].type === 'ObjectExpression' && | ||
node.arguments[1].properties.find(property => ( |
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.
Could you also hoist this one?
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.
I assumed that you meant by these that you'd like me to define the functions at the top level, which I've done. Let me know if you meant something else?
)) | ||
) | ||
) { | ||
path.context.addNodeDiagnostic( |
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.
I believe this fixable
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.
Are you thinking we would just get rid of the children prop? We could do that. I worry a little bit that people would maybe prefer to just be told though, so that they don't have to add it again with a name other than "children". But if you still think it would be better to delete it, or had something else in mind, then I could do that.
packages/@romejs/js-compiler/lint/rules/react/noChildrenProp.ts
Outdated
Show resolved
Hide resolved
When running tests, I'm being prompted to run |
@macovedj I also got those when I created my PR but I just ommited them |
Neato. New problem though. When I try to update snapshots for the tests that I wrote, I get this error which I'm having difficulty parsing. `✖ unimplemented
ℹ Lint options
ℹ Input
` |
It means
Feel free to do that in this PR. |
I believe there's a bug in snapshots that's not causing failures to be emitted correctly. There was a PR that must have been merged that incorrectly allowed them. I pushed the updated snapshots to |
Looks good, thank you! |
no-children-prop eslint rule