Skip to content

Commit d01b647

Browse files
committed
style(tsconfig): format code for better readability in type rewriting functions
1 parent bc97a7a commit d01b647

2 files changed

Lines changed: 9 additions & 3 deletions

File tree

packages/cli/src/migration/__tests__/migrator.spec.ts

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -859,7 +859,9 @@ describe('rewriteStandaloneProject — tsconfig types rewriting', () => {
859859
rewriteStandaloneProject(tmpDir, makeWorkspaceInfo(tmpDir, PackageManager.pnpm), true, true);
860860

861861
const tsconfig = readJson(path.join(tmpDir, 'tsconfig.json'));
862-
expect((tsconfig.compilerOptions as { types: string[] }).types).toContain('vite-plus/pack/client');
862+
expect((tsconfig.compilerOptions as { types: string[] }).types).toContain(
863+
'vite-plus/pack/client',
864+
);
863865
expect((tsconfig.compilerOptions as { types: string[] }).types).not.toContain('tsdown/client');
864866
});
865867

@@ -885,6 +887,8 @@ describe('rewriteStandaloneProject — tsconfig types rewriting', () => {
885887
rewriteStandaloneProject(tmpDir, makeWorkspaceInfo(tmpDir, PackageManager.pnpm), true, true);
886888

887889
const tsconfig = readJson(path.join(tmpDir, 'tsconfig.node.json'));
888-
expect((tsconfig.compilerOptions as { types: string[] }).types).toContain('vite-plus/pack/client');
890+
expect((tsconfig.compilerOptions as { types: string[] }).types).toContain(
891+
'vite-plus/pack/client',
892+
);
889893
});
890894
});

packages/cli/src/utils/tsconfig.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,9 @@ export function rewriteTypesInTsconfig(filePath: string): boolean {
8484
};
8585

8686
const toReplace = types
87-
.map((t, i) => (typeof t === 'string' && t in REPLACEMENTS ? { i, newVal: REPLACEMENTS[t] } : null))
87+
.map((t, i) =>
88+
typeof t === 'string' && t in REPLACEMENTS ? { i, newVal: REPLACEMENTS[t] } : null,
89+
)
8890
.filter((x): x is { i: number; newVal: string } => x !== null);
8991

9092
if (toReplace.length === 0) {

0 commit comments

Comments
 (0)