Skip to content

Commit fa06e2d

Browse files
committed
Lint, fix ts warnings
1 parent e04e160 commit fa06e2d

4 files changed

Lines changed: 20 additions & 11 deletions

File tree

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ run()
5454

5555
This library can be used in the browser to access an AMQP server over WebSockets. For servers such as RabbitMQ that doesn't (yet?) support WebSockets natively a [WebSocket TCP relay](https://github.com/cloudamqp/websocket-tcp-relay/) have to be used as a proxy. More information can be found [in this blog post](https://www.cloudamqp.com/blog/cloudamqp-releases-amqp-websockets.html).
5656

57-
For web browsers a [compiled](https://www.typescriptlang.org/) and [rolled up](https://www.rollupjs.org/) version is available at https://github.com/cloudamqp/amqp-client.js/releases.
57+
For web browsers a [compiled](https://www.typescriptlang.org/) and [rolled up](https://www.rollupjs.org/) version is available at <https://github.com/cloudamqp/amqp-client.js/releases>.
5858

5959
Using AMQP over WebSockets in a browser:
6060

src/amqp-channel.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -750,7 +750,7 @@ export class AMQPChannel {
750750
this.rpcQueue = this.rpcQueue.then(() => {
751751
// Add the callbacks to the queue before sending
752752
this.rpcCallbacks.push([resolve, reject])
753-
753+
754754
return this.connection.send(new Uint8Array(frame.buffer, 0, frameSize))
755755
.catch((err) => {
756756
// Remove the callbacks from the queue if send fails
@@ -780,11 +780,11 @@ export class AMQPChannel {
780780
this.closed = true
781781
this.consumers.forEach((consumer) => consumer.setClosed(err))
782782
this.consumers.clear()
783-
783+
784784
// Reject all pending RPC callbacks
785785
this.rpcCallbacks.forEach(([, reject]) => reject(err))
786786
this.rpcCallbacks.length = 0
787-
787+
788788
// Reject and clear all unconfirmed publishes
789789
this.unconfirmedPublishes.forEach(([, , reject]) => reject(err))
790790
this.unconfirmedPublishes.length = 0

test-browser/websocket.ts

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ test('can unsubscribe from a queue', async () => {
9595
const conn = await amqp.connect()
9696
const ch = await conn.channel()
9797
const q = await ch.queue("")
98-
const consumer = await q.subscribe({}, () => "")
98+
const consumer = await q.subscribe({}, () => {})
9999
await expect(q.unsubscribe(consumer.tag)).resolves.toBeDefined()
100100
})
101101

@@ -129,7 +129,7 @@ test('will throw an error after consumer timeout', async () => {
129129
const conn = await amqp.connect()
130130
const ch = await conn.channel()
131131
const q = await ch.queue("")
132-
const consumer = await q.subscribe({noAck: false}, () => "")
132+
const consumer = await q.subscribe({noAck: false}, () => {})
133133
await expect(consumer.wait(1)).rejects.toThrow()
134134
})
135135

@@ -138,7 +138,7 @@ test('will throw an error if consumer is closed', async () => {
138138
const conn = await amqp.connect()
139139
const ch = await conn.channel()
140140
const q = await ch.queue("")
141-
const consumer = await q.subscribe({noAck: false}, () => "")
141+
const consumer = await q.subscribe({noAck: false}, () => {})
142142
consumer.setClosed(new Error("testing"))
143143
try {
144144
await consumer.wait(1);
@@ -162,7 +162,7 @@ test('will clear consumer wait timeout on cancel', async () => {
162162
const conn = await amqp.connect()
163163
const ch = await conn.channel()
164164
const q = await ch.queue("")
165-
const consumer = await q.subscribe({noAck: false}, () => "")
165+
const consumer = await q.subscribe({noAck: false}, () => {})
166166
const wait = consumer.wait(5000);
167167
consumer.cancel()
168168
await expect(wait).resolves.toBeUndefined()
@@ -189,7 +189,7 @@ test('consumer stops wait on cancel', async () => {
189189
const conn = await amqp.connect()
190190
const ch = await conn.channel()
191191
const q = await ch.queue()
192-
const consumer = await q.subscribe({}, () => ({}))
192+
const consumer = await q.subscribe({}, () => {})
193193
await q.publish("foobar")
194194
await consumer.cancel()
195195
await expect(consumer.wait()).resolves.toBeUndefined()
@@ -200,7 +200,7 @@ test('consumer stops wait on channel error', async () => {
200200
const conn = await amqp.connect()
201201
const ch = await conn.channel()
202202
const q = await ch.queue()
203-
const consumer = await q.subscribe({}, () => ({}))
203+
const consumer = await q.subscribe({}, () => {})
204204
// acking invalid delivery tag should close channel
205205
setTimeout(() => ch.basicAck(99999), 1)
206206
await expect(consumer.wait()).rejects.toThrow()
@@ -577,7 +577,7 @@ test("can handle cancel from server", async () => {
577577
const conn = await amqp.connect()
578578
const ch = await conn.channel()
579579
const q = await ch.queue("")
580-
const consumer = await q.subscribe({}, () => "")
580+
const consumer = await q.subscribe({}, () => {})
581581
await q.delete()
582582
await expect(consumer.wait()).rejects.toThrow(/Consumer cancelled by the server/)
583583
}, 10_000)

vite-env.d.ts

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
/// <reference types="vite/client" />
2+
3+
interface ImportMetaEnv {
4+
readonly VITE_WS_URL?: string
5+
}
6+
7+
interface ImportMeta {
8+
readonly env: ImportMetaEnv
9+
}

0 commit comments

Comments
 (0)