Skip to content

Commit

Permalink
update to Deno 1.42 lint
Browse files Browse the repository at this point in the history
  • Loading branch information
seriousme committed Apr 13, 2024
1 parent 4f7d92b commit 77ebf79
Show file tree
Hide file tree
Showing 53 changed files with 130 additions and 130 deletions.
2 changes: 1 addition & 1 deletion bin/conformanceServer.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// this server is intended to be used with https://github.com/eclipse/iottestware

import { AuthenticationResult, Context, Topic } from "../server/mod.ts";
import { AuthenticationResult, type Context, type Topic } from "../server/mod.ts";
import { logger, LogLevel } from "../utils/mod.ts";
import { getArgs, parseArgs } from "../utils/mod.ts";
import { TcpServer } from "../deno/server.ts";
Expand Down
2 changes: 1 addition & 1 deletion bin/demoServer.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { AuthenticationResult, Context, Topic } from "../server/mod.ts";
import { AuthenticationResult, type Context, type Topic } from "../server/mod.ts";
import { logger, LogLevel } from "../utils/mod.ts";
import { getArgs, parseArgs } from "../utils/mod.ts";
import { TcpServer } from "../deno/server.ts";
Expand Down
10 changes: 5 additions & 5 deletions client/client.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
import {
AuthenticationResult,
ConnectPacket,
type AuthenticationResult,
type ConnectPacket,
Deferred,
logger,
MemoryStore,
PacketType,
PublishPacket,
SockConn,
SubscribePacket,
type PublishPacket,
type SockConn,
type SubscribePacket,
} from "./deps.ts";

import { Context } from "./context.ts";
Expand Down
20 changes: 10 additions & 10 deletions client/context.ts
Original file line number Diff line number Diff line change
@@ -1,20 +1,20 @@
import {
AnyPacket,
type AnyPacket,
AsyncQueue,
AuthenticationResult,
ConnectPacket,
type AuthenticationResult,
type ConnectPacket,
Deferred,
logger,
MemoryStore,
type MemoryStore,
MqttConn,
PacketId,
type PacketId,
PacketType,
PublishPacket,
ReturnCodes,
SockConn,
SubscribePacket,
type PublishPacket,
type ReturnCodes,
type SockConn,
type SubscribePacket,
Timer,
UnsubscribePacket,
type UnsubscribePacket,
} from "./deps.ts";

import { handlePacket } from "./handlers/handlePacket.ts";
Expand Down
4 changes: 2 additions & 2 deletions client/handlers/handleConnack.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { ConnectionState, Context } from "../context.ts";
import { AuthenticationResult, ConnackPacket } from "../deps.ts";
import { ConnectionState, type Context } from "../context.ts";
import { AuthenticationResult, type ConnackPacket } from "../deps.ts";

export async function handleConnack(packet: ConnackPacket, ctx: Context) {
if (packet.returnCode === 0) {
Expand Down
4 changes: 2 additions & 2 deletions client/handlers/handlePacket.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { ConnectionState, Context } from "../context.ts";
import { AnyPacket, PacketType } from "../deps.ts";
import { ConnectionState, type Context } from "../context.ts";
import { type AnyPacket, PacketType } from "../deps.ts";
import { handleConnack } from "./handleConnack.ts";
import { handlePublish } from "./handlePublish.ts";
import { handlePuback } from "./handlePuback.ts";
Expand Down
4 changes: 2 additions & 2 deletions client/handlers/handlePuback.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Context } from "../context.ts";
import { PubackPacket } from "../deps.ts";
import type { Context } from "../context.ts";
import type { PubackPacket } from "../deps.ts";

// A PUBACK Packet is the response to a PUBLISH Packet with QoS level 1.

Expand Down
4 changes: 2 additions & 2 deletions client/handlers/handlePubcomp.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Context } from "../context.ts";
import { PubcompPacket } from "../deps.ts";
import type { Context } from "../context.ts";
import type { PubcompPacket } from "../deps.ts";

// The PUBCOMP Packet is the response to a PUBREL Packet.
// It is the fourth and final packet of the QoS 2 protocol exchange.
Expand Down
4 changes: 2 additions & 2 deletions client/handlers/handlePublish.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Context } from "../context.ts";
import { PacketType, PublishPacket } from "../deps.ts";
import type { Context } from "../context.ts";
import { PacketType, type PublishPacket } from "../deps.ts";

// Incoming publish

Expand Down
4 changes: 2 additions & 2 deletions client/handlers/handlePubrec.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Context } from "../context.ts";
import { PacketType, PubrecPacket, PubrelPacket } from "../deps.ts";
import type { Context } from "../context.ts";
import { PacketType, type PubrecPacket, type PubrelPacket } from "../deps.ts";

// A PUBREC Packet is the response to a PUBLISH Packet with QoS 2.
// It is the second packet of the QoS 2 protocol exchange.
Expand Down
4 changes: 2 additions & 2 deletions client/handlers/handlePubrel.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Context } from "../context.ts";
import { PacketType, PubrelPacket } from "../deps.ts";
import type { Context } from "../context.ts";
import { PacketType, type PubrelPacket } from "../deps.ts";

// A PUBREL Packet is the response to a PUBREC Packet.
// It is the third packet of the QoS 2 protocol exchange.
Expand Down
4 changes: 2 additions & 2 deletions client/handlers/handleSuback.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Context } from "../context.ts";
import { SubackPacket } from "../deps.ts";
import type { Context } from "../context.ts";
import type { SubackPacket } from "../deps.ts";

// A SUBACK Packet is sent by the Server to the Client to confirm receipt
// and processing of a SUBSCRIBE Packet.
Expand Down
4 changes: 2 additions & 2 deletions client/handlers/handleUnsuback.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Context } from "../context.ts";
import { UnsubackPacket } from "../deps.ts";
import type { Context } from "../context.ts";
import type { UnsubackPacket } from "../deps.ts";

// The UNSUBACK Packet is sent by the Server to the Client to confirm receipt
// of an UNSUBSCRIBE Packet.
Expand Down
12 changes: 6 additions & 6 deletions client/store/memoryStore.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
import { assert, PacketId } from "./deps.ts";
import { assert, type PacketId } from "./deps.ts";

import {
IStore,
maxPacketId,
PacketStore,
PendingAckOutgoing,
pendingIncoming,
PendingOutgoing,
PendingOutgoingPackets,
type PacketStore,
type PendingAckOutgoing,
type pendingIncoming,
type PendingOutgoing,
type PendingOutgoingPackets,
} from "./store.ts";

export class MemoryStore implements IStore {
Expand Down
2 changes: 1 addition & 1 deletion client/store/store.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import {
import type {
PacketId,
PublishPacket,
PubrelPacket,
Expand Down
2 changes: 1 addition & 1 deletion deno/server.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { MqttServer, MqttServerOptions } from "../server/mod.ts";
import { MqttServer, type MqttServerOptions } from "../server/mod.ts";

export class TcpServer {
private listener: Deno.Listener<Deno.Conn>;
Expand Down
2 changes: 1 addition & 1 deletion dev_utils/dummyConn.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { AsyncQueue } from "../utils/mod.ts";
import type { AsyncQueue } from "../utils/mod.ts";
import { SockConn } from "../socket/socket.ts";

class Uint8Writer implements WritableStreamDefaultWriter {
Expand Down
2 changes: 1 addition & 1 deletion mqttConn/mqttConn.test.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { MqttConn, MqttConnError } from "./mqttConn.ts";
import { assertEquals, DummyConn } from "../dev_utils/mod.ts";
import { AnyPacket, encode, PacketType } from "../mqttPacket/mod.ts";
import { type AnyPacket, encode, PacketType } from "../mqttPacket/mod.ts";

const connectPacket: AnyPacket = {
type: PacketType.connect,
Expand Down
6 changes: 3 additions & 3 deletions mqttConn/mqttConn.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
import {
AnyPacket,
type AnyPacket,
decodePayload,
encode,
getLengthDecoder,
LengthDecoderResult,
type LengthDecoderResult,
} from "../mqttPacket/mod.ts";

import { assert } from "../utils/mod.ts";
import { SockConn } from "../socket/socket.ts";
import type { SockConn } from "../socket/socket.ts";

export enum MqttConnError {
invalidPacket = "Invalid Packet",
Expand Down
2 changes: 1 addition & 1 deletion mqttPacket/connect.test.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { PacketType } from "./types.ts";
import { assertEquals, assertThrows } from "../dev_utils/mod.ts";
import { ConnectPacket, decode, encode } from "./mod.ts";
import { type ConnectPacket, decode, encode } from "./mod.ts";

Deno.test("encode Connect with ClientId", () => {
assertEquals(
Expand Down
2 changes: 1 addition & 1 deletion mqttPacket/connect.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { BitMask, ClientId, PacketType, Payload, QoS, Topic } from "./types.ts";
import { BitMask, type ClientId, PacketType, type Payload, type QoS, type Topic } from "./types.ts";
import { Encoder } from "./encoder.ts";
import {
booleanFlag,
Expand Down
2 changes: 1 addition & 1 deletion mqttPacket/decoder.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { BitMask, Topic, TopicFilter } from "./types.ts";
import type { BitMask, Topic, TopicFilter } from "./types.ts";
import { invalidTopic, invalidTopicFilter } from "./validators.ts";

const utf8Decoder = new TextDecoder("utf-8");
Expand Down
2 changes: 1 addition & 1 deletion mqttPacket/encoder.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
const utf8Encoder = new TextEncoder();
import { Topic, TopicFilter } from "./types.ts";
import type { Topic, TopicFilter } from "./types.ts";
import { invalidTopic, invalidTopicFilter } from "./validators.ts";

export class EncoderError extends Error {
Expand Down
44 changes: 22 additions & 22 deletions mqttPacket/mod.ts
Original file line number Diff line number Diff line change
@@ -1,30 +1,30 @@
import {
ClientId,
Dup,
PacketId,
type ClientId,
type Dup,
type PacketId,
PacketType,
Payload,
QoS,
ReturnCodes,
Topic,
TopicFilter,
type Payload,
type QoS,
type ReturnCodes,
type Topic,
type TopicFilter,
} from "./types.ts";
import { invalidTopic, invalidTopicFilter, invalidUTF8 } from "./validators.ts";
import { decodeLength, encodeLength } from "./length.ts";
import connect, { ConnectPacket } from "./connect.ts";
import connack, { AuthenticationResult, ConnackPacket } from "./connack.ts";
import publish, { PublishPacket } from "./publish.ts";
import puback, { PubackPacket } from "./puback.ts";
import pubrec, { PubrecPacket } from "./pubrec.ts";
import pubrel, { PubrelPacket } from "./pubrel.ts";
import pubcomp, { PubcompPacket } from "./pubcomp.ts";
import subscribe, { SubscribePacket } from "./subscribe.ts";
import suback, { SubackPacket } from "./suback.ts";
import unsubscribe, { UnsubscribePacket } from "./unsubscribe.ts";
import unsuback, { UnsubackPacket } from "./unsuback.ts";
import pingreq, { PingreqPacket } from "./pingreq.ts";
import pingres, { PingresPacket } from "./pingres.ts";
import disconnect, { DisconnectPacket } from "./disconnect.ts";
import connect, { type ConnectPacket } from "./connect.ts";
import connack, { AuthenticationResult, type ConnackPacket } from "./connack.ts";
import publish, { type PublishPacket } from "./publish.ts";
import puback, { type PubackPacket } from "./puback.ts";
import pubrec, { type PubrecPacket } from "./pubrec.ts";
import pubrel, { type PubrelPacket } from "./pubrel.ts";
import pubcomp, { type PubcompPacket } from "./pubcomp.ts";
import subscribe, { type SubscribePacket } from "./subscribe.ts";
import suback, { type SubackPacket } from "./suback.ts";
import unsubscribe, { type UnsubscribePacket } from "./unsubscribe.ts";
import unsuback, { type UnsubackPacket } from "./unsuback.ts";
import pingreq, { type PingreqPacket } from "./pingreq.ts";
import pingres, { type PingresPacket } from "./pingres.ts";
import disconnect, { type DisconnectPacket } from "./disconnect.ts";
import { DecoderError } from "./decoder.ts";

export type AnyPacket =
Expand Down
2 changes: 1 addition & 1 deletion mqttPacket/puback.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { PacketId, PacketType } from "./types.ts";
import { type PacketId, PacketType } from "./types.ts";
import { Decoder } from "./decoder.ts";
import { Encoder } from "./encoder.ts";

Expand Down
2 changes: 1 addition & 1 deletion mqttPacket/pubcomp.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { PacketId, PacketType } from "./types.ts";
import { type PacketId, PacketType } from "./types.ts";
import { Decoder } from "./decoder.ts";
import { Encoder } from "./encoder.ts";

Expand Down
2 changes: 1 addition & 1 deletion mqttPacket/publish.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { BitMask, PacketType, Payload, QoS, Topic } from "./types.ts";
import { BitMask, PacketType, type Payload, type QoS, type Topic } from "./types.ts";
import { Encoder, EncoderError } from "./encoder.ts";
import { booleanFlag, Decoder, DecoderError } from "./decoder.ts";

Expand Down
2 changes: 1 addition & 1 deletion mqttPacket/pubrec.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { PacketId, PacketType } from "./types.ts";
import { type PacketId, PacketType } from "./types.ts";
import { Decoder } from "./decoder.ts";
import { Encoder } from "./encoder.ts";

Expand Down
2 changes: 1 addition & 1 deletion mqttPacket/pubrel.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { PacketId, PacketType } from "./types.ts";
import { type PacketId, PacketType } from "./types.ts";
import { Decoder } from "./decoder.ts";
import { Encoder } from "./encoder.ts";

Expand Down
2 changes: 1 addition & 1 deletion mqttPacket/suback.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { PacketId, PacketType, ReturnCodes } from "./types.ts";
import { type PacketId, PacketType, type ReturnCodes } from "./types.ts";
import { Encoder } from "./encoder.ts";
import { Decoder } from "./decoder.ts";

Expand Down
2 changes: 1 addition & 1 deletion mqttPacket/subscribe.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { BitMask, PacketId, PacketType, QoS, TopicFilter } from "./types.ts";
import { BitMask, type PacketId, PacketType, type QoS, type TopicFilter } from "./types.ts";
import { Encoder } from "./encoder.ts";
import { booleanFlag, Decoder, DecoderError } from "./decoder.ts";

Expand Down
2 changes: 1 addition & 1 deletion mqttPacket/unsuback.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { PacketId, PacketType } from "./types.ts";
import { type PacketId, PacketType } from "./types.ts";
import { Decoder } from "./decoder.ts";
import { Encoder } from "./encoder.ts";

Expand Down
2 changes: 1 addition & 1 deletion mqttPacket/unsubscribe.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { BitMask, PacketId, PacketType, Topic, TopicFilter } from "./types.ts";
import { BitMask, type PacketId, PacketType, type Topic, type TopicFilter } from "./types.ts";
import { Encoder } from "./encoder.ts";
import { booleanFlag, Decoder, DecoderError } from "./decoder.ts";

Expand Down
2 changes: 1 addition & 1 deletion mqttPacket/validators.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Topic, TopicFilter } from "./types.ts";
import type { Topic, TopicFilter } from "./types.ts";

// deno-lint-ignore no-control-regex
const invalidUTF8regEx = new RegExp(/\x00|\uFFFD/);
Expand Down
2 changes: 1 addition & 1 deletion persistence/memory/memoryPersistence.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import {
MemoryStore as Store,
} from "./memoryPersistence.ts";

import { PacketType, PublishPacket } from "../deps.ts";
import { PacketType, type PublishPacket } from "../deps.ts";
import { assertEquals } from "../../dev_utils/mod.ts";

const payloadAny = new TextEncoder().encode("any");
Expand Down
16 changes: 8 additions & 8 deletions persistence/memory/memoryPersistence.ts
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
import {
ClientId,
PacketId,
PublishPacket,
QoS,
Topic,
TopicFilter,
type ClientId,
type PacketId,
type PublishPacket,
type QoS,
type Topic,
type TopicFilter,
Trie,
} from "../deps.ts";

import { Client, Handler, IPersistence, RetainStore } from "../persistence.ts";
import { IStore, PacketStore, SubscriptionStore } from "../store.ts";
import { type Client, type Handler, IPersistence, type RetainStore } from "../persistence.ts";
import { IStore, type PacketStore, type SubscriptionStore } from "../store.ts";
import { assert } from "../../utils/mod.ts";

const maxPacketId = 0xffff;
Expand Down
4 changes: 2 additions & 2 deletions persistence/persistence.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { ClientId, PublishPacket, QoS, Topic } from "./deps.ts";
import { IStore } from "./store.ts";
import type { ClientId, PublishPacket, QoS, Topic } from "./deps.ts";
import type { IStore } from "./store.ts";

export type Handler = (packet: PublishPacket) => void;

Expand Down
2 changes: 1 addition & 1 deletion persistence/store.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { ClientId, PacketId, PublishPacket, QoS, Topic } from "./deps.ts";
import type { ClientId, PacketId, PublishPacket, QoS, Topic } from "./deps.ts";

export type PacketStore = Map<PacketId, PublishPacket>;

Expand Down
Loading

0 comments on commit 77ebf79

Please sign in to comment.