Skip to content
Draft
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
1 change: 1 addition & 0 deletions .oxlintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@
"allow": ["URL", "URLSearchParams"]
}
],
"typescript/no-unnecessary-type-assertion": "error",
"jsx-a11y/interactive-supports-focus": "off",
"unicorn/prefer-spread": "error"
},
Expand Down
2 changes: 1 addition & 1 deletion apps/games-api/src/index.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ describe("worker Sentry reporting", () => {
Cookie: "session=synthetic-secret",
},
},
) as Parameters<typeof worker.fetch>[0],
),
env,
ctx,
);
Expand Down
2 changes: 1 addition & 1 deletion apps/games-api/src/leaderboard.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ function makeEnv(overrides: Record<string, unknown> = {}): Env {
return {
SENTRY_GAMES_READ_TOKEN: TOKEN,
...overrides,
} as unknown as Env;
};
}

function upstreamBody(rows: Array<[unknown, unknown]>) {
Expand Down
2 changes: 1 addition & 1 deletion packages/cli/script/bench-sweep.ts
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ function parseArgs(argv: readonly string[]): SweepArgs {
const kneeThresholdPct = 0.03; // 3%

for (let i = 0; i < argv.length; i += 1) {
const arg = argv[i] as string;
const arg = argv[i];
const next = argv[i + 1];
switch (arg) {
case "--size": {
Expand Down
4 changes: 2 additions & 2 deletions packages/cli/script/bench.ts
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,7 @@ function parseArgs(argv: readonly string[]): CliArgs {
const thresholdPct = Number(process.env.BENCH_THRESHOLD ?? 0.2);

for (let i = 0; i < argv.length; i += 1) {
const arg = argv[i] as string;
const arg = argv[i];
const next = argv[i + 1];
if (applyFlag(state, arg, next)) {
i += 1;
Expand Down Expand Up @@ -477,7 +477,7 @@ async function buildOps(): Promise<OpEntry[]> {
".git/HEAD",
];
for (let i = 0; i < 10_000; i += 1) {
const q = queries[i % queries.length] as string;
const q = queries[i % queries.length];
stack.isIgnored(q, false);
}
},
Expand Down
2 changes: 1 addition & 1 deletion packages/cli/script/fragment-commands.ts
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ function parseMarker(token: Token | undefined): Marker | undefined {
function childTokenLists(token: Token): Token[][] {
const lists: Token[][] = [];
if ("tokens" in token && Array.isArray(token.tokens)) {
lists.push(token.tokens as Token[]);
lists.push(token.tokens);
}
if (token.type === "list") {
lists.push(token.items as Token[]);
Expand Down
6 changes: 3 additions & 3 deletions packages/cli/script/generate-banner-image.ts
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,8 @@ function gradientAt(t: number): [number, number, number] {
const seg = clamped * (GRADIENT_ANCHORS.length - 1);
const i = Math.min(GRADIENT_ANCHORS.length - 2, Math.floor(seg));
const f = seg - i;
const a = GRADIENT_ANCHORS[i] as [number, number, number];
const b = GRADIENT_ANCHORS[i + 1] as [number, number, number];
const a = GRADIENT_ANCHORS[i];
const b = GRADIENT_ANCHORS[i + 1];
return [
Math.round(a[0] + (b[0] - a[0]) * f),
Math.round(a[1] + (b[1] - a[1]) * f),
Expand Down Expand Up @@ -106,7 +106,7 @@ function encodePngBase64(mask: PNG): string {
const model = maskModel(mask);
const out = new PNG({ width: mask.width, height: mask.height });
for (let y = 0; y < mask.height; y++) {
const [r, g, b] = palette[model.bandForRow(y)] as [number, number, number];
const [r, g, b] = palette[model.bandForRow(y)];
for (let x = 0; x < mask.width; x++) {
const i = (y * mask.width + x) * 4;
out.data[i] = r;
Expand Down
2 changes: 1 addition & 1 deletion packages/cli/script/generate-docs-sections.ts
Original file line number Diff line number Diff line change
Expand Up @@ -345,7 +345,7 @@ function extractNodeVersion(): string {
*/
function extractDevNodeVersion(): string {
const constraint: string | undefined =
(pkg as any).devEngines?.runtime?.version ?? pkg.engines?.node;
pkg.devEngines?.runtime?.version ?? pkg.engines?.node;
if (!constraint) {
throw new Error("Missing devEngines.runtime.version and engines.node");
}
Expand Down
2 changes: 1 addition & 1 deletion packages/cli/script/generate-sdk.ts
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@ function extractSdkFlags(command: Command): SdkFlagInfo[] {

const flags: SdkFlagInfo[] = [];

for (const [name, def] of Object.entries(flagDefs) as [string, FlagDef][]) {
for (const [name, def] of Object.entries(flagDefs)) {
if (INTERNAL_FLAGS.has(name)) {
continue;
}
Expand Down
2 changes: 1 addition & 1 deletion packages/cli/script/lib/output-schema-fields.ts
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,7 @@ export function extractSchemaFieldPaths(schema: GenericSchema): string[] {
}
}
};
visit(schema as unknown as ValibotSchemaNode, "");
visit(schema, "");
return [...paths];
}

Expand Down
4 changes: 1 addition & 3 deletions packages/cli/src/commands/alert/issues/edit.ts
Original file line number Diff line number Diff line change
Expand Up @@ -147,9 +147,7 @@ function applyIssueEdits(
const actionFilters = Array.isArray(body.actionFilters)
? (body.actionFilters as Record<string, unknown>[])
: [];
const existingFilter = actionFilters[0] as
| Record<string, unknown>
| undefined;
const existingFilter = actionFilters[0];
// When the rule has no action filter yet, a partial edit (e.g. only
// --action) must still emit a valid DataConditionGroup. Seed the same
// defaults the create path uses so the group carries a logicType and a
Expand Down
2 changes: 1 addition & 1 deletion packages/cli/src/commands/api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1354,7 +1354,7 @@ export function buildFromFields(
// Merge field-built key=value entries into the auto-detected JSON object body
body =
body && typeof body === "object"
? { ...(body as Record<string, unknown>), ...options.body }
? { ...body, ...options.body }
: options.body;
}

Expand Down
2 changes: 1 addition & 1 deletion packages/cli/src/commands/auth/default.ts
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,7 @@ export const authDefaultCommand = buildCommand({
async *func(this: SentryContext, flags: AuthDefaultFlags) {
const target = resolveAuthDefaultTarget(flags);
const command = target === "login" ? loginCommand : statusCommand;
const raw = getRawFunc(command as Command<SentryContext>);
const raw = getRawFunc(command);
const generator = raw.call(
this,
flags as unknown as Record<string, unknown>,
Expand Down
2 changes: 1 addition & 1 deletion packages/cli/src/commands/cli/upgrade.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1113,7 +1113,7 @@ function startChangelogFetch(options: {
source,
})
.then((result) => result ?? undefined)
.catch(() => undefined as undefined);
.catch(() => undefined);
}

/**
Expand Down
5 changes: 2 additions & 3 deletions packages/cli/src/commands/local/server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -435,13 +435,12 @@ export function buildApp(
contentType = SENTRY_CONTENT_TYPE;
}
const rawEncoding = c.req.header("content-encoding");
const contentEncoding = (
const contentEncoding =
rawEncoding === "gzip" ||
rawEncoding === "deflate" ||
rawEncoding === "br"
? rawEncoding
: undefined
) as "gzip" | "deflate" | "br" | undefined;
: undefined;
const userAgent = c.req.header("user-agent");

pushToSpotlightBuffer({
Expand Down
3 changes: 1 addition & 2 deletions packages/cli/src/commands/monitor/run.ts
Original file line number Diff line number Diff line change
Expand Up @@ -362,8 +362,7 @@ The wrapped command receives the \`SENTRY_MONITOR_SLUG\` environment variable.`,
// Map signal kills to 128+N (Unix convention: e.g. 130 for
// SIGINT, 137 for SIGKILL, 143 for SIGTERM) so CI pipelines
// and shell scripts inspecting $? see the correct exit code.
const sigNum =
osConstants.signals[signal as keyof typeof osConstants.signals];
const sigNum = osConstants.signals[signal];
resolve(128 + (sigNum ?? 1));
} else {
resolve(1);
Expand Down
4 changes: 1 addition & 3 deletions packages/cli/src/commands/release/list.ts
Original file line number Diff line number Diff line change
Expand Up @@ -170,9 +170,7 @@ function formatSessionSparkline(r: SentryRelease): string {
if (!health) {
return "";
}
const points = extractSessionPoints(
health.stats as Record<string, unknown> | undefined,
);
const points = extractSessionPoints(health.stats);
if (points.length === 0) {
return "";
}
Expand Down
2 changes: 1 addition & 1 deletion packages/cli/src/lib/api-scope.ts
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ function extractScopeCandidate(entry: unknown): string | undefined {
entry &&
typeof entry === "object" &&
"scope" in entry &&
typeof (entry as { scope: unknown }).scope === "string"
typeof entry.scope === "string"
) {
return (entry as { scope: string }).scope;
}
Expand Down
11 changes: 2 additions & 9 deletions packages/cli/src/lib/api/alerts.ts
Original file line number Diff line number Diff line change
Expand Up @@ -425,11 +425,6 @@ export async function listMetricAlertsPaginated(
sortBy: "-id",
cursor: options.cursor,
per_page: options.perPage,
} as {
query?: string;
sortBy?: string;
cursor?: string;
per_page?: number;
},
});
const { data, nextCursor } = unwrapPaginatedResult<MetricDetector[]>(
Expand Down Expand Up @@ -734,7 +729,7 @@ function buildDetectorBody(
detectorBody.enabled = Number(body.status) !== 1;
}
if (body.owner !== undefined) {
detectorBody.owner = body.owner as string | null;
detectorBody.owner = body.owner;
}
return detectorBody;
}
Expand Down Expand Up @@ -846,9 +841,7 @@ export async function putMetricAlertRule(
},
// `buildDetectorBody` returns the camelCase detector document as a plain
// record, so cast it into the SDK's typed body.
body: buildDetectorBody(body) as unknown as Parameters<
typeof updateOrganizationDetector
>[0]["body"],
body: buildDetectorBody(body),
});
return unwrapResult<UpdateOrganizationDetectorResponse>(
result,
Expand Down
2 changes: 1 addition & 1 deletion packages/cli/src/lib/api/events.ts
Original file line number Diff line number Diff line change
Expand Up @@ -278,7 +278,7 @@ export async function listIssueEvents(
// `per_page` is accepted at runtime but absent from the generated query
// type, so widen via cast.
per_page: perPage,
} as Parameters<typeof listOrganizationIssueEvents>[0]["query"],
},
});
return unwrapPaginatedResult<IssueEvent[]>(
result,
Expand Down
2 changes: 1 addition & 1 deletion packages/cli/src/lib/api/infrastructure.ts
Original file line number Diff line number Diff line change
Expand Up @@ -367,7 +367,7 @@ export function throwApiError(
const status = response.status;
const rawDetail =
error && typeof error === "object" && "detail" in error
? (error as { detail: unknown }).detail
? error.detail
: undefined;
const hasUsableDetail = rawDetail !== null && rawDetail !== undefined;
// Enrichment functions (enrich403Detail, enrich401Detail) render better
Expand Down
2 changes: 1 addition & 1 deletion packages/cli/src/lib/api/issues.ts
Original file line number Diff line number Diff line change
Expand Up @@ -751,7 +751,7 @@ export async function getSharedIssue(
try {
result = await getOrganizationSharedIssue({
baseUrl: normalizedBase,
fetch: fetchUnauthenticated as unknown as typeof fetch,
fetch: fetchUnauthenticated,
headers,
parseAs: "json",
path: { organization_id_or_slug: orgSlug, share_id: shareId },
Expand Down
2 changes: 1 addition & 1 deletion packages/cli/src/lib/api/logs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -218,7 +218,7 @@ export async function listLogs(
start: options.start,
end: options.end,
sort: toApiSort(options.sort),
} as Parameters<typeof listOrganizationEvents>[0]["query"],
},
});

const { data: raw, nextCursor } = unwrapPaginatedResult<unknown>(
Expand Down
5 changes: 1 addition & 4 deletions packages/cli/src/lib/api/preprod-artifacts.ts
Original file line number Diff line number Diff line change
Expand Up @@ -190,10 +190,7 @@ export async function downloadBuildArtifact(
}

// Stream to disk so large (hundreds-of-MB) artifacts never buffer in memory.
await pipeline(
Readable.fromWeb(response.body as Parameters<typeof Readable.fromWeb>[0]),
createWriteStream(destPath),
);
await pipeline(Readable.fromWeb(response.body), createWriteStream(destPath));
}

/** Optional metadata sent with a build assemble request. */
Expand Down
7 changes: 2 additions & 5 deletions packages/cli/src/lib/api/projects.ts
Original file line number Diff line number Diff line change
Expand Up @@ -81,10 +81,7 @@ export async function listProjects(orgSlug: string): Promise<SentryProject[]> {
const result = await listOrganizationProjects({
...config,
path: { organization_id_or_slug: orgSlug },
query: { cursor, per_page: API_MAX_PER_PAGE } as {
cursor?: string;
per_page?: number;
},
query: { cursor, per_page: API_MAX_PER_PAGE },
});
return unwrapPaginatedResult<SentryProject[]>(
result,
Expand Down Expand Up @@ -138,7 +135,7 @@ export async function listProjectsPaginated(
cursor: options.cursor,
per_page: perPage,
query: options.query,
} as { cursor?: string; per_page?: number; query?: string },
},
});

return unwrapPaginatedResult<SentryProject[]>(
Expand Down
8 changes: 2 additions & 6 deletions packages/cli/src/lib/api/releases.ts
Original file line number Diff line number Diff line change
Expand Up @@ -306,9 +306,7 @@ export async function updateRelease(
organization_id_or_slug: orgSlug,
version,
},
body: body as unknown as Parameters<
typeof updateOrganizationRelease
>[0]["body"],
body: body,
});

return unwrapResult<SentryRelease>(
Expand Down Expand Up @@ -394,9 +392,7 @@ export async function createReleaseDeploy(
organization_id_or_slug: orgSlug,
version,
},
body: body as unknown as Parameters<
typeof createOrganizationReleaseDeploy
>[0]["body"],
body: body,
});

return unwrapResult<SentryDeploy>(result, "Failed to create deploy");
Expand Down
6 changes: 1 addition & 5 deletions packages/cli/src/lib/api/replays.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ import {
ReplayDetailsResponseSchema,
ReplayIdsByResourceSchema,
type ReplayListItem,
type ReplayListResponse,
ReplayListResponseSchema,
type ReplayStringProjectId,
} from "../../types/index.js";
Expand Down Expand Up @@ -221,10 +220,7 @@ async function fetchReplayPage(
start: options.start,
end: options.end,
},
schema: ReplayListResponseSchema as GenericSchema<
unknown,
ReplayListResponse
>,
schema: ReplayListResponseSchema,
},
);

Expand Down
2 changes: 1 addition & 1 deletion packages/cli/src/lib/api/teams.ts
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ export async function listTeamsPaginated(
cursor: options.cursor,
per_page: options.perPage ?? 25,
query: options.query,
} as { cursor?: string; per_page?: number; query?: string },
},
});

return unwrapPaginatedResult<SentryTeam[]>(result, "Failed to list teams");
Expand Down
2 changes: 1 addition & 1 deletion packages/cli/src/lib/chunk-loader.ts
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ function suppressLoaderWarning(): void {
return;
}
loaderWarningSuppressed = true;
const originalEmit = process.emit.bind(process) as typeof process.emit;
const originalEmit = process.emit.bind(process);
process.emit = ((event: string, ...args: unknown[]) => {
const [warning] = args;
if (
Expand Down
7 changes: 2 additions & 5 deletions packages/cli/src/lib/command.ts
Original file line number Diff line number Diff line change
Expand Up @@ -578,10 +578,7 @@ export function buildCommand<
builderArgs.skipRcUrlCheck === true || builderArgs.auth === "dsn";

// Merge global flags into the command's flag definitions.
const existingParams = (builderArgs.parameters ?? {}) as Record<
string,
unknown
>;
const existingParams = builderArgs.parameters ?? {};
const existingFlags = (existingParams.flags ?? {}) as Record<string, unknown>;

const { mergedFlags, commandOwnsOrg, commandOwnsProject, stripKeys } =
Expand Down Expand Up @@ -799,7 +796,7 @@ export function buildCommand<
commandOwnsProject,
);

const cleanFlags = cleanRawFlags(flags as Record<string, unknown>);
const cleanFlags = cleanRawFlags(flags);
setFlagContext(cleanFlags);
if (args.length > 0) {
setArgsContext(args.flatMap(rawPositional));
Expand Down
4 changes: 2 additions & 2 deletions packages/cli/src/lib/db/resilient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -286,7 +286,7 @@ export function createResilientDatabase(
): Database {
const originalQuery = db.query.bind(db);

return new Proxy(db as object, {
return new Proxy(db, {
get(target, prop) {
if (prop === "query") {
return (sql: string) => {
Expand Down Expand Up @@ -316,5 +316,5 @@ export function createResilientDatabase(
}
return value;
},
}) as Database;
});
}
2 changes: 1 addition & 1 deletion packages/cli/src/lib/db/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ export function upsert<T extends Record<string, SqlValue>>(
options: UpsertOptions<T> = {},
): SqlQuery {
const columns = Object.keys(data);
const values = Object.values(data) as SqlValue[];
const values = Object.values(data);

if (columns.length === 0) {
throw new Error("upsert: data object must have at least one column");
Expand Down
Loading
Loading