@@ -5,6 +5,8 @@ ruleTesterWithTypes.run(RULE_NAME, rule, {
5
5
invalid : [
6
6
{
7
7
code : /* tsx */ `
8
+ import * as React from "react";
9
+
8
10
const App = (props: { id: string; className: string }) => {
9
11
return <div id={props.id} className={props.className} />
10
12
}
@@ -17,6 +19,8 @@ ruleTesterWithTypes.run(RULE_NAME, rule, {
17
19
} ,
18
20
{
19
21
code : /* tsx */ `
22
+ import * as React from "react";
23
+
20
24
function App(props: { id: string; className: string }) {
21
25
return <div id={props.id} className={props.className} />
22
26
}
@@ -29,6 +33,8 @@ ruleTesterWithTypes.run(RULE_NAME, rule, {
29
33
} ,
30
34
{
31
35
code : /* tsx */ `
36
+ import * as React from "react";
37
+
32
38
const App = function (props: { id: string; className: string }) {
33
39
return <div id={props.id} className={props.className} />
34
40
}
@@ -41,6 +47,8 @@ ruleTesterWithTypes.run(RULE_NAME, rule, {
41
47
} ,
42
48
{
43
49
code : /* tsx */ `
50
+ import * as React from "react";
51
+
44
52
const App = function ({ id, className }: { id: string; className: string }) {
45
53
return <div id={id} className={className} />
46
54
}
@@ -53,6 +61,8 @@ ruleTesterWithTypes.run(RULE_NAME, rule, {
53
61
} ,
54
62
{
55
63
code : /* tsx */ `
64
+ import * as React from "react";
65
+
56
66
const App = function ({ id, className }: { readonly id: string; className: string }) {
57
67
return <div id={id} className={className} />
58
68
}
@@ -65,8 +75,9 @@ ruleTesterWithTypes.run(RULE_NAME, rule, {
65
75
} ,
66
76
{
67
77
code : /* tsx */ `
68
- import { FC } from "react";
69
- const App: FC<{ id: string; className: string }> = (props) => {
78
+ import * as React from "react";
79
+
80
+ const App: React.FC<{ id: string; className: string }> = (props) => {
70
81
return <div id={props.id} className={props.className} />
71
82
}
72
83
` ,
@@ -78,8 +89,9 @@ ruleTesterWithTypes.run(RULE_NAME, rule, {
78
89
} ,
79
90
{
80
91
code : /* tsx */ `
81
- import { FC } from "react";
82
- const App: FC<{ id: string; className: string }> = ({ id, className }) => {
92
+ import * as React from "react";
93
+
94
+ const App: React.FC<{ id: string; className: string }> = ({ id, className }) => {
83
95
return <div id={id} className={className} />
84
96
}
85
97
` ,
@@ -91,7 +103,7 @@ ruleTesterWithTypes.run(RULE_NAME, rule, {
91
103
} ,
92
104
{
93
105
code : /* tsx */ `
94
- import React from "react";
106
+ import * as React from "react";
95
107
96
108
export const App: React.FC<{ id: string; className: string }> = (props) => {
97
109
return <div className={props.className} id={props.id} />
@@ -105,7 +117,7 @@ ruleTesterWithTypes.run(RULE_NAME, rule, {
105
117
} ,
106
118
{
107
119
code : /* tsx */ `
108
- import React from "react";
120
+ import * as React from "react";
109
121
110
122
export const App: React.FC<{ readonly id: string; readonly className: string } | { id: string; className: string }> = (props) => {
111
123
return <div className={props.className} id={props.id} />
@@ -119,7 +131,7 @@ ruleTesterWithTypes.run(RULE_NAME, rule, {
119
131
} ,
120
132
{
121
133
code : /* tsx */ `
122
- import { FC } from "react";
134
+ import * as React from "react";
123
135
124
136
const defaultProps = { id: "default-id", className: "default-class" };
125
137
type Props = typeof defaultProps;
@@ -136,6 +148,8 @@ ruleTesterWithTypes.run(RULE_NAME, rule, {
136
148
} ,
137
149
{
138
150
code : /* tsx */ `
151
+ import * as React from "react";
152
+
139
153
interface HSV {
140
154
h: number;
141
155
s: number;
@@ -158,6 +172,8 @@ ruleTesterWithTypes.run(RULE_NAME, rule, {
158
172
} ,
159
173
{
160
174
code : /* tsx */ `
175
+ import * as React from "react";
176
+
161
177
interface HSV {
162
178
h: number;
163
179
s: number;
@@ -180,9 +196,9 @@ ruleTesterWithTypes.run(RULE_NAME, rule, {
180
196
} ,
181
197
{ // memo with generic
182
198
code : /* tsx */ `
183
- import React, { memo } from "react";
199
+ import * as React from "react";
184
200
185
- const App = memo(({ id, className }: { id: string; className: string }) => {
201
+ const App = React. memo(({ id, className }: { id: string; className: string }) => {
186
202
return <div id={id} className={className} />
187
203
});
188
204
` ,
@@ -194,11 +210,11 @@ ruleTesterWithTypes.run(RULE_NAME, rule, {
194
210
} ,
195
211
{ // memo with generic and default props
196
212
code : /* tsx */ `
197
- import React, { memo } from "react";
213
+ import * as React from "react";
198
214
199
215
const defaultProps = { id: "default-id", className: "default-class" };
200
216
type Props = typeof defaultProps;
201
- const App = memo(({ id, className }: Props) => {
217
+ const App = React. memo(({ id, className }: Props) => {
202
218
return <div id={id} className={className} />
203
219
});
204
220
` ,
@@ -210,9 +226,9 @@ ruleTesterWithTypes.run(RULE_NAME, rule, {
210
226
} ,
211
227
{ // forwardRef with generic
212
228
code : /* tsx */ `
213
- import React, { forwardRef } from "react";
229
+ import * as React from "react";
214
230
215
- const App = forwardRef<HTMLDivElement, { id: string; className: string }>(({ id, className }, ref) => {
231
+ const App = React. forwardRef<HTMLDivElement, { id: string; className: string }>(({ id, className }, ref) => {
216
232
return <div id={id} className={className} ref={ref} />
217
233
});
218
234
` ,
@@ -224,11 +240,11 @@ ruleTesterWithTypes.run(RULE_NAME, rule, {
224
240
} ,
225
241
{ // forwardRef with generic and default props
226
242
code : /* tsx */ `
227
- import React, { forwardRef } from "react";
243
+ import * as React from "react";
228
244
229
245
const defaultProps = { id: "default-id", className: "default-class" };
230
246
type Props = typeof defaultProps;
231
- const App = forwardRef<HTMLDivElement, Props>(({ id, className }, ref) => {
247
+ const App = React. forwardRef<HTMLDivElement, Props>(({ id, className }, ref) => {
232
248
return <div id={id} className={className} ref={ref} />
233
249
});
234
250
` ,
@@ -240,9 +256,9 @@ ruleTesterWithTypes.run(RULE_NAME, rule, {
240
256
} ,
241
257
{ // memo and forwardRef with generic
242
258
code : /* tsx */ `
243
- import React, { memo, forwardRef } from "react";
259
+ import * as React from "react";
244
260
245
- const App = memo(forwardRef<HTMLDivElement, { id: string; className: string }>(({ id, className }, ref) => {
261
+ const App = React. memo(React. forwardRef<HTMLDivElement, { id: string; className: string }>(({ id, className }, ref) => {
246
262
return <div id={id} className={className} ref={ref} />
247
263
}));
248
264
` ,
@@ -256,7 +272,7 @@ ruleTesterWithTypes.run(RULE_NAME, rule, {
256
272
valid : [
257
273
...allValid ,
258
274
/* tsx */ `
259
- import React from "react";
275
+ import * as React from "react";
260
276
261
277
type DeepReadonly<T> = Readonly<{[K in keyof T]: T[K] extends (number | string | symbol) ? Readonly<T[K]> : T[K] extends Array<infer A> ? Readonly<Array<DeepReadonly<A>>> : DeepReadonly<T[K]>;}>;
262
278
@@ -265,32 +281,36 @@ ruleTesterWithTypes.run(RULE_NAME, rule, {
265
281
}
266
282
` ,
267
283
/* tsx */ `
268
- import React from "react";
284
+ import * as React from "react";
269
285
import { ReadonlyDeep } from "type-fest";
270
286
271
287
export const App: React.FC<ReadonlyDeep<{ id: string; className: string }>> = (props) => {
272
288
return <div className={props.className} id={props.id} />
273
289
}
274
290
` ,
275
291
/* tsx */ `
292
+ import * as React from "react";
293
+
276
294
const App = function ({ id, className }: { readonly id: string; readonly className: string }) {
277
295
return <div id={id} className={className} />
278
296
}
279
297
` ,
280
298
/* tsx */ `
281
- import { FC } from "react";
282
- const App: FC<{ readonly id: string; readonly className: string }> = (props) => {
299
+ import * as React from "react";
300
+
301
+ const App: React.FC<{ readonly id: string; readonly className: string }> = (props) => {
283
302
return <div id={props.id} className={props.className} />
284
303
}
285
304
` ,
286
305
/* tsx */ `
287
- import { FC } from "react";
288
- const App: FC<{ readonly id: string; readonly className: string }> = ({ id, className }) => {
306
+ import * as React from "react";
307
+
308
+ const App: React.FC<{ readonly id: string; readonly className: string }> = ({ id, className }) => {
289
309
return <div id={id} className={className} />
290
310
}
291
311
` ,
292
312
/* tsx */ `
293
- import { FC } from "react";
313
+ import * as React from "react";
294
314
295
315
const defaultProps = { id: "default-id", className: "default-class" } as const;
296
316
type Props = typeof defaultProps;
@@ -300,29 +320,33 @@ ruleTesterWithTypes.run(RULE_NAME, rule, {
300
320
}
301
321
` ,
302
322
/* tsx */ `
303
- import { FC } from "react";
323
+ import * as React from "react";
304
324
305
325
const defaultProps = { id: "default-id", className: "default-class" } as const;
306
326
type Props = typeof defaultProps;
307
- const App: FC<Props> = ({ id, className }) => {
327
+ const App: React. FC<Props> = ({ id, className }) => {
308
328
return <div id={id} className={className} />
309
329
}
310
330
` ,
311
331
/* tsx */ `
312
- import { FC } from "react";
332
+ import * as React from "react";
313
333
314
334
const defaultProps = { id: "default-id", className: "default-class" } as const;
315
- const App: FC<typeof defaultProps> = ({ id, className }) => {
335
+ const App: React. FC<typeof defaultProps> = ({ id, className }) => {
316
336
return <div id={id} className={className} />
317
337
}
318
338
` ,
319
339
/* tsx */ `
340
+ import * as React from "react";
341
+
320
342
const defaultProps = { id: "default-id", className: "default-class" } as const;
321
343
const App = ({ id, className }: typeof defaultProps) => {
322
344
return <div id={id} className={className} />
323
345
}
324
346
` ,
325
347
/* tsx */ `
348
+ import * as React from "react";
349
+
326
350
interface HSV {
327
351
h: number;
328
352
s: number;
@@ -338,6 +362,8 @@ ruleTesterWithTypes.run(RULE_NAME, rule, {
338
362
}
339
363
` ,
340
364
/* tsx */ `
365
+ import * as React from "react";
366
+
341
367
interface HSV {
342
368
h: number;
343
369
s: number;
@@ -355,48 +381,48 @@ ruleTesterWithTypes.run(RULE_NAME, rule, {
355
381
` ,
356
382
// memo with generic
357
383
/* tsx */ `
358
- import React, { memo } from "react";
384
+ import * as React from "react";
359
385
360
386
type Props = { readonly id: string; readonly className: string };
361
- const App = memo<Props>(({ id, className }) => {
387
+ const App = React. memo<Props>(({ id, className }) => {
362
388
return <div id={id} className={className} />
363
389
});
364
390
` ,
365
391
// memo with generic and default props
366
392
/* tsx */ `
367
- import React, { memo } from "react";
393
+ import * as React from "react";
368
394
369
395
const defaultProps = { id: "default-id", className: "default-class" } as const;
370
396
type Props = typeof defaultProps;
371
- const App = memo<Props>(({ id, className }) => {
397
+ const App = React. memo<Props>(({ id, className }) => {
372
398
return <div id={id} className={className} />
373
399
});
374
400
` ,
375
401
// forwardRef with generic
376
402
/* tsx */ `
377
- import React, { forwardRef } from "react";
403
+ import * as React from "react";
378
404
379
405
type Props = { readonly id: string; readonly className: string };
380
- const App = forwardRef<HTMLDivElement, Props>(({ id, className }, ref) => {
406
+ const App = React. forwardRef<HTMLDivElement, Props>(({ id, className }, ref) => {
381
407
return <div id={id} className={className} ref={ref} />
382
408
});
383
409
` ,
384
410
// forwardRef with generic and default props
385
411
/* tsx */ `
386
- import React, { forwardRef } from "react";
412
+ import * as React from "react";
387
413
388
414
const defaultProps = { id: "default-id", className: "default-class" } as const;
389
415
type Props = typeof defaultProps;
390
- const App = forwardRef<HTMLDivElement, Props>(({ id, className }, ref) => {
416
+ const App = React. forwardRef<HTMLDivElement, Props>(({ id, className }, ref) => {
391
417
return <div id={id} className={className} ref={ref} />
392
418
});
393
419
` ,
394
420
// memo and forwardRef with generic
395
421
/* tsx */ `
396
- import React, { memo, forwardRef } from "react";
422
+ import * as React from "react";
397
423
398
424
type Props = { readonly id: string; readonly className: string };
399
- const App = memo(forwardRef<HTMLDivElement, Props>(({ id, className }, ref) => {
425
+ const App = React. memo(React. forwardRef<HTMLDivElement, Props>(({ id, className }, ref) => {
400
426
return <div id={id} className={className} ref={ref} />
401
427
}));
402
428
` ,
0 commit comments