@@ -1096,16 +1096,15 @@ ruleTester.run('order', rule, {
1096
1096
// orderImportKind option that is not used
1097
1097
test ( {
1098
1098
code : `
1099
- import B from './B';
1100
- import b from './b';
1101
- ` ,
1099
+ import B from './B';
1100
+ import b from './b';
1101
+ ` ,
1102
1102
options : [
1103
1103
{
1104
1104
'alphabetize' : { order : 'asc' , orderImportKind : 'asc' , 'caseInsensitive' : true } ,
1105
1105
} ,
1106
1106
] ,
1107
1107
} ) ,
1108
-
1109
1108
] ,
1110
1109
invalid : [
1111
1110
// builtin before external module (require)
@@ -3275,5 +3274,84 @@ flowRuleTester.run('order', rule, {
3275
3274
message : '`./local/sub` typeof import should occur before import of `./local/sub`' ,
3276
3275
} ] ,
3277
3276
} ) ,
3277
+ test ( {
3278
+ code : `
3279
+ import { cfg } from 'path/path/path/src/Cfg';
3280
+ import { l10n } from 'path/src/l10n';
3281
+ import { helpers } from 'path/path/path/helpers';
3282
+ import { tip } from 'path/path/tip';
3283
+
3284
+ import { controller } from '../../../../path/path/path/controller';
3285
+ import { component } from '../../../../path/path/path/component';
3286
+ ` ,
3287
+ output : semver . satisfies ( eslintPkg . version , '< 3' ) ? `
3288
+ import { cfg } from 'path/path/path/src/Cfg';
3289
+ import { tip } from 'path/path/tip';
3290
+ import { l10n } from 'path/src/l10n';
3291
+ import { helpers } from 'path/path/path/helpers';
3292
+
3293
+ import { component } from '../../../../path/path/path/component';
3294
+ import { controller } from '../../../../path/path/path/controller';
3295
+ ` : `
3296
+ import { helpers } from 'path/path/path/helpers';
3297
+ import { cfg } from 'path/path/path/src/Cfg';
3298
+ import { l10n } from 'path/src/l10n';
3299
+ import { tip } from 'path/path/tip';
3300
+
3301
+ import { component } from '../../../../path/path/path/component';
3302
+ import { controller } from '../../../../path/path/path/controller';
3303
+ ` ,
3304
+ options : [
3305
+ {
3306
+ 'groups' : [
3307
+ [ 'builtin' , 'external' ] ,
3308
+ 'internal' ,
3309
+ [ 'sibling' , 'parent' ] ,
3310
+ 'object' ,
3311
+ 'type' ,
3312
+ ] ,
3313
+ 'pathGroups' : [
3314
+ {
3315
+ 'pattern' : 'react' ,
3316
+ 'group' : 'builtin' ,
3317
+ 'position' : 'before' ,
3318
+ 'patternOptions' : {
3319
+ 'matchBase' : true ,
3320
+ } ,
3321
+ } ,
3322
+ {
3323
+ 'pattern' : '*.+(css|svg)' ,
3324
+ 'group' : 'type' ,
3325
+ 'position' : 'after' ,
3326
+ 'patternOptions' : {
3327
+ 'matchBase' : true ,
3328
+ } ,
3329
+ } ,
3330
+ ] ,
3331
+ 'pathGroupsExcludedImportTypes' : [ 'react' ] ,
3332
+ 'alphabetize' : {
3333
+ 'order' : 'asc' ,
3334
+ } ,
3335
+ 'newlines-between' : 'always' ,
3336
+ } ,
3337
+ ] ,
3338
+ errors : [
3339
+ {
3340
+ message : '`path/path/path/helpers` import should occur before import of `path/path/path/src/Cfg`' ,
3341
+ line : 4 ,
3342
+ column : 9 ,
3343
+ } ,
3344
+ {
3345
+ message : '`path/path/tip` import should occur before import of `path/src/l10n`' ,
3346
+ line : 5 ,
3347
+ column : 9 ,
3348
+ } ,
3349
+ {
3350
+ message : '`../../../../path/path/path/component` import should occur before import of `../../../../path/path/path/controller`' ,
3351
+ line : 8 ,
3352
+ column : 9 ,
3353
+ } ,
3354
+ ] ,
3355
+ } ) ,
3278
3356
] ,
3279
3357
} ) ;
0 commit comments