@@ -28,6 +28,10 @@ const settings = {
28
28
29
29
require ( 'babel-eslint' ) ;
30
30
31
+ function withAndWithoutFlowVersion ( flowVersion , test ) {
32
+ return [ test , Object . assign ( { } , test , { settings : { react : { flowVersion} } } ) ] ;
33
+ }
34
+
31
35
// ------------------------------------------------------------------------------
32
36
// Tests
33
37
// ------------------------------------------------------------------------------
@@ -1475,7 +1479,7 @@ ruleTester.run('prop-types', rule, {
1475
1479
'}'
1476
1480
] . join ( '\n' ) ,
1477
1481
parser : 'babel-eslint'
1478
- } , {
1482
+ } , ... withAndWithoutFlowVersion ( '0.52' , {
1479
1483
code : [
1480
1484
'type Person = {' ,
1481
1485
' firstname: string' ,
@@ -1487,7 +1491,7 @@ ruleTester.run('prop-types', rule, {
1487
1491
'}'
1488
1492
] . join ( '\n' ) ,
1489
1493
parser : 'babel-eslint'
1490
- } , {
1494
+ } ) , ... withAndWithoutFlowVersion ( '0.52' , {
1491
1495
code : [
1492
1496
'type Person = {' ,
1493
1497
' firstname: string' ,
@@ -1500,7 +1504,7 @@ ruleTester.run('prop-types', rule, {
1500
1504
'}'
1501
1505
] . join ( '\n' ) ,
1502
1506
parser : 'babel-eslint'
1503
- } , {
1507
+ } ) , ... withAndWithoutFlowVersion ( '0.52' , {
1504
1508
code : [
1505
1509
'type Person = {' ,
1506
1510
' firstname: string' ,
@@ -1515,7 +1519,7 @@ ruleTester.run('prop-types', rule, {
1515
1519
'}'
1516
1520
] . join ( '\n' ) ,
1517
1521
parser : 'babel-eslint'
1518
- } , {
1522
+ } ) , ... withAndWithoutFlowVersion ( '0.52' , {
1519
1523
code : [
1520
1524
'type Props = {name: {firstname: string;};};' ,
1521
1525
'class Hello extends React.Component<void, Props, void> {' ,
@@ -1525,7 +1529,7 @@ ruleTester.run('prop-types', rule, {
1525
1529
'}'
1526
1530
] . join ( '\n' ) ,
1527
1531
parser : 'babel-eslint'
1528
- } , {
1532
+ } ) , ... withAndWithoutFlowVersion ( '0.52' , {
1529
1533
code : [
1530
1534
'import type Props from "fake";' ,
1531
1535
'class Hello extends React.Component<void, Props, void> {' ,
@@ -1535,7 +1539,7 @@ ruleTester.run('prop-types', rule, {
1535
1539
'}'
1536
1540
] . join ( '\n' ) ,
1537
1541
parser : 'babel-eslint'
1538
- } , {
1542
+ } ) , ... withAndWithoutFlowVersion ( '0.52' , {
1539
1543
code : [
1540
1544
'type Person = {' ,
1541
1545
' firstname: string' ,
@@ -1547,7 +1551,7 @@ ruleTester.run('prop-types', rule, {
1547
1551
'}'
1548
1552
] . join ( '\n' ) ,
1549
1553
parser : 'babel-eslint'
1550
- } , {
1554
+ } ) , ... withAndWithoutFlowVersion ( '0.52' , {
1551
1555
code : [
1552
1556
'type Props = {result?: {ok?: ?string | boolean;}|{ok?: ?number | Array}};' ,
1553
1557
'class Hello extends React.Component<void, Props, void> {' ,
@@ -1557,8 +1561,7 @@ ruleTester.run('prop-types', rule, {
1557
1561
'}'
1558
1562
] . join ( '\n' ) ,
1559
1563
parser : 'babel-eslint'
1560
- } ,
1561
- {
1564
+ } ) , ...withAndWithoutFlowVersion ( '0.53' , {
1562
1565
code : `
1563
1566
type Props = {
1564
1567
foo: string,
@@ -1571,7 +1574,7 @@ ruleTester.run('prop-types', rule, {
1571
1574
}
1572
1575
` ,
1573
1576
parser : 'babel-eslint'
1574
- } , {
1577
+ } ) , ... withAndWithoutFlowVersion ( '0.53' , {
1575
1578
code : `
1576
1579
type FancyProps = {
1577
1580
foo: string,
@@ -1584,7 +1587,7 @@ ruleTester.run('prop-types', rule, {
1584
1587
}
1585
1588
` ,
1586
1589
parser : 'babel-eslint'
1587
- } ,
1590
+ } ) ,
1588
1591
// issue #1288
1589
1592
`function Foo() {
1590
1593
const props = {}
@@ -2847,7 +2850,7 @@ ruleTester.run('prop-types', rule, {
2847
2850
errors : [
2848
2851
{ message : '\'name\' is missing in props validation' }
2849
2852
]
2850
- } , {
2853
+ } , ... withAndWithoutFlowVersion ( '0.52' , {
2851
2854
code : [
2852
2855
'type Person = {' ,
2853
2856
' firstname: string' ,
@@ -2865,7 +2868,7 @@ ruleTester.run('prop-types', rule, {
2865
2868
type : 'Identifier'
2866
2869
} ] ,
2867
2870
parser : 'babel-eslint'
2868
- } , {
2871
+ } ) , ... withAndWithoutFlowVersion ( '0.52' , {
2869
2872
code : [
2870
2873
'type Person = {' ,
2871
2874
' firstname: string' ,
@@ -2884,7 +2887,7 @@ ruleTester.run('prop-types', rule, {
2884
2887
type : 'Property'
2885
2888
} ] ,
2886
2889
parser : 'babel-eslint'
2887
- } , {
2890
+ } ) , ... withAndWithoutFlowVersion ( '0.52' , {
2888
2891
code : [
2889
2892
'type Person = {' ,
2890
2893
' firstname: string' ,
@@ -2905,7 +2908,7 @@ ruleTester.run('prop-types', rule, {
2905
2908
type : 'Property'
2906
2909
} ] ,
2907
2910
parser : 'babel-eslint'
2908
- } , {
2911
+ } ) , ... withAndWithoutFlowVersion ( '0.52' , {
2909
2912
code : [
2910
2913
'type Props = {name: {firstname: string;};};' ,
2911
2914
'class Hello extends React.Component<void, Props, void> {' ,
@@ -2921,7 +2924,7 @@ ruleTester.run('prop-types', rule, {
2921
2924
type : 'Identifier'
2922
2925
} ] ,
2923
2926
parser : 'babel-eslint'
2924
- } , {
2927
+ } ) , ... withAndWithoutFlowVersion ( '0.52' , {
2925
2928
code : [
2926
2929
'type Props = {result?: {ok: string | boolean;}|{ok: number | Array}};' ,
2927
2930
'class Hello extends React.Component<void, Props, void> {' ,
@@ -2937,7 +2940,7 @@ ruleTester.run('prop-types', rule, {
2937
2940
type : 'Identifier'
2938
2941
} ] ,
2939
2942
parser : 'babel-eslint'
2940
- } , {
2943
+ } ) , ... withAndWithoutFlowVersion ( '0.52' , {
2941
2944
code : [
2942
2945
'type Person = {' ,
2943
2946
' firstname: string' ,
@@ -2955,7 +2958,7 @@ ruleTester.run('prop-types', rule, {
2955
2958
type : 'Identifier'
2956
2959
} ] ,
2957
2960
parser : 'babel-eslint'
2958
- } , {
2961
+ } ) , ... withAndWithoutFlowVersion ( '0.53' , {
2959
2962
code : `
2960
2963
type Props = {
2961
2964
foo: string,
@@ -2974,7 +2977,7 @@ ruleTester.run('prop-types', rule, {
2974
2977
type : 'Identifier'
2975
2978
} ] ,
2976
2979
parser : 'babel-eslint'
2977
- } , {
2980
+ } ) , ... withAndWithoutFlowVersion ( '0.53' , {
2978
2981
code : `
2979
2982
type FancyProps = {
2980
2983
foo: string,
@@ -2993,6 +2996,6 @@ ruleTester.run('prop-types', rule, {
2993
2996
type : 'Identifier'
2994
2997
} ] ,
2995
2998
parser : 'babel-eslint'
2996
- }
2999
+ } )
2997
3000
]
2998
3001
} ) ;
0 commit comments