Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 12 additions & 9 deletions eslint.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,18 @@ const commonFiles = '{js,mjs,cjs,ts,mts,cts,jsx,tsx}';

const commonRuleset = merge(...common, { files: [`**/*${commonFiles}`] });

const nodeRuleset = merge(...node, { files: [`**/*${commonFiles}`] });
const nodeRuleset = merge(...node, {
files: [`**/*${commonFiles}`],
rules: {
'no-restricted-globals': 0,
'n/prefer-global/buffer': [2, 'always'],
'n/prefer-global/process': [2, 'always'],
'n/prefer-global/text-decoder': [2, 'always'],
'n/prefer-global/text-encoder': [2, 'always'],
'n/prefer-global/url': [2, 'always'],
'n/prefer-global/url-search-params': [2, 'always'],
},
});

const typeScriptRuleset = merge(...typescript, {
files: [`**/*${commonFiles}`],
Expand Down Expand Up @@ -123,7 +134,6 @@ export default defineConfig(
{
files: [`packages/{api-extractor,api-extractor-model,api-extractor-utils}/**/*${commonFiles}`],
rules: {
'n/prefer-global/process': 0,
'@typescript-eslint/naming-convention': 0,
'@typescript-eslint/no-empty-interface': 0,
'@typescript-eslint/no-empty-object-type': 0,
Expand Down Expand Up @@ -236,11 +246,6 @@ export default defineConfig(
{
files: [`packages/rest/**/*${commonFiles}`],
rules: {
'n/prefer-global/url': 0,
'n/prefer-global/url-search-params': 0,
'n/prefer-global/buffer': 0,
'n/prefer-global/process': 0,
'no-restricted-globals': 0,
'unicorn/prefer-node-protocol': 0,
},
},
Expand All @@ -255,8 +260,6 @@ export default defineConfig(
{
files: [`packages/voice/**/*${commonFiles}`],
rules: {
'no-restricted-globals': 0,
'n/prefer-global/buffer': 0,
'@typescript-eslint/no-unsafe-declaration-merging': 0,
},
},
Expand Down
1 change: 0 additions & 1 deletion packages/actions/src/releasePackages/releasePackage.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import process from 'node:process';
import { setInterval, clearInterval } from 'node:timers';
import { info, warning } from '@actions/core';
import { getOctokit, context } from '@actions/github';
Expand Down
1 change: 0 additions & 1 deletion packages/actions/src/uploadDocumentation/index.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import { readFile } from 'node:fs/promises';
import process from 'node:process';
import { getInput, setFailed } from '@actions/core';
import { create } from '@actions/glob';
import { PutObjectCommand, S3Client } from '@aws-sdk/client-s3';
Expand Down
1 change: 0 additions & 1 deletion packages/actions/src/uploadSearchIndices/index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import process from 'node:process';
import { setFailed } from '@actions/core';
import { generateAllIndices } from '@discordjs/scripts';
import Cloudflare from 'cloudflare';
Expand Down
1 change: 0 additions & 1 deletion packages/actions/src/uploadSplitDocumentation/index.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import { readFile } from 'node:fs/promises';
import { basename, dirname, relative, sep } from 'node:path';
import process from 'node:process';
import { setTimeout as sleep } from 'node:timers/promises';
import { setFailed, getInput } from '@actions/core';
import { create } from '@actions/glob';
Expand Down
1 change: 0 additions & 1 deletion packages/api-extractor-model/src/model/ApiPackage.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
// Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT license.
// See LICENSE in the project root for license information.

import { Buffer } from 'node:buffer';
import path from 'node:path';
import util from 'node:util';
import { TSDocConfiguration } from '@microsoft/tsdoc';
Expand Down
2 changes: 0 additions & 2 deletions packages/api-extractor-model/src/model/SourceLocation.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
// Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT license.
// See LICENSE in the project root for license information.

import { URL } from 'node:url';

/**
* Constructor options for `SourceLocation`.
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
// See LICENSE in the project root for license information.

import * as os from 'node:os';
import process from 'node:process';
import { InternalError } from '@rushstack/node-core-library';
import { CommandLineParser, type CommandLineFlagParameter } from '@rushstack/ts-command-line';
import colors from 'colors';
Expand Down
1 change: 0 additions & 1 deletion packages/api-extractor/src/start.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
// See LICENSE in the project root for license information.

import * as os from 'node:os';
import * as process from 'node:process';
import colors from 'colors';
import { Extractor } from './api/Extractor.js';
import { ApiExtractorCommandLine } from './cli/ApiExtractorCommandLine.js';
Expand Down
1 change: 0 additions & 1 deletion packages/brokers/src/brokers/Broker.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import { Buffer } from 'node:buffer';
import { encode, decode } from '@msgpack/msgpack';
import type { AsyncEventEmitter } from '@vladfrangu/async_event_emitter';

Expand Down
1 change: 0 additions & 1 deletion packages/brokers/src/brokers/redis/BaseRedis.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import type { Buffer } from 'node:buffer';
import { randomBytes } from 'node:crypto';
import { readFileSync } from 'node:fs';
import { resolve } from 'node:path';
Expand Down
1 change: 0 additions & 1 deletion packages/brokers/src/brokers/redis/PubSubRedis.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import type { Buffer } from 'node:buffer';
import type { IPubSubBroker } from '../Broker.js';
import { BaseRedisBroker } from './BaseRedis.js';

Expand Down
1 change: 0 additions & 1 deletion packages/brokers/src/brokers/redis/RPCRedis.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import type { Buffer } from 'node:buffer';
import { clearTimeout, setTimeout } from 'node:timers';
import type Redis from 'ioredis/built/Redis.js';
import type { IRPCBroker } from '../Broker.js';
Expand Down
1 change: 0 additions & 1 deletion packages/core/src/api/oauth2.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ export class OAuth2API {
* @param options - The options for creating the authorization URL
*/
public generateAuthorizationURL(options: RESTOAuth2AuthorizationQuery) {
// eslint-disable-next-line n/prefer-global/url
const url = new URL(`${RouteBases.api}${Routes.oauth2Authorization()}`);
url.search = makeURLSearchParams(options).toString();
return url.toString();
Expand Down
4 changes: 0 additions & 4 deletions packages/create-discord-bot/bin/index.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,3 @@
#!/usr/bin/env node
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why was the shebang removed?

Copy link
Member Author

@didinele didinele Nov 17, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure, an eslint rule fired on it. Gonna look into it


// eslint-disable-next-line n/shebang
import process from 'node:process';
import { styleText } from 'node:util';
import { Option, program } from 'commander';
import prompts from 'prompts';
Expand Down
1 change: 0 additions & 1 deletion packages/create-discord-bot/scripts/rename-to-app.mjs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import { readFile, writeFile } from 'node:fs/promises';
import { URL } from 'node:url';

const pkgJsonPath = new URL('../package.json', import.meta.url);
const pkgJson = JSON.parse(await readFile(pkgJsonPath, 'utf8'));
Expand Down
2 changes: 0 additions & 2 deletions packages/create-discord-bot/src/create-discord-bot.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
import type { ExecException } from 'node:child_process';
import { cp, glob, mkdir, stat, readdir, readFile, writeFile } from 'node:fs/promises';
import path from 'node:path';
import process from 'node:process';
import { URL } from 'node:url';
import { styleText } from 'node:util';
import type { PackageManager } from './helpers/packageManager.js';
import { install, isNodePackageManager } from './helpers/packageManager.js';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import { execSync } from 'node:child_process';
import process from 'node:process';
import { styleText } from 'node:util';
import { DEFAULT_PACKAGE_MANAGER, NODE_PACKAGE_MANAGERS } from '../util/constants.js';

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import { URL } from 'node:url';
import { Events } from 'discord.js';
import { loadCommands } from '../util/loaders.js';

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
import process from 'node:process';
import { URL } from 'node:url';
import { Client, GatewayIntentBits } from 'discord.js';
import { loadEvents } from './util/loaders.js';

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
import process from 'node:process';
import { URL } from 'node:url';
import { API } from '@discordjs/core/http-only';
import { REST } from 'discord.js';
import { loadCommands } from './loaders.js';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { glob, stat } from 'node:fs/promises';
import { resolve } from 'node:path';
import { fileURLToPath, URL } from 'node:url';
import { fileURLToPath } from 'node:url';
import { predicate as commandPredicate } from '../commands/index.js';
import { predicate as eventPredicate } from '../events/index.js';

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import { URL } from 'node:url';
import { Events } from 'discord.js';
import { loadCommands } from '../util/loaders.[REPLACE_IMPORT_EXT]';
import type { Event } from './index.[REPLACE_IMPORT_EXT]';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
import process from 'node:process';
import { URL } from 'node:url';
import { Client, GatewayIntentBits } from 'discord.js';
import { loadEvents } from './util/loaders.[REPLACE_IMPORT_EXT]';

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
import process from 'node:process';
import { URL } from 'node:url';
import { API } from '@discordjs/core/http-only';
import { REST } from 'discord.js';
import { loadCommands } from './loaders.[REPLACE_IMPORT_EXT]';
Expand Down
1 change: 0 additions & 1 deletion packages/discord.js/scripts/esmDts.mjs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import { cp } from 'node:fs/promises';
import { URL } from 'node:url';

const rawIndexDTS = new URL('../typings/index.d.ts', import.meta.url);
const rawIndexMTS = new URL('../typings/index.d.mts', import.meta.url);
Expand Down
1 change: 0 additions & 1 deletion packages/discord.js/scripts/generateRequires.mjs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import { readdir, writeFile } from 'node:fs/promises';
import { URL } from 'node:url';

async function writeWebsocketHandlerImports() {
const lines = ["'use strict';\n", 'const PacketHandlers = Object.fromEntries(['];
Expand Down
1 change: 0 additions & 1 deletion packages/discord.js/src/client/Client.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
'use strict';

const process = require('node:process');
const { clearTimeout, setImmediate, setTimeout } = require('node:timers');
const { Collection } = require('@discordjs/collection');
const { REST, RESTEvents, makeURLSearchParams } = require('@discordjs/rest');
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
'use strict';

const process = require('node:process');
const { GatewayOpcodes } = require('discord-api-types/v10');

const emittedFor = new Set();
Expand Down
1 change: 0 additions & 1 deletion packages/discord.js/src/managers/ChannelManager.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
'use strict';

const process = require('node:process');
const { lazy } = require('@discordjs/util');
const { Routes } = require('discord-api-types/v10');
const { BaseChannel } = require('../structures/BaseChannel.js');
Expand Down
1 change: 0 additions & 1 deletion packages/discord.js/src/managers/GuildChannelManager.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
'use strict';

const process = require('node:process');
const { Collection } = require('@discordjs/collection');
const { ChannelType, Routes } = require('discord-api-types/v10');
const { DiscordjsError, DiscordjsTypeError, ErrorCodes } = require('../errors/index.js');
Expand Down
1 change: 0 additions & 1 deletion packages/discord.js/src/managers/GuildManager.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
'use strict';

const process = require('node:process');
const { setTimeout, clearTimeout } = require('node:timers');
const { Collection } = require('@discordjs/collection');
const { makeURLSearchParams } = require('@discordjs/rest');
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
'use strict';

const process = require('node:process');
const { Collection } = require('@discordjs/collection');
const { OverwriteType, Routes } = require('discord-api-types/v10');
const { DiscordjsTypeError, ErrorCodes } = require('../errors/index.js');
Expand Down
1 change: 0 additions & 1 deletion packages/discord.js/src/managers/RoleManager.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
'use strict';

const process = require('node:process');
const { Collection } = require('@discordjs/collection');
const { Routes } = require('discord-api-types/v10');
const { DiscordjsTypeError, ErrorCodes } = require('../errors/index.js');
Expand Down
1 change: 0 additions & 1 deletion packages/discord.js/src/sharding/Shard.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
'use strict';

const path = require('node:path');
const process = require('node:process');
const { setTimeout, clearTimeout } = require('node:timers');
const { setTimeout: sleep } = require('node:timers/promises');
const { SHARE_ENV } = require('node:worker_threads');
Expand Down
1 change: 0 additions & 1 deletion packages/discord.js/src/sharding/ShardClientUtil.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
/* eslint-disable promise/prefer-await-to-callbacks, promise/prefer-await-to-then */
'use strict';

const process = require('node:process');
const { calculateShardId } = require('@discordjs/util');
const { WebSocketShardEvents } = require('@discordjs/ws');
const { DiscordjsError, DiscordjsTypeError, ErrorCodes } = require('../errors/index.js');
Expand Down
1 change: 0 additions & 1 deletion packages/discord.js/src/sharding/ShardingManager.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

const fs = require('node:fs');
const path = require('node:path');
const process = require('node:process');
const { setTimeout: sleep } = require('node:timers/promises');
const { Collection } = require('@discordjs/collection');
const { range } = require('@discordjs/util');
Expand Down
1 change: 0 additions & 1 deletion packages/discord.js/src/structures/MessagePayload.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
'use strict';

const { Buffer } = require('node:buffer');
const { isJSONEncodable, lazy } = require('@discordjs/util');
const { DiscordSnowflake } = require('@sapphire/snowflake');
const { DiscordjsError, DiscordjsRangeError, ErrorCodes } = require('../errors/index.js');
Expand Down
1 change: 0 additions & 1 deletion packages/discord.js/src/util/DataResolver.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
'use strict';

const { Buffer } = require('node:buffer');
const fs = require('node:fs/promises');
const path = require('node:path');
const { lazy } = require('@discordjs/util');
Expand Down
2 changes: 0 additions & 2 deletions packages/discord.js/test/messages.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
'use strict';

const { Buffer } = require('node:buffer');
const { createReadStream } = require('node:fs');
const { readFile } = require('node:fs/promises');
const path = require('node:path');
const process = require('node:process');
const { setTimeout: sleep } = require('node:timers/promises');
const { fetch } = require('undici');
const {
Expand Down
13 changes: 4 additions & 9 deletions packages/discord.js/test/sendtest.js
Original file line number Diff line number Diff line change
@@ -1,15 +1,13 @@
'use strict';

const { Buffer } = require('node:buffer');
const fs = require('node:fs');
const path = require('node:path');
const process = require('node:process');
const { setTimeout: sleep } = require('node:timers/promises');
const util = require('node:util');
const { GatewayIntentBits } = require('discord-api-types/v10');
const { fetch } = require('undici');
const { owner, token } = require('./auth.js');
const { Client, MessageAttachment, Embed, Events } = require('../src/index.js');
const { owner, token } = require('./auth.js');

const client = new Client({ intents: [GatewayIntentBits.Guilds, GatewayIntentBits.GuildMessages] });

Expand Down Expand Up @@ -93,23 +91,20 @@ client.on(Events.MessageCreate, async message => {
if (message.author.id !== owner) return;
const match = message.content.match(/^do (.+)$/);
if (match?.[1] === 'it') {
/* eslint-disable no-await-in-loop */
for (const [i, test] of tests.entries()) {
await message.channel.send(`**#${i}**\n\`\`\`js\n${test.toString()}\`\`\``);
await test(message).catch(e => message.channel.send(`Error!\n\`\`\`\n${e}\`\`\``));
await test(message).catch(error => message.channel.send(`Error!\n\`\`\`\n${error}\`\`\``));
await sleep(1_000);
}
/* eslint-enable no-await-in-loop */
} else if (match) {
const n = parseInt(match[1]) || 0;
const n = Number.parseInt(match[1]) || 0;
const test = tests.slice(n)[0];
const i = tests.indexOf(test);
await message.channel.send(`**#${i}**\n\`\`\`js\n${test.toString()}\`\`\``);
await test(message).catch(e => message.channel.send(`Error!\n\`\`\`\n${e}\`\`\``));
await test(message).catch(error => message.channel.send(`Error!\n\`\`\`\n${error}\`\`\``));
}
});

client.login(token);

// eslint-disable-next-line no-console
process.on('unhandledRejection', console.error);
1 change: 0 additions & 1 deletion packages/discord.js/test/shard.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
'use strict';

const process = require('node:process');
const { setTimeout } = require('node:timers');
const { GatewayIntentBits } = require('discord-api-types/v10');
const { token } = require('./auth.json');
Expand Down
1 change: 0 additions & 1 deletion packages/discord.js/test/sharder.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
'use strict';

const process = require('node:process');
const { token } = require('./auth.js');
const { ShardingManager } = require('../src/index.js');

Expand Down
1 change: 0 additions & 1 deletion packages/discord.js/test/tester1000.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
'use strict';

const process = require('node:process');
const { GatewayIntentBits } = require('discord-api-types/v10');
const { token, prefix, owner } = require('./auth.js');
const { Client, Events, RESTEvents } = require('../src/index.js');
Expand Down
1 change: 0 additions & 1 deletion packages/discord.js/test/tester2000.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
'use strict';

const process = require('node:process');
const { GatewayIntentBits } = require('discord-api-types/v10');
const { token, prefix, owner } = require('./auth.js');
const { Client, Events, Options, RESTEvents, codeBlock } = require('../src/index.js');
Expand Down
1 change: 0 additions & 1 deletion packages/discord.js/test/webhooktest.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
'use strict';

const { Buffer } = require('node:buffer');
const fs = require('node:fs');
const path = require('node:path');
const { setTimeout: sleep } = require('node:timers/promises');
Expand Down
1 change: 0 additions & 1 deletion packages/discord.js/typings/index.d.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import { Buffer } from 'node:buffer';
import { ChildProcess } from 'node:child_process';
import { Stream } from 'node:stream';
import { MessagePort, Worker } from 'node:worker_threads';
Expand Down
Loading