Skip to content

Commit 6ed4372

Browse files
committed
Linter fixes
1 parent 0b70a3f commit 6ed4372

File tree

2 files changed

+49
-25
lines changed

2 files changed

+49
-25
lines changed

src/migrate/migration-wizard.ts

Lines changed: 39 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,10 @@ export async function runMigrationWizard(
112112

113113
const packageJson = await getPackageDotJson(options);
114114

115-
const providerInstallation = detectProviderInstallation(packageJson, provider);
115+
const providerInstallation = detectProviderInstallation(
116+
packageJson,
117+
provider,
118+
);
116119

117120
if (!providerInstallation) {
118121
clack.log.warn(
@@ -131,7 +134,9 @@ export async function runMigrationWizard(
131134
}
132135
} else {
133136
clack.log.success(
134-
`Detected ${provider.name} installation: ${chalk.cyan(providerInstallation.packageName)}@${providerInstallation.version}`,
137+
`Detected ${provider.name} installation: ${chalk.cyan(
138+
providerInstallation.packageName,
139+
)}@${providerInstallation.version}`,
135140
);
136141
}
137142

@@ -323,7 +328,9 @@ async function uninstallPackages(
323328

324329
const uninstallSpinner = clack.spinner();
325330
uninstallSpinner.start(
326-
`Removing ${providerName} packages: ${packages.map((p) => p.packageName).join(', ')}`,
331+
`Removing ${providerName} packages: ${packages
332+
.map((p) => p.packageName)
333+
.join(', ')}`,
327334
);
328335

329336
try {
@@ -332,21 +339,27 @@ async function uninstallPackages(
332339
packageManager.name === 'yarn'
333340
? `yarn remove ${packageNames}`
334341
: packageManager.name === 'pnpm'
335-
? `pnpm remove ${packageNames}`
336-
: `npm uninstall ${packageNames}`;
342+
? `pnpm remove ${packageNames}`
343+
: `npm uninstall ${packageNames}`;
337344

338345
await new Promise<void>((resolve, reject) => {
339-
childProcess.exec(uninstallCommand, { cwd: options.installDir }, (err) => {
340-
if (err) {
341-
reject(err);
342-
} else {
343-
resolve();
344-
}
345-
});
346+
childProcess.exec(
347+
uninstallCommand,
348+
{ cwd: options.installDir },
349+
(err) => {
350+
if (err) {
351+
reject(err);
352+
} else {
353+
resolve();
354+
}
355+
},
356+
);
346357
});
347358

348359
uninstallSpinner.stop(
349-
`Removed ${providerName} packages: ${packages.map((p) => chalk.cyan(p.packageName)).join(', ')}`,
360+
`Removed ${providerName} packages: ${packages
361+
.map((p) => chalk.cyan(p.packageName))
362+
.join(', ')}`,
350363
);
351364

352365
analytics.capture('wizard interaction', {
@@ -468,8 +481,11 @@ async function migrateFiles({
468481
path.join(installDir, filePath),
469482
'utf8',
470483
);
471-
} catch (readError: any) {
472-
if (readError.code !== 'ENOENT') {
484+
} catch (readError: unknown) {
485+
if (
486+
readError instanceof Error &&
487+
(readError as NodeJS.ErrnoException).code !== 'ENOENT'
488+
) {
473489
clack.log.warn(`Error reading file ${filePath}`);
474490
continue;
475491
}
@@ -537,11 +553,11 @@ async function migrateFiles({
537553
}
538554

539555
function getMigrationOutroMessage({
540-
options,
556+
options: _options,
541557
cloudRegion,
542558
provider,
543559
addedEditorRules,
544-
packageManager,
560+
packageManager: _packageManager,
545561
envFileChanged,
546562
uploadedEnvVars,
547563
migratedFilesCount,
@@ -553,7 +569,9 @@ function getMigrationOutroMessage({
553569

554570
message += chalk.bold('What we did:\n');
555571
message += provider.defaultChanges;
556-
message += `\n• Migrated ${migratedFilesCount} file${migratedFilesCount !== 1 ? 's' : ''}`;
572+
message += `\n• Migrated ${migratedFilesCount} file${
573+
migratedFilesCount !== 1 ? 's' : ''
574+
}`;
557575

558576
if (envFileChanged) {
559577
message += `\n• Added environment variables to ${envFileChanged}`;
@@ -592,7 +610,9 @@ export async function checkAndOfferMigration(
592610
}
593611

594612
clack.log.warn(
595-
`Detected ${provider.name} SDK: ${chalk.cyan(installation.packageName)}@${installation.version}`,
613+
`Detected ${provider.name} SDK: ${chalk.cyan(installation.packageName)}@${
614+
installation.version
615+
}`,
596616
);
597617

598618
const shouldMigrate = await abortIfCancelled(

src/migrate/providers/amplitude.ts

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -25,15 +25,15 @@ function getMigrationDocs(options: MigrationDocsOptions): string {
2525
envVarPrefix === 'VITE_PUBLIC_'
2626
? 'import.meta.env.VITE_PUBLIC_POSTHOG_KEY'
2727
: envVarPrefix.startsWith('NEXT_PUBLIC_')
28-
? `process.env.NEXT_PUBLIC_POSTHOG_KEY`
29-
: `process.env.${envVarPrefix}POSTHOG_KEY`;
28+
? `process.env.NEXT_PUBLIC_POSTHOG_KEY`
29+
: `process.env.${envVarPrefix}POSTHOG_KEY`;
3030

3131
const hostText =
3232
envVarPrefix === 'VITE_PUBLIC_'
3333
? 'import.meta.env.VITE_PUBLIC_POSTHOG_HOST'
3434
: envVarPrefix.startsWith('NEXT_PUBLIC_')
35-
? `process.env.NEXT_PUBLIC_POSTHOG_HOST`
36-
: `process.env.${envVarPrefix}POSTHOG_HOST`;
35+
? `process.env.NEXT_PUBLIC_POSTHOG_HOST`
36+
: `process.env.${envVarPrefix}POSTHOG_HOST`;
3737

3838
return `
3939
==============================
@@ -278,7 +278,11 @@ const distinctId = posthog.get_distinct_id();
278278
--------------------------------------------------
279279
280280
==============================
281-
${framework === 'react' || framework === 'nextjs' ? getReactSpecificDocs(apiKeyText, hostText, language) : ''}
281+
${
282+
framework === 'react' || framework === 'nextjs'
283+
? getReactSpecificDocs(apiKeyText, hostText, language)
284+
: ''
285+
}
282286
==============================
283287
IMPORTANT MIGRATION NOTES
284288
==============================
@@ -311,7 +315,7 @@ IMPORTANT MIGRATION NOTES
311315
function getReactSpecificDocs(
312316
apiKeyText: string,
313317
hostText: string,
314-
language: 'typescript' | 'javascript',
318+
_language: 'typescript' | 'javascript',
315319
): string {
316320
return `
317321
REACT-SPECIFIC MIGRATION

0 commit comments

Comments
 (0)