add eslint plugin unicorn
This commit is contained in:
@@ -20,9 +20,9 @@ export class ReacordContainer {
|
||||
}
|
||||
|
||||
clear() {
|
||||
this.instances.forEach((instance) => {
|
||||
for (const instance of this.instances) {
|
||||
instance.destroy()
|
||||
})
|
||||
}
|
||||
this.instances.clear()
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
// eslint-disable-next-line import/no-unused-modules
|
||||
export type Deferred<T> = PromiseLike<T> & {
|
||||
resolve: (value: T | PromiseLike<T>) => void
|
||||
reject: (reason?: unknown) => void
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
/* eslint-disable unicorn/no-null */
|
||||
import ReactReconciler from "react-reconciler"
|
||||
import type { ReacordContainer } from "./container.js"
|
||||
import { ReacordInstance } from "./instance.js"
|
||||
@@ -30,7 +31,7 @@ export const reconciler = ReactReconciler<
|
||||
|
||||
createInstance: (
|
||||
type,
|
||||
props,
|
||||
properties,
|
||||
rootContainerInstance,
|
||||
hostContext,
|
||||
internalInstanceHandle,
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
import test from "ava"
|
||||
import { Client, TextChannel } from "discord.js"
|
||||
import { nanoid } from "nanoid"
|
||||
import { testBotToken, testChannelId } from "../test/env.js"
|
||||
import { raise } from "./helpers/raise.js"
|
||||
import { waitForWithTimeout } from "./helpers/wait-for-with-timeout.js"
|
||||
import { render } from "./render.js"
|
||||
import { testBotToken, testChannelId } from "./test-environment.js"
|
||||
|
||||
const client = new Client({
|
||||
intents: ["GUILDS"],
|
||||
@@ -21,7 +21,7 @@ test.before(async () => {
|
||||
raise("Channel not found")
|
||||
|
||||
if (!(result instanceof TextChannel)) {
|
||||
throw new Error("Channel must be a text channel")
|
||||
throw new TypeError("Channel must be a text channel")
|
||||
}
|
||||
|
||||
channel = result
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
/* eslint-disable unicorn/no-null */
|
||||
import type { TextBasedChannels } from "discord.js"
|
||||
import { ReacordContainer } from "./container"
|
||||
import { reconciler } from "./reconciler"
|
||||
|
||||
10
src/test-environment.ts
Normal file
10
src/test-environment.ts
Normal file
@@ -0,0 +1,10 @@
|
||||
import "dotenv/config.js"
|
||||
import { raise } from "./helpers/raise.js"
|
||||
|
||||
function getEnvironmentValue(name: string) {
|
||||
return process.env[name] ?? raise(`Missing environment variable: ${name}`)
|
||||
}
|
||||
|
||||
export const testBotToken = getEnvironmentValue("TEST_BOT_TOKEN")
|
||||
// export const testGuildId = getEnvironmentValue("TEST_GUILD_ID")
|
||||
export const testChannelId = getEnvironmentValue("TEST_CHANNEL_ID")
|
||||
Reference in New Issue
Block a user