Skip to content

Commit 2591d56

Browse files
authored
Merge pull request #7112 from Shopify/03-26-chore_fix_87_eslint_warnings_across_the_codebase
chore: fix 87 eslint warnings across the codebase
2 parents e3b0758 + ccb06f4 commit 2591d56

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

60 files changed

+104
-136
lines changed

packages/app/src/cli/commands/app/app-logs/sources.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,10 +26,10 @@ export default class Sources extends AppLinkedCommand {
2626
userProvidedConfigName: flags.config,
2727
})
2828

29-
if (!app.errors.isEmpty()) {
30-
process.exit(2)
31-
} else {
29+
if (app.errors.isEmpty()) {
3230
sources(app)
31+
} else {
32+
process.exit(2)
3333
}
3434
return {app}
3535
}

packages/app/src/cli/commands/app/function/run.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,15 +56,15 @@ export default class FunctionRun extends AppUnlinkedCommand {
5656
if (targeting.length > 1 && isTTY({})) {
5757
const targets = targeting.map((target) => ({
5858
label: target.target,
59-
value: target.export || DEFAULT_FUNCTION_EXPORT,
59+
value: target.export || DEFAULT_FUNCTION_EXPORT, // eslint-disable-line @typescript-eslint/prefer-nullish-coalescing -- empty export should use default
6060
}))
6161

6262
functionExport = await renderAutocompletePrompt({
6363
message: `Which target would you like to execute?`,
6464
choices: targets,
6565
})
6666
} else {
67-
functionExport = targeting?.[0]?.export || DEFAULT_FUNCTION_EXPORT
67+
functionExport = targeting?.[0]?.export || DEFAULT_FUNCTION_EXPORT // eslint-disable-line @typescript-eslint/prefer-nullish-coalescing -- empty export should use default
6868
outputDebug(
6969
`Using export '${functionExport}'. Use the --export flag or an interactive terminal to select a different export.`,
7070
)

packages/app/src/cli/commands/app/webhook/trigger.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ export default class WebhookTrigger extends AppLinkedCommand {
106106
deliveryMethod: flags['delivery-method'],
107107
address: flags.address,
108108
clientId: flags['client-id'],
109-
clientSecret: flags['client-secret'] || flags['shared-secret'],
109+
clientSecret: flags['client-secret'] || flags['shared-secret'], // eslint-disable-line @typescript-eslint/prefer-nullish-coalescing -- empty flag should try next
110110
path: flags.path,
111111
config: flags.config,
112112
organizationId: appContextResult.organization.id,

packages/app/src/cli/models/app/identifiers.ts

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -52,11 +52,9 @@ export async function updateAppIdentifiers(
5252
): Promise<AppInterface> {
5353
let dotenvFile = app.dotenv
5454

55-
if (!dotenvFile) {
56-
dotenvFile = {
57-
path: joinPath(app.directory, getDotEnvFileName(app.configPath)),
58-
variables: {},
59-
}
55+
dotenvFile ??= {
56+
path: joinPath(app.directory, getDotEnvFileName(app.configPath)),
57+
variables: {},
6058
}
6159
const updatedVariables: {[key: string]: string} = {...(app.dotenv?.variables ?? {})}
6260
if (!systemEnvironment[app.idEnvironmentVariableName]) {

packages/app/src/cli/prompts/generate/extension.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ const generateExtensionPrompts = async (
9292

9393
const extensionTemplate = extensionTemplates.find((template) => template.identifier === templateType)!
9494

95-
const name = options.name || (await promptName(options.directory, extensionTemplate.defaultName))
95+
const name = options.name || (await promptName(options.directory, extensionTemplate.defaultName)) // eslint-disable-line @typescript-eslint/prefer-nullish-coalescing -- empty name should prompt
9696
const flavor = options.extensionFlavor ?? (await promptFlavor(extensionTemplate))
9797
const extensionContent = {name, flavor}
9898

packages/app/src/cli/prompts/init/init.ts

Lines changed: 11 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -84,18 +84,16 @@ const init = async (options: InitOptions): Promise<InitOutput> => {
8484
template: templates.reactRouter.url,
8585
} as const
8686

87-
if (!template) {
88-
template = await renderSelectPrompt({
89-
choices: templateOptionsInOrder.map((key) => {
90-
return {
91-
label: templates[key].label || key,
92-
value: key,
93-
}
94-
}),
95-
message: 'Get started building your app:',
96-
defaultValue: allTemplates.find((key) => templates[key].url === defaults.template),
97-
})
98-
}
87+
template ??= await renderSelectPrompt({
88+
choices: templateOptionsInOrder.map((key) => {
89+
return {
90+
label: templates[key].label || key, // eslint-disable-line @typescript-eslint/prefer-nullish-coalescing -- empty label should show key
91+
value: key,
92+
}
93+
}),
94+
message: 'Get started building your app:',
95+
defaultValue: allTemplates.find((key) => templates[key].url === defaults.template),
96+
})
9997

10098
const answers: InitOutput = {
10199
...options,
@@ -129,7 +127,7 @@ const init = async (options: InitOptions): Promise<InitOutput> => {
129127
selectedUrl = `${selectedUrl}#${branch}`
130128
}
131129

132-
answers.template = selectedUrl || answers.template || defaults.template
130+
answers.template = selectedUrl || answers.template || defaults.template // eslint-disable-line @typescript-eslint/prefer-nullish-coalescing -- empty URL should fall through
133131

134132
answers.globalCLIResult = await installGlobalCLIPrompt()
135133

packages/app/src/cli/services/app-context.ts

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -92,9 +92,7 @@ export async function linkedAppContext({
9292
const effectiveClientId = clientId ?? configClientId
9393

9494
// Fetch the remote app, using a different clientID if provided via flag.
95-
if (!remoteApp) {
96-
remoteApp = await appFromIdentifiers({apiKey: effectiveClientId})
97-
}
95+
remoteApp ??= await appFromIdentifiers({apiKey: effectiveClientId})
9896
const developerPlatformClient = remoteApp.developerPlatformClient
9997

10098
const organization = await fetchOrgFromId(remoteApp.organizationId, developerPlatformClient)

packages/app/src/cli/services/app-logs/dev/poll-app-logs.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,7 @@ export const pollAppLogs = async ({
130130
stdout,
131131
appLogsFetchInput: {
132132
jwtToken: nextJwtToken,
133-
cursor: responseCursor || cursor,
133+
cursor: responseCursor ?? cursor,
134134
},
135135
developerPlatformClient,
136136
resubscribeCallback,

packages/app/src/cli/services/app-logs/logs-command/poll-app-logs.test.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,13 +44,13 @@ const EMPTY_FILTERS = {status: undefined, sources: undefined}
4444
const createMockResponse = (data: any, status = 200, statusText = 'OK') => {
4545
if (status !== 200 || data.errors) {
4646
return {
47-
errors: data.errors || [`Error with status ${status}`],
47+
errors: data.errors ?? [`Error with status ${status}`],
4848
status,
4949
}
5050
}
5151

5252
return {
53-
app_logs: data.app_logs || [],
53+
app_logs: data.app_logs ?? [],
5454
cursor: data.cursor,
5555
status,
5656
}

packages/app/src/cli/services/app-logs/logs-command/render-json-logs.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ export async function renderJsonLogs({
8787
options: {variables, developerPlatformClient},
8888
pollOptions: {
8989
jwtToken: nextJwtToken || pollOptions.jwtToken,
90-
cursor: nextCursor || pollOptions.cursor,
90+
cursor: nextCursor ?? pollOptions.cursor,
9191
filters: pollOptions.filters,
9292
},
9393
storeNameById,

0 commit comments

Comments
 (0)