From 9546dc2aa39ab096ccc723786e718a739d0bdaf9 Mon Sep 17 00:00:00 2001 From: Kristóf Marussy Date: Thu, 27 Jan 2022 00:17:22 +0100 Subject: refactor: Coding conventions MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Make sure that files have a default import with the same name as the file whenever possible to reduce surprise. Also shuffles around some file names for better legibility. Signed-off-by: Kristóf Marussy --- packages/service-shared/src/index.ts | 3 +-- packages/service-shared/src/schemas.ts | 16 ++++++++++++---- 2 files changed, 13 insertions(+), 6 deletions(-) (limited to 'packages/service-shared') diff --git a/packages/service-shared/src/index.ts b/packages/service-shared/src/index.ts index 94be734..a2e5ee5 100644 --- a/packages/service-shared/src/index.ts +++ b/packages/service-shared/src/index.ts @@ -20,5 +20,4 @@ export { MainToServiceIpcMessage, ServiceToMainIpcMessage } from './ipc'; -export type { UnreadCount, WebSource } from './schemas'; -export { unreadCount, webSource } from './schemas'; +export { UnreadCount, WebSource } from './schemas'; diff --git a/packages/service-shared/src/schemas.ts b/packages/service-shared/src/schemas.ts index 586750c..0b31eb7 100644 --- a/packages/service-shared/src/schemas.ts +++ b/packages/service-shared/src/schemas.ts @@ -20,16 +20,24 @@ import { z } from 'zod'; -export const unreadCount = z.object({ +export const UnreadCount = z.object({ direct: z.number().nonnegative().optional(), indirect: z.number().nonnegative().optional(), }); -export type UnreadCount = z.infer; +/* + eslint-disable-next-line @typescript-eslint/no-redeclare -- + Intentionally naming the type the same as the schema definition. +*/ +export type UnreadCount = z.infer; -export const webSource = z.object({ +export const WebSource = z.object({ code: z.string(), url: z.string().nonempty(), }); -export type WebSource = z.infer; +/* + eslint-disable-next-line @typescript-eslint/no-redeclare -- + Intentionally naming the type the same as the schema definition. +*/ +export type WebSource = z.infer; -- cgit v1.2.3-54-g00ecf