File tree Expand file tree Collapse file tree 2 files changed +14
-0
lines changed Expand file tree Collapse file tree 2 files changed +14
-0
lines changed Original file line number Diff line number Diff line change 1+ import { defaultConfig } from '../defaultConfig' ;
2+ import { Config } from '../types' ;
3+
4+ export function getGroupOrder ( config : Partial < Config > ) {
5+ const groups = new Set ( config ?. groupOrder || [ ] ) ;
6+ const uniqueGroups = Array . from ( groups ) ;
7+ return ! isValidGroupArgument ( uniqueGroups ) ? defaultConfig . groupOrder : uniqueGroups ;
8+ }
9+
10+ function isValidGroupArgument ( groups : string [ ] ) : boolean {
11+ return groups . length === defaultConfig . groupOrder . length && groups . every ( ( group ) => defaultConfig . groupOrder . includes ( group ) ) ;
12+ }
Original file line number Diff line number Diff line change 11import { sync } from 'glob' ;
22
3+ import { getGroupOrder } from './conductor/get-group-order' ;
34import { getThirdParty } from './conductor/get-third-party' ;
45import { defaultConfig } from './defaultConfig' ;
56import { CliConfig , Config } from './types' ;
@@ -17,6 +18,7 @@ export function resolveConfig(cliConfig: Partial<CliConfig>): Config {
1718 ...defaultConfig ,
1819 ...normalized ,
1920 thirdPartyDependencies : getThirdParty ( ) ,
21+ groupOrder : getGroupOrder ( normalized ) ,
2022 } ;
2123 if ( merged . ignore . length > 0 ) {
2224 merged . ignore = merged . ignore . map ( ( pattern ) => ( pattern . includes ( '*' ) ? sync ( pattern ) : pattern ) ) . flat ( ) ;
You can’t perform that action at this time.
0 commit comments