Phase 10: запрет inline eslint-disable, file-level overrides, IUser-тип
This commit is contained in:
@@ -22,7 +22,6 @@ function fieldOf(obj: unknown, key: string): string | undefined {
|
||||
if (typeof obj !== 'object' || obj === null) {
|
||||
return undefined;
|
||||
}
|
||||
// eslint-disable-next-line @typescript-eslint/consistent-type-assertions, @typescript-eslint/no-unsafe-type-assertion -- извлечение полей из unknown
|
||||
const record = obj as Record<string, unknown>;
|
||||
const value = record[key];
|
||||
return typeof value === 'string' ? value : undefined;
|
||||
@@ -48,7 +47,6 @@ function userEmailOf(body: unknown): string | undefined {
|
||||
if (typeof body !== 'object' || body === null) {
|
||||
return undefined;
|
||||
}
|
||||
// eslint-disable-next-line @typescript-eslint/consistent-type-assertions, @typescript-eslint/no-unsafe-type-assertion -- извлечение полей из unknown
|
||||
const record = body as Record<string, unknown>;
|
||||
// /me возвращает { id, email } на верхнем уровне, register/login — { user: { id, email } }
|
||||
if (record.email !== undefined) {
|
||||
@@ -67,7 +65,6 @@ function userIdOf(body: unknown): string | undefined {
|
||||
if (typeof body !== 'object' || body === null) {
|
||||
return undefined;
|
||||
}
|
||||
// eslint-disable-next-line @typescript-eslint/consistent-type-assertions, @typescript-eslint/no-unsafe-type-assertion -- извлечение полей из unknown
|
||||
const user = (body as Record<string, unknown>).user;
|
||||
return fieldOf(user, 'id');
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user