Skip to content

Commit ed3370b

Browse files
committed
Add SpreadElement and JSXText support to no-danger-with-children
1 parent 0a028e4 commit ed3370b

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

lib/rules/no-danger-with-children.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ module.exports = {
3636
return node.properties.find(prop => {
3737
if (prop.type === 'Property') {
3838
return prop.key.name === propName;
39-
} else if (prop.type === 'ExperimentalSpreadProperty') {
39+
} else if (prop.type === 'ExperimentalSpreadProperty' || prop.type === 'SpreadElement') {
4040
const variable = findSpreadVariable(prop.argument.name);
4141
if (variable && variable.defs.length && variable.defs[0].node.init) {
4242
if (seenProps.indexOf(prop.argument.name) > -1) {
@@ -74,7 +74,7 @@ module.exports = {
7474
* @returns {Boolean} True if node is a line break, false if not
7575
*/
7676
function isLineBreak(node) {
77-
const isLiteral = node.type === 'Literal';
77+
const isLiteral = node.type === 'Literal' || node.type === 'JSXText';
7878
const isMultiline = node.loc.start.line !== node.loc.end.line;
7979
const isWhiteSpaces = /^\s*$/.test(node.value);
8080

0 commit comments

Comments
 (0)