Skip to content

Commit 579912f

Browse files
authored
chore: finish biome migration (#21)
1 parent d6c2109 commit 579912f

7 files changed

Lines changed: 0 additions & 78 deletions

File tree

.gitignore

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
coverage
44
node_modules
55
*.tsbuildinfo
6-
.eslintcache
76

87
# Artifacts #
98
#############

eslint.config.js

Lines changed: 0 additions & 45 deletions
This file was deleted.

prettier.config.js

Lines changed: 0 additions & 3 deletions
This file was deleted.

src/cli.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
/* eslint-disable no-console */
2-
31
import { mkdir } from "node:fs/promises";
42
import { argv } from "bun";
53
import yargs from "yargs";

src/index.spec.ts

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ const encoder = new TextEncoder();
66
const decoder = new TextDecoder();
77

88
// from https://en.wikipedia.org/wiki/MIME#Multipart_messages
9-
// eslint-disable-next-line spellcheck/spell-checker
109
const example = `MIME-Version: 1.0
1110
Subject: =?iso-8859-1?Q?=A1Hola,_se=F1or!?=
1211
Content-Type: multipart/mixed; boundary=frontier
@@ -39,7 +38,6 @@ Content-Type: multipart/related;
3938
------MultipartBoundary--NYswbLinUCqE8KaJecg8DEV6giqFeyGLtHeT0qLB4h------
4039
`;
4140

42-
// eslint-disable-next-line @typescript-eslint/require-await
4341
async function* stringToStream(
4442
file: string,
4543
): AsyncIterableIterator<Uint8Array> {
@@ -62,7 +60,6 @@ describe("parseMhtml()", () => {
6260
const expectedHeaders = [
6361
{
6462
"MIME-Version": "1.0",
65-
// eslint-disable-next-line spellcheck/spell-checker
6663
Subject: "¡Hola, señor!",
6764
"Content-Type": "multipart/mixed; boundary=frontier",
6865
},
@@ -86,7 +83,6 @@ describe("parseMhtml()", () => {
8683
});
8784

8885
test("other headers", async () => {
89-
// eslint-disable-next-line spellcheck/spell-checker
9086
const content = `MIME-Version: 1.0
9187
From: this is a wrapped: header
9288
with an extra delimiter in: both sections
@@ -125,15 +121,13 @@ This is a message with multiple parts in MIME format.
125121
const headers = files.map(({ headers }) => Object.fromEntries(headers));
126122
const expectedHeaders = [
127123
{
128-
// eslint-disable-next-line spellcheck/spell-checker
129124
"Content-Type": `multipart/related;type="text/html";boundary="----MultipartBoundary--NYswbLinUCqE8KaJecg8DEV6giqFeyGLtHeT0qLB4h----"`,
130125
Date: "Sat, 16 Apr 2022 17:48:31 -0000",
131126
From: "<Saved by Blink>",
132127
"MIME-Version": "1.0",
133128
"Snapshot-Content-Location":
134129
"https://www.newyorker.com/culture/cultural-comment/what-the-twilight-zone-reveals-about-todays-prestige-tv",
135130
Subject:
136-
// eslint-disable-next-line spellcheck/spell-checker
137131
"What “The Twilight Zone” Reveals About Today’s Prestige TV | The New Yorker",
138132
},
139133
];
@@ -144,12 +138,10 @@ This is a message with multiple parts in MIME format.
144138
});
145139

146140
test("fails non-ascii in q-encoding", async () => {
147-
// eslint-disable-next-line spellcheck/spell-checker
148141
const content = `MIME-Version: 1.0
149142
Subject: =?iso-8859-1?Q?=A1Hola,\xffse=F1or!?=
150143
`;
151144
const parser = parseMhtml(stringToStream(content));
152-
// eslint-disable-next-line @typescript-eslint/no-confusing-void-expression,@typescript-eslint/await-thenable
153145
await expect(consume(parser)).rejects.toThrow(
154146
"got non-ascii character when decoding q-quoted word",
155147
);
@@ -237,7 +229,6 @@ This is a message with multiple parts in MIME format.
237229
Subject: =?utf-8?Q?a=ZZb?=
238230
`;
239231
const parser = parseMhtml(stringToStream(content));
240-
// eslint-disable-next-line @typescript-eslint/no-confusing-void-expression,@typescript-eslint/await-thenable
241232
await expect(consume(parser)).rejects.toThrow(
242233
"got invalid hex escape when decoding q-quoted word",
243234
);
@@ -246,7 +237,6 @@ Subject: =?utf-8?Q?a=ZZb?=
246237
test("fails without empty header delimiter", async () => {
247238
const content = `MIME-Version: 1.0`;
248239
const parser = parseMhtml(stringToStream(content));
249-
// eslint-disable-next-line @typescript-eslint/no-confusing-void-expression,@typescript-eslint/await-thenable
250240
await expect(consume(parser)).rejects.toThrow(
251241
"didn't find an empty line to signify the end of header parsing",
252242
);
@@ -258,7 +248,6 @@ invalid header
258248
259249
`;
260250
const parser = parseMhtml(stringToStream(content));
261-
// eslint-disable-next-line @typescript-eslint/no-confusing-void-expression,@typescript-eslint/await-thenable
262251
await expect(consume(parser)).rejects.toThrow(
263252
"header line didn't have key-value delimiter",
264253
);
@@ -269,7 +258,6 @@ invalid header
269258
270259
`;
271260
const parser = parseMhtml(stringToStream(content));
272-
// eslint-disable-next-line @typescript-eslint/no-confusing-void-expression,@typescript-eslint/await-thenable
273261
await expect(consume(parser)).rejects.toThrow(
274262
"first headers didn't contain a content type",
275263
);
@@ -281,7 +269,6 @@ Content-Type: text/plain; boundary=frontier
281269
282270
`;
283271
const parser = parseMhtml(stringToStream(content));
284-
// eslint-disable-next-line @typescript-eslint/no-confusing-void-expression,@typescript-eslint/await-thenable
285272
await expect(consume(parser)).rejects.toThrow(
286273
"first content type header didn't contain",
287274
);
@@ -293,7 +280,6 @@ Content-Type: multipart/mixed
293280
294281
`;
295282
const parser = parseMhtml(stringToStream(content));
296-
// eslint-disable-next-line @typescript-eslint/no-confusing-void-expression,@typescript-eslint/await-thenable
297283
await expect(consume(parser)).rejects.toThrow(
298284
"first content type header didn't contain",
299285
);
@@ -306,7 +292,6 @@ Content-Type: multipart/mixed; boundary=frontier
306292
307293
`;
308294
const parser = parseMhtml(stringToStream(content));
309-
// eslint-disable-next-line @typescript-eslint/no-confusing-void-expression,@typescript-eslint/await-thenable
310295
await expect(consume(parser)).rejects.toThrow(
311296
"unhandled encoding type: unknown",
312297
);
@@ -319,7 +304,6 @@ Content-Type: multipart/mixed; boundary=frontier
319304
This is a message with multiple parts in MIME format.
320305
`;
321306
const parser = parseMhtml(stringToStream(content));
322-
// eslint-disable-next-line @typescript-eslint/no-confusing-void-expression,@typescript-eslint/await-thenable
323307
await expect(consume(parser)).rejects.toThrow(
324308
"stream didn't end with the appropriate termination boundary",
325309
);

src/index.ts

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,6 @@ async function parseHeaders(
8686
let key = "";
8787
let val = "";
8888
for (;;) {
89-
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
9089
const { done, value } = await iter.next();
9190
if (done) {
9291
throw new Error(
@@ -143,7 +142,6 @@ const defaultDecoders = new Map<string, Decoder>([
143142
["binary", decodeBinary],
144143
]);
145144

146-
// eslint-disable-next-line spellcheck/spell-checker
147145
/**
148146
* extract the boundary condition from a multipart header
149147
*
@@ -187,7 +185,6 @@ function getBoundary(headers: MhtmlHeaders): [Uint8Array, Uint8Array] {
187185

188186
/** options for mhtml parsing */
189187
export interface ParseOptions {
190-
// eslint-disable-next-line spellcheck/spell-checker
191188
/**
192189
* custom decoders keyed by (lowercased) Content-Transfer-Encoding
193190
*
@@ -234,7 +231,6 @@ export async function* parseMhtml(
234231
let bound = null;
235232
let cont = true;
236233

237-
// eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
238234
while (cont) {
239235
// parse out headers and get encoding for content
240236
const headers = await parseHeaders(lines);
@@ -255,7 +251,6 @@ export async function* parseMhtml(
255251
[Symbol.asyncIterator]() {
256252
return {
257253
async next(): Promise<IteratorResult<Uint8Array>> {
258-
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
259254
const { done, value } = await lines.next();
260255
if (done) {
261256
throw new Error(

src/utils.spec.ts

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@ import {
1212
const encoder = new TextEncoder();
1313
const decoder = new TextDecoder();
1414

15-
// eslint-disable-next-line @typescript-eslint/require-await
1615
async function* toAsyncIterable<T>(items: Iterable<T>): AsyncIterable<T> {
1716
for (const item of items) {
1817
yield item;
@@ -148,7 +147,6 @@ test("collect()", async () => {
148147

149148
describe("decodeQuotedPrintable()", () => {
150149
test("success", async () => {
151-
// eslint-disable-next-line spellcheck/spell-checker
152150
const input = ["key=3Dvalue", "this line continues =", "on the next line"];
153151
const res = decoder.decode(
154152
await collect(
@@ -163,7 +161,6 @@ describe("decodeQuotedPrintable()", () => {
163161
});
164162

165163
test("normalizes to a custom separator when given one", async () => {
166-
// eslint-disable-next-line spellcheck/spell-checker
167164
const input = ["key=3Dvalue", "this line continues =", "on the next line"];
168165
const res = decoder.decode(
169166
await collect(
@@ -183,7 +180,6 @@ describe("decodeQuotedPrintable()", () => {
183180
const decoded = decodeQuotedPrintable(
184181
toAsyncIterable(input.map((l) => encoder.encode(l))),
185182
);
186-
// eslint-disable-next-line @typescript-eslint/no-confusing-void-expression,@typescript-eslint/await-thenable
187183
await expect(
188184
(async () => {
189185
for await (const _ of decoded) {
@@ -198,7 +194,6 @@ describe("decodeQuotedPrintable()", () => {
198194
const decoded = decodeQuotedPrintable(
199195
toAsyncIterable(input.map((l) => encoder.encode(l))),
200196
);
201-
// eslint-disable-next-line @typescript-eslint/no-confusing-void-expression,@typescript-eslint/await-thenable
202197
await expect(
203198
(async () => {
204199
for await (const _ of decoded) {
@@ -213,7 +208,6 @@ describe("decodeQuotedPrintable()", () => {
213208
const decoded = decodeQuotedPrintable(
214209
toAsyncIterable(input.map((l) => encoder.encode(l))),
215210
);
216-
// eslint-disable-next-line @typescript-eslint/no-confusing-void-expression,@typescript-eslint/await-thenable
217211
await expect(
218212
(async () => {
219213
for await (const _ of decoded) {

0 commit comments

Comments
 (0)