diff --git a/packages/types/.eslintignore b/packages/types/.eslintignore deleted file mode 120000 index 5169d53c8..000000000 --- a/packages/types/.eslintignore +++ /dev/null @@ -1 +0,0 @@ -../../lint-configs/.eslintignore \ No newline at end of file diff --git a/packages/types/.eslintrc.js b/packages/types/.eslintrc.js deleted file mode 120000 index 5962fa3ca..000000000 --- a/packages/types/.eslintrc.js +++ /dev/null @@ -1 +0,0 @@ -../../lint-configs/.eslintrc.js \ No newline at end of file diff --git a/packages/types/.vscode/settings.json b/packages/types/.vscode/settings.json index 6de18e4ed..97bef4c57 100644 --- a/packages/types/.vscode/settings.json +++ b/packages/types/.vscode/settings.json @@ -1,3 +1,3 @@ { - "typescript.tsdk": "./node_modules/typescript/lib" + "typescript.tsdk": "./node_modules/typescript/lib" } diff --git a/packages/types/api-extractor.json b/packages/types/api-extractor.json deleted file mode 100644 index dbbbba8b5..000000000 --- a/packages/types/api-extractor.json +++ /dev/null @@ -1,34 +0,0 @@ -{ - /** - * Config file for API Extractor. For more info, please visit: https://api-extractor.com - */ - "$schema": "https://developer.microsoft.com/json-schemas/api-extractor/v7/api-extractor.schema.json", - - "mainEntryPointFilePath": "/dist/index.d.ts", - - "apiReport": { - "enabled": false - }, - - "docModel": { - "enabled": true, - "apiJsonFilePath": "/../../support/ref-docs/models/.api.json" - }, - - "dtsRollup": { - "enabled": false - }, - - "tsdocMetadata": { - "enabled": false - }, - - "messages": { - "extractorMessageReporting": { - // Disable release tagging warnings - "ae-missing-release-tag": { - "logLevel": "none" - } - } - } -} diff --git a/packages/types/biome.json b/packages/types/biome.json new file mode 100644 index 000000000..ea710a856 --- /dev/null +++ b/packages/types/biome.json @@ -0,0 +1,4 @@ +{ + "$schema": "https://biomejs.dev/schemas/1.8.3/schema.json", + "extends": ["../../biome.json"] +} diff --git a/packages/types/package.json b/packages/types/package.json index de3477451..aabdacf25 100644 --- a/packages/types/package.json +++ b/packages/types/package.json @@ -4,17 +4,10 @@ "description": "Shared type definitions for the Node Slack SDK", "author": "Slack Technologies, LLC", "license": "MIT", - "keywords": [ - "slack", - "typescript", - "types", - "api" - ], + "keywords": ["slack", "typescript", "types", "api"], "main": "dist/index.js", "types": "dist/index.d.ts", - "files": [ - "dist/**/*" - ], + "files": ["dist/**/*"], "engines": { "node": ">= 12.13.0", "npm": ">= 6.12.0" @@ -31,22 +24,12 @@ "prepare": "npm run build", "build": "npm run build:clean && tsc", "build:clean": "shx rm -rf ./dist", - "lint": "eslint --fix --ext .ts src", + "lint": "npx @biomejs/biome check --write .", "test": "npm run lint && npm run build && npm run test:types", - "test:types": "tsd", - "ref-docs:model": "api-extractor run" + "test:types": "tsd" }, "devDependencies": { - "@microsoft/api-extractor": "^7.38.0", - "@typescript-eslint/eslint-plugin": "^6.4.1", - "@typescript-eslint/parser": "^6.4.0", - "eslint": "^8.47.0", - "eslint-config-airbnb-base": "^15.0.0", - "eslint-config-airbnb-typescript": "^17.1.0", - "eslint-plugin-import": "^2.28.1", - "eslint-plugin-import-newlines": "^1.3.4", - "eslint-plugin-jsdoc": "^46.5.0", - "eslint-plugin-node": "^11.1.0", + "@biomejs/biome": "^1.8.3", "shx": "^0.3.2", "tsd": "^0.31.0", "typescript": "^5.5.4" diff --git a/packages/types/src/block-kit/block-elements.ts b/packages/types/src/block-kit/block-elements.ts index 00ba2420b..840cc58c0 100644 --- a/packages/types/src/block-kit/block-elements.ts +++ b/packages/types/src/block-kit/block-elements.ts @@ -1,7 +1,7 @@ // This file contains objects documented here: https://api.slack.com/reference/block-kit/block-elements -import { RichTextBlock } from './blocks'; -import { +import type { RichTextBlock } from './blocks'; +import type { ColorScheme, Option, PlainTextElement, @@ -9,7 +9,7 @@ import { SlackFileImageObject, UrlImageObject, } from './composition-objects'; -import { +import type { Actionable, Confirmable, Dispatchable, @@ -89,11 +89,7 @@ export interface Checkboxes extends Actionable, Confirmable, Focusable { * @see {@link https://api.slack.com/reference/block-kit/block-elements#datepicker Date picker element reference}. * @see {@link https://api.slack.com/interactivity/handling This is an interactive component - see our guide to enabling interactivity}. */ -export interface Datepicker - extends Actionable, - Confirmable, - Focusable, - Placeholdable { +export interface Datepicker extends Actionable, Confirmable, Focusable, Placeholdable { /** * @description The type of element. In this case `type` is always `datepicker`. */ @@ -131,11 +127,7 @@ export interface DateTimepicker extends Actionable, Confirmable, Focusable { * @see {@link https://api.slack.com/reference/block-kit/block-elements#email Email input element reference}. * @see {@link https://api.slack.com/interactivity/handling This is an interactive component - see our guide to enabling interactivity}. */ -export interface EmailInput - extends Actionable, - Dispatchable, - Focusable, - Placeholdable { +export interface EmailInput extends Actionable, Dispatchable, Focusable, Placeholdable { /** * @description The type of element. In this case `type` is always `email_text_input`. */ @@ -199,12 +191,7 @@ export type ImageElement = { * @see {@link https://api.slack.com/reference/block-kit/block-elements#select Select menu element reference}. * @see {@link https://api.slack.com/interactivity/handling This is an interactive component - see our guide to enabling interactivity}. */ -export type Select = - | UsersSelect - | StaticSelect - | ConversationsSelect - | ChannelsSelect - | ExternalSelect; +export type Select = UsersSelect | StaticSelect | ConversationsSelect | ChannelsSelect | ExternalSelect; /** * @description Allows users to select multiple items from a list of options. @@ -229,11 +216,7 @@ export type MultiSelect = * @see {@link https://api.slack.com/reference/block-kit/block-elements#users_select Select menu of users reference}. * @see {@link https://api.slack.com/interactivity/handling This is an interactive component - see our guide to enabling interactivity}. */ -export interface UsersSelect - extends Actionable, - Confirmable, - Focusable, - Placeholdable { +export interface UsersSelect extends Actionable, Confirmable, Focusable, Placeholdable { /** * @description The type of element. In this case `type` is always `users_select`. */ @@ -250,12 +233,7 @@ export interface UsersSelect * @see {@link https://api.slack.com/reference/block-kit/block-elements#users_multi_select Multi-select menu of users reference}. * @see {@link https://api.slack.com/interactivity/handling This is an interactive component - see our guide to enabling interactivity}. */ -export interface MultiUsersSelect - extends Actionable, - Confirmable, - Focusable, - MaxItemsSelectable, - Placeholdable { +export interface MultiUsersSelect extends Actionable, Confirmable, Focusable, MaxItemsSelectable, Placeholdable { /** * @description The type of element. In this case `type` is always `multi_users_select`. */ @@ -272,11 +250,7 @@ export interface MultiUsersSelect * @see {@link https://api.slack.com/reference/block-kit/block-elements#static_select Select menu of static options reference}. * @see {@link https://api.slack.com/interactivity/handling This is an interactive component - see our guide to enabling interactivity}. */ -export interface StaticSelect - extends Actionable, - Confirmable, - Focusable, - Placeholdable { +export interface StaticSelect extends Actionable, Confirmable, Focusable, Placeholdable { /** * @description The type of element. In this case `type` is always `static_select`. */ @@ -313,12 +287,7 @@ export interface StaticSelect * @see {@link https://api.slack.com/reference/block-kit/block-elements#static_multi_select Multi-select menu of static options reference}. * @see {@link https://api.slack.com/interactivity/handling This is an interactive component - see our guide to enabling interactivity}. */ -export interface MultiStaticSelect - extends Actionable, - Confirmable, - Focusable, - MaxItemsSelectable, - Placeholdable { +export interface MultiStaticSelect extends Actionable, Confirmable, Focusable, MaxItemsSelectable, Placeholdable { /** * @description The type of element. In this case `type` is always `multi_static_select`. */ @@ -355,12 +324,7 @@ export interface MultiStaticSelect * @see {@link https://api.slack.com/reference/block-kit/block-elements#conversations_select Select menu of conversations reference}. * @see {@link https://api.slack.com/interactivity/handling This is an interactive component - see our guide to enabling interactivity}. */ -export interface ConversationsSelect - extends Actionable, - Confirmable, - Focusable, - Placeholdable, - URLRespondable { +export interface ConversationsSelect extends Actionable, Confirmable, Focusable, Placeholdable, URLRespondable { /** * @description The type of element. In this case `type` is always `conversations_select`. */ @@ -396,10 +360,10 @@ export interface ConversationsSelect */ export interface MultiConversationsSelect extends Actionable, - Confirmable, - Focusable, - MaxItemsSelectable, - Placeholdable { + Confirmable, + Focusable, + MaxItemsSelectable, + Placeholdable { /** * @description The type of element. In this case `type` is always `conversations_select`. */ @@ -432,12 +396,7 @@ export interface MultiConversationsSelect * @see {@link https://api.slack.com/reference/block-kit/block-elements#channels_select Select menu of public channels reference}. * @see {@link https://api.slack.com/interactivity/handling This is an interactive component - see our guide to enabling interactivity}. */ -export interface ChannelsSelect - extends Actionable, - Confirmable, - Focusable, - Placeholdable, - URLRespondable { +export interface ChannelsSelect extends Actionable, Confirmable, Focusable, Placeholdable, URLRespondable { /** * @description The type of element. In this case `type` is always `channels_select`. */ @@ -454,12 +413,7 @@ export interface ChannelsSelect * @see {@link https://api.slack.com/reference/block-kit/block-elements#channel_multi_select Multi-select menu of public channels reference}. * @see {@link https://api.slack.com/interactivity/handling This is an interactive component - see our guide to enabling interactivity}. */ -export interface MultiChannelsSelect - extends Actionable, - Confirmable, - Focusable, - MaxItemsSelectable, - Placeholdable { +export interface MultiChannelsSelect extends Actionable, Confirmable, Focusable, MaxItemsSelectable, Placeholdable { /** * @description The type of element. In this case `type` is always `multi_channels_select`. */ @@ -477,11 +431,7 @@ export interface MultiChannelsSelect * @see {@link https://api.slack.com/reference/block-kit/block-elements#external_select Select menu of external data source reference}. * @see {@link https://api.slack.com/interactivity/handling This is an interactive component - see our guide to enabling interactivity}. */ -export interface ExternalSelect - extends Actionable, - Confirmable, - Focusable, - Placeholdable { +export interface ExternalSelect extends Actionable, Confirmable, Focusable, Placeholdable { /** * @description The type of element. In this case `type` is always `external_select`. */ @@ -504,12 +454,7 @@ export interface ExternalSelect * @see {@link https://api.slack.com/reference/block-kit/block-elements#external_multi_select Multi-select menu of external data source reference}. * @see {@link https://api.slack.com/interactivity/handling This is an interactive component - see our guide to enabling interactivity}. */ -export interface MultiExternalSelect - extends Actionable, - Confirmable, - Focusable, - MaxItemsSelectable, - Placeholdable { +export interface MultiExternalSelect extends Actionable, Confirmable, Focusable, MaxItemsSelectable, Placeholdable { /** * @description The type of element. In this case `type` is always `multi_external_select`. */ @@ -538,11 +483,7 @@ export interface MultiExternalSelect * @see {@link https://api.slack.com/reference/block-kit/block-elements#number Number input element reference}. * @see {@link https://api.slack.com/interactivity/handling This is an interactive component - see our guide to enabling interactivity}. */ -export interface NumberInput - extends Actionable, - Dispatchable, - Focusable, - Placeholdable { +export interface NumberInput extends Actionable, Dispatchable, Focusable, Placeholdable { /** * @description The type of element. In this case `type` is always `number_input`. */ @@ -591,11 +532,7 @@ export interface Overflow extends Actionable, Confirmable { * @see {@link https://api.slack.com/reference/block-kit/block-elements#input Plain-text input element reference}. * @see {@link https://api.slack.com/interactivity/handling This is an interactive component - see our guide to enabling interactivity}. */ -export interface PlainTextInput - extends Actionable, - Dispatchable, - Focusable, - Placeholdable { +export interface PlainTextInput extends Actionable, Dispatchable, Focusable, Placeholdable { /** * @description The type of element. In this case `type` is always `plain_text_input`. */ @@ -649,11 +586,7 @@ export interface RadioButtons extends Actionable, Confirmable, Focusable { * @see {@link https://api.slack.com/reference/block-kit/block-elements#timepicker Time picker element reference}. * @see {@link https://api.slack.com/interactivity/handling This is an interactive component - see our guide to enabling interactivity}. */ -export interface Timepicker - extends Actionable, - Confirmable, - Focusable, - Placeholdable { +export interface Timepicker extends Actionable, Confirmable, Focusable, Placeholdable { /** * @description The type of element. In this case `type` is always `timepicker`. */ @@ -676,11 +609,7 @@ export interface Timepicker * @see {@link https://api.slack.com/reference/block-kit/block-elements#url URL input element reference}. * @see {@link https://api.slack.com/interactivity/handling This is an interactive component - see our guide to enabling interactivity}. */ -export interface URLInput - extends Actionable, - Dispatchable, - Focusable, - Placeholdable { +export interface URLInput extends Actionable, Dispatchable, Focusable, Placeholdable { /** * @description The type of element. In this case `type` is always `url_text_input`. */ @@ -1024,11 +953,7 @@ export interface RichTextPreformatted extends RichTextBorderable { * @see {@link https://api.slack.com/reference/block-kit/block-elements#rich_text_input Rich-text input element reference}. * @see {@link https://api.slack.com/interactivity/handling This is an interactive component - see our guide to enabling interactivity}. */ -export interface RichTextInput - extends Actionable, - Dispatchable, - Focusable, - Placeholdable { +export interface RichTextInput extends Actionable, Dispatchable, Focusable, Placeholdable { /** * @description The type of element. In this case `type` is always `rich_text_input`. */ diff --git a/packages/types/src/block-kit/blocks.ts b/packages/types/src/block-kit/blocks.ts index 101ca11c5..c1e851923 100644 --- a/packages/types/src/block-kit/blocks.ts +++ b/packages/types/src/block-kit/blocks.ts @@ -1,5 +1,5 @@ // This file contains objects documented here: https://api.slack.com/reference/block-kit/blocks -import { +import type { Button, Checkboxes, DateTimepicker, @@ -22,12 +22,7 @@ import { URLInput, WorkflowButton, } from './block-elements'; -import { - PlainTextElement, - SlackFileImageObject, - TextObject, - UrlImageObject, -} from './composition-objects'; +import type { PlainTextElement, SlackFileImageObject, TextObject, UrlImageObject } from './composition-objects'; export interface Block { /** @@ -48,8 +43,17 @@ export interface Block { * A helper union type of all known Blocks, as listed out on the * {@link https://api.slack.com/reference/block-kit/blocks Blocks reference}. */ -export type KnownBlock = ImageBlock | ContextBlock | ActionsBlock | DividerBlock | -SectionBlock | InputBlock | FileBlock | HeaderBlock | VideoBlock | RichTextBlock; +export type KnownBlock = + | ImageBlock + | ContextBlock + | ActionsBlock + | DividerBlock + | SectionBlock + | InputBlock + | FileBlock + | HeaderBlock + | VideoBlock + | RichTextBlock; /** * A helper union type of all known Blocks as well as the generic {@link Block} interface. A full list of known blocks @@ -61,8 +65,18 @@ export type AnyBlock = KnownBlock | Block; * A helper union type of all Block Elements that can be used in an {@link ActionsBlock}. * @see {@link https://api.slack.com/reference/block-kit/blocks#actions Actions block reference}. */ -export type ActionsBlockElement = Button | Checkboxes | Datepicker | DateTimepicker | MultiSelect | Overflow | -RadioButtons | Select | Timepicker | WorkflowButton | RichTextInput; +export type ActionsBlockElement = + | Button + | Checkboxes + | Datepicker + | DateTimepicker + | MultiSelect + | Overflow + | RadioButtons + | Select + | Timepicker + | WorkflowButton + | RichTextInput; /** * @description Holds multiple interactive elements. @@ -172,14 +186,27 @@ export type ImageBlock = { * Maximum length for the text in this field is 2000 characters. */ title?: PlainTextElement; -} & Block & (UrlImageObject | SlackFileImageObject); +} & Block & + (UrlImageObject | SlackFileImageObject); /** * A helper union type of all Block Elements that can be used in an {@link InputBlock}. * @see {@link https://api.slack.com/reference/block-kit/blocks#input Input block reference}. */ -export type InputBlockElement = Checkboxes | Datepicker | DateTimepicker | EmailInput | FileInput | MultiSelect | -NumberInput | PlainTextInput | RadioButtons | RichTextInput | Select | Timepicker | URLInput; +export type InputBlockElement = + | Checkboxes + | Datepicker + | DateTimepicker + | EmailInput + | FileInput + | MultiSelect + | NumberInput + | PlainTextInput + | RadioButtons + | RichTextInput + | Select + | Timepicker + | URLInput; /** * @description Collects information from users via block elements. @@ -237,7 +264,7 @@ export interface RichTextBlock extends Block { /** * @description The type of block. For a rich text block, `type` is always `rich_text`. */ - type: 'rich_text', + type: 'rich_text'; elements: RichTextBlockElement[]; } @@ -245,8 +272,17 @@ export interface RichTextBlock extends Block { * A helper union type of all Block Elements that can be used as an accessory in a {@link SectionBlock}. * @see {@link https://api.slack.com/reference/block-kit/blocks#section Section block reference}. */ -export type SectionBlockAccessory = Button | Checkboxes | Datepicker | ImageElement | MultiSelect | Overflow | -RadioButtons | Select | Timepicker | WorkflowButton; +export type SectionBlockAccessory = + | Button + | Checkboxes + | Datepicker + | ImageElement + | MultiSelect + | Overflow + | RadioButtons + | Select + | Timepicker + | WorkflowButton; // TODO: breaking change: use a discriminative union to represent section block using `text` or `fields` but // not both or neither. diff --git a/packages/types/src/block-kit/composition-objects.ts b/packages/types/src/block-kit/composition-objects.ts index 41ce1e346..ab9396b2f 100644 --- a/packages/types/src/block-kit/composition-objects.ts +++ b/packages/types/src/block-kit/composition-objects.ts @@ -175,10 +175,10 @@ export interface MrkdwnElement { interface BaseConversationFilter { /** - * @description Indicates which type of conversations should be included in the list. When this field is provided, any - * conversations that do not match will be excluded. You should provide an array of strings from the following options: - * `im`, `mpim`, `private`, and `public`. The array cannot be empty. - */ + * @description Indicates which type of conversations should be included in the list. When this field is provided, any + * conversations that do not match will be excluded. You should provide an array of strings from the following options: + * `im`, `mpim`, `private`, and `public`. The array cannot be empty. + */ include?: [ConversationType, ...ConversationType[]]; /** * @description Indicates whether to exclude external {@link https://api.slack.com/enterprise/shared-channels shared channels} @@ -196,7 +196,10 @@ interface BaseConversationFilter { * conversations select menu or a conversations multi-select menu. * @see {@link https://api.slack.com/reference/block-kit/composition-objects#filter_conversations Conversation filter object reference}. */ -export type ConversationFilter = (BaseConversationFilter & Required>) | (BaseConversationFilter & Required>) | (BaseConversationFilter & Required>); +export type ConversationFilter = + | (BaseConversationFilter & Required>) + | (BaseConversationFilter & Required>) + | (BaseConversationFilter & Required>); /** * @description Object for image which contains a image_url. */ diff --git a/packages/types/src/block-kit/extensions.ts b/packages/types/src/block-kit/extensions.ts index 5204f414f..ec21804f7 100644 --- a/packages/types/src/block-kit/extensions.ts +++ b/packages/types/src/block-kit/extensions.ts @@ -1,5 +1,5 @@ // This file contains reusable extensions/mixins that other Block Kit elements will extend from. -import { ConfirmationDialog, DispatchActionConfig, PlainTextElement } from './composition-objects'; +import type { ConfirmationDialog, DispatchActionConfig, PlainTextElement } from './composition-objects'; // TODO: breaking change: remove `Action` and move properties to `Actionable` on next major release. /** diff --git a/packages/types/src/events/app.ts b/packages/types/src/events/app.ts index 15780edc2..44123d28a 100644 --- a/packages/types/src/events/app.ts +++ b/packages/types/src/events/app.ts @@ -1,7 +1,7 @@ -import { Block, KnownBlock } from '../block-kit/blocks'; -import { BotProfile } from '../common/bot-profile'; -import { MessageAttachment } from '../message-attachments'; -import { View } from '../views'; +import type { Block, KnownBlock } from '../block-kit/blocks'; +import type { BotProfile } from '../common/bot-profile'; +import type { MessageAttachment } from '../message-attachments'; +import type { View } from '../views'; export interface AppRequestedEvent { type: 'app_requested'; @@ -31,7 +31,7 @@ export interface AppRequestedEvent { image_512?: string; image_1024?: string; image_original?: string; - } + }; }; }; previous_resolution: { diff --git a/packages/types/src/events/channel.ts b/packages/types/src/events/channel.ts index 7c41d854a..97e54e4ff 100644 --- a/packages/types/src/events/channel.ts +++ b/packages/types/src/events/channel.ts @@ -18,16 +18,16 @@ export interface ChannelCreatedEvent { creator: string; // user ID is_shared: boolean; is_org_shared: boolean; - context_team_id: string, + context_team_id: string; is_archived: boolean; - is_frozen: boolean, - is_general: boolean, - is_group: boolean, - is_private: boolean, - is_ext_shared: boolean, - is_im: boolean, - is_mpim: boolean, - is_pending_ext_shared: boolean, + is_frozen: boolean; + is_general: boolean; + is_group: boolean; + is_private: boolean; + is_ext_shared: boolean; + is_im: boolean; + is_mpim: boolean; + is_pending_ext_shared: boolean; }; } diff --git a/packages/types/src/events/function.ts b/packages/types/src/events/function.ts index d8e3278e6..cd72af570 100644 --- a/packages/types/src/events/function.ts +++ b/packages/types/src/events/function.ts @@ -23,7 +23,7 @@ export interface FunctionExecutedEvent { app_id: string; date_created: number; date_updated: number; - date_deleted: number + date_deleted: number; }; inputs: FunctionInputs; function_execution_id: string; diff --git a/packages/types/src/events/index.ts b/packages/types/src/events/index.ts index c49dfca56..df4491a56 100644 --- a/packages/types/src/events/index.ts +++ b/packages/types/src/events/index.ts @@ -1,4 +1,4 @@ -import { +import type { AppDeletedEvent, AppHomeOpenedEvent, AppInstalledEvent, @@ -8,8 +8,8 @@ import { AppUninstalledEvent, AppUninstalledTeamEvent, } from './app'; -import { CallRejectedEvent } from './call'; -import { +import type { CallRejectedEvent } from './call'; +import type { ChannelArchiveEvent, ChannelCreatedEvent, ChannelDeletedEvent, @@ -21,10 +21,10 @@ import { ChannelUnarchiveEvent, ChannelUnsharedEvent, } from './channel'; -import { DNDUpdatedEvent, DNDUpdatedUserEvent } from './dnd'; -import { EmailDomainChangedEvent } from './email'; -import { EmojiChangedEvent } from './emoji'; -import { +import type { DNDUpdatedEvent, DNDUpdatedUserEvent } from './dnd'; +import type { EmailDomainChangedEvent } from './email'; +import type { EmojiChangedEvent } from './emoji'; +import type { FileChangeEvent, FileCommentDeletedEvent, FileCreatedEvent, @@ -33,9 +33,9 @@ import { FileSharedEvent, FileUnsharedEvent, } from './file'; -import { FunctionExecutedEvent } from './function'; -import { GridMigrationFinishedEvent, GridMigrationStartedEvent } from './grid-migration'; -import { +import type { FunctionExecutedEvent } from './function'; +import type { GridMigrationFinishedEvent, GridMigrationStartedEvent } from './grid-migration'; +import type { GroupArchiveEvent, GroupCloseEvent, GroupDeletedEvent, @@ -45,45 +45,45 @@ import { GroupRenameEvent, GroupUnarchiveEvent, } from './group'; -import { IMCloseEvent, IMCreatedEvent, IMHistoryChangedEvent, IMOpenEvent } from './im'; -import { InviteRequestedEvent } from './invite'; -import { LinkSharedEvent } from './link-shared'; -import { MemberJoinedChannelEvent, MemberLeftChannelEvent } from './member'; -import { AllMessageEvents } from './message'; -import { AllMessageMetadataEvents } from './message-metadata'; -import { PinAddedEvent, PinRemovedEvent } from './pin'; -import { ReactionAddedEvent, ReactionRemovedEvent } from './reaction'; -import { +import type { IMCloseEvent, IMCreatedEvent, IMHistoryChangedEvent, IMOpenEvent } from './im'; +import type { InviteRequestedEvent } from './invite'; +import type { LinkSharedEvent } from './link-shared'; +import type { MemberJoinedChannelEvent, MemberLeftChannelEvent } from './member'; +import type { AllMessageEvents } from './message'; +import type { AllMessageMetadataEvents } from './message-metadata'; +import type { PinAddedEvent, PinRemovedEvent } from './pin'; +import type { ReactionAddedEvent, ReactionRemovedEvent } from './reaction'; +import type { SharedChannelInviteAcceptedEvent, SharedChannelInviteApprovedEvent, SharedChannelInviteDeclinedEvent, SharedChannelInviteReceivedEvent, SharedChannelInviteRequestedEvent, } from './shared-channel'; -import { StarAddedEvent, StarRemovedEvent } from './star'; -import { +import type { StarAddedEvent, StarRemovedEvent } from './star'; +import type { WorkflowDeletedEvent, WorkflowPublishedEvent, WorkflowStepDeletedEvent, WorkflowStepExecuteEvent, WorkflowUnpublishedEvent, } from './steps-from-apps'; -import { +import type { SubteamCreatedEvent, SubteamMembersChangedEvent, SubteamSelfAddedEvent, SubteamSelfRemovedEvent, SubteamUpdatedEvent, } from './subteam'; -import { +import type { TeamAccessGrantedEvent, TeamAccessRevokedEvent, TeamDomainChangedEvent, TeamJoinEvent, TeamRenameEvent, } from './team'; -import { TokensRevokedEvent } from './token'; -import { UserChangeEvent, UserHuddleChangedEvent, UserProfileChangedEvent, UserStatusChangedEvent } from './user'; +import type { TokensRevokedEvent } from './token'; +import type { UserChangeEvent, UserHuddleChangedEvent, UserProfileChangedEvent, UserStatusChangedEvent } from './user'; export type MessageEvent = AllMessageEvents; export * from './app'; diff --git a/packages/types/src/events/message-metadata.ts b/packages/types/src/events/message-metadata.ts index a7772438a..e932ccaae 100644 --- a/packages/types/src/events/message-metadata.ts +++ b/packages/types/src/events/message-metadata.ts @@ -1,9 +1,9 @@ -import { MessageMetadata } from '../message-metadata'; +import type { MessageMetadata } from '../message-metadata'; export type AllMessageMetadataEvents = -| MessageMetadataDeletedEvent -| MessageMetadataPostedEvent -| MessageMetadataUpdatedEvent; + | MessageMetadataDeletedEvent + | MessageMetadataPostedEvent + | MessageMetadataUpdatedEvent; export interface MessageMetadataPostedEvent { type: 'message_metadata_posted'; diff --git a/packages/types/src/events/message.ts b/packages/types/src/events/message.ts index bdd371f32..1d3bf921e 100644 --- a/packages/types/src/events/message.ts +++ b/packages/types/src/events/message.ts @@ -1,6 +1,6 @@ -import { Block, KnownBlock } from '../block-kit/blocks'; -import { BotProfile } from '../common/bot-profile'; -import { MessageAttachment } from '../message-attachments'; +import type { Block, KnownBlock } from '../block-kit/blocks'; +import type { BotProfile } from '../common/bot-profile'; +import type { MessageAttachment } from '../message-attachments'; type ChannelTypes = 'channel' | 'group' | 'im' | 'mpim' | 'app_home'; @@ -338,7 +338,7 @@ interface File { has_rich_preview?: boolean; shares?: { - // eslint-disable-next-line @typescript-eslint/no-explicit-any + // biome-ignore lint/suspicious/noExplicitAny: TODO: type shares [key: string]: any; }; channels: string[] | null; @@ -346,7 +346,7 @@ interface File { users?: string[]; pinned_to?: string[]; reactions?: { - // eslint-disable-next-line @typescript-eslint/no-explicit-any + // biome-ignore lint/suspicious/noExplicitAny: TODO: type reactions [key: string]: any; }[]; is_starred?: boolean; diff --git a/packages/types/src/events/pin.ts b/packages/types/src/events/pin.ts index 59fbaf2d1..968daa389 100644 --- a/packages/types/src/events/pin.ts +++ b/packages/types/src/events/pin.ts @@ -1,6 +1,6 @@ -import { Block, KnownBlock } from '../block-kit/blocks'; -import { BotProfile } from '../common/bot-profile'; -import { MessageAttachment } from '../message-attachments'; +import type { Block, KnownBlock } from '../block-kit/blocks'; +import type { BotProfile } from '../common/bot-profile'; +import type { MessageAttachment } from '../message-attachments'; interface PinnedMessageItem { client_msg_id?: string; @@ -15,7 +15,7 @@ interface PinnedMessageItem { blocks?: (KnownBlock | Block)[]; pinned_to?: string[]; permalink: string; - ts: string + ts: string; } interface PinnedFileItem { id: string; diff --git a/packages/types/src/events/steps-from-apps.ts b/packages/types/src/events/steps-from-apps.ts index 395f4b112..0b57efebf 100644 --- a/packages/types/src/events/steps-from-apps.ts +++ b/packages/types/src/events/steps-from-apps.ts @@ -72,7 +72,7 @@ export interface WorkflowStepExecuteEvent { step_id: string; inputs: { [key: string]: { - // eslint-disable-next-line @typescript-eslint/no-explicit-any + // biome-ignore lint/suspicious/noExplicitAny: untyped step inputs value: any; }; }; diff --git a/packages/types/src/events/team.ts b/packages/types/src/events/team.ts index ea084e07d..0c4b89f00 100644 --- a/packages/types/src/events/team.ts +++ b/packages/types/src/events/team.ts @@ -1,4 +1,4 @@ -import { StatusEmojiDisplayInfo } from '../common/status-emoji-display-info'; +import type { StatusEmojiDisplayInfo } from '../common/status-emoji-display-info'; export interface TeamAccessGrantedEvent { type: 'team_access_granted'; @@ -60,14 +60,14 @@ export interface TeamJoinEvent { image_1024?: string; team: string; fields: - | { - [key: string]: { - value: string; - alt: string; - }; - } - | [] - | null; + | { + [key: string]: { + value: string; + alt: string; + }; + } + | [] + | null; }; is_admin: boolean; is_owner: boolean; diff --git a/packages/types/src/events/user.ts b/packages/types/src/events/user.ts index 928af13bf..bedc3e85a 100644 --- a/packages/types/src/events/user.ts +++ b/packages/types/src/events/user.ts @@ -1,4 +1,4 @@ -import { StatusEmojiDisplayInfo } from '../common/status-emoji-display-info'; +import type { StatusEmojiDisplayInfo } from '../common/status-emoji-display-info'; export interface UserChangeEvent { type: 'user_change'; @@ -42,14 +42,14 @@ export interface UserChangeEvent { image_1024?: string; team: string; fields: - | { - [key: string]: { - value: string; - alt: string; - }; - } - | [] - | null; + | { + [key: string]: { + value: string; + alt: string; + }; + } + | [] + | null; }; is_admin: boolean; is_owner: boolean; @@ -124,14 +124,14 @@ export interface UserHuddleChangedEvent { image_1024?: string; team: string; fields: - | { - [key: string]: { - value: string; - alt: string; - }; - } - | [] - | null; + | { + [key: string]: { + value: string; + alt: string; + }; + } + | [] + | null; }; is_admin: boolean; is_owner: boolean; @@ -206,14 +206,14 @@ export interface UserProfileChangedEvent { image_1024?: string; team: string; fields: - | { - [key: string]: { - value: string; - alt: string; - }; - } - | [] - | null; + | { + [key: string]: { + value: string; + alt: string; + }; + } + | [] + | null; }; is_admin: boolean; is_owner: boolean; @@ -269,7 +269,7 @@ export interface UserStatusChangedEvent { status_text: string; status_text_canonical: string; status_emoji: string; - status_emoji_display_info: StatusEmojiDisplayInfo[], + status_emoji_display_info: StatusEmojiDisplayInfo[]; status_expiration: number; avatar_hash: string; first_name: string; @@ -286,14 +286,14 @@ export interface UserStatusChangedEvent { image_1024?: string; team: string; fields: - | { - [key: string]: { - value: string; - alt: string; - }; - } - | [] - | null; + | { + [key: string]: { + value: string; + alt: string; + }; + } + | [] + | null; }; is_admin: boolean; is_owner: boolean; diff --git a/packages/types/src/message-attachments.ts b/packages/types/src/message-attachments.ts index 9426465ea..ae1ce9ea6 100644 --- a/packages/types/src/message-attachments.ts +++ b/packages/types/src/message-attachments.ts @@ -1,5 +1,5 @@ -import { AnyBlock } from './block-kit/blocks'; -import { PlainTextElement } from './block-kit/composition-objects'; +import type { AnyBlock } from './block-kit/blocks'; +import type { PlainTextElement } from './block-kit/composition-objects'; // TODO: breaking changes, use discriminated union for `fallback`, `text` and `block` properties, maybe LegacyAttachment // vs. BlocksAttachment? as per https://api.slack.com/reference/messaging/attachments#legacy_fields @@ -155,7 +155,7 @@ interface AttachmentAction { name?: string; options?: OptionField[]; option_groups?: { - text: string + text: string; options: OptionField[]; }[]; selected_options?: OptionField[]; diff --git a/packages/types/src/message-metadata.ts b/packages/types/src/message-metadata.ts index 66e2a8758..69721ec68 100644 --- a/packages/types/src/message-metadata.ts +++ b/packages/types/src/message-metadata.ts @@ -14,9 +14,9 @@ export interface MessageMetadata { */ event_payload: { [key: string]: string | number | boolean | MessageMetadataEventPayloadObject | MessageMetadataEventPayloadObject[]; - } + }; } export interface MessageMetadataEventPayloadObject { - [key: string]: string | number | boolean + [key: string]: string | number | boolean; } diff --git a/packages/types/src/views.ts b/packages/types/src/views.ts index 4bdbf9123..74c9a7407 100644 --- a/packages/types/src/views.ts +++ b/packages/types/src/views.ts @@ -1,5 +1,5 @@ -import { AnyBlock } from './block-kit/blocks'; -import { PlainTextElement } from './block-kit/composition-objects'; +import type { AnyBlock } from './block-kit/blocks'; +import type { PlainTextElement } from './block-kit/composition-objects'; interface BaseView { /** @description An array of {@link AnyBlock} that defines the content of the view. Max of 100 blocks. */ diff --git a/packages/types/test/views.test-d.ts b/packages/types/test/views.test-d.ts index 48fcb57d8..9f5af870c 100644 --- a/packages/types/test/views.test-d.ts +++ b/packages/types/test/views.test-d.ts @@ -1,5 +1,5 @@ import { expectAssignable, expectError } from 'tsd'; -import { HomeView, ModalView, PlainTextElement } from '../src/index'; +import type { HomeView, ModalView, PlainTextElement } from '../src/index'; const plaintext: PlainTextElement = { type: 'plain_text', text: 'hi' }; diff --git a/packages/types/tsconfig.eslint.json b/packages/types/tsconfig.eslint.json deleted file mode 120000 index 2cd9fb812..000000000 --- a/packages/types/tsconfig.eslint.json +++ /dev/null @@ -1 +0,0 @@ -../../lint-configs/tsconfig.eslint.json \ No newline at end of file diff --git a/packages/types/tsconfig.json b/packages/types/tsconfig.json index b61d86ce5..4707b9610 100644 --- a/packages/types/tsconfig.json +++ b/packages/types/tsconfig.json @@ -19,20 +19,15 @@ "paths": { "*": ["./types/*"] }, - "esModuleInterop" : true, + "esModuleInterop": true // Not using this setting because its only used to require the package.json file, and that would change the // structure of the files in the dist directory because package.json is not located inside src. It would be nice // to use import instead of require(), but its not worth the tradeoff of restructuring the build (for now). // "resolveJsonModule": true, }, - "include": [ - "src/**/*" - ], - "exclude": [ - "src/**/*.spec.js", - "src/**/*.js" - ], + "include": ["src/**/*"], + "exclude": ["src/**/*.spec.js", "src/**/*.js"], "jsdoc": { "out": "support/jsdoc", "access": "public"