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
no-danger-with-children false positive with newline in element #1262
Comments
That's still considered "children", afaik - why not |
Ah, I didn't realize we could do self-closing divs in jsx. Still, I don't think newlines between tags are considered children. Hacked together this quick test: import React from 'react';
import { mount } from 'enzyme';
class Parent extends React.Component {
render() {
console.log(this.props.children);
return <div>{this.props.children}</div>;
}
}
it('does stuff', () => {
mount(<Parent></Parent>); // => `undefined`
mount(<Parent>
</Parent>); // => `undefined`
mount(<Parent />); // => `undefined`
mount(<Parent> </Parent>); // => `' '`
mount(<Parent>
</Parent>); // => `undefined`
mount(<Parent>foo</Parent>); // => `'foo'`
}) |
Fair point - both your example and https://jsfiddle.net/ljharb/69z2wepo/80986/ implies it's a bug in eslint-plugin-react. |
Ha, nice. I started typing |
The following reports an error on the
no-danger-with-children
rule:I would expect if there is a newline between the opening and closing tag that the rule would not complain.
The text was updated successfully, but these errors were encountered: