11import { join , resolve } from 'node:path' ;
22import { pathToFileURL } from 'node:url' ;
3- import { getConfigState , type LoadedRstackConfig } from '../config.ts' ;
3+ import { getConfigState } from '../config.ts' ;
44import { insertConfigArg , parseArgs , parseCliArgs } from './args.ts' ;
55import { hasHelpFlag , printCommandHelp } from './help.ts' ;
66
@@ -156,16 +156,6 @@ async function runRslintCLI(args: string[]): Promise<void> {
156156 await runCLI ( { argv } ) ;
157157}
158158
159- const getLoadedConfig = async ( ) : Promise < LoadedRstackConfig > => {
160- // Rslint loads its one-shot config through Node's module cache. Import the
161- // same URL to read the Rstack config exported for the following fmt phase.
162- const configModule = ( await import (
163- pathToFileURL ( RSLINT_CONFIG_PATH ) . href
164- ) ) as typeof import ( '../rslintConfig.ts' ) ;
165-
166- return configModule . loadedConfig ;
167- } ;
168-
169159async function runCheckCLI ( args : string [ ] ) : Promise < void > {
170160 const { values } = parseArgs ( {
171161 args,
@@ -186,7 +176,11 @@ async function runCheckCLI(args: string[]): Promise<void> {
186176 return ;
187177 }
188178
189- const loadedConfig = await getLoadedConfig ( ) ;
179+ // Rslint loads its one-shot config through Node's module cache. Import the
180+ // same URL to read the Rstack config exported for the following fmt phase.
181+ const { loadedConfig } = ( await import (
182+ pathToFileURL ( RSLINT_CONFIG_PATH ) . href
183+ ) ) as typeof import ( '../rslintConfig.ts' ) ;
190184 const { runFmtCLI } = await import (
191185 /* rspackChunkName: 'fmt' */
192186 '../fmt/cli.ts'
0 commit comments