@@ -467,6 +467,19 @@ ruleTester.run('sort-prop-types', rule, {
467
467
};
468
468
` ,
469
469
options : [ { sortShapeProp : true } ] ,
470
+ } ,
471
+ {
472
+ code : `
473
+ var Component = createReactClass({
474
+ propTypes: {
475
+ a: React.PropTypes.string,
476
+ c: React.PropTypes.string,
477
+ b: React.PropTypes.string,
478
+ onChange: React.PropTypes.func,
479
+ }
480
+ });
481
+ ` ,
482
+ options : [ { callbacksLast : true , noSortAlphabetically : true } ] ,
470
483
}
471
484
) ) ,
472
485
invalid : parsers . all ( [ ] . concat (
@@ -1888,7 +1901,7 @@ ruleTester.run('sort-prop-types', rule, {
1888
1901
} ,
1889
1902
{
1890
1903
code : `
1891
- var Component = React.createClass ({
1904
+ var Component = createReactClass ({
1892
1905
propTypes: {
1893
1906
onChange: React.PropTypes.func,
1894
1907
a: React.PropTypes.string,
@@ -1898,7 +1911,7 @@ ruleTester.run('sort-prop-types', rule, {
1898
1911
});
1899
1912
` ,
1900
1913
output : `
1901
- var Component = React.createClass ({
1914
+ var Component = createReactClass ({
1902
1915
propTypes: {
1903
1916
a: React.PropTypes.string,
1904
1917
c: React.PropTypes.string,
@@ -1912,6 +1925,8 @@ ruleTester.run('sort-prop-types', rule, {
1912
1925
{
1913
1926
messageId : 'callbackPropsLast' ,
1914
1927
line : 4 ,
1928
+ column : 13 ,
1929
+ type : 'Property' ,
1915
1930
} ,
1916
1931
] ,
1917
1932
} ,
@@ -2177,6 +2192,64 @@ ruleTester.run('sort-prop-types', rule, {
2177
2192
type : 'Property' ,
2178
2193
} ,
2179
2194
] ,
2195
+ } : [ ] ,
2196
+ semver . satisfies ( eslintPkg . version , '> 3' ) ? {
2197
+ code : `
2198
+ var Component = createReactClass({
2199
+ propTypes: {
2200
+ /* onChange */ onChange: React.PropTypes.func,
2201
+ /* a */ a: React.PropTypes.string,
2202
+ /* c */ c: React.PropTypes.string,
2203
+ /* b */ b: React.PropTypes.string,
2204
+ }
2205
+ });
2206
+ ` ,
2207
+ output : `
2208
+ var Component = createReactClass({
2209
+ propTypes: {
2210
+ /* a */ a: React.PropTypes.string,
2211
+ /* c */ c: React.PropTypes.string,
2212
+ /* b */ b: React.PropTypes.string,
2213
+ /* onChange */ onChange: React.PropTypes.func,
2214
+ }
2215
+ });
2216
+ ` ,
2217
+ options : [ { callbacksLast : true , noSortAlphabetically : true } ] ,
2218
+ errors : [
2219
+ {
2220
+ messageId : 'callbackPropsLast' ,
2221
+ line : 4 ,
2222
+ } ,
2223
+ ] ,
2224
+ } : [ ] ,
2225
+ semver . satisfies ( eslintPkg . version , '> 3' ) ? {
2226
+ code : `
2227
+ var Component = createReactClass({
2228
+ propTypes: {
2229
+ /* onChange */ onChange: React.PropTypes.func /* onChange */,
2230
+ /* a */ a: React.PropTypes.string /* a */,
2231
+ /* c */ c: React.PropTypes.string /* c */,
2232
+ /* b */ b: React.PropTypes.string /* b */,
2233
+ }
2234
+ });
2235
+ ` ,
2236
+ output : `
2237
+ var Component = createReactClass({
2238
+ propTypes: {
2239
+ /* a */ a: React.PropTypes.string /* a */,
2240
+ /* c */ c: React.PropTypes.string /* c */,
2241
+ /* b */ b: React.PropTypes.string /* b */,
2242
+ /* onChange */ onChange: React.PropTypes.func /* onChange */,
2243
+ }
2244
+ });
2245
+ ` ,
2246
+ options : [ { callbacksLast : true , noSortAlphabetically : true } ] ,
2247
+ errors : [
2248
+ {
2249
+ messageId : 'callbackPropsLast' ,
2250
+ line : 4 ,
2251
+ } ,
2252
+ ] ,
2180
2253
} : [ ]
2181
2254
) ) ,
2182
2255
} ) ;
0 commit comments