diff --git a/plugins/controlled-documents-resources/src/components/document/DocumentHistory.svelte b/plugins/controlled-documents-resources/src/components/document/DocumentHistory.svelte index ea9293a2ec..e616ca62d4 100644 --- a/plugins/controlled-documents-resources/src/components/document/DocumentHistory.svelte +++ b/plugins/controlled-documents-resources/src/components/document/DocumentHistory.svelte @@ -52,7 +52,7 @@ (doc.major === $controlledDocument.major && doc.minor <= $controlledDocument.minor) ) }) - .toSorted(documentCompareFn) + .sort(documentCompareFn) function getDescription (cc: ChangeControl | undefined): string { if (cc === undefined) { diff --git a/plugins/questions-resources/package.json b/plugins/questions-resources/package.json index 2784c503e5..50662e7667 100644 --- a/plugins/questions-resources/package.json +++ b/plugins/questions-resources/package.json @@ -7,6 +7,7 @@ "build": "compile ui", "build:watch": "compile ui", "format": "format src", + "svelte-check": "do-svelte-check", "_phase:build": "compile ui", "_phase:format": "format src", "_phase:validate": "compile validate" diff --git a/plugins/questions-resources/src/components/OrderingAnswerDataEditor.svelte b/plugins/questions-resources/src/components/OrderingAnswerDataEditor.svelte index 3b7a3b64ac..70e2291ea6 100644 --- a/plugins/questions-resources/src/components/OrderingAnswerDataEditor.svelte +++ b/plugins/questions-resources/src/components/OrderingAnswerDataEditor.svelte @@ -45,12 +45,12 @@ $: if (showDiff && assessmentData !== null) { indices = assessmentData.correctOrder .map((position, index) => [position, index]) - .toSorted(([aPosition], [bPosition]) => (aPosition > bPosition ? 1 : aPosition < bPosition ? -1 : 0)) + .sort(([aPosition], [bPosition]) => (aPosition > bPosition ? 1 : aPosition < bPosition ? -1 : 0)) .map(([_, index]) => index) as [number, ...number[]] } else if (answerData !== null) { indices = answerData.order .map((position, index) => [position, index]) - .toSorted(([aPosition], [bPosition]) => (aPosition > bPosition ? 1 : aPosition < bPosition ? -1 : 0)) + .sort(([aPosition], [bPosition]) => (aPosition > bPosition ? 1 : aPosition < bPosition ? -1 : 0)) .map(([_, index]) => index) as [number, ...number[]] } else { indices = questionData.options.map((_, index) => index) as [number, ...number[]] @@ -67,7 +67,7 @@ indices = moveItem(indices, from, to) const order = indices .map((initialIndex, index) => [initialIndex, index]) - .toSorted(([aInitialIndex], [bInitialIndex]) => + .sort(([aInitialIndex], [bInitialIndex]) => aInitialIndex > bInitialIndex ? 1 : aInitialIndex < bInitialIndex ? -1 : 0 ) .map(([_, index]) => index + 1) as [OrderingPosition, ...OrderingPosition[]] diff --git a/plugins/questions-resources/src/functions/MultipleChoiceAssessmentAssess.ts b/plugins/questions-resources/src/functions/MultipleChoiceAssessmentAssess.ts index 5fe41d4070..c5d51863b3 100644 --- a/plugins/questions-resources/src/functions/MultipleChoiceAssessmentAssess.ts +++ b/plugins/questions-resources/src/functions/MultipleChoiceAssessmentAssess.ts @@ -16,6 +16,8 @@ MultipleChoiceAssessmentAnswer return { score: // eslint-disable-next-line @typescript-eslint/require-array-sort-compare - answerData.selectedIndices.toSorted().join('~') === assessmentData.correctIndices.toSorted().join('~') ? 100 : 0 + answerData.selectedIndices.slice().sort().join('~') === assessmentData.correctIndices.slice().sort().join('~') + ? 100 + : 0 } } diff --git a/plugins/recruit-resources/src/components/EditVacancy.svelte b/plugins/recruit-resources/src/components/EditVacancy.svelte index 0aed8ae7ed..ede94190d3 100644 --- a/plugins/recruit-resources/src/components/EditVacancy.svelte +++ b/plugins/recruit-resources/src/components/EditVacancy.svelte @@ -15,7 +15,7 @@ --> diff --git a/plugins/recruit-resources/src/components/OptimizeSkills.svelte b/plugins/recruit-resources/src/components/OptimizeSkills.svelte index 14ad404157..2b726016cd 100644 --- a/plugins/recruit-resources/src/components/OptimizeSkills.svelte +++ b/plugins/recruit-resources/src/components/OptimizeSkills.svelte @@ -232,7 +232,8 @@ goodTagMap = toIdMap(goodTags) const goodSortedTags = goodTags - .toSorted((a, b) => b.title.length - a.title.length) + .slice() + .sort((a, b) => b.title.length - a.title.length) .filter((t) => t.title.length > 2) const goodSortedTagsTitles = new Map, string>() processed = -1 @@ -251,7 +252,7 @@ const tagElementIds = new Map, TagUpdatePlan['elements'][0]>() - for (const tag of tagElements.toSorted((a, b) => prepareTitle(a.title).length - prepareTitle(b.title).length)) { + for (const tag of tagElements.slice().sort((a, b) => prepareTitle(a.title).length - prepareTitle(b.title).length)) { processed++ const refs = allRefs.filter((it) => it.tag === tag._id) if (goodTagMap.has(tag._id)) { diff --git a/plugins/recruit-resources/src/components/icons/Vacancy.svelte b/plugins/recruit-resources/src/components/icons/Vacancy.svelte index 82205374d1..e6d5113fc7 100644 --- a/plugins/recruit-resources/src/components/icons/Vacancy.svelte +++ b/plugins/recruit-resources/src/components/icons/Vacancy.svelte @@ -14,7 +14,9 @@ // limitations under the License. --> diff --git a/plugins/time-resources/src/components/team/calendar/TeamCalendarDay.svelte b/plugins/time-resources/src/components/team/calendar/TeamCalendarDay.svelte index 4981733440..c0a22b32d2 100644 --- a/plugins/time-resources/src/components/team/calendar/TeamCalendarDay.svelte +++ b/plugins/time-resources/src/components/team/calendar/TeamCalendarDay.svelte @@ -143,14 +143,14 @@ ...gitem.events, ...gitem.busyEvents, ...gitem.busy.slots - ].toSorted((a, b) => a.date - b.date)} + ].sort((a, b) => a.date - b.date)}
{#each Array.from(Array(24).keys()) as hour} {@const _slots = slots .filter((it) => new Date(it.date).getHours() === hour) - .toSorted((a, b) => a.date - b.date)} + .sort((a, b) => a.date - b.date)} {@const cwidth = hourWidths[hour]}
{#each _slots as m, i} diff --git a/plugins/training-resources/package.json b/plugins/training-resources/package.json index 6d851b1da0..727af338fc 100644 --- a/plugins/training-resources/package.json +++ b/plugins/training-resources/package.json @@ -7,6 +7,7 @@ "build": "compile ui", "build:watch": "compile ui", "format": "format src", + "svelte-check": "do-svelte-check", "_phase:build": "compile ui", "_phase:format": "format src", "_phase:validate": "compile validate" diff --git a/plugins/training-resources/src/components/SentRequestCompletionPopup.svelte b/plugins/training-resources/src/components/SentRequestCompletionPopup.svelte index 736716eb1f..ed157c2ced 100644 --- a/plugins/training-resources/src/components/SentRequestCompletionPopup.svelte +++ b/plugins/training-resources/src/components/SentRequestCompletionPopup.svelte @@ -43,7 +43,7 @@ _id: employee._id as Ref, completion: completionMap.get(employee._id) as CompletionMapValue })) - .toSorted((item1, item2) => compareCompletionMapValueState(item1.completion.state, item2.completion.state)) + .sort((item1, item2) => compareCompletionMapValueState(item1.completion.state, item2.completion.state)) }, { sort: { diff --git a/plugins/training-resources/src/functions/trainingAttemptStateSort.ts b/plugins/training-resources/src/functions/trainingAttemptStateSort.ts index 4a67a36802..0ad9eb7aed 100644 --- a/plugins/training-resources/src/functions/trainingAttemptStateSort.ts +++ b/plugins/training-resources/src/functions/trainingAttemptStateSort.ts @@ -9,7 +9,7 @@ export async function trainingAttemptStateSort ( _: TxOperations, states: TrainingAttemptState[] ): Promise { - return states.toSorted( - (state1, state2) => trainingAttemptStateOrder.indexOf(state2) - trainingAttemptStateOrder.indexOf(state1) - ) + return states + .slice() + .sort((state1, state2) => trainingAttemptStateOrder.indexOf(state2) - trainingAttemptStateOrder.indexOf(state1)) } diff --git a/plugins/training-resources/src/functions/trainingStateSort.ts b/plugins/training-resources/src/functions/trainingStateSort.ts index e08898a44e..4c2f0fb14a 100644 --- a/plugins/training-resources/src/functions/trainingStateSort.ts +++ b/plugins/training-resources/src/functions/trainingStateSort.ts @@ -17,5 +17,7 @@ import type { TxOperations } from '@hcengineering/core' import { type TrainingState, trainingStateOrder } from '@hcengineering/training' export async function trainingStateSort (_: TxOperations, states: TrainingState[]): Promise { - return states.toSorted((state1, state2) => trainingStateOrder.indexOf(state1) - trainingStateOrder.indexOf(state2)) + return states + .slice() + .sort((state1, state2) => trainingStateOrder.indexOf(state1) - trainingStateOrder.indexOf(state2)) } diff --git a/plugins/workbench-resources/package.json b/plugins/workbench-resources/package.json index 4e371ccab9..0291371717 100644 --- a/plugins/workbench-resources/package.json +++ b/plugins/workbench-resources/package.json @@ -8,6 +8,7 @@ "build": "compile ui", "build:docs": "api-extractor run --local", "format": "format src", + "svelte-check": "do-svelte-check", "build:watch": "compile ui", "_phase:build": "compile ui", "_phase:format": "format src", diff --git a/plugins/workbench-resources/src/components/statistics/MetricsInfo.svelte b/plugins/workbench-resources/src/components/statistics/MetricsInfo.svelte index 714b0fe849..f862aa7c32 100644 --- a/plugins/workbench-resources/src/components/statistics/MetricsInfo.svelte +++ b/plugins/workbench-resources/src/components/statistics/MetricsInfo.svelte @@ -98,7 +98,7 @@ {/each} {#each Object.entries(metrics.params) as [k, v], i}
- {#each Object.entries(v).toSorted((a, b) => b[1].value / (b[1].operations + 1) - a[1].value / (a[1].operations + 1)) as [kk, vv]} + {#each Object.entries(v).sort((a, b) => b[1].value / (b[1].operations + 1) - a[1].value / (a[1].operations + 1)) as [kk, vv]} {@const childExpandable = vv.topResult !== undefined && vv.topResult.length > 0 &&