Run local CLI rules with Oxlint - #8209
gonzaloriestra wants to merge 1 commit into
Conversation
|
Warning This pull request is not mergeable via GitHub because a downstack PR is open. Once all requirements are satisfied, merge this PR as a stack on Graphite.
This stack of pull requests is managed by Graphite. Learn more about stacking. |
|
This PR seems inactive. If it's still relevant, please add a comment saying so. Otherwise, take no action. |
Differences in type declarationsWe detected differences in the type declarations generated by Typescript for this branch compared to the baseline ('main' branch). Please, review them to ensure they are backward-compatible. Here are some important things to keep in mind:
New type declarationsWe found no new type declarations in this PR Existing type declarationspackages/cli-kit/dist/private/node/otel-metrics.d.ts@@ -2,7 +2,7 @@ import { OtelService } from '../../public/node/vendor/otel-js/service/types.js';
import { DefaultOtelServiceOptions } from '../../public/node/vendor/otel-js/service/DefaultOtelService/DefaultOtelService.js';
type MetricRecorder = 'console' | {
type: 'otel';
- otel: Pick<OtelService, 'getMeterProvider' | 'record'>;
+ otel: Pick<OtelService, 'record'>;
};
interface Timing {
active: number;
packages/cli-kit/dist/public/common/string.d.ts@@ -1,4 +1,4 @@
-import type { Token, TokenItem } from '../../private/node/ui/components/token-item.js';
+import { Token, TokenItem } from '../../private/node/ui/components/TokenizedText.js';
export type RandomNameFamily = 'business' | 'creative';
/**
* Generates a random name by combining an adjective and noun.
packages/cli-kit/dist/public/common/version.d.ts@@ -1 +1 @@
-export declare const CLI_KIT_VERSION = "4.8.0";
\ No newline at end of file
+export declare const CLI_KIT_VERSION = "4.5.0";
\ No newline at end of file
packages/cli-kit/dist/public/node/abort.d.ts@@ -1,24 +1,16 @@
+import { AbortController as NodeAbortController, AbortSignal as NodeAbortControllerSignal } from 'node-abort-controller';
/**
* The AbortController interface represents a controller object that allows you to abort one or more Web requests as and when desired.
*
* - MDN Documentation: https://developer.mozilla.org/en-US/docs/Web/API/AbortController
*
- * This class exists to keep the historical `@shopify/cli-kit/node/abort` import path working
- * now that Node provides AbortController natively.
+ * This class is necessary because AbortController support was added to Node 15 and the minimum
+ * version that we support is Node 14.
*/
-export declare class AbortController extends globalThis.AbortController {
+export declare class AbortController extends NodeAbortController {
}
/**
* The AbortSignal interface represents a signal object that allows you to communicate with a DOM request (such as a fetch request) and abort it if required via an AbortController object.
- *
- * Note that AbortSignal cannot be constructed directly. Get one from an AbortController's
- * `signal` property or from the static helpers such as `AbortSignal.timeout()`.
*/
-export declare const AbortSignal: {
- new (): globalThis.AbortSignal;
- prototype: globalThis.AbortSignal;
- abort(reason?: any): globalThis.AbortSignal;
- any(signals: globalThis.AbortSignal[]): globalThis.AbortSignal;
- timeout(milliseconds: number): globalThis.AbortSignal;
-};
-export type AbortSignal = globalThis.AbortSignal;
\ No newline at end of file
+export declare class AbortSignal extends NodeAbortControllerSignal {
+}
\ No newline at end of file
packages/cli-kit/dist/public/node/analytics.d.ts@@ -6,7 +6,6 @@ interface ReportAnalyticsEventOptions {
errorMessage?: string;
exitMode: CommandExitMode;
}
-export declare function sendAnalyticsEventFromStdin(): Promise<void>;
/**
* Report an analytics event, sending it off to Monorail -- Shopify's internal analytics service.
*
packages/cli-kit/dist/public/node/base-command.d.ts@@ -2,16 +2,8 @@ import { Command } from '@oclif/core';
import { OutputFlags, Input, ParserOutput, FlagInput, OutputArgs } from '@oclif/core/parser';
export type ArgOutput = OutputArgs<any>;
export type FlagOutput = OutputFlags<any>;
-export interface NonTTYFlagRequirement {
- /** At least one of these flags must be present when the requirement applies. */
- flags: string[];
- /** Determines whether the requirement applies to the parsed flags. */
- when?: (flags: FlagOutput) => boolean;
-}
declare abstract class BaseCommand extends Command {
static baseFlags: FlagInput<{}>;
- static get requiresSyncAnalytics(): boolean;
- static nonTTYFlagRequirements(_flags: FlagOutput): NonTTYFlagRequirement[];
static descriptionWithoutMarkdown(): string | undefined;
static analyticsNameOverride(): string | undefined;
static analyticsStopCommand(): string | undefined;
@@ -30,8 +22,6 @@ declare abstract class BaseCommand extends Command {
}>;
protected environmentsFilename(): string | undefined;
protected failMissingNonTTYFlags(flags: FlagOutput, requiredFlags: string[]): void;
- private failMissingNonTTYFlagRequirements;
- private applicableNonTTYFlagRequirements;
private resultWithEnvironment;
/**
* Tries to load an environment to forward to the command. If no environment
packages/cli-kit/dist/public/node/cli.d.ts@@ -55,19 +55,6 @@ export declare const portFlag: (options?: {
env?: string;
hidden?: boolean;
}) => import("@oclif/core/interfaces").OptionFlag<number | undefined, import("@oclif/core/interfaces").CustomOptions>;
-/**
- * Marks a flag as required when the CLI cannot prompt for a value.
- *
- * The flag remains optional in interactive terminals. In non-interactive environments,
- * `BaseCommand` validates the flag automatically and the requirement is shown in `--help`.
- * Use `BaseCommand.nonTTYFlagRequirements` for conditional or alternative requirements.
- *
- * @param flag - An oclif flag definition.
- * @returns A new flag definition annotated for non-interactive validation and help output.
- */
-export declare function requiredIfNonInteractive<TFlag extends {
- description?: string;
-}>(flag: TFlag): TFlag;
/**
* Clear the CLI cache, used to store some API responses and handle notifications status
*/
packages/cli-kit/dist/public/node/custom-oclif-loader.d.ts@@ -17,12 +17,6 @@ export declare class ShopifyConfig extends Config {
* @param loader - The lazy command loader function.
*/
setLazyCommandLoader(loader: LazyCommandLoader): void;
- /**
- * Override load to protect oclif's shell detection from a failing OS user lookup.
- *
- * @returns A promise that resolves once the config is loaded.
- */
- load(): Promise<void>;
/**
* Override runCommand to use lazy loading when available.
* Instead of calling cmd.load() which triggers loading ALL commands via index.js,
packages/cli-kit/dist/public/node/error.d.ts@@ -1,6 +1,7 @@
import { OutputMessage } from './output.js';
-import { type InlineToken, type TokenItem } from '../../private/node/ui/components/token-item.js';
+import { InlineToken, TokenItem } from '../../private/node/ui/components/TokenizedText.js';
import type { AlertCustomSection } from './ui.js';
+export { ExtendableError } from 'ts-error';
export declare enum FatalErrorType {
Abort = 0,
AbortSilent = 1,
@@ -37,6 +38,8 @@ export declare abstract class FatalError extends Error {
* Those usually represent unexpected scenarios that we can't handle and that usually require some action from the developer.
*/
export declare class AbortError extends FatalError {
+ nextSteps?: TokenItem<InlineToken>[];
+ customSections?: AlertCustomSection[];
constructor(message: TokenItem | OutputMessage, tryMessage?: TokenItem | OutputMessage | null, nextSteps?: TokenItem<InlineToken>[], customSections?: AlertCustomSection[]);
}
/**
packages/cli-kit/dist/public/node/fs.d.ts@@ -114,26 +114,12 @@ export declare function mkdir(path: string): Promise<void>;
* @param path - Path to the directory to be created.
*/
export declare function mkdirSync(path: string): void;
-interface RemoveFileOptions {
- /**
- * Number of times Node retries the removal when it hits a transient error
- * (EBUSY, EMFILE, ENFILE, ENOTEMPTY or EPERM), waiting `retryDelay` milliseconds
- * longer on each try. Defaults to 0 (no retries).
- */
- maxRetries?: number;
- /**
- * Milliseconds to wait between retries. Defaults to 100.
- */
- retryDelay?: number;
-}
/**
- * Removes a file or directory (recursively) at the given path.
+ * Removes a file at the given path.
*
- * @param path - Path to the file or directory to be removed.
- * @param options - Retry behavior, passed through to Node's `fs.rm`. Useful when the removal can
- * race with transient locks, such as an antivirus scanning freshly written files.
+ * @param path - Path to the file to be removed.
*/
-export declare function removeFile(path: string, options?: RemoveFileOptions): Promise<void>;
+export declare function removeFile(path: string): Promise<void>;
/**
* Renames a file.
* @param from - Path to the file to be renamed.
packages/cli-kit/dist/public/node/metadata.d.ts@@ -42,7 +42,6 @@ declare const coreData: RuntimeMetadataManager<CmdFieldsFromMonorail, {
startCommand: string;
startTopic?: string;
startArgs: string[];
- requiresSyncAnalytics?: boolean;
};
} & {
environmentFlags: string;
@@ -64,7 +63,6 @@ export declare const getAllPublicMetadata: () => Partial<CmdFieldsFromMonorail>,
startCommand: string;
startTopic?: string;
startArgs: string[];
- requiresSyncAnalytics?: boolean;
};
} & {
environmentFlags: string;
@@ -85,7 +83,6 @@ export declare const getAllPublicMetadata: () => Partial<CmdFieldsFromMonorail>,
startCommand: string;
startTopic?: string;
startArgs: string[];
- requiresSyncAnalytics?: boolean;
};
} & {
environmentFlags: string;
packages/cli-kit/dist/public/node/system.d.ts@@ -115,25 +115,12 @@ export declare function terminalSupportsPrompting(): boolean;
* @returns True if the current environment is a CI environment.
*/
export declare function isCI(): boolean;
-interface WslDetectionOverrides {
- platform?: NodeJS.Platform;
- kernelRelease?: string;
- procVersion?: string;
- insideContainer?: boolean;
-}
/**
* Check if the current environment is a WSL environment.
*
- * @param overrides - Detection inputs, read from the system when not provided. Intended for tests.
* @returns True if the current environment is a WSL environment.
*/
-export declare function isWsl(overrides?: WslDetectionOverrides): Promise<boolean>;
-/**
- * Check if the current process is running inside a container.
- *
- * @returns True if the current process is running inside a container.
- */
-export declare function isInsideContainer(): boolean;
+export declare function isWsl(): Promise<boolean>;
/**
* Check if stdin has piped data available.
* This distinguishes between actual piped input (e.g., `echo "query" | cmd`)
@@ -152,5 +139,4 @@ export declare function isStdinPiped(): boolean;
*
* @returns A promise that resolves with the stdin content, or undefined if stdin is a TTY.
*/
-export declare function readStdinString(): Promise<string | undefined>;
-export {};
\ No newline at end of file
+export declare function readStdinString(): Promise<string | undefined>;
\ No newline at end of file
packages/cli-kit/dist/public/node/ui.d.ts@@ -6,7 +6,7 @@ import { AlertOptions } from '../../private/node/ui/alert.js';
import { CustomSection } from '../../private/node/ui/components/Alert.js';
import ScalarDict from '../../private/node/ui/components/Table/ScalarDict.js';
import { TableColumn, TableProps } from '../../private/node/ui/components/Table/Table.js';
-import { type InlineToken, type LinkToken, type ListToken, type Token, type TokenItem } from '../../private/node/ui/components/token-item.js';
+import { Token, InlineToken, LinkToken, ListToken, TokenItem } from '../../private/node/ui/components/TokenizedText.js';
import { DangerousConfirmationPromptProps } from '../../private/node/ui/components/DangerousConfirmationPrompt.js';
import { SelectPromptProps } from '../../private/node/ui/components/SelectPrompt.js';
import { Task } from '../../private/node/ui/components/Tasks.js';
packages/cli-kit/dist/private/node/analytics/graphql-error-codes.d.ts@@ -21,8 +21,8 @@ export declare function graphQLErrorCodes(errors: unknown): string[];
/**
* Whether a single code is a rate-limit signal (`THROTTLED` or `429`).
*
- * Shared with the retry path (`isThrottled` in `private/node/api.ts`), where these codes signal
- * rate limiting even at HTTP 200.
+ * Mirrors the established shape detected by `errorsIncludeStatus429` in `private/node/api.ts`,
+ * where `extensions.code === '429'` signals rate limiting even at HTTP 200.
*/
export declare function isRateLimitCode(code: string | undefined): boolean;
/**
packages/cli-kit/dist/private/node/session/exchange.d.ts@@ -1,9 +1,10 @@
import { ApplicationToken, IdentityToken } from './schema.js';
import { API } from '../api.js';
import { Result } from '../../../public/node/result.js';
-export declare class InvalidGrantError extends Error {
+import { ExtendableError } from '../../../public/node/error.js';
+export declare class InvalidGrantError extends ExtendableError {
}
-export declare class InvalidRequestError extends Error {
+export declare class InvalidRequestError extends ExtendableError {
}
export interface ExchangeScopes {
admin: string[];
@@ -51,8 +52,7 @@ export declare function exchangeAppAutomationTokenForBusinessPlatformAccessToken
accessToken: string;
userId: string;
}>;
-declare const identityDeviceErrors: readonly ["authorization_pending", "access_denied", "expired_token", "slow_down", "unknown_failure"];
-type IdentityDeviceError = (typeof identityDeviceErrors)[number];
+type IdentityDeviceError = 'authorization_pending' | 'access_denied' | 'expired_token' | 'slow_down' | 'unknown_failure';
/**
* Given a deviceCode obtained after starting a device identity flow, request an identity token.
* @param deviceCode - The device code obtained after starting a device identity flow
packages/cli-kit/dist/private/node/ui/utilities.d.ts@@ -1,16 +1,16 @@
-import { type TokenItem } from './components/token-item.js';
-export declare function messageWithPunctuation(message: TokenItem): string | import("./components/token-item.js").LinkToken | import("./components/token-item.js").UserInputToken | import("./components/token-item.js").ListToken | {
+import { TokenItem } from './components/TokenizedText.js';
+export declare function messageWithPunctuation(message: TokenItem): string | {
command: string;
-} | {
+} | import("./components/TokenizedText.js").LinkToken | {
char: string;
-} | {
+} | import("./components/TokenizedText.js").UserInputToken | {
subdued: string;
} | {
filePath: string;
-} | import("./components/token-item.js").BoldToken | {
+} | import("./components/TokenizedText.js").ListToken | import("./components/TokenizedText.js").BoldToken | {
info: string;
} | {
warn: string;
} | {
error: string;
-} | import("./components/token-item.js").Token[];
\ No newline at end of file
+} | import("./components/TokenizedText.js").Token[];
\ No newline at end of file
packages/cli-kit/dist/public/node/context/local.d.ts@@ -141,9 +141,7 @@ export declare function ciPlatform(env?: NodeJS.ProcessEnv): {
metadata?: undefined;
};
/**
- * Returns the first mac address found, preferring external interfaces. Returns a random
- * value when no interface has a MAC, so callers hashing it as a device id don't group
- * unrelated devices together.
+ * Returns the first mac address found.
*
* @returns Mac address.
*/
packages/cli-kit/dist/public/node/plugins/tunnel.d.ts@@ -1,3 +1,4 @@
+import { ExtendableError } from '../error.js';
import { OutputMessage } from '../output.js';
import { FanoutHookFunction, PluginReturnsForHook } from '../plugins.js';
import { Result } from '../result.js';
@@ -21,7 +22,7 @@ export type TunnelStatusType = {
message: TokenItem | OutputMessage;
tryMessage?: TokenItem | OutputMessage | null;
};
-export declare class TunnelError extends Error {
+export declare class TunnelError extends ExtendableError {
type: TunnelErrorType;
constructor(type: TunnelErrorType, message?: string);
}
packages/cli-kit/dist/private/node/ui/components/Alert.d.ts@@ -1,7 +1,7 @@
import { BannerType } from './Banner.js';
+import { BoldToken, InlineToken, LinkToken, TokenItem } from './TokenizedText.js';
import { TabularDataProps } from './TabularData.js';
import { FunctionComponent } from 'react';
-import type { BoldToken, InlineToken, LinkToken, TokenItem } from './token-item.js';
export interface CustomSection {
title?: string;
body: TabularDataProps | TokenItem;
packages/cli-kit/dist/private/node/ui/components/DangerousConfirmationPrompt.d.ts@@ -1,7 +1,7 @@
+import { InlineToken, TokenItem } from './TokenizedText.js';
import { InfoTableProps } from './Prompts/InfoTable.js';
import { AbortSignal } from '../../../../public/node/abort.js';
import { FunctionComponent } from 'react';
-import type { InlineToken, TokenItem } from './token-item.js';
export interface DangerousConfirmationPromptProps {
message: string;
confirmation: string;
packages/cli-kit/dist/private/node/ui/components/List.d.ts@@ -1,6 +1,6 @@
+import { InlineToken, TokenItem } from './TokenizedText.js';
import { TextProps } from 'ink';
import { FunctionComponent } from 'react';
-import type { InlineToken, TokenItem } from './token-item.js';
export interface CustomListItem {
type?: string;
item: TokenItem<InlineToken>;
packages/cli-kit/dist/private/node/ui/components/TabularData.d.ts@@ -1,4 +1,4 @@
-import { type InlineToken } from './token-item.js';
+import { InlineToken } from './TokenizedText.js';
import { FunctionComponent } from 'react';
export interface TabularDataProps {
tabularData: InlineToken[][];
packages/cli-kit/dist/private/node/ui/components/TextPrompt.d.ts@@ -1,6 +1,6 @@
+import { InlineToken, TokenItem } from './TokenizedText.js';
import { AbortSignal } from '../../../../public/node/abort.js';
import { FunctionComponent } from 'react';
-import type { InlineToken, TokenItem } from './token-item.js';
export interface TextPromptProps {
message: TokenItem;
onSubmit: (value: string) => void;
packages/cli-kit/dist/private/node/ui/components/TokenizedText.d.ts@@ -1,5 +1,42 @@
import { FunctionComponent } from 'react';
-import type { TokenItem } from './token-item.js';
+export interface LinkToken {
+ link: {
+ label?: string;
+ url: string;
+ };
+}
+export interface UserInputToken {
+ userInput: string;
+}
+export interface ListToken {
+ list: {
+ title?: TokenItem<InlineToken>;
+ items: TokenItem<InlineToken>[];
+ ordered?: boolean;
+ };
+}
+export interface BoldToken {
+ bold: string;
+}
+export type Token = string | {
+ command: string;
+} | LinkToken | {
+ char: string;
+} | UserInputToken | {
+ subdued: string;
+} | {
+ filePath: string;
+} | ListToken | BoldToken | {
+ info: string;
+} | {
+ warn: string;
+} | {
+ error: string;
+};
+export type InlineToken = Exclude<Token, ListToken>;
+export type TokenItem<T extends Token = Token> = T | T[];
+export declare function tokenItemToString(token: TokenItem): string;
+export declare function appendToTokenItem(token: TokenItem, suffix: string): TokenItem;
interface TokenizedTextProps {
item: TokenItem;
}
packages/cli-kit/dist/private/node/ui/components/Prompts/InfoMessage.d.ts@@ -1,6 +1,6 @@
+import { InlineToken, LinkToken, TokenItem, UserInputToken } from '../TokenizedText.js';
import { TextProps } from 'ink';
import { FunctionComponent } from 'react';
-import type { InlineToken, LinkToken, TokenItem, UserInputToken } from '../token-item.js';
export interface InfoMessageProps {
message: {
title: {
packages/cli-kit/dist/private/node/ui/components/Prompts/InfoTable.d.ts@@ -1,7 +1,7 @@
import { CustomListItem } from '../List.js';
+import { InlineToken, TokenItem } from '../TokenizedText.js';
import { TextProps } from 'ink';
import { FunctionComponent } from 'react';
-import type { InlineToken, TokenItem } from '../token-item.js';
type Items = (TokenItem<InlineToken> | CustomListItem)[];
export interface InfoTableSection {
color?: TextProps['color'];
packages/cli-kit/dist/private/node/ui/components/Prompts/PromptLayout.d.ts@@ -1,9 +1,9 @@
import { InfoTableProps } from './InfoTable.js';
import { InfoMessageProps } from './InfoMessage.js';
+import { InlineToken, LinkToken, TokenItem } from '../TokenizedText.js';
import { AbortSignal } from '../../../../../public/node/abort.js';
import { PromptState } from '../../hooks/use-prompt.js';
import { ReactElement } from 'react';
-import type { InlineToken, LinkToken, TokenItem } from '../token-item.js';
export type Message = TokenItem<Exclude<InlineToken, LinkToken>>;
interface PromptLayoutProps {
message: Message;
packages/cli-kit/dist/public/node/vendor/otel-js/service/types.d.ts@@ -1,5 +1,5 @@
-import type { Counter, Histogram, MetricAttributes, MetricOptions, UpDownCounter } from '@opentelemetry/api';
-import type { MeterProvider, ViewOptions } from '@opentelemetry/sdk-metrics';
+import type { Counter, Histogram, MeterProvider, MetricAttributes, MetricOptions, UpDownCounter } from '@opentelemetry/api';
+import type { ViewOptions } from '@opentelemetry/sdk-metrics';
export type CustomMetricLabels<TLabels extends Record<TKeys, MetricAttributes>, TKeys extends string = keyof TLabels & string> = {
[P in TKeys]: TLabels[P] extends MetricAttributes ? TLabels[P] : never;
};
|
262e430 to
681c164
Compare

WHY are these changes introduced?
This is the fourth step of the ESLint-to-Oxlint migration. The repository-local CLI rules were one of the remaining reasons normal linting still needed ESLint.
WHAT is this pull request doing?
@shopify/eslint-plugin-cliimplementation as an Oxlint JavaScript pluginno-inline-graphqlknown-failure lookup independent of pnpm installation depth so it works when Oxlint loads the workspace plugin directlyHow to test your changes?
pnpm lint:oxlintpnpm lintnode bin/run-knip-ci.jsgit diff --check