Skip to content

Commit 6a68329

Browse files
JoshuaKGoldbergclaudesentry-junior[bot]
authored
ref(lint): Enable no-unnecessary-template-expression (#2126)
Turns on `typescript/no-unnecessary-template-expression` and unwraps the template literals that only wrapped a single string. Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com> Co-authored-by: sentry-junior[bot] <264270552+sentry-junior[bot]@users.noreply.github.com>
1 parent 931a0c9 commit 6a68329

11 files changed

Lines changed: 15 additions & 14 deletions

File tree

‎.oxlintrc.json‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@
3737
"allow": ["URL", "URLSearchParams"]
3838
}
3939
],
40+
"typescript/no-unnecessary-template-expression": "error",
4041
"typescript/no-unnecessary-type-assertion": "error",
4142
"typescript/no-unnecessary-type-parameters": "error",
4243
"typescript/no-useless-default-assignment": "error",

‎packages/cli/src/commands/issue/resolve-commit-spec.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -161,7 +161,7 @@ export async function resolveCommitSpec(
161161
if (!match) {
162162
throw new ValidationError(
163163
`--in @commit:${spec.repository}@${spec.commit}: no Sentry repository named '${spec.repository}' in organization '${orgSlug}'.\n\n` +
164-
`${formatAvailableRepos(sentryRepos)}`,
164+
formatAvailableRepos(sentryRepos),
165165
"in",
166166
);
167167
}

‎packages/cli/src/lib/db/pagination.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -518,7 +518,7 @@ export function buildMultiTargetContextKey(
518518
? escapeContextKeyValue(filters.query)
519519
: undefined;
520520
return (
521-
`${base}` +
521+
base +
522522
(escapedSort ? `|sort:${escapedSort}` : "") +
523523
`|period:${escapedPeriod}` +
524524
(escapedQuery ? `|q:${escapedQuery}` : "") +

‎packages/cli/src/lib/formatters/human.ts‎

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2422,9 +2422,7 @@ export function formatUpgradeResult(data: UpgradeResult): string {
24222422
default: {
24232423
// Exhaustive check — all action types should be handled above
24242424
const _: never = data.action;
2425-
lines.push(
2426-
`${ACTION_DESCRIPTIONS[_ as UpgradeResult["action"]] ?? "Done"}`,
2427-
);
2425+
lines.push(ACTION_DESCRIPTIONS[_ as UpgradeResult["action"]] ?? "Done");
24282426
}
24292427
}
24302428

‎packages/cli/test/lib/command.test.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1213,7 +1213,7 @@ describe("buildCommand return-based output", () => {
12131213
auth: false,
12141214
docs: { brief: "Test" },
12151215
output: {
1216-
human: (d: { id: number; name: string; role: string }) => `${d.name}`,
1216+
human: (d: { id: number; name: string; role: string }) => d.name,
12171217
},
12181218
parameters: {},
12191219
async *func(this: TestContext) {

‎packages/cli/test/lib/delta-upgrade.mocked.test.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -227,7 +227,7 @@ describe("resolveNightlyDelta", () => {
227227
mediaType: "application/octet-stream",
228228
size: 1000,
229229
annotations: {
230-
"org.opencontainers.image.title": `${BINARY_NAME}`,
230+
"org.opencontainers.image.title": BINARY_NAME,
231231
},
232232
},
233233
],

‎packages/cli/test/lib/formatters/output.test.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ describe("renderCommandOutput", () => {
6666
test("renders JSON when json=true", () => {
6767
const w = createTestWriter();
6868
const config: OutputConfig<{ id: number; name: string }> = {
69-
human: (d) => `${d.name}`,
69+
human: (d) => d.name,
7070
};
7171
render(w, { id: 1, name: "Alice" }, config, { json: true });
7272
expect(JSON.parse(w.output)).toEqual({ id: 1, name: "Alice" });

‎packages/cli/test/lib/formatters/text-table.test.ts‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -376,7 +376,9 @@ describe("truncate option", () => {
376376
});
377377

378378
test("ellipsis inherits ANSI color from surrounding text", () => {
379-
const colored = `${chalk.hex("#898294")("A very long colored text that will be truncated at the boundary")}`;
379+
const colored = chalk.hex("#898294")(
380+
"A very long colored text that will be truncated at the boundary",
381+
);
380382
const out = renderTextTable(["VAL"], [[colored]], {
381383
maxWidth: 30,
382384
truncate: true,

‎packages/cli/test/lib/hex-id.test.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -202,7 +202,7 @@ describe("validateHexId", () => {
202202
});
203203

204204
test("throws for newline-separated IDs (not a single valid ID)", () => {
205-
const multiLine = `${VALID_ID}\n${"bbbb1111cccc2222dddd3333eeee4444"}`;
205+
const multiLine = `${VALID_ID}\nbbbb1111cccc2222dddd3333eeee4444`;
206206
expect(() => validateHexId(multiLine, "test ID")).toThrow(ValidationError);
207207
});
208208

‎packages/cli/test/lib/sentry-client.test.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -643,7 +643,7 @@ describe("fetchWithTimeout internal timeout classification", () => {
643643
const authFetch = getSdkConfig(REGION_URL, {
644644
idempotent: true,
645645
timeoutMs: 50,
646-
}).fetch as typeof fetch;
646+
}).fetch;
647647
const error = await authFetch(`${REGION_URL}/api/0/chunk-upload/`, {
648648
method: "POST",
649649
body: "{}",

0 commit comments

Comments
 (0)