@@ -43,24 +43,24 @@ ruleTester.run('no-danger-with-children', rule, {
43
43
code : '<div children="Children" />'
44
44
} ,
45
45
{
46
- code : [
47
- ' const props = { dangerouslySetInnerHTML: { __html: "HTML" } };' ,
48
- ' <div {...props} />'
49
- ] . join ( '\n' )
46
+ code : `
47
+ const props = { dangerouslySetInnerHTML: { __html: "HTML" } };
48
+ <div {...props} />
49
+ `
50
50
} ,
51
51
{
52
- code : [
53
- ' const moreProps = { className: "eslint" };' ,
54
- ' const props = { children: "Children", ...moreProps };' ,
55
- ' <div {...props} />'
56
- ] . join ( '\n' )
52
+ code : `
53
+ const moreProps = { className: "eslint" };
54
+ const props = { children: "Children", ...moreProps };
55
+ <div {...props} />
56
+ `
57
57
} ,
58
58
{
59
- code : [
60
- ' const otherProps = { children: "Children" };' ,
61
- ' const { a, b, ...props } = otherProps;' ,
62
- ' <div {...props} />'
63
- ] . join ( '\n' )
59
+ code : `
60
+ const otherProps = { children: "Children" };
61
+ const { a, b, ...props } = otherProps;
62
+ <div {...props} />
63
+ `
64
64
} ,
65
65
{
66
66
code : '<Hello>Children</Hello>'
@@ -95,37 +95,37 @@ ruleTester.run('no-danger-with-children', rule, {
95
95
] ,
96
96
invalid : [
97
97
{
98
- code : [
99
- ' <div dangerouslySetInnerHTML={{ __html: "HTML" }}>' ,
100
- ' Children' ,
101
- ' </div>'
102
- ] . join ( '\n' ) ,
98
+ code : `
99
+ <div dangerouslySetInnerHTML={{ __html: "HTML" }}>
100
+ Children
101
+ </div>
102
+ ` ,
103
103
errors : [ { message : 'Only set one of `children` or `props.dangerouslySetInnerHTML`' } ]
104
104
} ,
105
105
{
106
106
code : '<div dangerouslySetInnerHTML={{ __html: "HTML" }} children="Children" />' ,
107
107
errors : [ { message : 'Only set one of `children` or `props.dangerouslySetInnerHTML`' } ]
108
108
} ,
109
109
{
110
- code : [
111
- ' const props = { dangerouslySetInnerHTML: { __html: "HTML" } };' ,
112
- ' <div {...props}>Children</div>'
113
- ] . join ( '\n' ) ,
110
+ code : `
111
+ const props = { dangerouslySetInnerHTML: { __html: "HTML" } };
112
+ <div {...props}>Children</div>
113
+ ` ,
114
114
errors : [ { message : 'Only set one of `children` or `props.dangerouslySetInnerHTML`' } ]
115
115
} ,
116
116
{
117
- code : [
118
- ' const props = { children: "Children", dangerouslySetInnerHTML: { __html: "HTML" } };' ,
119
- ' <div {...props} />'
120
- ] . join ( '\n' ) ,
117
+ code : `
118
+ const props = { children: "Children", dangerouslySetInnerHTML: { __html: "HTML" } };
119
+ <div {...props} />
120
+ ` ,
121
121
errors : [ { message : 'Only set one of `children` or `props.dangerouslySetInnerHTML`' } ]
122
122
} ,
123
123
{
124
- code : [
125
- ' <Hello dangerouslySetInnerHTML={{ __html: "HTML" }}>' ,
126
- ' Children' ,
127
- ' </Hello>'
128
- ] . join ( '\n' ) ,
124
+ code : `
125
+ <Hello dangerouslySetInnerHTML={{ __html: "HTML" }}>
126
+ Children
127
+ </Hello>
128
+ ` ,
129
129
errors : [ { message : 'Only set one of `children` or `props.dangerouslySetInnerHTML`' } ]
130
130
} ,
131
131
{
@@ -137,70 +137,70 @@ ruleTester.run('no-danger-with-children', rule, {
137
137
errors : [ { message : 'Only set one of `children` or `props.dangerouslySetInnerHTML`' } ]
138
138
} ,
139
139
{
140
- code : [
141
- ' React.createElement(' ,
142
- ' "div",' ,
143
- ' { dangerouslySetInnerHTML: { __html: "HTML" } },' ,
144
- ' "Children"' ,
145
- ');'
146
- ] . join ( '\n' ) ,
140
+ code : `
141
+ React.createElement(
142
+ "div",
143
+ { dangerouslySetInnerHTML: { __html: "HTML" } },
144
+ "Children"
145
+ );
146
+ ` ,
147
147
errors : [ { message : 'Only set one of `children` or `props.dangerouslySetInnerHTML`' } ]
148
148
} ,
149
149
{
150
- code : [
151
- ' React.createElement(' ,
152
- ' "div",' ,
153
- ' {' ,
154
- ' dangerouslySetInnerHTML: { __html: "HTML" },' ,
155
- ' children: "Children",' ,
156
- ' }' ,
157
- ');'
158
- ] . join ( '\n' ) ,
150
+ code : `
151
+ React.createElement(
152
+ "div",
153
+ {
154
+ dangerouslySetInnerHTML: { __html: "HTML" },
155
+ children: "Children",
156
+ }
157
+ );
158
+ ` ,
159
159
errors : [ { message : 'Only set one of `children` or `props.dangerouslySetInnerHTML`' } ]
160
160
} ,
161
161
{
162
- code : [
163
- ' React.createElement(' ,
164
- ' "Hello",' ,
165
- ' { dangerouslySetInnerHTML: { __html: "HTML" } },' ,
166
- ' "Children"' ,
167
- ');'
168
- ] . join ( '\n' ) ,
162
+ code : `
163
+ React.createElement(
164
+ "Hello",
165
+ { dangerouslySetInnerHTML: { __html: "HTML" } },
166
+ "Children"
167
+ );
168
+ ` ,
169
169
errors : [ { message : 'Only set one of `children` or `props.dangerouslySetInnerHTML`' } ]
170
170
} ,
171
171
{
172
- code : [
173
- ' React.createElement(' ,
174
- ' "Hello",' ,
175
- ' {' ,
176
- ' dangerouslySetInnerHTML: { __html: "HTML" },' ,
177
- ' children: "Children",' ,
178
- ' }' ,
179
- ');'
180
- ] . join ( '\n' ) ,
172
+ code : `
173
+ React.createElement(
174
+ "Hello",
175
+ {
176
+ dangerouslySetInnerHTML: { __html: "HTML" },
177
+ children: "Children",
178
+ }
179
+ );
180
+ ` ,
181
181
errors : [ { message : 'Only set one of `children` or `props.dangerouslySetInnerHTML`' } ]
182
182
} ,
183
183
{
184
- code : [
185
- ' const props = { dangerouslySetInnerHTML: { __html: "HTML" } };' ,
186
- ' React.createElement("div", props, "Children");'
187
- ] . join ( '\n' ) ,
184
+ code : `
185
+ const props = { dangerouslySetInnerHTML: { __html: "HTML" } };
186
+ React.createElement("div", props, "Children");
187
+ ` ,
188
188
errors : [ { message : 'Only set one of `children` or `props.dangerouslySetInnerHTML`' } ]
189
189
} ,
190
190
{
191
- code : [
192
- ' const props = { children: "Children", dangerouslySetInnerHTML: { __html: "HTML" } };' ,
193
- ' React.createElement("div", props);'
194
- ] . join ( '\n' ) ,
191
+ code : `
192
+ const props = { children: "Children", dangerouslySetInnerHTML: { __html: "HTML" } };
193
+ React.createElement("div", props);
194
+ ` ,
195
195
errors : [ { message : 'Only set one of `children` or `props.dangerouslySetInnerHTML`' } ]
196
196
} ,
197
197
{
198
- code : [
199
- ' const moreProps = { children: "Children" };' ,
200
- ' const otherProps = { ...moreProps };' ,
201
- ' const props = { ...otherProps, dangerouslySetInnerHTML: { __html: "HTML" } };' ,
202
- ' React.createElement("div", props);'
203
- ] . join ( '\n' ) ,
198
+ code : `
199
+ const moreProps = { children: "Children" };
200
+ const otherProps = { ...moreProps };
201
+ const props = { ...otherProps, dangerouslySetInnerHTML: { __html: "HTML" } };
202
+ React.createElement("div", props);
203
+ ` ,
204
204
errors : [ { message : 'Only set one of `children` or `props.dangerouslySetInnerHTML`' } ]
205
205
}
206
206
]
0 commit comments