Убраны предупреждения линта в utils/sla
no-new-null: подавление стояло перед сигнатурой effectiveSlaHours, а предупреждения падали на строки параметра и типа возврата — комментарии перенесены к самим строкам; в isRowOverdue подавление добавлено. explicit-function-return-type: у хелпера row в тесте activatedAt указан тип возврата (ActivationRow — те же поля, что читает activatedAt). Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
@@ -9,7 +9,10 @@ import {
|
||||
slaHoursToInput,
|
||||
triStateToBool
|
||||
} from './sla';
|
||||
import { APPROVAL_PHASE } from '../models';
|
||||
import { APPROVAL_PHASE, ManagedApprovalRow } from '../models';
|
||||
|
||||
/** Ровно те поля строки, которые читает activatedAt (см. его сигнатуру). */
|
||||
type ActivationRow = Pick<ManagedApprovalRow, 'order' | 'phase' | 'dateIso'>;
|
||||
|
||||
// Смысл всех этих проверок один: «не задано» и «ноль/нет» — РАЗНЫЕ состояния.
|
||||
// Если они где-то схлопнутся, шаг с настройкой «напоминать сразу» станет
|
||||
@@ -110,7 +113,7 @@ describe('effectiveSlaHours', () => {
|
||||
// Повторяет ReminderService.ActivatedAt на бэкенде — та же формула, поэтому и
|
||||
// проверяется на тех же случаях (параллельные шаги, переход между фазами).
|
||||
describe('activatedAt', () => {
|
||||
const row = (order: number, phase: string, dateIso: string) => ({ order, phase, dateIso });
|
||||
const row = (order: number, phase: string, dateIso: string): ActivationRow => ({ order, phase, dateIso });
|
||||
|
||||
it('первый шаг согласования — от создания заявки', () => {
|
||||
const rows = [row(1, APPROVAL_PHASE.approval, '')];
|
||||
|
||||
@@ -76,10 +76,11 @@ export function formatSlaHours(value: number | null | undefined): string {
|
||||
* здесь его нужно повторить, чтобы посчитать просрочку и показать реальное число
|
||||
* часов, а не только «от типа заявки» без цифры.
|
||||
*/
|
||||
// eslint-disable-next-line @rushstack/no-new-null -- зеркалит nullable-контракт бэкенда
|
||||
export function effectiveSlaHours(
|
||||
row: Pick<ManagedApprovalRow, 'slaHours'>,
|
||||
// eslint-disable-next-line @rushstack/no-new-null -- зеркалит nullable-контракт бэкенда
|
||||
requestTypeSlaHours: number | null | undefined
|
||||
// eslint-disable-next-line @rushstack/no-new-null -- null = «SLA не задан нигде», это не 0
|
||||
): number | null {
|
||||
if (row.slaHours !== null) return row.slaHours;
|
||||
return requestTypeSlaHours ?? null;
|
||||
@@ -140,6 +141,7 @@ export function isRowOverdue(
|
||||
row: Pick<ManagedApprovalRow, 'order' | 'phase' | 'dateIso' | 'slaHours'>,
|
||||
allRows: readonly Pick<ManagedApprovalRow, 'order' | 'phase' | 'dateIso'>[],
|
||||
requestCreatedIso: string,
|
||||
// eslint-disable-next-line @rushstack/no-new-null -- зеркалит nullable-контракт бэкенда
|
||||
requestTypeSlaHours: number | null | undefined,
|
||||
now: Date
|
||||
): boolean {
|
||||
|
||||
Reference in New Issue
Block a user