File tree Expand file tree Collapse file tree 1 file changed +10
-2
lines changed
@commitlint/load/src/utils Expand file tree Collapse file tree 1 file changed +10
-2
lines changed Original file line number Diff line number Diff line change 1- import { cosmiconfig } from 'cosmiconfig' ;
1+ import { cosmiconfig , type Loader } from 'cosmiconfig' ;
22import { TypeScriptLoader } from 'cosmiconfig-typescript-loader' ;
33import path from 'path' ;
44
@@ -13,7 +13,15 @@ export async function loadConfig(
1313 configPath ?: string
1414) : Promise < LoadConfigResult | null > {
1515 const moduleName = 'commitlint' ;
16- const tsLoader = TypeScriptLoader ( ) ;
16+
17+ let tsLoaderInstance : Loader | undefined ;
18+ const tsLoader : Loader = ( ...args ) => {
19+ if ( ! tsLoaderInstance ) {
20+ tsLoaderInstance = TypeScriptLoader ( ) ;
21+ }
22+ return tsLoaderInstance ( ...args ) ;
23+ } ;
24+
1725 const explorer = cosmiconfig ( moduleName , {
1826 searchPlaces : [
1927 // cosmiconfig overrides default searchPlaces if any new search place is added (For e.g. `*.ts` files),
You can’t perform that action at this time.
0 commit comments