@@ -29,176 +29,176 @@ ruleTester.run('jsx-no-comment-textnodes', rule, {
29
29
30
30
valid : [
31
31
{
32
- code : [
33
- ' class Comp1 extends Component {' ,
34
- ' render() {' ,
35
- ' return (' ,
36
- ' <div>' ,
37
- ' {/* valid */}' ,
38
- ' </div>' ,
39
- ' );' ,
40
- ' }' ,
41
- '}'
42
- ] . join ( '\n' ) ,
32
+ code : `
33
+ class Comp1 extends Component {
34
+ render() {
35
+ return (
36
+ <div>
37
+ {/* valid */}
38
+ </div>
39
+ );
40
+ }
41
+ }
42
+ ` ,
43
43
parser : 'babel-eslint'
44
44
} , {
45
- code : [
46
- ' class Comp1 extends Component {' ,
47
- ' render() {' ,
48
- ' return (<div>{/* valid */}</div>);' ,
49
- ' }' ,
50
- '}'
51
- ] . join ( '\n' ) ,
45
+ code : `
46
+ class Comp1 extends Component {
47
+ render() {
48
+ return (<div>{/* valid */}</div>);
49
+ }
50
+ }
51
+ ` ,
52
52
parser : 'babel-eslint'
53
53
} , {
54
- code : [
55
- ' class Comp1 extends Component {' ,
56
- ' render() {' ,
57
- ' const bar = (<div>{/* valid */}</div>);' ,
58
- ' return bar;' ,
59
- ' }' ,
60
- '}'
61
- ] . join ( '\n' ) ,
54
+ code : `
55
+ class Comp1 extends Component {
56
+ render() {
57
+ const bar = (<div>{/* valid */}</div>);
58
+ return bar;
59
+ }
60
+ }
61
+ ` ,
62
62
parser : 'babel-eslint'
63
63
} , {
64
- code : [
65
- ' var Hello = createReactClass({' ,
66
- ' foo: (<div>{/* valid */}</div>),' ,
67
- ' render() {' ,
68
- ' return this.foo;' ,
69
- ' },' ,
70
- ' });'
71
- ] . join ( '\n' ) ,
64
+ code : `
65
+ var Hello = createReactClass({
66
+ foo: (<div>{/* valid */}</div>),
67
+ render() {
68
+ return this.foo;
69
+ } ,
70
+ });
71
+ ` ,
72
72
parser : 'babel-eslint'
73
73
} , {
74
- code : [
75
- ' class Comp1 extends Component {' ,
76
- ' render() {' ,
77
- ' return (' ,
78
- ' <div>' ,
79
- ' {/* valid */}' ,
80
- ' {/* valid 2 */}' ,
81
- ' {/* valid 3 */}' ,
82
- ' </div>' ,
83
- ' );' ,
84
- ' }' ,
85
- '}'
86
- ] . join ( '\n' ) ,
74
+ code : `
75
+ class Comp1 extends Component {
76
+ render() {
77
+ return (
78
+ <div>
79
+ {/* valid */}
80
+ {/* valid 2 */}
81
+ {/* valid 3 */}
82
+ </div>
83
+ );
84
+ }
85
+ }
86
+ ` ,
87
87
parser : 'babel-eslint'
88
88
} , {
89
- code : [
90
- ' class Comp1 extends Component {' ,
91
- ' render() {' ,
92
- ' return (' ,
93
- ' <div>' ,
94
- ' </div>' ,
95
- ' );' ,
96
- ' }' ,
97
- '}'
98
- ] . join ( '\n' ) ,
89
+ code : `
90
+ class Comp1 extends Component {
91
+ render() {
92
+ return (
93
+ <div>
94
+ </div>
95
+ );
96
+ }
97
+ }
98
+ ` ,
99
99
parser : 'babel-eslint'
100
100
} , {
101
- code : [
102
- ' var foo = require(\ 'foo\ ');'
103
- ] . join ( '\n' ) ,
101
+ code : `
102
+ var foo = require('foo');
103
+ ` ,
104
104
parser : 'babel-eslint'
105
105
} , {
106
- code : [
107
- ' <Foo bar=\ 'test\'>' ,
108
- ' {/* valid */}' ,
109
- ' </Foo>'
110
- ] . join ( '\n' ) ,
106
+ code : `
107
+ <Foo bar='test'>
108
+ {/* valid */}
109
+ </Foo>
110
+ ` ,
111
111
parser : 'babel-eslint'
112
112
} ,
113
113
{
114
- code : [
115
- ' <strong>' ,
116
- ' https://www.example.com/attachment/download/1' ,
117
- ' </strong>'
118
- ] . join ( '\n' ) ,
114
+ code : `
115
+ <strong>
116
+ https://www.example.com/attachment/download/1
117
+ </strong>
118
+ ` ,
119
119
parser : 'babel-eslint'
120
120
} ,
121
121
122
122
// inside element declarations
123
123
{
124
- code : [
125
- ' <Foo /* valid */ placeholder={\ 'foo\ '}/>'
126
- ] . join ( '\n' ) ,
124
+ code : `
125
+ <Foo /* valid */ placeholder={'foo'}/>
126
+ ` ,
127
127
parser : 'babel-eslint'
128
128
} ,
129
129
{
130
- code : [
131
- ' <Foo title={\ 'foo\ ' /* valid */}/>'
132
- ] . join ( '\n' ) ,
130
+ code : `
131
+ <Foo title={'foo' /* valid */}/>
132
+ ` ,
133
133
parser : 'babel-eslint'
134
134
}
135
135
] ,
136
136
137
137
invalid : [
138
138
{
139
- code : [
140
- ' class Comp1 extends Component {' ,
141
- ' render() {' ,
142
- ' return (<div>// invalid</div>);' ,
143
- ' }' ,
144
- '}'
145
- ] . join ( '\n' ) ,
139
+ code : `
140
+ class Comp1 extends Component {
141
+ render() {
142
+ return (<div>// invalid</div>);
143
+ }
144
+ }
145
+ ` ,
146
146
parser : 'babel-eslint' ,
147
147
errors : [ { message : 'Comments inside children section of tag should be placed inside braces' } ]
148
148
} , {
149
- code : [
150
- ' class Comp1 extends Component {' ,
151
- ' render() {' ,
152
- ' return (<div>/* invalid */</div>);' ,
153
- ' }' ,
154
- '}'
155
- ] . join ( '\n' ) ,
149
+ code : `
150
+ class Comp1 extends Component {
151
+ render() {
152
+ return (<div>/* invalid */</div>);
153
+ }
154
+ }
155
+ ` ,
156
156
parser : 'babel-eslint' ,
157
157
errors : [ { message : 'Comments inside children section of tag should be placed inside braces' } ]
158
158
} , {
159
- code : [
160
- ' class Comp1 extends Component {' ,
161
- ' render() {' ,
162
- ' return (' ,
163
- ' <div>' ,
164
- ' // invalid' ,
165
- ' </div>' ,
166
- ' );' ,
167
- ' }' ,
168
- '}'
169
- ] . join ( '\n' ) ,
159
+ code : `
160
+ class Comp1 extends Component {
161
+ render() {
162
+ return (
163
+ <div>
164
+ // invalid
165
+ </div>
166
+ );
167
+ }
168
+ }
169
+ ` ,
170
170
parser : 'babel-eslint' ,
171
171
errors : [ { message : 'Comments inside children section of tag should be placed inside braces' } ]
172
172
} , {
173
- code : [
174
- ' class Comp1 extends Component {' ,
175
- ' render() {' ,
176
- ' return (' ,
177
- ' <div>' ,
178
- ' asdjfl' ,
179
- ' /* invalid */' ,
180
- ' foo' ,
181
- ' </div>' ,
182
- ' );' ,
183
- ' }' ,
184
- '}'
185
- ] . join ( '\n' ) ,
173
+ code : `
174
+ class Comp1 extends Component {
175
+ render() {
176
+ return (
177
+ <div>
178
+ asdjfl
179
+ /* invalid */
180
+ foo
181
+ </div>
182
+ );
183
+ }
184
+ }
185
+ ` ,
186
186
parser : 'babel-eslint' ,
187
187
errors : [ { message : 'Comments inside children section of tag should be placed inside braces' } ]
188
188
} , {
189
- code : [
190
- ' class Comp1 extends Component {' ,
191
- ' render() {' ,
192
- ' return (' ,
193
- ' <div>' ,
194
- ' {\ 'asdjfl\'}' ,
195
- ' // invalid' ,
196
- ' {\ 'foo\'}' ,
197
- ' </div>' ,
198
- ' );' ,
199
- ' }' ,
200
- '}'
201
- ] . join ( '\n' ) ,
189
+ code : `
190
+ class Comp1 extends Component {
191
+ render() {
192
+ return (
193
+ <div>
194
+ { 'asdjfl'}
195
+ // invalid
196
+ { 'foo'}
197
+ </div>
198
+ );
199
+ }
200
+ }
201
+ ` ,
202
202
parser : 'babel-eslint' ,
203
203
errors : [ { message : 'Comments inside children section of tag should be placed inside braces' } ]
204
204
}
0 commit comments