@@ -745,6 +745,36 @@ ruleTester.run('order', rule, {
745
745
'newlines-between' : 'always' ,
746
746
} ] ,
747
747
} ) ,
748
+ test ( {
749
+ code : `
750
+ import { ReactElement, ReactNode } from 'react';
751
+
752
+ import { util } from 'Internal/lib';
753
+
754
+ import { parent } from '../parent';
755
+
756
+ import { sibling } from './sibling';
757
+ ` ,
758
+ options : [ {
759
+ alphabetize : {
760
+ caseInsensitive : true ,
761
+ order : 'asc' ,
762
+ } ,
763
+ pathGroups : [
764
+ { pattern : 'Internal/**/*' , group : 'internal' } ,
765
+ ] ,
766
+ groups : [
767
+ 'builtin' ,
768
+ 'external' ,
769
+ 'internal' ,
770
+ 'parent' ,
771
+ 'sibling' ,
772
+ 'index' ,
773
+ ] ,
774
+ 'newlines-between' : 'always' ,
775
+ pathGroupsExcludedImportTypes : [ ] ,
776
+ } ] ,
777
+ } ) ,
748
778
...flatMap ( getTSParsers , parser => [
749
779
// Order of the `import ... = require(...)` syntax
750
780
test ( {
@@ -2334,6 +2364,71 @@ context('TypeScript', function () {
2334
2364
} ,
2335
2365
parserConfig ,
2336
2366
) ,
2367
+ // Option alphabetize: {order: 'asc'} with type group & path group
2368
+ test (
2369
+ {
2370
+ // only: true,
2371
+ code : `
2372
+ import c from 'Bar';
2373
+ import a from 'foo';
2374
+
2375
+ import b from 'dirA/bar';
2376
+
2377
+ import index from './';
2378
+
2379
+ import type { C } from 'dirA/Bar';
2380
+ import type { A } from 'foo';
2381
+ ` ,
2382
+ parser,
2383
+ options : [
2384
+ {
2385
+ alphabetize : { order : 'asc' } ,
2386
+ groups : [ 'external' , 'internal' , 'index' , 'type' ] ,
2387
+ pathGroups : [
2388
+ {
2389
+ pattern : 'dirA/**' ,
2390
+ group : 'internal' ,
2391
+ } ,
2392
+ ] ,
2393
+ 'newlines-between' : 'always' ,
2394
+ pathGroupsExcludedImportTypes : [ 'type' ] ,
2395
+ } ,
2396
+ ] ,
2397
+ } ,
2398
+ parserConfig ,
2399
+ ) ,
2400
+ // Option alphabetize: {order: 'asc'} with path group
2401
+ test (
2402
+ {
2403
+ // only: true,
2404
+ code : `
2405
+ import c from 'Bar';
2406
+ import type { A } from 'foo';
2407
+ import a from 'foo';
2408
+
2409
+ import type { C } from 'dirA/Bar';
2410
+ import b from 'dirA/bar';
2411
+
2412
+ import index from './';
2413
+ ` ,
2414
+ parser,
2415
+ options : [
2416
+ {
2417
+ alphabetize : { order : 'asc' } ,
2418
+ groups : [ 'external' , 'internal' , 'index' ] ,
2419
+ pathGroups : [
2420
+ {
2421
+ pattern : 'dirA/**' ,
2422
+ group : 'internal' ,
2423
+ } ,
2424
+ ] ,
2425
+ 'newlines-between' : 'always' ,
2426
+ pathGroupsExcludedImportTypes : [ ] ,
2427
+ } ,
2428
+ ] ,
2429
+ } ,
2430
+ parserConfig ,
2431
+ ) ,
2337
2432
// Option alphabetize: {order: 'desc'} with type group
2338
2433
test (
2339
2434
{
0 commit comments