Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use @typescript-eslint's most robust rules. #4670

Merged
merged 5 commits into from
Oct 18, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 29 additions & 1 deletion .github/workflows/shopify-cli.yml
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ jobs:
matrix:
os: ['ubuntu-latest']
node: ['18.20.3']
target: ['build', 'type-check', 'lint']
target: ['build', 'type-check']
steps:
- uses: actions/checkout@v3
with:
Expand All @@ -127,6 +127,34 @@ jobs:
- name: ${{ matrix.target }}
run: pnpm nx run-many --all --skip-nx-cache --target=${{ matrix.target }} --output-style=stream

pr-platform-agnostic-lint:
name: '[PR] Run lint with Node ${{ matrix.node }} in ${{ matrix.os }}'
runs-on: ${{ matrix.os }}
if: ${{ github.event_name == 'pull_request' || github.event_name == 'merge_group' }}
timeout-minutes: 30
strategy:
matrix:
os: ['ubuntu-latest']
node: ['18.20.3']
steps:
- uses: actions/checkout@v3
with:
repository: ${{ github.event.pull_request.head.repo.full_name || github.event.repository.full_name }}
ref: ${{ github.event.pull_request.head.ref || github.event.merge_group.head_ref }}
fetch-depth: 1
- name: Setup deps
uses: ./.github/actions/setup-cli-deps
with:
node-version: ${{ matrix.node }}
- name: Lint
run: pnpm nx run-many --all --skip-nx-cache --target=lint --output-style=stream --format=json -o eslint-report.json
continue-on-error: true
- name: Annotate Code Linting Results
uses: ataylorme/eslint-annotate-action@21a1ba0738d8b732639999029c4ff40b6e121bb4 # pin@v3
with:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
report-json: "packages/*/eslint-report.json"

pr-platform-agnostic-bundle:
name: '[PR] Run bundle with Node ${{ matrix.node }} in ${{ matrix.os }}'
runs-on: ${{ matrix.os }}
Expand Down
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -166,3 +166,6 @@ testing.mjs

# NX
.nx

# ESLint reports
eslint-report.json
2 changes: 1 addition & 1 deletion packages/app/src/cli/models/app/app.ts
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@
allowDynamicallySpecifiedConfigs = false,
): ZodObjectOf<Omit<CurrentAppConfiguration, 'path'>> {
// eslint-disable-next-line @typescript-eslint/no-explicit-any
const schema = specs.reduce((schema, spec) => spec.contributeToAppConfigurationSchema(schema), AppSchema as any)
const schema = specs.reduce<any>((schema, spec) => spec.contributeToAppConfigurationSchema(schema), AppSchema)

if (allowDynamicallySpecifiedConfigs) {
return schema.passthrough()
Expand Down Expand Up @@ -326,8 +326,8 @@
this.errors = errors
this.usesWorkspaces = usesWorkspaces
this.specifications = specifications
this.configSchema = configSchema ?? AppSchema

Check warning on line 329 in packages/app/src/cli/models/app/app.ts

View workflow job for this annotation

GitHub Actions / ESLint Report Analysis

packages/app/src/cli/models/app/app.ts#L329

[@typescript-eslint/no-unnecessary-condition] Unnecessary conditional, expected left-hand side of `??` operator to be possibly null or undefined.
this.remoteFlags = remoteFlags ?? []

Check warning on line 330 in packages/app/src/cli/models/app/app.ts

View workflow job for this annotation

GitHub Actions / ESLint Report Analysis

packages/app/src/cli/models/app/app.ts#L330

[@typescript-eslint/no-unnecessary-condition] Unnecessary conditional, expected left-hand side of `??` operator to be possibly null or undefined.
}

get allExtensions() {
Expand Down Expand Up @@ -417,7 +417,7 @@
const frontendConfig = this.webs.find((web) => isWebType(web, WebType.Frontend))
const backendConfig = this.webs.find((web) => isWebType(web, WebType.Backend))

return Boolean(frontendConfig || backendConfig)

Check warning on line 420 in packages/app/src/cli/models/app/app.ts

View workflow job for this annotation

GitHub Actions / ESLint Report Analysis

packages/app/src/cli/models/app/app.ts#L420

[@typescript-eslint/prefer-nullish-coalescing] Prefer using nullish coalescing operator (`??`) instead of a logical or (`||`), as it is a safer operator.
}

creationDefaultOptions(): AppCreationDefaultOptions {
Expand Down
2 changes: 1 addition & 1 deletion packages/app/src/cli/models/app/loader.ts
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@

const configurationObject = preloadedContent ?? (await loadConfigurationFileContent(filepath, abortOrReport, decode))

if (!configurationObject) return fallbackOutput

Check warning on line 111 in packages/app/src/cli/models/app/loader.ts

View workflow job for this annotation

GitHub Actions / ESLint Report Analysis

packages/app/src/cli/models/app/loader.ts#L111

[@typescript-eslint/no-unnecessary-condition] Unnecessary conditional, value is always falsy.

const configuration = parseConfigurationObject(schema, filepath, configurationObject, abortOrReport)
return {...configuration, path: filepath}
Expand All @@ -117,7 +117,7 @@
export function parseHumanReadableError(issues: Pick<zod.ZodIssueBase, 'path' | 'message'>[]) {
let humanReadableError = ''
issues.forEach((issue) => {
const path = issue.path ? issue?.path.join('.') : 'n/a'

Check warning on line 120 in packages/app/src/cli/models/app/loader.ts

View workflow job for this annotation

GitHub Actions / ESLint Report Analysis

packages/app/src/cli/models/app/loader.ts#L120

[@typescript-eslint/no-unnecessary-condition] Unnecessary conditional, value is always truthy.

Check warning on line 120 in packages/app/src/cli/models/app/loader.ts

View workflow job for this annotation

GitHub Actions / ESLint Report Analysis

packages/app/src/cli/models/app/loader.ts#L120

[@typescript-eslint/no-unnecessary-condition] Unnecessary optional chain on a non-nullish value.
humanReadableError += `• [${path}]: ${issue.message}\n`
})
return humanReadableError
Expand Down Expand Up @@ -339,7 +339,7 @@
private findSpecificationForType(type: string) {
return this.specifications.find(
(spec) =>
spec.identifier === type || spec.externalIdentifier === type || spec.additionalIdentifiers?.includes(type),

Check warning on line 342 in packages/app/src/cli/models/app/loader.ts

View workflow job for this annotation

GitHub Actions / ESLint Report Analysis

packages/app/src/cli/models/app/loader.ts#L342

[@typescript-eslint/no-unnecessary-condition] Unnecessary optional chain on a non-nullish value.
)
}

Expand Down Expand Up @@ -433,11 +433,11 @@
if (specification) {
usedKnownSpecification = true
} else {
return this.abortOrReport(
outputContent`Invalid extension type "${type}" in "${relativizePath(configurationPath)}"`,
undefined,
configurationPath,
)

Check warning on line 440 in packages/app/src/cli/models/app/loader.ts

View workflow job for this annotation

GitHub Actions / ESLint Report Analysis

packages/app/src/cli/models/app/loader.ts#L436-L440

[@typescript-eslint/no-confusing-void-expression] Returning a void expression from a function is forbidden. Please move it before the `return` statement.
}

const configuration = parseConfigurationObjectAgainstSpecification(
Expand All @@ -447,7 +447,7 @@
this.abortOrReport.bind(this),
)

if (usedKnownSpecification) {

Check warning on line 450 in packages/app/src/cli/models/app/loader.ts

View workflow job for this annotation

GitHub Actions / ESLint Report Analysis

packages/app/src/cli/models/app/loader.ts#L450

[@typescript-eslint/no-unnecessary-condition] Unnecessary conditional, value is always truthy.
entryPath = await this.findEntryPath(directory, specification)
}

Expand All @@ -459,7 +459,7 @@
specification,
})

if (usedKnownSpecification) {

Check warning on line 462 in packages/app/src/cli/models/app/loader.ts

View workflow job for this annotation

GitHub Actions / ESLint Report Analysis

packages/app/src/cli/models/app/loader.ts#L462

[@typescript-eslint/no-unnecessary-condition] Unnecessary conditional, value is always truthy.
const validateResult = await extensionInstance.validate()
if (validateResult.isErr()) {
this.abortOrReport(outputContent`\n${validateResult.error}`, undefined, configurationPath)
Expand Down Expand Up @@ -549,13 +549,13 @@
// Legacy toml file with a single extension.
return this.createExtensionInstance(type, obj, configurationPath, directory)
} else {
return this.abortOrReport(
outputContent`Invalid extension type at "${outputToken.path(
relativePath(appDirectory, configurationPath),
)}". Please specify a type.`,
undefined,
configurationPath,
)

Check warning on line 558 in packages/app/src/cli/models/app/loader.ts

View workflow job for this annotation

GitHub Actions / ESLint Report Analysis

packages/app/src/cli/models/app/loader.ts#L552-L558

[@typescript-eslint/no-confusing-void-expression] Returning a void expression from a function is forbidden. Please move it before the `return` statement.
}
})
}
Expand Down Expand Up @@ -633,7 +633,7 @@
}
return extensionInstancesWithKeys
.filter(([instance]) => instance)
.map(([instance]) => instance as ExtensionInstance)

Check warning on line 636 in packages/app/src/cli/models/app/loader.ts

View workflow job for this annotation

GitHub Actions / ESLint Report Analysis

packages/app/src/cli/models/app/loader.ts#L636

[@typescript-eslint/non-nullable-type-assertion-style] Use a ! assertion to more succinctly remove null and undefined from the type.
}

private async validateConfigurationExtensionInstance(
Expand All @@ -654,7 +654,7 @@
await Promise.all(
['index']
.flatMap((name) => [`${name}.js`, `${name}.jsx`, `${name}.ts`, `${name}.tsx`])
.flatMap((fileName) => [`src/${fileName}`, `${fileName}`])
.flatMap((fileName) => [`src/${fileName}`, fileName])
.map((relativePath) => joinPath(directory, relativePath))
.map(async (sourcePath) => ((await fileExists(sourcePath)) ? sourcePath : undefined)),
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@
this.uid = this.configuration.uid ?? randomUUID()

if (this.features.includes('esbuild') || this.type === 'tax_calculation') {
this.outputPath = joinPath(this.directory, 'dist', `${this.outputFileName}`)
this.outputPath = joinPath(this.directory, 'dist', this.outputFileName)
}

if (this.isFunctionExtension) {
Expand Down Expand Up @@ -230,7 +230,7 @@
if (this.specification.getBundleExtensionStdinContent) {
return this.specification.getBundleExtensionStdinContent(this.configuration)
}
const relativeImportPath = this.entrySourceFilePath?.replace(this.directory, '')

Check warning on line 233 in packages/app/src/cli/models/extensions/extension-instance.ts

View workflow job for this annotation

GitHub Actions / ESLint Report Analysis

packages/app/src/cli/models/extensions/extension-instance.ts#L233

[@typescript-eslint/no-unnecessary-condition] Unnecessary optional chain on a non-nullish value.
return `import '.${relativeImportPath}';`
}

Expand All @@ -239,7 +239,7 @@
}

hasExtensionPointTarget(target: string): boolean {
return this.specification.hasExtensionPointTarget?.(this.configuration, target) || false

Check warning on line 242 in packages/app/src/cli/models/extensions/extension-instance.ts

View workflow job for this annotation

GitHub Actions / ESLint Report Analysis

packages/app/src/cli/models/extensions/extension-instance.ts#L242

[@typescript-eslint/prefer-nullish-coalescing] Prefer using nullish coalescing operator (`??`) instead of a logical or (`||`), as it is a safer operator.
}

// Functions specific properties
Expand All @@ -257,7 +257,7 @@
return null
}

const watchPaths: string[] = configuredPaths ?? []

Check warning on line 260 in packages/app/src/cli/models/extensions/extension-instance.ts

View workflow job for this annotation

GitHub Actions / ESLint Report Analysis

packages/app/src/cli/models/extensions/extension-instance.ts#L260

[@typescript-eslint/no-unnecessary-condition] Unnecessary conditional, expected left-hand side of `??` operator to be possibly null or undefined.
if (this.isJavaScript && configuredPaths.length === 0) {
watchPaths.push(joinPath('src', '**', '*.{js,ts}'))
}
Expand Down Expand Up @@ -291,7 +291,7 @@
}

get isJavaScript() {
return Boolean(this.entrySourceFilePath?.endsWith('.js') || this.entrySourceFilePath?.endsWith('.ts'))

Check warning on line 294 in packages/app/src/cli/models/extensions/extension-instance.ts

View workflow job for this annotation

GitHub Actions / ESLint Report Analysis

packages/app/src/cli/models/extensions/extension-instance.ts#L294

[@typescript-eslint/no-unnecessary-condition] Unnecessary optional chain on a non-nullish value.

Check warning on line 294 in packages/app/src/cli/models/extensions/extension-instance.ts

View workflow job for this annotation

GitHub Actions / ESLint Report Analysis

packages/app/src/cli/models/extensions/extension-instance.ts#L294

[@typescript-eslint/no-unnecessary-condition] Unnecessary optional chain on a non-nullish value.
}

async build(options: ExtensionBuildOptions): Promise<void> {
Expand All @@ -314,7 +314,7 @@

async buildForBundle(options: ExtensionBuildOptions, bundleDirectory: string, identifiers?: Identifiers) {
const extensionId = identifiers?.extensions[this.localIdentifier] ?? this.configuration.uid ?? this.handle
const outputFile = this.isThemeExtension ? '' : joinPath('dist', `${this.outputFileName}`)
const outputFile = this.isThemeExtension ? '' : joinPath('dist', this.outputFileName)

if (this.features.includes('bundling')) {
// Modules that are going to be inclued in the bundle should be built in the bundle directory
Expand All @@ -328,7 +328,7 @@
}

get singleTarget() {
const targets = (getPathValue(this.configuration, 'targeting') as {target: string}[]) ?? []

Check warning on line 331 in packages/app/src/cli/models/extensions/extension-instance.ts

View workflow job for this annotation

GitHub Actions / ESLint Report Analysis

packages/app/src/cli/models/extensions/extension-instance.ts#L331

[@typescript-eslint/no-unnecessary-condition] Unnecessary conditional, expected left-hand side of `??` operator to be possibly null or undefined.

Check warning on line 331 in packages/app/src/cli/models/extensions/extension-instance.ts

View workflow job for this annotation

GitHub Actions / ESLint Report Analysis

packages/app/src/cli/models/extensions/extension-instance.ts#L331

[@typescript-eslint/non-nullable-type-assertion-style] Use a ! assertion to more succinctly remove null and undefined from the type.
if (targets.length !== 1) return undefined
return targets[0]?.target
}
Expand Down Expand Up @@ -372,7 +372,7 @@
case 'single':
return slugify(this.specification.identifier)
case 'uuid':
return this.configuration.handle ?? slugify(this.configuration.name ?? '')

Check warning on line 375 in packages/app/src/cli/models/extensions/extension-instance.ts

View workflow job for this annotation

GitHub Actions / ESLint Report Analysis

packages/app/src/cli/models/extensions/extension-instance.ts#L375

[@typescript-eslint/no-unnecessary-condition] Unnecessary conditional, expected left-hand side of `??` operator to be possibly null or undefined.
case 'dynamic':
// Hardcoded temporal solution for webhooks
const subscription = this.configuration as unknown as SingleWebhookSubscriptionType
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
import {deepCompare, getPathValue} from '@shopify/cli-kit/common/object'

export function transformFromWebhookConfig(content: object) {
const webhooks = getPathValue(content, 'webhooks') as WebhooksConfig

Check warning on line 5 in packages/app/src/cli/models/extensions/specifications/transform/app_config_webhook.ts

View workflow job for this annotation

GitHub Actions / ESLint Report Analysis

packages/app/src/cli/models/extensions/specifications/transform/app_config_webhook.ts#L5

[@typescript-eslint/non-nullable-type-assertion-style] Use a ! assertion to more succinctly remove null and undefined from the type.
if (!webhooks) return content

Check warning on line 6 in packages/app/src/cli/models/extensions/specifications/transform/app_config_webhook.ts

View workflow job for this annotation

GitHub Actions / ESLint Report Analysis

packages/app/src/cli/models/extensions/specifications/transform/app_config_webhook.ts#L6

[@typescript-eslint/no-unnecessary-condition] Unnecessary conditional, value is always falsy.

// eslint-disable-next-line @typescript-eslint/naming-convention
const {api_version} = webhooks
Expand All @@ -13,7 +13,7 @@

export function transformToWebhookConfig(content: object) {
let webhooks = {}
const apiVersion = getPathValue(content, 'api_version') as string

Check warning on line 16 in packages/app/src/cli/models/extensions/specifications/transform/app_config_webhook.ts

View workflow job for this annotation

GitHub Actions / ESLint Report Analysis

packages/app/src/cli/models/extensions/specifications/transform/app_config_webhook.ts#L16

[@typescript-eslint/non-nullable-type-assertion-style] Use a ! assertion to more succinctly remove null and undefined from the type.
webhooks = {...(apiVersion ? {webhooks: {api_version: apiVersion}} : {})}
return webhooks
}
Expand Down Expand Up @@ -77,10 +77,10 @@
subscriptions: WebhookSubscription[],
property?: keyof Pick<WebhookSubscription, 'topics' | 'compliance_topics'>,
) {
return subscriptions.reduce((accumulator, subscription) => {
return subscriptions.reduce<WebhookSubscription[]>((accumulator, subscription) => {
const existingSubscription = findSubscription(accumulator, subscription)
if (existingSubscription) {
if (property && subscription?.[property]?.length) {

Check warning on line 83 in packages/app/src/cli/models/extensions/specifications/transform/app_config_webhook.ts

View workflow job for this annotation

GitHub Actions / ESLint Report Analysis

packages/app/src/cli/models/extensions/specifications/transform/app_config_webhook.ts#L83

[@typescript-eslint/no-unnecessary-condition] Unnecessary optional chain on a non-nullish value.
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
existingSubscription[property]?.push(...subscription[property]!)
} else {
Expand All @@ -97,5 +97,5 @@
accumulator.push(subscription)
}
return accumulator
}, [] as WebhookSubscription[])
}, [])
}
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@

export function extensionUuidToHandle(config: Config, allExtensions: ExtensionRegistration[]) {
const uiExtensionHandle = config.ui_extension_handle
if (uiExtensionHandle || 'ui_extension_registration_uuid' in config === false) {
if (uiExtensionHandle || !('ui_extension_registration_uuid' in config)) {

Check warning on line 16 in packages/app/src/cli/models/extensions/specifications/transform/extension_uuid_to_handle.ts

View workflow job for this annotation

GitHub Actions / ESLint Report Analysis

packages/app/src/cli/models/extensions/specifications/transform/extension_uuid_to_handle.ts#L16

[@typescript-eslint/prefer-nullish-coalescing] Prefer using nullish coalescing operator (`??`) instead of a logical or (`||`), as it is a safer operator.
return uiExtensionHandle
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
return {
target: targeting.target,
module: targeting.module,
metafields: targeting.metafields ?? config.metafields ?? [],

Check warning on line 31 in packages/app/src/cli/models/extensions/specifications/ui_extension.ts

View workflow job for this annotation

GitHub Actions / ESLint Report Analysis

packages/app/src/cli/models/extensions/specifications/ui_extension.ts#L31

[@typescript-eslint/no-unnecessary-condition] Unnecessary conditional, expected left-hand side of `??` operator to be possibly null or undefined.
default_placement_reference: targeting.default_placement,
capabilities: targeting.capabilities,
}
Expand All @@ -43,7 +43,7 @@
appModuleFeatures: (config) => {
const basic: ExtensionFeature[] = ['ui_preview', 'bundling', 'esbuild']
const needsCart =
config?.extension_points?.find((extensionPoint) => {

Check warning on line 46 in packages/app/src/cli/models/extensions/specifications/ui_extension.ts

View workflow job for this annotation

GitHub Actions / ESLint Report Analysis

packages/app/src/cli/models/extensions/specifications/ui_extension.ts#L46

[@typescript-eslint/no-unnecessary-condition] Unnecessary optional chain on a non-nullish value.
return getExtensionPointTargetSurface(extensionPoint.target) === 'checkout'
}) !== undefined
return needsCart ? [...basic, 'cart_url'] : basic
Expand Down Expand Up @@ -83,7 +83,7 @@
const uniqueTargets: string[] = []
const duplicateTargets: string[] = []

if (!extensionPoints || extensionPoints.length === 0) {

Check warning on line 86 in packages/app/src/cli/models/extensions/specifications/ui_extension.ts

View workflow job for this annotation

GitHub Actions / ESLint Report Analysis

packages/app/src/cli/models/extensions/specifications/ui_extension.ts#L86

[@typescript-eslint/no-unnecessary-condition] Unnecessary conditional, value is always falsy.
return err(missingExtensionPointsMessage)
}

Expand All @@ -100,11 +100,11 @@
)
}

if (uniqueTargets.indexOf(target) === -1) {
if (!uniqueTargets.includes(target)) {
uniqueTargets.push(target)
} else {
duplicateTargets.push(target)
}

Check warning on line 107 in packages/app/src/cli/models/extensions/specifications/ui_extension.ts

View workflow job for this annotation

GitHub Actions / ESLint Report Analysis

packages/app/src/cli/models/extensions/specifications/ui_extension.ts#L103-L107

[no-negated-condition] Unexpected negated condition.
}

if (duplicateTargets.length) {
Expand Down
2 changes: 1 addition & 1 deletion packages/app/src/cli/prompts/init/init.ts
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@
template = await renderSelectPrompt({
choices: templateOptionsInOrder.map((key) => {
return {
label: templates[key].label || key,

Check warning on line 83 in packages/app/src/cli/prompts/init/init.ts

View workflow job for this annotation

GitHub Actions / ESLint Report Analysis

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

[@typescript-eslint/prefer-nullish-coalescing] Prefer using nullish coalescing operator (`??`) instead of a logical or (`||`), as it is a safer operator.
value: key,
}
}),
Expand Down Expand Up @@ -118,10 +118,10 @@
}

if (branch) {
selectedUrl += `#${branch}`
selectedUrl = `${selectedUrl}#${branch}`
}

answers.template = selectedUrl || answers.template || defaults.template

Check warning on line 124 in packages/app/src/cli/prompts/init/init.ts

View workflow job for this annotation

GitHub Actions / ESLint Report Analysis

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

[@typescript-eslint/prefer-nullish-coalescing] Prefer using nullish coalescing operator (`??`) instead of a logical or (`||`), as it is a safer operator.

answers.globalCLIResult = await installGlobalCLIPrompt()

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ export const pollAppLogs = async ({jwtToken, cursor, filters}: PollOptions): Pro
}
if (response.status === 401 || response.status === 429 || response.status >= 500) {
return {
errors: [{status: response.status, message: `${errorResponse.errors.join(', ')}`}],
errors: [{status: response.status, message: errorResponse.errors.join(', ')}],
}
} else {
throw new AbortError(`${errorResponse.errors.join(', ')} while fetching app logs`)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ const Logs: FunctionComponent<LogsProps> = ({pollOptions: {jwtToken, filters}, r
<Text>
<Text color="green">{prefix.logTimestamp} </Text>
<Text color="blueBright">{`${prefix.storeName.split('.')[0]}`} </Text>
<Text color="blueBright">{`${prefix.source}`} </Text>
<Text color="blueBright">{prefix.source} </Text>
<Text color={prefix.status === 'Success' ? 'green' : 'red'}>{prefix.status} </Text>
<Text>{prefix.description}</Text>
</Text>
Expand Down
10 changes: 2 additions & 8 deletions packages/app/src/cli/services/build/theme-check.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,15 +50,9 @@ function formatOffenses(offenses: Offense[]): TokenItem {
const codeSnippet = getSnippet(absolutePath, start.line, end.line)

// Ensure enough padding between offenses
const offensePadding = `${index === offenses.length - 1 ? '' : '\n\n'}`
const offensePadding = index === offenses.length - 1 ? '' : '\n\n'

return [
severityToToken(severity),
{bold: `${check}`},
{subdued: `\n${message}`},
`\n\n${codeSnippet}`,
offensePadding,
]
return [severityToToken(severity), {bold: check}, {subdued: `\n${message}`}, `\n\n${codeSnippet}`, offensePadding]
})

return offenseBodies.flat()
Expand Down
8 changes: 4 additions & 4 deletions packages/app/src/cli/services/deploy/upload.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@
handle: themeExtension.handle,
}
const result = await developerPlatformClient.updateExtension(themeExtensionInput)
if (result.extensionUpdateDraft?.userErrors && result.extensionUpdateDraft?.userErrors.length > 0) {

Check warning on line 51 in packages/app/src/cli/services/deploy/upload.ts

View workflow job for this annotation

GitHub Actions / ESLint Report Analysis

packages/app/src/cli/services/deploy/upload.ts#L51

[@typescript-eslint/no-unnecessary-condition] Unnecessary optional chain on a non-nullish value.
const errors = result.extensionUpdateDraft.userErrors.map((error) => error.message).join(', ')
throw new AbortError(errors)
}
Expand Down Expand Up @@ -163,7 +163,7 @@

const result: AppDeploySchema = await handlePartnersErrors(() => options.developerPlatformClient.deploy(variables))

if (result.appDeploy?.userErrors?.length > 0) {

Check warning on line 166 in packages/app/src/cli/services/deploy/upload.ts

View workflow job for this annotation

GitHub Actions / ESLint Report Analysis

packages/app/src/cli/services/deploy/upload.ts#L166

[@typescript-eslint/no-unnecessary-condition] Unnecessary optional chain on a non-nullish value.

Check warning on line 166 in packages/app/src/cli/services/deploy/upload.ts

View workflow job for this annotation

GitHub Actions / ESLint Report Analysis

packages/app/src/cli/services/deploy/upload.ts#L166

[@typescript-eslint/no-unnecessary-condition] Unnecessary optional chain on a non-nullish value.
const customSections: AlertCustomSection[] = deploymentErrorsToCustomSections(
result.appDeploy.userErrors,
options.extensionIds,
Expand All @@ -172,7 +172,7 @@
},
)

if (result.appDeploy.appVersion) {

Check warning on line 175 in packages/app/src/cli/services/deploy/upload.ts

View workflow job for this annotation

GitHub Actions / ESLint Report Analysis

packages/app/src/cli/services/deploy/upload.ts#L175

[@typescript-eslint/no-unnecessary-condition] Unnecessary conditional, value is always truthy.
deployError = result.appDeploy.userErrors.map((error) => error.message).join(', ')
} else {
throw new AbortError({bold: "Version couldn't be created."}, null, [], customSections)
Expand Down Expand Up @@ -205,12 +205,12 @@
} = {},
): ErrorCustomSection[] {
const isExtensionError = (error: (typeof errors)[0]) => {
return error.details?.some((detail) => detail.extension_id) ?? false

Check warning on line 208 in packages/app/src/cli/services/deploy/upload.ts

View workflow job for this annotation

GitHub Actions / ESLint Report Analysis

packages/app/src/cli/services/deploy/upload.ts#L208

[@typescript-eslint/no-unnecessary-condition] Unnecessary conditional, expected left-hand side of `??` operator to be possibly null or undefined.

Check warning on line 208 in packages/app/src/cli/services/deploy/upload.ts

View workflow job for this annotation

GitHub Actions / ESLint Report Analysis

packages/app/src/cli/services/deploy/upload.ts#L208

[@typescript-eslint/no-unnecessary-condition] Unnecessary optional chain on a non-nullish value.
}

const isCliError = (error: (typeof errors)[0], extensionIds: IdentifiersExtensions) => {
const errorExtensionId =
error.details?.find((detail) => typeof detail.extension_id !== 'undefined')?.extension_id.toString() ?? ''

Check warning on line 213 in packages/app/src/cli/services/deploy/upload.ts

View workflow job for this annotation

GitHub Actions / ESLint Report Analysis

packages/app/src/cli/services/deploy/upload.ts#L213

[@typescript-eslint/no-unnecessary-condition] Unnecessary optional chain on a non-nullish value.

return Object.values(extensionIds).includes(errorExtensionId)
}
Expand Down Expand Up @@ -272,7 +272,7 @@
}

function cliErrorsSections(errors: AppDeploySchema['appDeploy']['userErrors'], identifiers: IdentifiersExtensions) {
return errors.reduce((sections, error) => {
return errors.reduce<ErrorCustomSection[]>((sections, error) => {
const field = (error.field ?? ['unknown']).join('.').replace('extension_points', 'extensions.targeting')
const errorMessage = field === 'base' ? error.message : `${field}: ${error.message}`

Expand Down Expand Up @@ -343,12 +343,12 @@
})

return sections
}, [] as ErrorCustomSection[])
}, [])
}

function partnersErrorsSections(errors: AppDeploySchema['appDeploy']['userErrors']) {
return errors
.reduce((sections, error) => {
.reduce<{title: string | undefined; errorCount: number}[]>((sections, error) => {
const extensionIdentifier = error.details.find(
(detail) => typeof detail.extension_title !== 'undefined',
)?.extension_title
Expand All @@ -365,7 +365,7 @@
}

return sections
}, [] as {title: string | undefined; errorCount: number}[])
}, [])
.map((section) => ({
title: section.title,
body: `\n${section.errorCount} error${
Expand All @@ -384,7 +384,7 @@
) {
const result: AssetUrlSchema = await handlePartnersErrors(() => developerPlatformClient.generateSignedUploadUrl(app))

if (!result.assetUrl || result.userErrors?.length > 0) {

Check warning on line 387 in packages/app/src/cli/services/deploy/upload.ts

View workflow job for this annotation

GitHub Actions / ESLint Report Analysis

packages/app/src/cli/services/deploy/upload.ts#L387

[@typescript-eslint/no-unnecessary-condition] Unnecessary optional chain on a non-nullish value.
const errors = result.userErrors.map((error) => error.message).join(', ')
throw new AbortError(errors)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -90,9 +90,11 @@
isNewExtensionPointsSchema(foundExtension.extensionPoints) &&
isNewExtensionPointsSchema(rawPayloadExtension.extensionPoints)
) {
const foundExtensionPointsPayloadMap = foundExtension.extensionPoints.reduce((acc, ex) => {
const foundExtensionPointsPayloadMap = foundExtension.extensionPoints.reduce<{
[key: string]: DevNewExtensionPointSchema
}>((acc, ex) => {
return {...acc, [ex.target]: ex}
}, {} as {[key: string]: DevNewExtensionPointSchema})
}, {})

rawPayloadExtension.extensionPoints = deepMergeObjects(
rawPayloadExtension.extensionPoints,
Expand Down Expand Up @@ -144,7 +146,7 @@

payloadExtensions[index] = await getUIExtensionPayload(extension, {
...this.options,
currentDevelopmentPayload: development || {status: payloadExtensions[index]?.development.status},

Check warning on line 149 in packages/app/src/cli/services/dev/extension/payload/store.ts

View workflow job for this annotation

GitHub Actions / ESLint Report Analysis

packages/app/src/cli/services/dev/extension/payload/store.ts#L149

[@typescript-eslint/prefer-nullish-coalescing] Prefer using nullish coalescing operator (`??`) instead of a logical or (`||`), as it is a safer operator.
currentLocalizationPayload: payloadExtensions[index]?.localization,
})

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@
const exists = await fileExists(filePath)

if (!exists) {
return sendError(response, {statusCode: 404, statusMessage: `Not Found: ${filePath}`})

Check warning on line 48 in packages/app/src/cli/services/dev/extension/server/middlewares.ts

View workflow job for this annotation

GitHub Actions / ESLint Report Analysis

packages/app/src/cli/services/dev/extension/server/middlewares.ts#L48

[@typescript-eslint/no-confusing-void-expression] Returning a void expression from a function is forbidden. Please move it before the `return` statement.
}

const fileContent = await readFile(filePath)
Expand All @@ -67,7 +67,7 @@
} as const

const extensionName = extname(filePath) as keyof typeof extensionToContent
const contentType = extensionToContent[extensionName] || 'text/plain'

Check warning on line 70 in packages/app/src/cli/services/dev/extension/server/middlewares.ts

View workflow job for this annotation

GitHub Actions / ESLint Report Analysis

packages/app/src/cli/services/dev/extension/server/middlewares.ts#L70

[@typescript-eslint/no-unnecessary-condition] Unnecessary conditional, value is always truthy.

response.setHeader('Content-Type', contentType)
response.writeHead(200)
Expand All @@ -80,13 +80,13 @@
const extension = devOptions.extensions.find((extension) => extension.devUUID === extensionId)

if (!extension) {
return sendError(response, {
statusCode: 404,
statusMessage: `Extension with id ${extensionId} not found`,
})

Check warning on line 86 in packages/app/src/cli/services/dev/extension/server/middlewares.ts

View workflow job for this annotation

GitHub Actions / ESLint Report Analysis

packages/app/src/cli/services/dev/extension/server/middlewares.ts#L83-L86

[@typescript-eslint/no-confusing-void-expression] Returning a void expression from a function is forbidden. Please move it before the `return` statement.
}

const buildDirectory = extension.outputPath.replace(`${extension.outputFileName}`, '')
const buildDirectory = extension.outputPath.replace(extension.outputFileName, '')

return fileServerMiddleware(request, response, next, {
filePath: joinPath(buildDirectory, assetPath),
Expand All @@ -112,10 +112,10 @@
})

if (!rootDirectory) {
return sendError(response, {
statusCode: 404,
statusMessage: `Could not find root directory for dev console`,
})

Check warning on line 118 in packages/app/src/cli/services/dev/extension/server/middlewares.ts

View workflow job for this annotation

GitHub Actions / ESLint Report Analysis

packages/app/src/cli/services/dev/extension/server/middlewares.ts#L115-L118

[@typescript-eslint/no-confusing-void-expression] Returning a void expression from a function is forbidden. Please move it before the `return` statement.
}

return fileServerMiddleware(request, response, next, {
Expand All @@ -136,10 +136,10 @@
})

if (!rootDirectory) {
return sendError(response, {
statusCode: 404,
statusMessage: `Could not find root directory for dev console asset`,
})

Check warning on line 142 in packages/app/src/cli/services/dev/extension/server/middlewares.ts

View workflow job for this annotation

GitHub Actions / ESLint Report Analysis

packages/app/src/cli/services/dev/extension/server/middlewares.ts#L139-L142

[@typescript-eslint/no-confusing-void-expression] Returning a void expression from a function is forbidden. Please move it before the `return` statement.
}

return fileServerMiddleware(request, response, next, {
Expand All @@ -160,10 +160,10 @@
const extension = devOptions.extensions.find((extension) => extension.devUUID === extensionID)

if (!extension) {
return sendError(response, {
statusCode: 404,
statusMessage: `Extension with id ${extensionID} not found`,
})

Check warning on line 166 in packages/app/src/cli/services/dev/extension/server/middlewares.ts

View workflow job for this annotation

GitHub Actions / ESLint Report Analysis

packages/app/src/cli/services/dev/extension/server/middlewares.ts#L163-L166

[@typescript-eslint/no-confusing-void-expression] Returning a void expression from a function is forbidden. Please move it before the `return` statement.
}

if (request.headers.accept?.startsWith('text/html')) {
Expand Down Expand Up @@ -214,25 +214,25 @@
const extension = devOptions.extensions.find((extension) => extension.devUUID === extensionID)

if (!extension) {
return sendError(response, {
statusCode: 404,
statusMessage: `Extension with id ${extensionID} not found`,
})

Check warning on line 220 in packages/app/src/cli/services/dev/extension/server/middlewares.ts

View workflow job for this annotation

GitHub Actions / ESLint Report Analysis

packages/app/src/cli/services/dev/extension/server/middlewares.ts#L217-L220

[@typescript-eslint/no-confusing-void-expression] Returning a void expression from a function is forbidden. Please move it before the `return` statement.
}

if (!extension.hasExtensionPointTarget(requestedTarget)) {
return sendError(response, {
statusCode: 404,
statusMessage: `Extension with id ${extensionID} has not configured the "${requestedTarget}" extension target`,
})

Check warning on line 227 in packages/app/src/cli/services/dev/extension/server/middlewares.ts

View workflow job for this annotation

GitHub Actions / ESLint Report Analysis

packages/app/src/cli/services/dev/extension/server/middlewares.ts#L224-L227

[@typescript-eslint/no-confusing-void-expression] Returning a void expression from a function is forbidden. Please move it before the `return` statement.
}

const url = getExtensionPointRedirectUrl(requestedTarget, extension, devOptions)
if (!url) {
return sendError(response, {
statusCode: 404,
statusMessage: `Redirect url can't be constructed for extension with id ${extensionID} and extension target "${requestedTarget}"`,
})

Check warning on line 235 in packages/app/src/cli/services/dev/extension/server/middlewares.ts

View workflow job for this annotation

GitHub Actions / ESLint Report Analysis

packages/app/src/cli/services/dev/extension/server/middlewares.ts#L232-L235

[@typescript-eslint/no-confusing-void-expression] Returning a void expression from a function is forbidden. Please move it before the `return` statement.
}

await sendRedirect(response.event, url, 307)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ describe('app-logs-polling', () => {
token: TOKEN,
}

let subscribeToAppLogs: Mock<any, any>
let subscribeToAppLogs: Mock
let developerPlatformClient: DeveloperPlatformClient
let stdout: any
let stderr: any
Expand Down
7 changes: 2 additions & 5 deletions packages/app/src/cli/services/function/build.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
import {outputDebug} from '@shopify/cli-kit/node/output'
import {exec} from '@shopify/cli-kit/node/system'
import {joinPath} from '@shopify/cli-kit/node/path'
import {build as esBuild, BuildResult, BuildOptions} from 'esbuild'
import {build as esBuild, BuildResult} from 'esbuild'
import {findPathUp, inTemporaryDirectory, writeFile} from '@shopify/cli-kit/node/fs'
import {AbortSignal} from '@shopify/cli-kit/node/abort'
import {renderTasks} from '@shopify/cli-kit/node/ui'
Expand Down Expand Up @@ -139,7 +139,7 @@
const validEnvs = pickBy(processEnv, (value, key) => EsbuildEnvVarRegex.test(key) && value)

const env: {[variable: string]: string | undefined} = {...appEnv, ...validEnvs}
const define = Object.keys(env || {}).reduce(

Check warning on line 142 in packages/app/src/cli/services/function/build.ts

View workflow job for this annotation

GitHub Actions / ESLint Report Analysis

packages/app/src/cli/services/function/build.ts#L142

[@typescript-eslint/no-unnecessary-condition] Unnecessary conditional, value is always truthy.
(acc, key) => ({
...acc,
[`process.env.${key}`]: JSON.stringify(env[key]),
Expand Down Expand Up @@ -192,10 +192,7 @@
}

export interface JavyBuilder {
bundle(
fun: ExtensionInstance<FunctionConfigType>,
options: JSFunctionBuildOptions,
): Promise<BuildResult<BuildOptions>>
bundle(fun: ExtensionInstance<FunctionConfigType>, options: JSFunctionBuildOptions): Promise<BuildResult>
compile(fun: ExtensionInstance<FunctionConfigType>, options: JSFunctionBuildOptions): Promise<void>
}

Expand Down Expand Up @@ -277,7 +274,7 @@
}

export function jsExports(fun: ExtensionInstance<FunctionConfigType>) {
const targets = fun.configuration.targeting || []

Check warning on line 277 in packages/app/src/cli/services/function/build.ts

View workflow job for this annotation

GitHub Actions / ESLint Report Analysis

packages/app/src/cli/services/function/build.ts#L277

[@typescript-eslint/prefer-nullish-coalescing] Prefer using nullish coalescing operator (`??`) instead of a logical or (`||`), as it is a safer operator.
const withoutExport = targets.filter((target) => !target.export)
const withExport = targets.filter((target) => Boolean(target.export))

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@
onReloadAndBuildError: async (error) => {
if (error instanceof FatalError) {
// eslint-disable-next-line @typescript-eslint/no-base-to-string
setError(`Fatal error while reloading and building extension: ${error.formattedMessage || error.message}`)

Check warning on line 88 in packages/app/src/cli/services/function/ui/components/Replay/hooks/useFunctionWatcher.ts

View workflow job for this annotation

GitHub Actions / ESLint Report Analysis

packages/app/src/cli/services/function/ui/components/Replay/hooks/useFunctionWatcher.ts#L88

[@typescript-eslint/prefer-nullish-coalescing] Prefer using nullish coalescing operator (`??`) instead of a logical or (`||`), as it is a safer operator.
} else {
setError(`Error while reloading and building extension: ${error.message}`)
}
Expand Down Expand Up @@ -125,7 +125,7 @@
let functionRunnerOutput = ''
const customStdout = new Writable({
write(chunk, _encoding, next) {
functionRunnerOutput += chunk
functionRunnerOutput += chunk as string
next()
},
})
Expand Down
2 changes: 1 addition & 1 deletion packages/app/src/cli/services/generate.ts
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@
const type = template.type
const specification = specifications.find((spec) => spec.identifier === type || spec.externalIdentifier === type)
const existingExtensions = app.extensionsForType({identifier: type, externalIdentifier: type})
return existingExtensions.length >= (specification?.registrationLimit || 1)

Check warning on line 95 in packages/app/src/cli/services/generate.ts

View workflow job for this annotation

GitHub Actions / ESLint Report Analysis

packages/app/src/cli/services/generate.ts#L95

[@typescript-eslint/prefer-nullish-coalescing] Prefer using nullish coalescing operator (`??`) instead of a logical or (`||`), as it is a safer operator.
}

async function saveAnalyticsMetadata(promptAnswers: GenerateExtensionPromptOutput, typeFlag: string | undefined) {
Expand Down Expand Up @@ -156,7 +156,7 @@
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
options.nextSteps!.push([
'To preview this extension along with the rest of the project, run',
{command: `${formatPackageManagerCommand(depndencyManager, 'shopify app dev')}`},
{command: formatPackageManagerCommand(depndencyManager, 'shopify app dev')},
])
}

Expand Down
6 changes: 3 additions & 3 deletions packages/app/src/cli/services/info.ts
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@
if ('specifications' in appWithSupportedExtensions) {
appWithSupportedExtensions = {
...appWithSupportedExtensions,
specifications: appWithSupportedExtensions.specifications?.map((spec) => {

Check warning on line 66 in packages/app/src/cli/services/info.ts

View workflow job for this annotation

GitHub Actions / ESLint Report Analysis

packages/app/src/cli/services/info.ts#L66

[@typescript-eslint/no-unnecessary-condition] Unnecessary optional chain on a non-nullish value.
// We are choosing to leave appWithSupportedExtensions as close to the original as possible,
// instead allowing this one change in the type specifically.
//
Expand Down Expand Up @@ -153,7 +153,7 @@
['App name', this.remoteApp.title || NOT_CONFIGURED_TEXT],
['Client ID', this.remoteApp.apiKey || NOT_CONFIGURED_TEXT],
['Access scopes', getAppScopes(this.app.configuration)],
['Dev store', this.app.configuration.build?.dev_store_url || NOT_CONFIGURED_TEXT],

Check warning on line 156 in packages/app/src/cli/services/info.ts

View workflow job for this annotation

GitHub Actions / ESLint Report Analysis

packages/app/src/cli/services/info.ts#L156

[@typescript-eslint/prefer-nullish-coalescing] Prefer using nullish coalescing operator (`??`) instead of a logical or (`||`), as it is a safer operator.
['Update URLs', updateUrls],
partnersAccountInfo,
]
Expand Down Expand Up @@ -181,7 +181,7 @@
if (relevantExtensions[0]) {
body += `\n\n${outputContent`${outputToken.subheading(relevantExtensions[0].externalType)}`.value}`
relevantExtensions.forEach((extension: TExtension) => {
body += `${outputFormatter(extension)}`
body += outputFormatter(extension)
})
}
})
Expand All @@ -193,7 +193,7 @@
if (this.app.errors?.isEmpty() === false) {
body += `\n\n${outputContent`${outputToken.subheading('Extensions with errors')}`.value}`
supportedExtensions.forEach((extension) => {
body += `${this.invalidExtensionSubSection(extension)}`
body += this.invalidExtensionSubSection(extension)
})
}
return [title, body]
Expand All @@ -205,7 +205,7 @@
const toplevel = ['📂 web', '']
const sublevels: [string, string][] = []
this.app.webs.forEach((web) => {
if (web.configuration) {

Check warning on line 208 in packages/app/src/cli/services/info.ts

View workflow job for this annotation

GitHub Actions / ESLint Report Analysis

packages/app/src/cli/services/info.ts#L208

[@typescript-eslint/no-unnecessary-condition] Unnecessary conditional, value is always truthy.
if (web.configuration.name) {
const {name, roles} = web.configuration
sublevels.push([` 📂 ${name} (${roles.join(',')})`, relativePath(this.app.directory, web.directory)])
Expand Down Expand Up @@ -234,7 +234,7 @@
[`📂 ${extension.handle}`, relativePath(this.app.directory, extension.directory)],
[' config file', relativePath(extension.directory, extension.configurationPath)],
]
if (config && config.metafields?.length) {

Check warning on line 237 in packages/app/src/cli/services/info.ts

View workflow job for this annotation

GitHub Actions / ESLint Report Analysis

packages/app/src/cli/services/info.ts#L237

[@typescript-eslint/no-unnecessary-condition] Unnecessary conditional, value is always truthy.

Check warning on line 237 in packages/app/src/cli/services/info.ts

View workflow job for this annotation

GitHub Actions / ESLint Report Analysis

packages/app/src/cli/services/info.ts#L237

[@typescript-eslint/prefer-optional-chain] Prefer using an optional chain expression instead, as it's more concise and easier to read.

Check warning on line 237 in packages/app/src/cli/services/info.ts

View workflow job for this annotation

GitHub Actions / ESLint Report Analysis

packages/app/src/cli/services/info.ts#L237

[@typescript-eslint/no-unnecessary-condition] Unnecessary optional chain on a non-nullish value.
details.push([' metafields', `${config.metafields.length}`])
}

Expand Down Expand Up @@ -265,9 +265,9 @@
['Shopify CLI', CLI_KIT_VERSION],
['Package manager', this.app.packageManager],
['OS', `${platform}-${arch}`],
['Shell', process.env.SHELL || 'unknown'],

Check warning on line 268 in packages/app/src/cli/services/info.ts

View workflow job for this annotation

GitHub Actions / ESLint Report Analysis

packages/app/src/cli/services/info.ts#L268

[@typescript-eslint/prefer-nullish-coalescing] Prefer using nullish coalescing operator (`??`) instead of a logical or (`||`), as it is a safer operator.
['Node version', process.version],
]
return [title, `${linesToColumns(lines)}`]
return [title, linesToColumns(lines)]
}
}
4 changes: 2 additions & 2 deletions packages/app/src/cli/services/init/init.ts
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ async function init(options: InitOptions) {
const repoUrl = githubRepo.branch ? `${githubRepo.baseURL}#${githubRepo.branch}` : githubRepo.baseURL

await mkdir(templateDownloadDir)
const tasks: Task<unknown>[] = [
const tasks: Task[] = [
{
title: `Downloading template from ${repoUrl}`,
task: async () => {
Expand Down Expand Up @@ -217,7 +217,7 @@ async function init(options: InitOptions) {
{link: {label: 'Shopify docs', url: 'https://shopify.dev'}},
[
'For an overview of commands, run',
{command: `${formatPackageManagerCommand(packageManager, 'shopify app', '--help')}`},
{command: formatPackageManagerCommand(packageManager, 'shopify app', '--help')},
],
],
})
Expand Down
2 changes: 1 addition & 1 deletion packages/app/src/cli/services/logs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@
storeNameById.set(storeId, storeFqdn)
if (commandOptions.storeFqdns && commandOptions.storeFqdns.length > 1) {
await Promise.all(
commandOptions.storeFqdns?.slice(1).map((storeFqdn) => {

Check warning on line 117 in packages/app/src/cli/services/logs.ts

View workflow job for this annotation

GitHub Actions / ESLint Report Analysis

packages/app/src/cli/services/logs.ts#L117

[@typescript-eslint/no-unnecessary-condition] Unnecessary optional chain on a non-nullish value.
return storeFromFqdn(storeFqdn, remoteApp.organizationId, developerPlatformClient).then((store) => {
storeNameById.set(store.shopId, storeFqdn)
})
Expand Down Expand Up @@ -151,7 +151,7 @@
const fileName = configFile && getAppConfigurationFileName(configFile)

renderInfo({
headline: `${configFile ? `Using ${fileName} for default values:` : 'Using these settings:'}`,
headline: configFile ? `Using ${fileName} for default values:` : 'Using these settings:',
body,
})
}
4 changes: 2 additions & 2 deletions packages/app/src/cli/services/webhook/trigger-flags.ts
Original file line number Diff line number Diff line change
Expand Up @@ -142,11 +142,11 @@ function equivalentTopic(passedTopic: string, availableTopics: string[]): string
export function deliveryMethodForAddress(address: string | undefined): string | undefined {
if (!address) return undefined

if (PROTOCOL.PUBSUB.test(address)) {
if (address.startsWith('pubsub:')) {
return DELIVERY_METHOD.PUBSUB
}

if (PROTOCOL.EVENTBRIDGE.test(address)) {
if (address.startsWith('arn:aws:events:')) {
return DELIVERY_METHOD.EVENTBRIDGE
}

Expand Down
2 changes: 1 addition & 1 deletion packages/app/src/cli/utilities/app/http-reverse-proxy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -109,9 +109,9 @@
return function (req, socket, head) {
const target = match(rules, req, true)
if (target) {
return proxy.ws(req, socket, head, {target}, (err) => {
outputWarn(`Error forwarding websocket request: ${err}`)
})

Check warning on line 114 in packages/app/src/cli/utilities/app/http-reverse-proxy.ts

View workflow job for this annotation

GitHub Actions / ESLint Report Analysis

packages/app/src/cli/utilities/app/http-reverse-proxy.ts#L112-L114

[@typescript-eslint/no-confusing-void-expression] Returning a void expression from a function is forbidden. Please move it before the `return` statement.
}
socket.destroy()
}
Expand All @@ -120,13 +120,13 @@
function getProxyServerRequestListener(
rules: {[key: string]: string},
proxy: Server,
): http.RequestListener<typeof http.IncomingMessage, typeof http.ServerResponse> | undefined {
): http.RequestListener | undefined {
return function (req, res) {
const target = match(rules, req)
if (target) {
return proxy.web(req, res, {target}, (err) => {
outputWarn(`Error forwarding web request: ${err}`)
})

Check warning on line 129 in packages/app/src/cli/utilities/app/http-reverse-proxy.ts

View workflow job for this annotation

GitHub Actions / ESLint Report Analysis

packages/app/src/cli/utilities/app/http-reverse-proxy.ts#L127-L129

[@typescript-eslint/no-confusing-void-expression] Returning a void expression from a function is forbidden. Please move it before the `return` statement.
}

outputDebug(outputContent`
Expand All @@ -144,7 +144,7 @@
const rules: {[key: string]: string} & {websocket?: string} = {}

const createProxyProcessDefinition = async (target: ReverseHTTPProxyTarget): Promise<OutputProcess> => {
const targetPort = target.customPort || (await getAvailableTCPPort())

Check warning on line 147 in packages/app/src/cli/utilities/app/http-reverse-proxy.ts

View workflow job for this annotation

GitHub Actions / ESLint Report Analysis

packages/app/src/cli/utilities/app/http-reverse-proxy.ts#L147

[@typescript-eslint/prefer-nullish-coalescing] Prefer using nullish coalescing operator (`??`) instead of a logical or (`||`), as it is a safer operator.
rules[target.pathPrefix ?? 'default'] = `http://localhost:${targetPort}`
const hmrServer = target.hmrServer
if (hmrServer) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,7 @@
if (isLaunchable) {
return {
org: parseInt(org.id, 10),
title: `${name}`,
title: name,
appUrl: 'https://example.com',
redir: ['https://example.com/api/auth'],
requestedAccessScopes: scopesArray ?? [],
Expand All @@ -183,7 +183,7 @@
} else {
return {
org: parseInt(org.id, 10),
title: `${name}`,
title: name,
appUrl: MAGIC_URL,
redir: [MAGIC_REDIRECT_URL],
requestedAccessScopes: scopesArray ?? [],
Expand Down Expand Up @@ -266,7 +266,7 @@
const variables: FindAppQueryVariables = {apiKey}
const res: FindAppQuerySchema = await this.request(FindAppQuery, variables)
const app = res.app
if (app) {

Check warning on line 269 in packages/app/src/cli/utilities/developer-platform-client/partners-client.ts

View workflow job for this annotation

GitHub Actions / ESLint Report Analysis

packages/app/src/cli/utilities/developer-platform-client/partners-client.ts#L269

[@typescript-eslint/no-unnecessary-condition] Unnecessary conditional, value is always truthy.
const flags = filterDisabledFlags(app.disabledFlags)
return {
...app,
Expand Down
2 changes: 0 additions & 2 deletions packages/cli-kit/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -50,9 +50,7 @@
"docs:open": "nx docs:open",
"lint": "nx lint",
"lint:ruby": "nx lint:ruby",
"lint:js": "nx lint:js",
"lint:fix": "nx lint:fix",
"lint:js:fix": "nx lint:js:fix",
"lint:ruby:fix": "nx lint:ruby:fix",
"prepack": "cross-env NODE_ENV=production pnpm nx build && cp ../../README.md README.md",
"test": "nx test",
Expand Down
Loading
Loading