Skip to content

Commit 0a028e4

Browse files
committed
Add JSXText support to jsx-one-expression-per-line
1 parent bd6caf0 commit 0a028e4

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

lib/rules/jsx-one-expression-per-line.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ module.exports = {
5454
let countNewLinesBeforeContent = 0;
5555
let countNewLinesAfterContent = 0;
5656

57-
if (child.type === 'Literal') {
57+
if (child.type === 'Literal' || child.type === 'JSXText') {
5858
if (/^\s*$/.test(child.raw)) {
5959
return;
6060
}
@@ -110,14 +110,14 @@ module.exports = {
110110
}
111111

112112
function spaceBetweenPrev () {
113-
return (prevChild.type === 'Literal' && / $/.test(prevChild.raw)) ||
114-
(child.type === 'Literal' && /^ /.test(child.raw)) ||
113+
return ((prevChild.type === 'Literal' || prevChild.type === 'JSXText') && / $/.test(prevChild.raw)) ||
114+
((child.type === 'Literal' || child.type === 'JSXText') && /^ /.test(child.raw)) ||
115115
sourceCode.isSpaceBetweenTokens(prevChild, child);
116116
}
117117

118118
function spaceBetweenNext () {
119-
return (nextChild.type === 'Literal' && /^ /.test(nextChild.raw)) ||
120-
(child.type === 'Literal' && / $/.test(child.raw)) ||
119+
return ((nextChild.type === 'Literal' || nextChild.type === 'JSXText') && /^ /.test(nextChild.raw)) ||
120+
((child.type === 'Literal' || child.type === 'JSXText') && / $/.test(child.raw)) ||
121121
sourceCode.isSpaceBetweenTokens(child, nextChild);
122122
}
123123

0 commit comments

Comments
 (0)