mirror of
https://github.com/discordjs/discord-api-types.git
synced 2026-05-21 02:40:08 +00:00
chore: eslint 9 (#1255)
This commit is contained in:
@@ -1,187 +0,0 @@
|
||||
import { AST_NODE_TYPES, ESLintUtils, TSESTree } from '@typescript-eslint/utils';
|
||||
import * as typescript from 'typescript';
|
||||
import * as tsutils from 'tsutils';
|
||||
|
||||
type Options = [
|
||||
{
|
||||
interfaceEndings: string[];
|
||||
},
|
||||
];
|
||||
|
||||
function shouldRun(eslNode: TSESTree.TSPropertySignature, interfaceEndings: string[]): boolean {
|
||||
// The first parent is the TSInterfaceBody, the second is the TSInterfaceDeclaration
|
||||
const interfaceNode = eslNode.parent?.parent;
|
||||
if (!(interfaceNode && 'id' in interfaceNode && interfaceNode.id?.type === AST_NODE_TYPES.Identifier)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
const { name } = interfaceNode.id;
|
||||
if (typeof name !== 'string') {
|
||||
return false;
|
||||
}
|
||||
|
||||
return interfaceEndings.some((ending) => name.endsWith(ending));
|
||||
}
|
||||
|
||||
const schema = [
|
||||
{
|
||||
type: 'object',
|
||||
properties: {
|
||||
interfaceEndings: {
|
||||
type: 'array',
|
||||
items: {
|
||||
type: 'string',
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
] as const;
|
||||
|
||||
const REST_TYPE_NAME_REGEX =
|
||||
/^REST(?:Get|Patch|Post|Put|Delete)[a-zA-Z0-9]+(?:JSONBody|FormDataBody|URLEncodedData|Result|Query)$/;
|
||||
|
||||
export = {
|
||||
rules: {
|
||||
'explicitly-optional-undefined-properties': ESLintUtils.RuleCreator.withoutDocs<Options, 'missingOptional'>({
|
||||
create: (context) => {
|
||||
const { interfaceEndings } = context.options[0];
|
||||
return {
|
||||
TSPropertySignature: (eslNode) => {
|
||||
if (!shouldRun(eslNode, interfaceEndings)) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (eslNode.optional) {
|
||||
return;
|
||||
}
|
||||
|
||||
const parserServices = ESLintUtils.getParserServices(context);
|
||||
const checker = parserServices.program.getTypeChecker();
|
||||
const tsNode = parserServices.esTreeNodeToTSNodeMap.get(eslNode);
|
||||
const type = checker.getApparentType(checker.getTypeAtLocation(tsNode));
|
||||
const unionParts = tsutils.unionTypeParts(type);
|
||||
|
||||
// If our prop is not optional, but has undefined in its union, we should report
|
||||
if (!unionParts.some((ty) => tsutils.isTypeFlagSet(ty, typescript.TypeFlags.Undefined))) {
|
||||
return;
|
||||
}
|
||||
|
||||
context.report({
|
||||
node: eslNode,
|
||||
messageId: 'missingOptional',
|
||||
fix: (fixer) => fixer.insertTextAfter(eslNode.key, '?'),
|
||||
});
|
||||
},
|
||||
};
|
||||
},
|
||||
meta: {
|
||||
fixable: 'code',
|
||||
messages: {
|
||||
missingOptional: 'When a property has `| undefined`, it should be marked as optional.',
|
||||
},
|
||||
type: 'problem',
|
||||
schema: schema,
|
||||
},
|
||||
defaultOptions: [{ interfaceEndings: [] }],
|
||||
}),
|
||||
'explicit-undefined-on-optional-properties': ESLintUtils.RuleCreator.withoutDocs<Options, 'missingUndefined'>({
|
||||
create: (context) => {
|
||||
const { interfaceEndings } = context.options[0];
|
||||
return {
|
||||
// This is done naively because type-checking the node will always include `| undefined`
|
||||
// due to it being optional. ideally, we'd have a way to get the type of the node disregarding
|
||||
// the optional flag, which would make this check a lot more trivial
|
||||
TSPropertySignature: (eslNode) => {
|
||||
if (!shouldRun(eslNode, interfaceEndings)) {
|
||||
return;
|
||||
}
|
||||
|
||||
// If our prop is't optional or if it doesn't have a type annotation, we don't need to do anything
|
||||
if (!eslNode.optional || !eslNode.typeAnnotation) {
|
||||
return;
|
||||
}
|
||||
|
||||
const { typeAnnotation } = eslNode.typeAnnotation;
|
||||
switch (typeAnnotation.type) {
|
||||
case AST_NODE_TYPES.TSUnionType: {
|
||||
if (typeAnnotation.types.some((t) => t.type === AST_NODE_TYPES.TSUndefinedKeyword)) {
|
||||
return;
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
case AST_NODE_TYPES.TSUndefinedKeyword: {
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
context.report({
|
||||
node: eslNode,
|
||||
messageId: 'missingUndefined',
|
||||
fix: (fixer) => fixer.insertTextAfter(eslNode.typeAnnotation!, ' | undefined'),
|
||||
});
|
||||
},
|
||||
};
|
||||
},
|
||||
meta: {
|
||||
fixable: 'code',
|
||||
messages: {
|
||||
missingUndefined: 'When a property is optional, explicitly include `undefined` in the union.',
|
||||
},
|
||||
type: 'suggestion',
|
||||
schema: schema,
|
||||
},
|
||||
defaultOptions: [{ interfaceEndings: [] }],
|
||||
}),
|
||||
'rest-type-naming-convention': ESLintUtils.RuleCreator.withoutDocs<[{ whitelist: string[] }], 'invalidName'>({
|
||||
create: (context) => {
|
||||
const { whitelist } = context.options[0];
|
||||
const whitelistSet = new Set(whitelist);
|
||||
|
||||
return {
|
||||
'TSTypeAliasDeclaration, TSInterfaceDeclaration': (
|
||||
node: TSESTree.TSTypeAliasDeclaration | TSESTree.TSInterfaceDeclaration,
|
||||
) => {
|
||||
if (node.id.type !== AST_NODE_TYPES.Identifier) {
|
||||
return;
|
||||
}
|
||||
|
||||
const { name } = node.id;
|
||||
if (whitelistSet.has(name)) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (!REST_TYPE_NAME_REGEX.test(name)) {
|
||||
context.report({
|
||||
node: node.id,
|
||||
messageId: 'invalidName',
|
||||
data: { name },
|
||||
});
|
||||
}
|
||||
},
|
||||
};
|
||||
},
|
||||
meta: {
|
||||
messages: {
|
||||
invalidName: `{{ name }} does not match REST type naming convention. Must match ${REST_TYPE_NAME_REGEX.source}.`,
|
||||
},
|
||||
type: 'problem',
|
||||
schema: [
|
||||
{
|
||||
type: 'object',
|
||||
properties: {
|
||||
whitelist: {
|
||||
type: 'array',
|
||||
items: {
|
||||
type: 'string',
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
] as const,
|
||||
},
|
||||
defaultOptions: [{ whitelist: [] }],
|
||||
}),
|
||||
},
|
||||
};
|
||||
@@ -1,9 +0,0 @@
|
||||
{
|
||||
"extends": "../tsconfig.json",
|
||||
"compilerOptions": {
|
||||
"declaration": false,
|
||||
"declarationMap": false,
|
||||
"skipLibCheck": true
|
||||
},
|
||||
"include": ["./index.ts"]
|
||||
}
|
||||
@@ -1,16 +0,0 @@
|
||||
deno/
|
||||
|
||||
gateway/v6/*
|
||||
payloads/v6/*
|
||||
rest/v6/*
|
||||
v6.ts
|
||||
|
||||
gateway/v8/*
|
||||
payloads/v8/*
|
||||
rest/v8/*
|
||||
utils/v8.ts
|
||||
v8.ts
|
||||
|
||||
djs/**/*
|
||||
|
||||
.yarn/*
|
||||
@@ -1,74 +0,0 @@
|
||||
{
|
||||
"extends": ["neon/common", "neon/node", "neon/typescript", "neon/prettier"],
|
||||
"parser": "@typescript-eslint/parser",
|
||||
"parserOptions": {
|
||||
"project": "./tsconfig.eslint.json"
|
||||
},
|
||||
"plugins": ["local"],
|
||||
"rules": {
|
||||
"local/explicit-undefined-on-optional-properties": ["error", { "interfaceEndings": ["JSONBody"] }],
|
||||
"local/explicitly-optional-undefined-properties": ["error", { "interfaceEndings": ["JSONBody"] }],
|
||||
"@typescript-eslint/consistent-type-definitions": ["error", "interface"],
|
||||
"@typescript-eslint/prefer-literal-enum-member": "off",
|
||||
"@typescript-eslint/sort-type-union-intersection-members": "off",
|
||||
"import/extensions": "off",
|
||||
"tsdoc/syntax": "off",
|
||||
"typescript-sort-keys/interface": "off",
|
||||
"typescript-sort-keys/string-enum": "off",
|
||||
"unicorn/prefer-math-trunc": "off",
|
||||
"jsdoc/no-undefined-types": "off"
|
||||
},
|
||||
"overrides": [
|
||||
{
|
||||
"files": ["rest/v10/*.ts", "rest/v9/*.ts"],
|
||||
"excludedFiles": ["rest/v10/index.ts", "rest/v9/index.ts"],
|
||||
"rules": {
|
||||
"local/rest-type-naming-convention": [
|
||||
"error",
|
||||
{
|
||||
"whitelist": [
|
||||
"RESTAPIAttachment",
|
||||
"RESTAPIChannelPatchOverwrite",
|
||||
"RESTAPIGuildChannelResolvable",
|
||||
"RESTAPIGuildCreateOverwrite",
|
||||
"RESTAPIGuildCreatePartialChannel",
|
||||
"RESTAPIGuildCreateRole",
|
||||
"RESTAPIGuildOnboardingPrompt",
|
||||
"RESTAPIGuildOnboardingPromptOption",
|
||||
"RESTAPIInteractionCallbackActivityInstanceResource",
|
||||
"RESTAPIInteractionCallbackObject",
|
||||
"RESTAPIInteractionCallbackResourceObject",
|
||||
"RESTAPIMessageReference",
|
||||
"RESTAPIPartialCurrentUserGuild",
|
||||
"RESTAPIPoll",
|
||||
"RESTOAuth2TokenOptionalClientCredentials",
|
||||
|
||||
"RESTOAuth2AdvancedBotAuthorizationQuery",
|
||||
"RESTOAuth2AdvancedBotAuthorizationQueryResult",
|
||||
"RESTOAuth2AuthorizationQuery",
|
||||
"RESTOAuth2BotAuthorizationQuery",
|
||||
"RESTOAuth2ImplicitAuthorizationQuery",
|
||||
"RESTOAuth2ImplicitAuthorizationURLFragmentResult",
|
||||
|
||||
// Deprecated types
|
||||
"APIChannelPatchOverwrite",
|
||||
"APIGuildChannelResolvable",
|
||||
"APIGuildCreateOverwrite",
|
||||
"APIGuildCreatePartialChannel",
|
||||
"APIGuildCreateRole",
|
||||
"APIMessageReferenceSend",
|
||||
"GetAPIVoiceRegionsResult",
|
||||
"RESTAPIModifyGuildOnboardingPromptData",
|
||||
"RESTAPIModifyGuildOnboardingPromptOptionData",
|
||||
"RESTAPIPollCreate",
|
||||
"RESTDeleteAPIChannelMessageOwnReaction",
|
||||
"RESTGetAPIStickerPack",
|
||||
"RESTOAuth2AuthorizationQueryResult",
|
||||
"RESTPostAPIEntitlementBody"
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -13,12 +13,12 @@ website/build
|
||||
|
||||
# Don't format build outputs
|
||||
*.js
|
||||
!eslint.config.js
|
||||
*.d.ts
|
||||
*.mjs
|
||||
|
||||
# Miscellaneous
|
||||
CODEOWNERS
|
||||
renovate.json
|
||||
CHANGELOG.md
|
||||
|
||||
# Format all of scripts
|
||||
|
||||
2
deno/gateway/v10.ts
generated
2
deno/gateway/v10.ts
generated
@@ -43,7 +43,7 @@ import type {
|
||||
import type { ReactionType } from '../rest/v10/mod.ts';
|
||||
import type { _Nullable } from '../utils/internals.ts';
|
||||
|
||||
export * from './common.ts';
|
||||
export type * from './common.ts';
|
||||
|
||||
export const GatewayVersion = '10';
|
||||
|
||||
|
||||
4
deno/gateway/v6.ts
generated
4
deno/gateway/v6.ts
generated
@@ -18,7 +18,7 @@ import type {
|
||||
PresenceUpdateStatus,
|
||||
} from '../payloads/v6/mod.ts';
|
||||
|
||||
export * from './common.ts';
|
||||
export type * from './common.ts';
|
||||
|
||||
/**
|
||||
* @deprecated Gateway v6 is deprecated and the types will not receive further updates, please update to v8.
|
||||
@@ -313,7 +313,6 @@ export type GatewayReadyDispatch = DataPayload<
|
||||
*/
|
||||
export type GatewayResumedDispatch = DataPayload<GatewayDispatchEvents.Resumed, never>;
|
||||
|
||||
/* eslint-disable @typescript-eslint/indent */
|
||||
/**
|
||||
* https://discord.com/developers/docs/topics/gateway#channel-create
|
||||
* https://discord.com/developers/docs/topics/gateway#channel-update
|
||||
@@ -325,7 +324,6 @@ export type GatewayChannelModifyDispatch = DataPayload<
|
||||
GatewayDispatchEvents.ChannelCreate | GatewayDispatchEvents.ChannelDelete | GatewayDispatchEvents.ChannelUpdate,
|
||||
APIChannel
|
||||
>;
|
||||
/* eslint-enable @typescript-eslint/indent */
|
||||
|
||||
/**
|
||||
* @deprecated Gateway v6 is deprecated and the types will not receive further updates, please update to v8.
|
||||
|
||||
2
deno/gateway/v8.ts
generated
2
deno/gateway/v8.ts
generated
@@ -26,7 +26,7 @@ import type {
|
||||
} from '../payloads/v8/mod.ts';
|
||||
import type { _Nullable } from '../utils/internals.ts';
|
||||
|
||||
export * from './common.ts';
|
||||
export type * from './common.ts';
|
||||
|
||||
/**
|
||||
* @deprecated API and gateway v8 are deprecated and the types will not receive further updates, please update to v10.
|
||||
|
||||
2
deno/gateway/v9.ts
generated
2
deno/gateway/v9.ts
generated
@@ -43,7 +43,7 @@ import type {
|
||||
import type { ReactionType } from '../rest/v9/mod.ts';
|
||||
import type { _Nullable } from '../utils/internals.ts';
|
||||
|
||||
export * from './common.ts';
|
||||
export type * from './common.ts';
|
||||
|
||||
export const GatewayVersion = '9';
|
||||
|
||||
|
||||
1
deno/globals.ts
generated
1
deno/globals.ts
generated
@@ -52,7 +52,6 @@ export const FormattingPatterns = {
|
||||
* The `fullName` (possibly including `name`, `subcommandOrGroup` and `subcommand`) and `id` group properties are present on the `exec` result of this expression
|
||||
*/
|
||||
SlashCommand:
|
||||
// eslint-disable-next-line unicorn/no-unsafe-regex
|
||||
/<\/(?<fullName>(?<name>[-_\p{Letter}\p{Number}\p{sc=Deva}\p{sc=Thai}]{1,32})(?: (?<subcommandOrGroup>[-_\p{Letter}\p{Number}\p{sc=Deva}\p{sc=Thai}]{1,32}))?(?: (?<subcommand>[-_\p{Letter}\p{Number}\p{sc=Deva}\p{sc=Thai}]{1,32}))?):(?<id>\d{17,20})>/u,
|
||||
/**
|
||||
* Regular expression for matching a custom emoji, either static or animated
|
||||
|
||||
2
deno/payloads/common.ts
generated
2
deno/payloads/common.ts
generated
@@ -17,7 +17,7 @@ export const PermissionFlagsBits = {
|
||||
/**
|
||||
* Allows kicking members
|
||||
*/
|
||||
// eslint-disable-next-line sonarjs/no-identical-expressions
|
||||
|
||||
KickMembers: 1n << 1n,
|
||||
/**
|
||||
* Allows banning members
|
||||
|
||||
@@ -47,19 +47,19 @@ import type {
|
||||
} from './_chatInput/user.ts';
|
||||
import type { APIBaseApplicationCommandInteractionData } from './internals.ts';
|
||||
|
||||
export * from './_chatInput/attachment.ts';
|
||||
export * from './_chatInput/base.ts';
|
||||
export * from './_chatInput/boolean.ts';
|
||||
export * from './_chatInput/channel.ts';
|
||||
export * from './_chatInput/integer.ts';
|
||||
export * from './_chatInput/mentionable.ts';
|
||||
export * from './_chatInput/number.ts';
|
||||
export * from './_chatInput/role.ts';
|
||||
export type * from './_chatInput/attachment.ts';
|
||||
export type * from './_chatInput/base.ts';
|
||||
export type * from './_chatInput/boolean.ts';
|
||||
export type * from './_chatInput/channel.ts';
|
||||
export type * from './_chatInput/integer.ts';
|
||||
export type * from './_chatInput/mentionable.ts';
|
||||
export type * from './_chatInput/number.ts';
|
||||
export type * from './_chatInput/role.ts';
|
||||
export * from './_chatInput/shared.ts';
|
||||
export * from './_chatInput/string.ts';
|
||||
export * from './_chatInput/subcommand.ts';
|
||||
export * from './_chatInput/subcommandGroup.ts';
|
||||
export * from './_chatInput/user.ts';
|
||||
export type * from './_chatInput/string.ts';
|
||||
export type * from './_chatInput/subcommand.ts';
|
||||
export type * from './_chatInput/subcommandGroup.ts';
|
||||
export type * from './_chatInput/user.ts';
|
||||
|
||||
/**
|
||||
* @see {@link https://discord.com/developers/docs/interactions/application-commands#application-command-object-application-command-option-structure}
|
||||
|
||||
@@ -23,10 +23,10 @@ import type { APIBaseInteraction } from './base.ts';
|
||||
import type { InteractionType } from './responses.ts';
|
||||
|
||||
export * from './_applicationCommands/chatInput.ts';
|
||||
export * from './_applicationCommands/contextMenu.ts';
|
||||
export type * from './_applicationCommands/contextMenu.ts';
|
||||
export * from './_applicationCommands/permissions.ts';
|
||||
export * from './_applicationCommands/entryPoint.ts';
|
||||
export * from './_applicationCommands/internals.ts';
|
||||
export type * from './_applicationCommands/entryPoint.ts';
|
||||
export type * from './_applicationCommands/internals.ts';
|
||||
|
||||
/**
|
||||
* @see {@link https://discord.com/developers/docs/interactions/application-commands#application-command-object}
|
||||
|
||||
10
deno/payloads/v10/interactions.ts
generated
10
deno/payloads/v10/interactions.ts
generated
@@ -21,11 +21,11 @@ import type {
|
||||
import type { APIPingInteraction } from './_interactions/ping.ts';
|
||||
|
||||
export * from './_interactions/applicationCommands.ts';
|
||||
export * from './_interactions/autocomplete.ts';
|
||||
export * from './_interactions/base.ts';
|
||||
export * from './_interactions/messageComponents.ts';
|
||||
export * from './_interactions/modalSubmit.ts';
|
||||
export * from './_interactions/ping.ts';
|
||||
export type * from './_interactions/autocomplete.ts';
|
||||
export type * from './_interactions/base.ts';
|
||||
export type * from './_interactions/messageComponents.ts';
|
||||
export type * from './_interactions/modalSubmit.ts';
|
||||
export type * from './_interactions/ping.ts';
|
||||
export * from './_interactions/responses.ts';
|
||||
|
||||
/**
|
||||
|
||||
8
deno/payloads/v10/mod.ts
generated
8
deno/payloads/v10/mod.ts
generated
@@ -3,7 +3,7 @@ export * from './application.ts';
|
||||
export * from './auditLog.ts';
|
||||
export * from './autoModeration.ts';
|
||||
export * from './channel.ts';
|
||||
export * from './emoji.ts';
|
||||
export type * from './emoji.ts';
|
||||
export * from './gateway.ts';
|
||||
export * from './guild.ts';
|
||||
export * from './guildScheduledEvent.ts';
|
||||
@@ -13,11 +13,11 @@ export * from './monetization.ts';
|
||||
export * from './oauth2.ts';
|
||||
export * from './permissions.ts';
|
||||
export * from './poll.ts';
|
||||
export * from './soundboard.ts';
|
||||
export type * from './soundboard.ts';
|
||||
export * from './stageInstance.ts';
|
||||
export * from './sticker.ts';
|
||||
export * from './teams.ts';
|
||||
export * from './template.ts';
|
||||
export type * from './template.ts';
|
||||
export * from './user.ts';
|
||||
export * from './voice.ts';
|
||||
export type * from './voice.ts';
|
||||
export * from './webhook.ts';
|
||||
|
||||
@@ -47,19 +47,19 @@ import type {
|
||||
} from './_chatInput/user.ts';
|
||||
import type { APIBaseApplicationCommandInteractionData } from './internals.ts';
|
||||
|
||||
export * from './_chatInput/attachment.ts';
|
||||
export * from './_chatInput/base.ts';
|
||||
export * from './_chatInput/boolean.ts';
|
||||
export * from './_chatInput/channel.ts';
|
||||
export * from './_chatInput/integer.ts';
|
||||
export * from './_chatInput/mentionable.ts';
|
||||
export * from './_chatInput/number.ts';
|
||||
export * from './_chatInput/role.ts';
|
||||
export type * from './_chatInput/attachment.ts';
|
||||
export type * from './_chatInput/base.ts';
|
||||
export type * from './_chatInput/boolean.ts';
|
||||
export type * from './_chatInput/channel.ts';
|
||||
export type * from './_chatInput/integer.ts';
|
||||
export type * from './_chatInput/mentionable.ts';
|
||||
export type * from './_chatInput/number.ts';
|
||||
export type * from './_chatInput/role.ts';
|
||||
export * from './_chatInput/shared.ts';
|
||||
export * from './_chatInput/string.ts';
|
||||
export * from './_chatInput/subcommand.ts';
|
||||
export * from './_chatInput/subcommandGroup.ts';
|
||||
export * from './_chatInput/user.ts';
|
||||
export type * from './_chatInput/string.ts';
|
||||
export type * from './_chatInput/subcommand.ts';
|
||||
export type * from './_chatInput/subcommandGroup.ts';
|
||||
export type * from './_chatInput/user.ts';
|
||||
|
||||
/**
|
||||
* @see {@link https://discord.com/developers/docs/interactions/application-commands#application-command-object-application-command-option-structure}
|
||||
|
||||
@@ -23,10 +23,10 @@ import type { APIBaseInteraction } from './base.ts';
|
||||
import type { InteractionType } from './responses.ts';
|
||||
|
||||
export * from './_applicationCommands/chatInput.ts';
|
||||
export * from './_applicationCommands/contextMenu.ts';
|
||||
export type * from './_applicationCommands/contextMenu.ts';
|
||||
export * from './_applicationCommands/permissions.ts';
|
||||
export * from './_applicationCommands/entryPoint.ts';
|
||||
export * from './_applicationCommands/internals.ts';
|
||||
export type * from './_applicationCommands/entryPoint.ts';
|
||||
export type * from './_applicationCommands/internals.ts';
|
||||
|
||||
/**
|
||||
* @see {@link https://discord.com/developers/docs/interactions/application-commands#application-command-object}
|
||||
|
||||
10
deno/payloads/v9/interactions.ts
generated
10
deno/payloads/v9/interactions.ts
generated
@@ -21,11 +21,11 @@ import type {
|
||||
import type { APIPingInteraction } from './_interactions/ping.ts';
|
||||
|
||||
export * from './_interactions/applicationCommands.ts';
|
||||
export * from './_interactions/autocomplete.ts';
|
||||
export * from './_interactions/base.ts';
|
||||
export * from './_interactions/messageComponents.ts';
|
||||
export * from './_interactions/modalSubmit.ts';
|
||||
export * from './_interactions/ping.ts';
|
||||
export type * from './_interactions/autocomplete.ts';
|
||||
export type * from './_interactions/base.ts';
|
||||
export type * from './_interactions/messageComponents.ts';
|
||||
export type * from './_interactions/modalSubmit.ts';
|
||||
export type * from './_interactions/ping.ts';
|
||||
export * from './_interactions/responses.ts';
|
||||
|
||||
/**
|
||||
|
||||
8
deno/payloads/v9/mod.ts
generated
8
deno/payloads/v9/mod.ts
generated
@@ -3,7 +3,7 @@ export * from './application.ts';
|
||||
export * from './auditLog.ts';
|
||||
export * from './autoModeration.ts';
|
||||
export * from './channel.ts';
|
||||
export * from './emoji.ts';
|
||||
export type * from './emoji.ts';
|
||||
export * from './gateway.ts';
|
||||
export * from './guild.ts';
|
||||
export * from './guildScheduledEvent.ts';
|
||||
@@ -13,11 +13,11 @@ export * from './monetization.ts';
|
||||
export * from './oauth2.ts';
|
||||
export * from './permissions.ts';
|
||||
export * from './poll.ts';
|
||||
export * from './soundboard.ts';
|
||||
export type * from './soundboard.ts';
|
||||
export * from './stageInstance.ts';
|
||||
export * from './sticker.ts';
|
||||
export * from './teams.ts';
|
||||
export * from './template.ts';
|
||||
export type * from './template.ts';
|
||||
export * from './user.ts';
|
||||
export * from './voice.ts';
|
||||
export type * from './voice.ts';
|
||||
export * from './webhook.ts';
|
||||
|
||||
36
deno/rest/v10/mod.ts
generated
36
deno/rest/v10/mod.ts
generated
@@ -2,26 +2,26 @@ import type { Snowflake } from '../../globals.ts';
|
||||
import { urlSafeCharacters } from '../../utils/internals.ts';
|
||||
|
||||
export * from '../common.ts';
|
||||
export * from './application.ts';
|
||||
export * from './auditLog.ts';
|
||||
export * from './autoModeration.ts';
|
||||
export type * from './application.ts';
|
||||
export type * from './auditLog.ts';
|
||||
export type * from './autoModeration.ts';
|
||||
export * from './channel.ts';
|
||||
export * from './emoji.ts';
|
||||
export * from './gateway.ts';
|
||||
export * from './guild.ts';
|
||||
export * from './guildScheduledEvent.ts';
|
||||
export * from './interactions.ts';
|
||||
export * from './invite.ts';
|
||||
export type * from './emoji.ts';
|
||||
export type * from './gateway.ts';
|
||||
export type * from './guild.ts';
|
||||
export type * from './guildScheduledEvent.ts';
|
||||
export type * from './interactions.ts';
|
||||
export type * from './invite.ts';
|
||||
export * from './monetization.ts';
|
||||
export * from './oauth2.ts';
|
||||
export * from './poll.ts';
|
||||
export * from './soundboard.ts';
|
||||
export * from './stageInstance.ts';
|
||||
export * from './sticker.ts';
|
||||
export * from './template.ts';
|
||||
export * from './user.ts';
|
||||
export * from './voice.ts';
|
||||
export * from './webhook.ts';
|
||||
export type * from './oauth2.ts';
|
||||
export type * from './poll.ts';
|
||||
export type * from './soundboard.ts';
|
||||
export type * from './stageInstance.ts';
|
||||
export type * from './sticker.ts';
|
||||
export type * from './template.ts';
|
||||
export type * from './user.ts';
|
||||
export type * from './voice.ts';
|
||||
export type * from './webhook.ts';
|
||||
|
||||
export const APIVersion = '10';
|
||||
|
||||
|
||||
36
deno/rest/v9/mod.ts
generated
36
deno/rest/v9/mod.ts
generated
@@ -2,26 +2,26 @@ import type { Snowflake } from '../../globals.ts';
|
||||
import { urlSafeCharacters } from '../../utils/internals.ts';
|
||||
|
||||
export * from '../common.ts';
|
||||
export * from './application.ts';
|
||||
export * from './auditLog.ts';
|
||||
export * from './autoModeration.ts';
|
||||
export type * from './application.ts';
|
||||
export type * from './auditLog.ts';
|
||||
export type * from './autoModeration.ts';
|
||||
export * from './channel.ts';
|
||||
export * from './emoji.ts';
|
||||
export * from './gateway.ts';
|
||||
export * from './guild.ts';
|
||||
export * from './guildScheduledEvent.ts';
|
||||
export * from './interactions.ts';
|
||||
export * from './invite.ts';
|
||||
export type * from './emoji.ts';
|
||||
export type * from './gateway.ts';
|
||||
export type * from './guild.ts';
|
||||
export type * from './guildScheduledEvent.ts';
|
||||
export type * from './interactions.ts';
|
||||
export type * from './invite.ts';
|
||||
export * from './monetization.ts';
|
||||
export * from './oauth2.ts';
|
||||
export * from './poll.ts';
|
||||
export * from './soundboard.ts';
|
||||
export * from './stageInstance.ts';
|
||||
export * from './sticker.ts';
|
||||
export * from './template.ts';
|
||||
export * from './user.ts';
|
||||
export * from './voice.ts';
|
||||
export * from './webhook.ts';
|
||||
export type * from './oauth2.ts';
|
||||
export type * from './poll.ts';
|
||||
export type * from './soundboard.ts';
|
||||
export type * from './stageInstance.ts';
|
||||
export type * from './sticker.ts';
|
||||
export type * from './template.ts';
|
||||
export type * from './user.ts';
|
||||
export type * from './voice.ts';
|
||||
export type * from './webhook.ts';
|
||||
|
||||
export const APIVersion = '9';
|
||||
|
||||
|
||||
358
eslint.config.js
Normal file
358
eslint.config.js
Normal file
@@ -0,0 +1,358 @@
|
||||
import { AST_NODE_TYPES, ESLintUtils, TSESTree } from '@typescript-eslint/utils';
|
||||
import common from 'eslint-config-neon/common';
|
||||
import node from 'eslint-config-neon/node';
|
||||
import prettier from 'eslint-config-neon/prettier';
|
||||
import ts from 'eslint-config-neon/typescript';
|
||||
import { createTypeScriptImportResolver } from 'eslint-import-resolver-typescript';
|
||||
import merge from 'lodash.merge';
|
||||
import * as tsutils from 'tsutils';
|
||||
import * as typescript from 'typescript';
|
||||
import { config } from 'typescript-eslint';
|
||||
|
||||
/**
|
||||
* @param {import('@typescript-eslint/utils').TSESTree.TSPropertySignature} eslNode
|
||||
* @param {string[]} interfaceEndings
|
||||
* @returns {boolean}
|
||||
*/
|
||||
function shouldRun(eslNode, interfaceEndings) {
|
||||
// The first parent is the TSInterfaceBody, the second is the TSInterfaceDeclaration
|
||||
const interfaceNode = eslNode.parent?.parent;
|
||||
if (!(interfaceNode && 'id' in interfaceNode && interfaceNode.id?.type === AST_NODE_TYPES.Identifier)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
const { name } = interfaceNode.id;
|
||||
if (typeof name !== 'string') {
|
||||
return false;
|
||||
}
|
||||
|
||||
return interfaceEndings.some((ending) => name.endsWith(ending));
|
||||
}
|
||||
|
||||
const REST_TYPE_NAME_REGEX =
|
||||
/^REST(?:Get|Patch|Post|Put|Delete)[\dA-Za-z]+(?:JSONBody|FormDataBody|URLEncodedData|Result|Query)$/;
|
||||
|
||||
/**
|
||||
* @typedef {[{ interfaceEndings: string[] }]} Options
|
||||
*/
|
||||
|
||||
/** @type {typeof ESLintUtils.RuleCreator.withoutDocs<Options, 'missingOptional'>} */
|
||||
const MissingOptionalRuleCreator = ESLintUtils.RuleCreator.withoutDocs;
|
||||
|
||||
/** @type {typeof ESLintUtils.RuleCreator.withoutDocs<Options, 'missingUndefined'>} */
|
||||
const MissingUndefinedRuleCreator = ESLintUtils.RuleCreator.withoutDocs;
|
||||
|
||||
/** @type {typeof ESLintUtils.RuleCreator.withoutDocs<[{ whitelist: string[] }], 'invalidName'>} */
|
||||
const RestTypeNameConventionRuleCreator = ESLintUtils.RuleCreator.withoutDocs;
|
||||
|
||||
const localPlugin = {
|
||||
rules: {
|
||||
'explicitly-optional-undefined-properties': MissingOptionalRuleCreator({
|
||||
create: (context) => {
|
||||
const { interfaceEndings } = context.options[0];
|
||||
return {
|
||||
TSPropertySignature: (eslNode) => {
|
||||
if (!shouldRun(eslNode, interfaceEndings)) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (eslNode.optional) {
|
||||
return;
|
||||
}
|
||||
|
||||
const parserServices = ESLintUtils.getParserServices(context);
|
||||
const checker = parserServices.program.getTypeChecker();
|
||||
const tsNode = parserServices.esTreeNodeToTSNodeMap.get(eslNode);
|
||||
const type = checker.getApparentType(checker.getTypeAtLocation(tsNode));
|
||||
const unionParts = tsutils.unionTypeParts(type);
|
||||
|
||||
// If our prop is not optional, but has undefined in its union, we should report
|
||||
if (!unionParts.some((ty) => tsutils.isTypeFlagSet(ty, typescript.TypeFlags.Undefined))) {
|
||||
return;
|
||||
}
|
||||
|
||||
context.report({
|
||||
node: eslNode,
|
||||
messageId: 'missingOptional',
|
||||
fix: (fixer) => fixer.insertTextAfter(eslNode.key, '?'),
|
||||
});
|
||||
},
|
||||
};
|
||||
},
|
||||
meta: {
|
||||
fixable: 'code',
|
||||
messages: {
|
||||
missingOptional: 'When a property has `| undefined`, it should be marked as optional.',
|
||||
},
|
||||
type: 'problem',
|
||||
schema: [
|
||||
{
|
||||
type: 'object',
|
||||
properties: {
|
||||
interfaceEndings: {
|
||||
type: 'array',
|
||||
items: {
|
||||
type: 'string',
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
],
|
||||
},
|
||||
defaultOptions: [{ interfaceEndings: [] }],
|
||||
}),
|
||||
'explicit-undefined-on-optional-properties': MissingUndefinedRuleCreator({
|
||||
create: (context) => {
|
||||
const { interfaceEndings } = context.options[0];
|
||||
return {
|
||||
// This is done naively because type-checking the node will always include `| undefined`
|
||||
// due to it being optional. ideally, we'd have a way to get the type of the node disregarding
|
||||
// the optional flag, which would make this check a lot more trivial
|
||||
TSPropertySignature: (eslNode) => {
|
||||
if (!shouldRun(eslNode, interfaceEndings)) {
|
||||
return;
|
||||
}
|
||||
|
||||
// If our prop is't optional or if it doesn't have a type annotation, we don't need to do anything
|
||||
if (!eslNode.optional || !eslNode.typeAnnotation) {
|
||||
return;
|
||||
}
|
||||
|
||||
const { typeAnnotation } = eslNode.typeAnnotation;
|
||||
switch (typeAnnotation.type) {
|
||||
case AST_NODE_TYPES.TSUnionType: {
|
||||
if (typeAnnotation.types.some((t) => t.type === AST_NODE_TYPES.TSUndefinedKeyword)) {
|
||||
return;
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
case AST_NODE_TYPES.TSUndefinedKeyword: {
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
context.report({
|
||||
node: eslNode,
|
||||
messageId: 'missingUndefined',
|
||||
fix: (fixer) =>
|
||||
fixer.insertTextAfter(
|
||||
/** @type {Exclude<typeof eslNode.typeAnnotation, undefined>} */ (
|
||||
eslNode.typeAnnotation
|
||||
),
|
||||
' | undefined',
|
||||
),
|
||||
});
|
||||
},
|
||||
};
|
||||
},
|
||||
meta: {
|
||||
fixable: 'code',
|
||||
messages: {
|
||||
missingUndefined: 'When a property is optional, explicitly include `undefined` in the union.',
|
||||
},
|
||||
type: 'suggestion',
|
||||
schema: [
|
||||
{
|
||||
type: 'object',
|
||||
properties: {
|
||||
interfaceEndings: {
|
||||
type: 'array',
|
||||
items: {
|
||||
type: 'string',
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
],
|
||||
},
|
||||
defaultOptions: [{ interfaceEndings: [] }],
|
||||
}),
|
||||
'rest-type-naming-convention': RestTypeNameConventionRuleCreator({
|
||||
create: (context) => {
|
||||
const { whitelist } = context.options[0];
|
||||
const whitelistSet = new Set(whitelist);
|
||||
|
||||
return {
|
||||
'TSTypeAliasDeclaration, TSInterfaceDeclaration': (_node) => {
|
||||
const node = /** @type {TSESTree.TSTypeAliasDeclaration | TSESTree.TSInterfaceDeclaration} */ (
|
||||
_node
|
||||
);
|
||||
|
||||
if (node.id.type !== AST_NODE_TYPES.Identifier) {
|
||||
return;
|
||||
}
|
||||
|
||||
const { name } = node.id;
|
||||
if (whitelistSet.has(name)) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (!REST_TYPE_NAME_REGEX.test(name)) {
|
||||
context.report({
|
||||
node: node.id,
|
||||
messageId: 'invalidName',
|
||||
data: { name },
|
||||
});
|
||||
}
|
||||
},
|
||||
};
|
||||
},
|
||||
meta: {
|
||||
messages: {
|
||||
invalidName: `{{ name }} does not match REST type naming convention. Must match ${REST_TYPE_NAME_REGEX.source}.`,
|
||||
},
|
||||
type: 'problem',
|
||||
schema: [
|
||||
{
|
||||
type: 'object',
|
||||
properties: {
|
||||
whitelist: {
|
||||
type: 'array',
|
||||
items: {
|
||||
type: 'string',
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
],
|
||||
},
|
||||
defaultOptions: [{ whitelist: [] }],
|
||||
}),
|
||||
},
|
||||
};
|
||||
|
||||
const commonFiles = '{js,mjs,cjs,ts,mts,cts}';
|
||||
|
||||
const commonRuleset = merge(...common, { files: [`**/*.${commonFiles}`] });
|
||||
|
||||
const nodeRuleset = merge(...node, { files: [`**/*${commonFiles}`] });
|
||||
|
||||
const prettierRuleset = merge(...prettier, { files: [`**/*${commonFiles}`] });
|
||||
|
||||
const tsRuleset = merge(...ts, {
|
||||
files: [`**/*.${commonFiles}`],
|
||||
languageOptions: {
|
||||
parserOptions: {
|
||||
warnOnUnsupportedTypeScriptVersion: false,
|
||||
allowAutomaticSingleRunInference: true,
|
||||
project: 'tsconfig.eslint.json',
|
||||
},
|
||||
},
|
||||
settings: {
|
||||
'import-x/resolver-next': [
|
||||
createTypeScriptImportResolver({
|
||||
project: 'tsconfig.eslint.json',
|
||||
}),
|
||||
],
|
||||
},
|
||||
});
|
||||
|
||||
export default config([
|
||||
{
|
||||
ignores: [
|
||||
'deno/',
|
||||
|
||||
'gateway/v6/',
|
||||
'payloads/v6/',
|
||||
'rest/v6/',
|
||||
'v6.ts',
|
||||
|
||||
'gateway/v8/',
|
||||
'payloads/v8/',
|
||||
'rest/v8/',
|
||||
'utils/v8.ts',
|
||||
'v8.ts',
|
||||
|
||||
'djs/**/*',
|
||||
'.yarn/*',
|
||||
],
|
||||
},
|
||||
commonRuleset,
|
||||
nodeRuleset,
|
||||
tsRuleset,
|
||||
prettierRuleset,
|
||||
{
|
||||
rules: {
|
||||
'@typescript-eslint/consistent-type-definitions': ['error', 'interface'],
|
||||
'@typescript-eslint/prefer-literal-enum-member': 'off',
|
||||
'@typescript-eslint/sort-type-union-intersection-members': 'off',
|
||||
'import/extensions': 'off',
|
||||
'tsdoc/syntax': 'off',
|
||||
'typescript-sort-keys/interface': 'off',
|
||||
'typescript-sort-keys/string-enum': 'off',
|
||||
'unicorn/prefer-math-trunc': 'off',
|
||||
'jsdoc/no-undefined-types': 'off',
|
||||
'@typescript-eslint/no-empty-object-type': [
|
||||
'error',
|
||||
{
|
||||
allowInterfaces: 'always',
|
||||
},
|
||||
],
|
||||
},
|
||||
},
|
||||
{
|
||||
plugins: {
|
||||
local: localPlugin,
|
||||
},
|
||||
rules: {
|
||||
'local/explicit-undefined-on-optional-properties': ['error', { interfaceEndings: ['JSONBody'] }],
|
||||
'local/explicitly-optional-undefined-properties': ['error', { interfaceEndings: ['JSONBody'] }],
|
||||
},
|
||||
},
|
||||
{
|
||||
files: ['rest/v10/*.ts', 'rest/v9/*.ts'],
|
||||
ignores: ['rest/v10/index.ts', 'rest/v9/index.ts'],
|
||||
plugins: {
|
||||
local: localPlugin,
|
||||
},
|
||||
rules: {
|
||||
'local/rest-type-naming-convention': [
|
||||
'error',
|
||||
{
|
||||
whitelist: [
|
||||
'RESTAPIAttachment',
|
||||
'RESTAPIChannelPatchOverwrite',
|
||||
'RESTAPIGuildChannelResolvable',
|
||||
'RESTAPIGuildCreateOverwrite',
|
||||
'RESTAPIGuildCreatePartialChannel',
|
||||
'RESTAPIGuildCreateRole',
|
||||
'RESTAPIGuildOnboardingPrompt',
|
||||
'RESTAPIGuildOnboardingPromptOption',
|
||||
'RESTAPIInteractionCallbackActivityInstanceResource',
|
||||
'RESTAPIInteractionCallbackObject',
|
||||
'RESTAPIInteractionCallbackResourceObject',
|
||||
'RESTAPIMessageReference',
|
||||
'RESTAPIPartialCurrentUserGuild',
|
||||
'RESTAPIPoll',
|
||||
'RESTOAuth2TokenOptionalClientCredentials',
|
||||
|
||||
'RESTOAuth2AdvancedBotAuthorizationQuery',
|
||||
'RESTOAuth2AdvancedBotAuthorizationQueryResult',
|
||||
'RESTOAuth2AuthorizationQuery',
|
||||
'RESTOAuth2BotAuthorizationQuery',
|
||||
'RESTOAuth2ImplicitAuthorizationQuery',
|
||||
'RESTOAuth2ImplicitAuthorizationURLFragmentResult',
|
||||
|
||||
// Deprecated types
|
||||
'APIChannelPatchOverwrite',
|
||||
'APIGuildChannelResolvable',
|
||||
'APIGuildCreateOverwrite',
|
||||
'APIGuildCreatePartialChannel',
|
||||
'APIGuildCreateRole',
|
||||
'APIMessageReferenceSend',
|
||||
'GetAPIVoiceRegionsResult',
|
||||
'RESTAPIModifyGuildOnboardingPromptData',
|
||||
'RESTAPIModifyGuildOnboardingPromptOptionData',
|
||||
'RESTAPIPollCreate',
|
||||
'RESTDeleteAPIChannelMessageOwnReaction',
|
||||
'RESTGetAPIStickerPack',
|
||||
'RESTOAuth2AuthorizationQueryResult',
|
||||
'RESTPostAPIEntitlementBody',
|
||||
],
|
||||
},
|
||||
],
|
||||
},
|
||||
},
|
||||
]);
|
||||
@@ -43,7 +43,7 @@ import type {
|
||||
import type { ReactionType } from '../rest/v10/index';
|
||||
import type { _Nullable } from '../utils/internals';
|
||||
|
||||
export * from './common';
|
||||
export type * from './common';
|
||||
|
||||
export const GatewayVersion = '10';
|
||||
|
||||
|
||||
@@ -18,7 +18,7 @@ import type {
|
||||
PresenceUpdateStatus,
|
||||
} from '../payloads/v6/index';
|
||||
|
||||
export * from './common';
|
||||
export type * from './common';
|
||||
|
||||
/**
|
||||
* @deprecated Gateway v6 is deprecated and the types will not receive further updates, please update to v8.
|
||||
@@ -313,7 +313,6 @@ export type GatewayReadyDispatch = DataPayload<
|
||||
*/
|
||||
export type GatewayResumedDispatch = DataPayload<GatewayDispatchEvents.Resumed, never>;
|
||||
|
||||
/* eslint-disable @typescript-eslint/indent */
|
||||
/**
|
||||
* https://discord.com/developers/docs/topics/gateway#channel-create
|
||||
* https://discord.com/developers/docs/topics/gateway#channel-update
|
||||
@@ -325,7 +324,6 @@ export type GatewayChannelModifyDispatch = DataPayload<
|
||||
GatewayDispatchEvents.ChannelCreate | GatewayDispatchEvents.ChannelDelete | GatewayDispatchEvents.ChannelUpdate,
|
||||
APIChannel
|
||||
>;
|
||||
/* eslint-enable @typescript-eslint/indent */
|
||||
|
||||
/**
|
||||
* @deprecated Gateway v6 is deprecated and the types will not receive further updates, please update to v8.
|
||||
|
||||
@@ -26,7 +26,7 @@ import type {
|
||||
} from '../payloads/v8/index';
|
||||
import type { _Nullable } from '../utils/internals';
|
||||
|
||||
export * from './common';
|
||||
export type * from './common';
|
||||
|
||||
/**
|
||||
* @deprecated API and gateway v8 are deprecated and the types will not receive further updates, please update to v10.
|
||||
|
||||
@@ -43,7 +43,7 @@ import type {
|
||||
import type { ReactionType } from '../rest/v9/index';
|
||||
import type { _Nullable } from '../utils/internals';
|
||||
|
||||
export * from './common';
|
||||
export type * from './common';
|
||||
|
||||
export const GatewayVersion = '9';
|
||||
|
||||
|
||||
@@ -52,7 +52,6 @@ export const FormattingPatterns = {
|
||||
* The `fullName` (possibly including `name`, `subcommandOrGroup` and `subcommand`) and `id` group properties are present on the `exec` result of this expression
|
||||
*/
|
||||
SlashCommand:
|
||||
// eslint-disable-next-line unicorn/no-unsafe-regex
|
||||
/<\/(?<fullName>(?<name>[-_\p{Letter}\p{Number}\p{sc=Deva}\p{sc=Thai}]{1,32})(?: (?<subcommandOrGroup>[-_\p{Letter}\p{Number}\p{sc=Deva}\p{sc=Thai}]{1,32}))?(?: (?<subcommand>[-_\p{Letter}\p{Number}\p{sc=Deva}\p{sc=Thai}]{1,32}))?):(?<id>\d{17,20})>/u,
|
||||
/**
|
||||
* Regular expression for matching a custom emoji, either static or animated
|
||||
|
||||
17
package.json
17
package.json
@@ -110,11 +110,11 @@
|
||||
"esm:utils": "gen-esm-wrapper ./utils/index.js ./utils/index.mjs",
|
||||
"esm:versions": "node ./scripts/versions.mjs",
|
||||
"esm:voice": "gen-esm-wrapper ./voice/index.js ./voice/index.mjs",
|
||||
"lint": "prettier --write . && eslint --fix --ext mjs,ts \"{gateway,payloads,rest,rpc,voice,utils}/**/*.ts\" \"{globals,v*}.ts\" \"scripts/**/*.mjs\"",
|
||||
"postinstallDev": "tsc -p ./.eslint-plugin-local && (is-ci || husky)",
|
||||
"lint": "prettier --write . && eslint --format=pretty --fix --ext mjs,ts \"{gateway,payloads,rest,rpc,voice,utils}/**/*.ts\" \"{globals,v*}.ts\" \"scripts/**/*.mjs\"",
|
||||
"postinstallDev": "is-ci || husky",
|
||||
"prepack": "run-s clean test:lint build:node",
|
||||
"postpack": "run-s clean:node build:deno",
|
||||
"test:lint": "prettier --check . && eslint --ext mjs,ts \"{gateway,payloads,rest,rpc,voice,utils}/**/*.ts\" \"{globals,v*}.ts\" \"scripts/**/*.mjs\"",
|
||||
"test:lint": "prettier --check . && eslint --format=pretty --ext mjs,ts \"{gateway,payloads,rest,rpc,voice,utils}/**/*.ts\" \"{globals,v*}.ts\" \"scripts/**/*.mjs\"",
|
||||
"test:types": "tsc -p tests"
|
||||
},
|
||||
"keywords": [
|
||||
@@ -136,26 +136,29 @@
|
||||
"@octokit/action": "^8.0.2",
|
||||
"@octokit/webhooks-types": "^7.6.1",
|
||||
"@sapphire/prettier-config": "^2.0.0",
|
||||
"@types/lodash.merge": "^4",
|
||||
"@types/node": "^22.15.29",
|
||||
"@typescript-eslint/utils": "^8.33.0",
|
||||
"conventional-changelog": "^7.0.2",
|
||||
"conventional-changelog-angular": "^8.0.0",
|
||||
"conventional-recommended-bump": "^11.1.0",
|
||||
"eslint": "^8.57.1",
|
||||
"eslint-config-neon": "^0.1.62",
|
||||
"eslint": "^9.28.0",
|
||||
"eslint-config-neon": "^0.2.7",
|
||||
"eslint-formatter-pretty": "^6.0.1",
|
||||
"eslint-import-resolver-typescript": "^4.4.2",
|
||||
"eslint-plugin-local": "^6.0.0",
|
||||
"gen-esm-wrapper": "^1.1.3",
|
||||
"husky": "^9.1.7",
|
||||
"is-ci": "^4.1.0",
|
||||
"lint-staged": "^16.1.0",
|
||||
"lodash.merge": "^4.6.2",
|
||||
"npm-run-all2": "^8.0.4",
|
||||
"prettier": "^3.5.3",
|
||||
"pretty-quick": "^4.1.1",
|
||||
"rimraf": "^6.0.1",
|
||||
"tsutils": "^3.21.0",
|
||||
"tsx": "^4.19.4",
|
||||
"typescript": "^5.8.3"
|
||||
"typescript": "^5.8.3",
|
||||
"typescript-eslint": "^8.33.0"
|
||||
},
|
||||
"publishConfig": {
|
||||
"provenance": true,
|
||||
|
||||
@@ -17,7 +17,7 @@ export const PermissionFlagsBits = {
|
||||
/**
|
||||
* Allows kicking members
|
||||
*/
|
||||
// eslint-disable-next-line sonarjs/no-identical-expressions
|
||||
|
||||
KickMembers: 1n << 1n,
|
||||
/**
|
||||
* Allows banning members
|
||||
|
||||
@@ -47,19 +47,19 @@ import type {
|
||||
} from './_chatInput/user';
|
||||
import type { APIBaseApplicationCommandInteractionData } from './internals';
|
||||
|
||||
export * from './_chatInput/attachment';
|
||||
export * from './_chatInput/base';
|
||||
export * from './_chatInput/boolean';
|
||||
export * from './_chatInput/channel';
|
||||
export * from './_chatInput/integer';
|
||||
export * from './_chatInput/mentionable';
|
||||
export * from './_chatInput/number';
|
||||
export * from './_chatInput/role';
|
||||
export type * from './_chatInput/attachment';
|
||||
export type * from './_chatInput/base';
|
||||
export type * from './_chatInput/boolean';
|
||||
export type * from './_chatInput/channel';
|
||||
export type * from './_chatInput/integer';
|
||||
export type * from './_chatInput/mentionable';
|
||||
export type * from './_chatInput/number';
|
||||
export type * from './_chatInput/role';
|
||||
export * from './_chatInput/shared';
|
||||
export * from './_chatInput/string';
|
||||
export * from './_chatInput/subcommand';
|
||||
export * from './_chatInput/subcommandGroup';
|
||||
export * from './_chatInput/user';
|
||||
export type * from './_chatInput/string';
|
||||
export type * from './_chatInput/subcommand';
|
||||
export type * from './_chatInput/subcommandGroup';
|
||||
export type * from './_chatInput/user';
|
||||
|
||||
/**
|
||||
* @see {@link https://discord.com/developers/docs/interactions/application-commands#application-command-object-application-command-option-structure}
|
||||
|
||||
@@ -23,10 +23,10 @@ import type { APIBaseInteraction } from './base';
|
||||
import type { InteractionType } from './responses';
|
||||
|
||||
export * from './_applicationCommands/chatInput';
|
||||
export * from './_applicationCommands/contextMenu';
|
||||
export type * from './_applicationCommands/contextMenu';
|
||||
export * from './_applicationCommands/permissions';
|
||||
export * from './_applicationCommands/entryPoint';
|
||||
export * from './_applicationCommands/internals';
|
||||
export type * from './_applicationCommands/entryPoint';
|
||||
export type * from './_applicationCommands/internals';
|
||||
|
||||
/**
|
||||
* @see {@link https://discord.com/developers/docs/interactions/application-commands#application-command-object}
|
||||
|
||||
@@ -3,7 +3,7 @@ export * from './application';
|
||||
export * from './auditLog';
|
||||
export * from './autoModeration';
|
||||
export * from './channel';
|
||||
export * from './emoji';
|
||||
export type * from './emoji';
|
||||
export * from './gateway';
|
||||
export * from './guild';
|
||||
export * from './guildScheduledEvent';
|
||||
@@ -13,11 +13,11 @@ export * from './monetization';
|
||||
export * from './oauth2';
|
||||
export * from './permissions';
|
||||
export * from './poll';
|
||||
export * from './soundboard';
|
||||
export type * from './soundboard';
|
||||
export * from './stageInstance';
|
||||
export * from './sticker';
|
||||
export * from './teams';
|
||||
export * from './template';
|
||||
export type * from './template';
|
||||
export * from './user';
|
||||
export * from './voice';
|
||||
export type * from './voice';
|
||||
export * from './webhook';
|
||||
|
||||
@@ -21,11 +21,11 @@ import type {
|
||||
import type { APIPingInteraction } from './_interactions/ping';
|
||||
|
||||
export * from './_interactions/applicationCommands';
|
||||
export * from './_interactions/autocomplete';
|
||||
export * from './_interactions/base';
|
||||
export * from './_interactions/messageComponents';
|
||||
export * from './_interactions/modalSubmit';
|
||||
export * from './_interactions/ping';
|
||||
export type * from './_interactions/autocomplete';
|
||||
export type * from './_interactions/base';
|
||||
export type * from './_interactions/messageComponents';
|
||||
export type * from './_interactions/modalSubmit';
|
||||
export type * from './_interactions/ping';
|
||||
export * from './_interactions/responses';
|
||||
|
||||
/**
|
||||
|
||||
@@ -47,19 +47,19 @@ import type {
|
||||
} from './_chatInput/user';
|
||||
import type { APIBaseApplicationCommandInteractionData } from './internals';
|
||||
|
||||
export * from './_chatInput/attachment';
|
||||
export * from './_chatInput/base';
|
||||
export * from './_chatInput/boolean';
|
||||
export * from './_chatInput/channel';
|
||||
export * from './_chatInput/integer';
|
||||
export * from './_chatInput/mentionable';
|
||||
export * from './_chatInput/number';
|
||||
export * from './_chatInput/role';
|
||||
export type * from './_chatInput/attachment';
|
||||
export type * from './_chatInput/base';
|
||||
export type * from './_chatInput/boolean';
|
||||
export type * from './_chatInput/channel';
|
||||
export type * from './_chatInput/integer';
|
||||
export type * from './_chatInput/mentionable';
|
||||
export type * from './_chatInput/number';
|
||||
export type * from './_chatInput/role';
|
||||
export * from './_chatInput/shared';
|
||||
export * from './_chatInput/string';
|
||||
export * from './_chatInput/subcommand';
|
||||
export * from './_chatInput/subcommandGroup';
|
||||
export * from './_chatInput/user';
|
||||
export type * from './_chatInput/string';
|
||||
export type * from './_chatInput/subcommand';
|
||||
export type * from './_chatInput/subcommandGroup';
|
||||
export type * from './_chatInput/user';
|
||||
|
||||
/**
|
||||
* @see {@link https://discord.com/developers/docs/interactions/application-commands#application-command-object-application-command-option-structure}
|
||||
|
||||
@@ -23,10 +23,10 @@ import type { APIBaseInteraction } from './base';
|
||||
import type { InteractionType } from './responses';
|
||||
|
||||
export * from './_applicationCommands/chatInput';
|
||||
export * from './_applicationCommands/contextMenu';
|
||||
export type * from './_applicationCommands/contextMenu';
|
||||
export * from './_applicationCommands/permissions';
|
||||
export * from './_applicationCommands/entryPoint';
|
||||
export * from './_applicationCommands/internals';
|
||||
export type * from './_applicationCommands/entryPoint';
|
||||
export type * from './_applicationCommands/internals';
|
||||
|
||||
/**
|
||||
* @see {@link https://discord.com/developers/docs/interactions/application-commands#application-command-object}
|
||||
|
||||
@@ -3,7 +3,7 @@ export * from './application';
|
||||
export * from './auditLog';
|
||||
export * from './autoModeration';
|
||||
export * from './channel';
|
||||
export * from './emoji';
|
||||
export type * from './emoji';
|
||||
export * from './gateway';
|
||||
export * from './guild';
|
||||
export * from './guildScheduledEvent';
|
||||
@@ -13,11 +13,11 @@ export * from './monetization';
|
||||
export * from './oauth2';
|
||||
export * from './permissions';
|
||||
export * from './poll';
|
||||
export * from './soundboard';
|
||||
export type * from './soundboard';
|
||||
export * from './stageInstance';
|
||||
export * from './sticker';
|
||||
export * from './teams';
|
||||
export * from './template';
|
||||
export type * from './template';
|
||||
export * from './user';
|
||||
export * from './voice';
|
||||
export type * from './voice';
|
||||
export * from './webhook';
|
||||
|
||||
@@ -21,11 +21,11 @@ import type {
|
||||
import type { APIPingInteraction } from './_interactions/ping';
|
||||
|
||||
export * from './_interactions/applicationCommands';
|
||||
export * from './_interactions/autocomplete';
|
||||
export * from './_interactions/base';
|
||||
export * from './_interactions/messageComponents';
|
||||
export * from './_interactions/modalSubmit';
|
||||
export * from './_interactions/ping';
|
||||
export type * from './_interactions/autocomplete';
|
||||
export type * from './_interactions/base';
|
||||
export type * from './_interactions/messageComponents';
|
||||
export type * from './_interactions/modalSubmit';
|
||||
export type * from './_interactions/ping';
|
||||
export * from './_interactions/responses';
|
||||
|
||||
/**
|
||||
|
||||
@@ -13,6 +13,12 @@
|
||||
"matchCurrentVersion": "!/^0/",
|
||||
"groupName": "patch/minor dependencies",
|
||||
"groupSlug": "all-non-major"
|
||||
},
|
||||
{
|
||||
"groupName": "eslint/prettier",
|
||||
"automerge": true,
|
||||
"groupSlug": "formatting-linting-dependencies",
|
||||
"matchPackageNames": ["/eslint/", "/prettier/"]
|
||||
}
|
||||
],
|
||||
"schedule": ["before 1pm every friday"]
|
||||
|
||||
@@ -2,26 +2,26 @@ import type { Snowflake } from '../../globals';
|
||||
import { urlSafeCharacters } from '../../utils/internals';
|
||||
|
||||
export * from '../common';
|
||||
export * from './application';
|
||||
export * from './auditLog';
|
||||
export * from './autoModeration';
|
||||
export type * from './application';
|
||||
export type * from './auditLog';
|
||||
export type * from './autoModeration';
|
||||
export * from './channel';
|
||||
export * from './emoji';
|
||||
export * from './gateway';
|
||||
export * from './guild';
|
||||
export * from './guildScheduledEvent';
|
||||
export * from './interactions';
|
||||
export * from './invite';
|
||||
export type * from './emoji';
|
||||
export type * from './gateway';
|
||||
export type * from './guild';
|
||||
export type * from './guildScheduledEvent';
|
||||
export type * from './interactions';
|
||||
export type * from './invite';
|
||||
export * from './monetization';
|
||||
export * from './oauth2';
|
||||
export * from './poll';
|
||||
export * from './soundboard';
|
||||
export * from './stageInstance';
|
||||
export * from './sticker';
|
||||
export * from './template';
|
||||
export * from './user';
|
||||
export * from './voice';
|
||||
export * from './webhook';
|
||||
export type * from './oauth2';
|
||||
export type * from './poll';
|
||||
export type * from './soundboard';
|
||||
export type * from './stageInstance';
|
||||
export type * from './sticker';
|
||||
export type * from './template';
|
||||
export type * from './user';
|
||||
export type * from './voice';
|
||||
export type * from './webhook';
|
||||
|
||||
export const APIVersion = '10';
|
||||
|
||||
|
||||
@@ -2,26 +2,26 @@ import type { Snowflake } from '../../globals';
|
||||
import { urlSafeCharacters } from '../../utils/internals';
|
||||
|
||||
export * from '../common';
|
||||
export * from './application';
|
||||
export * from './auditLog';
|
||||
export * from './autoModeration';
|
||||
export type * from './application';
|
||||
export type * from './auditLog';
|
||||
export type * from './autoModeration';
|
||||
export * from './channel';
|
||||
export * from './emoji';
|
||||
export * from './gateway';
|
||||
export * from './guild';
|
||||
export * from './guildScheduledEvent';
|
||||
export * from './interactions';
|
||||
export * from './invite';
|
||||
export type * from './emoji';
|
||||
export type * from './gateway';
|
||||
export type * from './guild';
|
||||
export type * from './guildScheduledEvent';
|
||||
export type * from './interactions';
|
||||
export type * from './invite';
|
||||
export * from './monetization';
|
||||
export * from './oauth2';
|
||||
export * from './poll';
|
||||
export * from './soundboard';
|
||||
export * from './stageInstance';
|
||||
export * from './sticker';
|
||||
export * from './template';
|
||||
export * from './user';
|
||||
export * from './voice';
|
||||
export * from './webhook';
|
||||
export type * from './oauth2';
|
||||
export type * from './poll';
|
||||
export type * from './soundboard';
|
||||
export type * from './stageInstance';
|
||||
export type * from './sticker';
|
||||
export type * from './template';
|
||||
export type * from './user';
|
||||
export type * from './voice';
|
||||
export type * from './webhook';
|
||||
|
||||
export const APIVersion = '9';
|
||||
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-member-access, @typescript-eslint/no-unsafe-assignment, @typescript-eslint/restrict-template-expressions */
|
||||
import { readFile } from 'node:fs/promises';
|
||||
import process from 'node:process';
|
||||
import { URL } from 'node:url';
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-member-access, @typescript-eslint/no-unsafe-assignment, @typescript-eslint/restrict-template-expressions */
|
||||
import { readFile } from 'node:fs/promises';
|
||||
import process from 'node:process';
|
||||
import { URL } from 'node:url';
|
||||
@@ -19,7 +18,7 @@ const previousReleases = await octokit.repos.listReleases({
|
||||
});
|
||||
|
||||
// Releases are sorted from newest to oldest, this should work™️
|
||||
// eslint-disable-next-line no-shadow -- are you stupid or are you high, line 80 is in fuck all compared to you
|
||||
|
||||
const previousRelease = previousReleases.data.find((release) => !release.draft);
|
||||
console.log('👀 Previous release version:', previousRelease?.tag_name);
|
||||
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
/* eslint-disable @typescript-eslint/restrict-template-expressions */
|
||||
import { execSync } from 'node:child_process';
|
||||
import process from 'node:process';
|
||||
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
/* eslint-disable @typescript-eslint/restrict-template-expressions, @typescript-eslint/no-unsafe-argument, @typescript-eslint/no-unsafe-assignment, @typescript-eslint/no-unsafe-member-access */
|
||||
import { execSync, spawnSync } from 'node:child_process';
|
||||
import process from 'node:process';
|
||||
import { Octokit } from '@octokit/action';
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
/* eslint-disable @typescript-eslint/restrict-template-expressions, @typescript-eslint/no-unsafe-argument, @typescript-eslint/no-unsafe-assignment, @typescript-eslint/no-unsafe-member-access */
|
||||
import { execSync } from 'node:child_process';
|
||||
import { readFile, rm, writeFile } from 'node:fs/promises';
|
||||
import { URL } from 'node:url';
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
/* eslint-disable @typescript-eslint/restrict-template-expressions */
|
||||
import { copyFile, mkdir, opendir, readFile, rm, writeFile } from 'node:fs/promises';
|
||||
import { URL } from 'node:url';
|
||||
|
||||
@@ -83,7 +82,7 @@ const folderResults = await Promise.allSettled(
|
||||
'rpc/',
|
||||
'utils/',
|
||||
'voice/',
|
||||
].map((item) => adaptFolderToDeno(item)),
|
||||
].map(async (item) => adaptFolderToDeno(item)),
|
||||
);
|
||||
|
||||
for (const result of folderResults) {
|
||||
@@ -97,7 +96,7 @@ const copyResults = await Promise.allSettled(
|
||||
'CHANGELOG.md',
|
||||
'README.md',
|
||||
'globals.ts',
|
||||
].map((item) => copyFile(new URL(item, baseDirectory), new URL(item, denoPath))),
|
||||
].map(async (item) => copyFile(new URL(item, baseDirectory), new URL(item, denoPath))),
|
||||
);
|
||||
|
||||
for (const result of copyResults) {
|
||||
@@ -111,7 +110,7 @@ const globalFileResults = await Promise.allSettled(
|
||||
'v8.ts',
|
||||
'v9.ts',
|
||||
'v10.ts',
|
||||
].map((version) => convertFile(new URL(version, baseDirectory), new URL(version, denoPath))),
|
||||
].map(async (version) => convertFile(new URL(version, baseDirectory), new URL(version, denoPath))),
|
||||
);
|
||||
|
||||
for (const result of globalFileResults) {
|
||||
|
||||
@@ -12,8 +12,10 @@ const execAsync = promisify(exec);
|
||||
* @param {string} path
|
||||
* @param {string} version
|
||||
*/
|
||||
const fileToESMWrapperCall = (path, version) =>
|
||||
execAsync(`npx gen-esm-wrapper "${join(rootDir, path, `${version}.js`)}" "${join(rootDir, path, `${version}.mjs`)}"`);
|
||||
const fileToESMWrapperCall = async (path, version) =>
|
||||
execAsync(
|
||||
`npx gen-esm-wrapper "${join(rootDir, path, `${version}.js`)}" "${join(rootDir, path, `${version}.mjs`)}"`,
|
||||
);
|
||||
|
||||
await Promise.allSettled(
|
||||
[
|
||||
|
||||
@@ -18,6 +18,7 @@
|
||||
"scripts",
|
||||
"deno",
|
||||
"tests/**/*.ts",
|
||||
"website"
|
||||
"website",
|
||||
"eslint.config.js"
|
||||
]
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user