Replace global unicorn/no-array-sort disable with targeted inline suppression
Remove the project-wide 'unicorn/no-array-sort': 'off' from .oxlintrc.json and add targeted // oxlint-disable-next-line unicorn/no-array-sort comments at each call site that intentionally uses Array#sort(). This preserves the lint safety net for the rest of the codebase while allowing the specific call sites that need in-place sorting.
This commit is contained in:
7 files changed
+45
-31
No files matched your search
@@ -101,6 +101,7 @@ export function buildTerminalMenuSessions(input: {
|
||||
sessionsById.set(input.currentSession.terminalId, input.currentSession);
|
||||
}
|
||||
|
||||
// oxlint-disable-next-line unicorn/no-array-sort
|
||||
return Array.from(sessionsById.values()).sort((left, right) =>
|
||||
left.terminalId.localeCompare(right.terminalId, undefined, { numeric: true }),
|
||||
);
|
||||
|
||||
@@ -65,6 +65,7 @@ export function ThreadNavigationDrawer(props: {
|
||||
title: group.projects[0]?.project.title ?? group.title,
|
||||
threads: group.projects
|
||||
.flatMap((projectGroup) => projectGroup.threads)
|
||||
// oxlint-disable-next-line unicorn/no-array-sort
|
||||
.sort(compareThreadActivity),
|
||||
})),
|
||||
[repositoryGroups],
|
||||
|
||||
@@ -860,6 +860,7 @@ it.layer(NodeServices.layer, { excludeTestServices: true })("TerminalManager", (
|
||||
const closedEvents = (yield* getEvents).filter(
|
||||
(event): event is Extract<TerminalEvent, { type: "closed" }> => event.type === "closed",
|
||||
);
|
||||
// oxlint-disable-next-line unicorn/no-array-sort
|
||||
expect(closedEvents.map((event) => event.terminalId).sort()).toEqual(["default", "sidecar"]);
|
||||
}),
|
||||
);
|
||||
|
||||
@@ -420,7 +420,9 @@ function terminalIdListsEqual(left: readonly string[], right: readonly string[])
|
||||
if (left.length === 0) {
|
||||
return true;
|
||||
}
|
||||
// oxlint-disable-next-line unicorn/no-array-sort
|
||||
const sortedLeft = [...left].sort((a, b) => a.localeCompare(b));
|
||||
// oxlint-disable-next-line unicorn/no-array-sort
|
||||
const sortedRight = [...right].sort((a, b) => a.localeCompare(b));
|
||||
for (let index = 0; index < sortedLeft.length; index += 1) {
|
||||
if (sortedLeft[index] !== sortedRight[index]) {
|
||||
|
||||
Reference in new issue
Block a user