mirror of
https://github.com/discordjs/discord.js.git
synced 2026-03-18 20:43:30 +01:00
chore: fix leftover eslint exceptions
This commit is contained in:
@@ -1,6 +1,4 @@
|
||||
/* eslint-disable @typescript-eslint/unbound-method */
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-member-access */
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-assignment */
|
||||
/* eslint-disable @typescript-eslint/dot-notation */
|
||||
import { Buffer } from 'node:buffer';
|
||||
import { once } from 'node:events';
|
||||
@@ -8,7 +6,7 @@ import process from 'node:process';
|
||||
import { Readable } from 'node:stream';
|
||||
import { addAudioPlayer, deleteAudioPlayer } from '../src/DataStore';
|
||||
import { VoiceConnection, VoiceConnectionStatus } from '../src/VoiceConnection';
|
||||
import { createAudioPlayer, AudioPlayerStatus, SILENCE_FRAME, type AudioPlayerState } from '../src/audio/AudioPlayer';
|
||||
import { createAudioPlayer, AudioPlayerStatus, SILENCE_FRAME } from '../src/audio/AudioPlayer';
|
||||
import { AudioPlayerError } from '../src/audio/AudioPlayerError';
|
||||
import { AudioResource } from '../src/audio/AudioResource';
|
||||
import { NoSubscriberBehavior } from '../src/index';
|
||||
@@ -23,7 +21,6 @@ const AudioPlayerErrorMock = AudioPlayerError as unknown as jest.Mock<typeof Aud
|
||||
const VoiceConnectionMock = VoiceConnection as unknown as jest.Mock<VoiceConnection>;
|
||||
|
||||
function* silence() {
|
||||
// eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
|
||||
while (true) {
|
||||
yield Buffer.from([0xf8, 0xff, 0xfe]);
|
||||
}
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-return */
|
||||
import { Buffer } from 'node:buffer';
|
||||
import process from 'node:process';
|
||||
import { PassThrough, Readable } from 'node:stream';
|
||||
@@ -26,7 +25,7 @@ async function started(resource: AudioResource) {
|
||||
const findPipeline = _findPipeline as unknown as jest.MockedFunction<typeof _findPipeline>;
|
||||
|
||||
beforeAll(() => {
|
||||
// @ts-expect-error no type
|
||||
// @ts-expect-error: No type
|
||||
findPipeline.mockImplementation((from: StreamType, constraint: (path: Edge[]) => boolean) => {
|
||||
const base = [
|
||||
{
|
||||
@@ -38,7 +37,6 @@ beforeAll(() => {
|
||||
if (constraint === VOLUME_CONSTRAINT) {
|
||||
base.push({
|
||||
cost: 1,
|
||||
// eslint-disable-next-line @typescript-eslint/no-unsafe-argument
|
||||
transformer: () => new VolumeTransformer({} as any),
|
||||
type: TransformerType.InlineVolume,
|
||||
});
|
||||
@@ -98,7 +96,6 @@ describe('createAudioResource', () => {
|
||||
});
|
||||
|
||||
test('Infers from VolumeTransformer', () => {
|
||||
// eslint-disable-next-line @typescript-eslint/no-unsafe-argument
|
||||
const stream = new VolumeTransformer({} as any);
|
||||
const resource = createAudioResource(stream, { inlineVolume: true });
|
||||
expect(findPipeline).toHaveBeenCalledWith(StreamType.Raw, NO_CONSTRAINT);
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-return */
|
||||
/* eslint-disable @typescript-eslint/dot-notation */
|
||||
import { GatewayOpcodes } from 'discord-api-types/v10';
|
||||
import * as DataStore from '../src/DataStore';
|
||||
|
||||
@@ -1,6 +1,4 @@
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-assignment */
|
||||
import type EventEmitter from 'node:events';
|
||||
import { once } from 'node:events';
|
||||
import { type EventEmitter, once } from 'node:events';
|
||||
import process from 'node:process';
|
||||
import { SSRCMap, type VoiceUserData } from '../src/receive/SSRCMap';
|
||||
|
||||
|
||||
@@ -1,10 +1,6 @@
|
||||
/* eslint-disable @typescript-eslint/unbound-method */
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-assignment */
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-return */
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-member-access */
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-argument */
|
||||
/* eslint-disable @typescript-eslint/dot-notation */
|
||||
import EventEmitter from 'node:events';
|
||||
import { EventEmitter } from 'node:events';
|
||||
import * as _DataStore from '../src/DataStore';
|
||||
import {
|
||||
createVoiceConnection,
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
/* eslint-disable id-length */
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-assignment */
|
||||
/* eslint-disable @typescript-eslint/dot-notation */
|
||||
import { Buffer } from 'node:buffer';
|
||||
import { once } from 'node:events';
|
||||
@@ -39,7 +38,6 @@ describe('VoiceReceiver', () => {
|
||||
let receiver: VoiceReceiver;
|
||||
|
||||
beforeEach(() => {
|
||||
// eslint-disable-next-line @typescript-eslint/no-unsafe-argument
|
||||
voiceConnection = new VoiceConnection({} as any, {} as any);
|
||||
voiceConnection.state = {
|
||||
status: VoiceConnectionStatus.Signalling,
|
||||
|
||||
@@ -1,9 +1,6 @@
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-return */
|
||||
/* eslint-disable @typescript-eslint/no-empty-function */
|
||||
/* eslint-disable @typescript-eslint/no-unused-vars */
|
||||
import { Buffer } from 'node:buffer';
|
||||
import { createSocket as _createSocket } from 'node:dgram';
|
||||
import EventEmitter, { once } from 'node:events';
|
||||
import { EventEmitter } from 'node:events';
|
||||
import { VoiceUDPSocket } from '../src/networking/VoiceUDPSocket';
|
||||
|
||||
jest.mock('node:dgram');
|
||||
|
||||
@@ -1,5 +1,3 @@
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-member-access */
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-assignment */
|
||||
import { type EventEmitter, once } from 'node:events';
|
||||
import { VoiceOpcodes } from 'discord-api-types/voice/v4';
|
||||
import WS from 'jest-websocket-mock';
|
||||
@@ -115,7 +113,6 @@ describe.skip('VoiceWebSocket: heartbeating', () => {
|
||||
const endpoint = 'ws://localhost:1234';
|
||||
const server = new WS(endpoint, { jsonProtocol: true });
|
||||
const ws = new VoiceWebSocket(endpoint, false);
|
||||
// eslint-disable-next-line @typescript-eslint/no-empty-function
|
||||
ws.on('error', () => {});
|
||||
await server.connected;
|
||||
const rcv = onceIgnoreError(ws, 'close');
|
||||
|
||||
@@ -1,6 +1,3 @@
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-call */
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-member-access */
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-assignment */
|
||||
import { Buffer } from 'node:buffer';
|
||||
import EventEmitter, { once } from 'node:events';
|
||||
import process from 'node:process';
|
||||
@@ -27,8 +24,7 @@ async function* gen(num: number) {
|
||||
}
|
||||
|
||||
function range(num: number) {
|
||||
// eslint-disable-next-line unicorn/no-new-array
|
||||
return Buffer.from(Array.from(new Array(num).keys()));
|
||||
return Buffer.from(Array.from(Array.from({ length: num }).keys()));
|
||||
}
|
||||
|
||||
const validHead = Buffer.from([
|
||||
@@ -80,7 +76,6 @@ describe('demuxProbe', () => {
|
||||
|
||||
test('Detects WebM', async () => {
|
||||
const stream = Readable.from(gen(10), { objectMode: false });
|
||||
// eslint-disable-next-line @typescript-eslint/no-unsafe-argument
|
||||
webmWrite.mockImplementation(function mock(data: Buffer) {
|
||||
if (data[0] === 5) this.emit('head', validHead);
|
||||
} as any);
|
||||
@@ -91,7 +86,6 @@ describe('demuxProbe', () => {
|
||||
|
||||
test('Detects Ogg', async () => {
|
||||
const stream = Readable.from(gen(10), { objectMode: false });
|
||||
// eslint-disable-next-line @typescript-eslint/no-unsafe-argument
|
||||
oggWrite.mockImplementation(function mock(data: Buffer) {
|
||||
if (data[0] === 5) this.emit('head', validHead);
|
||||
} as any);
|
||||
@@ -102,7 +96,6 @@ describe('demuxProbe', () => {
|
||||
|
||||
test('Rejects invalid OpusHead', async () => {
|
||||
const stream = Readable.from(gen(10), { objectMode: false });
|
||||
// eslint-disable-next-line @typescript-eslint/no-unsafe-argument
|
||||
oggWrite.mockImplementation(function mock(data: Buffer) {
|
||||
if (data[0] === 5) this.emit('head', invalidHead);
|
||||
} as any);
|
||||
|
||||
@@ -1,6 +1,4 @@
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-member-access */
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-assignment */
|
||||
import EventEmitter from 'node:events';
|
||||
import { EventEmitter } from 'node:events';
|
||||
import process from 'node:process';
|
||||
import { VoiceConnectionStatus, type VoiceConnection } from '../src/VoiceConnection';
|
||||
import { entersState } from '../src/util/entersState';
|
||||
@@ -19,7 +17,6 @@ describe('entersState', () => {
|
||||
test('Returns the target once the state has been entered before timeout', async () => {
|
||||
jest.useRealTimers();
|
||||
const vc = createFakeVoiceConnection();
|
||||
// eslint-disable-next-line @typescript-eslint/no-unsafe-argument
|
||||
process.nextTick(() => vc.emit(VoiceConnectionStatus.Ready, null as any, null as any));
|
||||
const result = await entersState(vc, VoiceConnectionStatus.Ready, 1_000);
|
||||
expect(result).toEqual(vc);
|
||||
@@ -36,7 +33,6 @@ describe('entersState', () => {
|
||||
jest.useRealTimers();
|
||||
const vc = createFakeVoiceConnection();
|
||||
const ac = new AbortController();
|
||||
// eslint-disable-next-line @typescript-eslint/no-unsafe-argument
|
||||
process.nextTick(() => vc.emit(VoiceConnectionStatus.Ready, null as any, null as any));
|
||||
const result = await entersState(vc, VoiceConnectionStatus.Ready, ac.signal);
|
||||
expect(result).toEqual(vc);
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-return */
|
||||
import * as VoiceConnection from '../src/VoiceConnection';
|
||||
import { joinVoiceChannel } from '../src/joinVoiceChannel';
|
||||
|
||||
|
||||
Reference in New Issue
Block a user