[ci] format

This commit is contained in:
matthewp 2022-09-15 13:53:30 +00:00 committed by fredkbot
parent fc885eaea1
commit c7c3cf7104
3 changed files with 6 additions and 9 deletions

View file

@ -554,16 +554,14 @@ async function tryLoadConfig(
} }
} }
function loadTSConfig( function loadTSConfig(cwd: string | undefined): tsr.TsConfigResult | undefined {
cwd: string | undefined for (const searchName of ['tsconfig.json', 'jsconfig.json']) {
): tsr.TsConfigResult | undefined {
for(const searchName of ['tsconfig.json', 'jsconfig.json']) {
const config = tsr.tsconfigResolverSync({ cwd, searchName }); const config = tsr.tsconfigResolverSync({ cwd, searchName });
if(config.exists) { if (config.exists) {
return config; return config;
} }
} }
return undefined return undefined;
} }
/** /**

View file

@ -12,7 +12,6 @@ export declare interface Alias {
/** Returns a path with its slashes replaced with posix slashes. */ /** Returns a path with its slashes replaced with posix slashes. */
const normalize = (pathname: string) => String(pathname).split(path.sep).join(path.posix.sep); const normalize = (pathname: string) => String(pathname).split(path.sep).join(path.posix.sep);
/** Returns a list of compiled aliases. */ /** Returns a list of compiled aliases. */
const getConfigAlias = (astroConfig: AstroConfig): Alias[] | null => { const getConfigAlias = (astroConfig: AstroConfig): Alias[] | null => {
/** Closest tsconfig.json or jsconfig.json */ /** Closest tsconfig.json or jsconfig.json */

View file

@ -16,7 +16,7 @@ import tagExportsPlugin from './tag.js';
type FixedCompilerOptions = TsConfigJson.CompilerOptions & { type FixedCompilerOptions = TsConfigJson.CompilerOptions & {
jsxImportSource?: string; jsxImportSource?: string;
} };
const JSX_EXTENSIONS = new Set(['.jsx', '.tsx', '.mdx']); const JSX_EXTENSIONS = new Set(['.jsx', '.tsx', '.mdx']);
const IMPORT_STATEMENTS: Record<string, string> = { const IMPORT_STATEMENTS: Record<string, string> = {
@ -229,7 +229,7 @@ export default function jsx({ config, logging }: AstroPluginJSXOptions): Plugin
} }
// Check the tsconfig // Check the tsconfig
if(!importSource) { if (!importSource) {
const compilerOptions = config._ctx.tsConfig?.compilerOptions; const compilerOptions = config._ctx.tsConfig?.compilerOptions;
importSource = (compilerOptions as FixedCompilerOptions | undefined)?.jsxImportSource; importSource = (compilerOptions as FixedCompilerOptions | undefined)?.jsxImportSource;
} }