Skip to content

Commit

Permalink
fix lint
Browse files Browse the repository at this point in the history
  • Loading branch information
e-moran committed Aug 19, 2024
1 parent ddbbd0b commit 9917645
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 13 deletions.
8 changes: 4 additions & 4 deletions body/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,15 +23,15 @@ export function getBodySync(
callback: StreamReadCallback,
) {
const decoder = new TextDecoder(opts.encoding);
var buffer = "";
var complete = false;
var sync = true;
let buffer = "";
let complete = false;
let sync = true;

if (typeof stream.readable !== "undefined" && !stream.readable) {
done(new Error("stream is not readable"));
}

var received = 0;
let received = 0;

const limit = opts.limit || 0;
const length = opts.expectedLength || null;
Expand Down
18 changes: 9 additions & 9 deletions body/test/body.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import { AddressInfo } from "net";

describe("reads the body from the readable stream", () => {
test("should read normal body streams", (done) => {
var server = http.createServer((req, res) => {
let server = http.createServer((req, res) => {

Check failure on line 11 in body/test/body.test.ts

View workflow job for this annotation

GitHub Actions / Run tests / Run tests (OS: ubuntu-latest, Node: 18)

'server' is never reassigned. Use 'const' instead

Check failure on line 11 in body/test/body.test.ts

View workflow job for this annotation

GitHub Actions / Run tests / Run tests (OS: ubuntu-latest, Node: 20)

'server' is never reassigned. Use 'const' instead
getBodySync(
req,
{ encoding: "utf-8", limit: 1024 },
Expand All @@ -27,8 +27,8 @@ describe("reads the body from the readable stream", () => {
});

server.listen(function onListen() {
var addr = server.address() as AddressInfo;
var client = http.request({ method: "POST", port: addr.port });
let addr = server.address() as AddressInfo;

Check failure on line 30 in body/test/body.test.ts

View workflow job for this annotation

GitHub Actions / Run tests / Run tests (OS: ubuntu-latest, Node: 18)

'addr' is never reassigned. Use 'const' instead

Check failure on line 30 in body/test/body.test.ts

View workflow job for this annotation

GitHub Actions / Run tests / Run tests (OS: ubuntu-latest, Node: 20)

'addr' is never reassigned. Use 'const' instead
let client = http.request({ method: "POST", port: addr.port });

Check failure on line 31 in body/test/body.test.ts

View workflow job for this annotation

GitHub Actions / Run tests / Run tests (OS: ubuntu-latest, Node: 18)

'client' is never reassigned. Use 'const' instead

Check failure on line 31 in body/test/body.test.ts

View workflow job for this annotation

GitHub Actions / Run tests / Run tests (OS: ubuntu-latest, Node: 20)

'client' is never reassigned. Use 'const' instead

client.end("hello, world!");

Expand All @@ -48,7 +48,7 @@ describe("reads the body from the readable stream", () => {
});

test("should error if the body exceeds the length limit", (done) => {
var server = http.createServer((req, res) => {
let server = http.createServer((req, res) => {

Check failure on line 51 in body/test/body.test.ts

View workflow job for this annotation

GitHub Actions / Run tests / Run tests (OS: ubuntu-latest, Node: 18)

'server' is never reassigned. Use 'const' instead

Check failure on line 51 in body/test/body.test.ts

View workflow job for this annotation

GitHub Actions / Run tests / Run tests (OS: ubuntu-latest, Node: 20)

'server' is never reassigned. Use 'const' instead
getBodySync(
req,
{ encoding: "utf-8", limit: 4 },
Expand All @@ -68,8 +68,8 @@ describe("reads the body from the readable stream", () => {
});

server.listen(function onListen() {
var addr = server.address() as AddressInfo;
var client = http.request({ method: "POST", port: addr.port });
let addr = server.address() as AddressInfo;

Check failure on line 71 in body/test/body.test.ts

View workflow job for this annotation

GitHub Actions / Run tests / Run tests (OS: ubuntu-latest, Node: 18)

'addr' is never reassigned. Use 'const' instead

Check failure on line 71 in body/test/body.test.ts

View workflow job for this annotation

GitHub Actions / Run tests / Run tests (OS: ubuntu-latest, Node: 20)

'addr' is never reassigned. Use 'const' instead
let client = http.request({ method: "POST", port: addr.port });

Check failure on line 72 in body/test/body.test.ts

View workflow job for this annotation

GitHub Actions / Run tests / Run tests (OS: ubuntu-latest, Node: 18)

'client' is never reassigned. Use 'const' instead

Check failure on line 72 in body/test/body.test.ts

View workflow job for this annotation

GitHub Actions / Run tests / Run tests (OS: ubuntu-latest, Node: 20)

'client' is never reassigned. Use 'const' instead

client.end("i am a string");

Expand All @@ -90,7 +90,7 @@ describe("reads the body from the readable stream", () => {
});

test("should error if it isnt the exact length specified", (done) => {
var server = http.createServer((req, res) => {
let server = http.createServer((req, res) => {

Check failure on line 93 in body/test/body.test.ts

View workflow job for this annotation

GitHub Actions / Run tests / Run tests (OS: ubuntu-latest, Node: 18)

'server' is never reassigned. Use 'const' instead

Check failure on line 93 in body/test/body.test.ts

View workflow job for this annotation

GitHub Actions / Run tests / Run tests (OS: ubuntu-latest, Node: 20)

'server' is never reassigned. Use 'const' instead
getBodySync(
req,
{ encoding: "utf-8", limit: 1024, expectedLength: 4 },
Expand All @@ -112,8 +112,8 @@ describe("reads the body from the readable stream", () => {
});

server.listen(function onListen() {
var addr = server.address() as AddressInfo;
var client = http.request({ method: "POST", port: addr.port });
let addr = server.address() as AddressInfo;

Check failure on line 115 in body/test/body.test.ts

View workflow job for this annotation

GitHub Actions / Run tests / Run tests (OS: ubuntu-latest, Node: 18)

'addr' is never reassigned. Use 'const' instead

Check failure on line 115 in body/test/body.test.ts

View workflow job for this annotation

GitHub Actions / Run tests / Run tests (OS: ubuntu-latest, Node: 20)

'addr' is never reassigned. Use 'const' instead
let client = http.request({ method: "POST", port: addr.port });

Check failure on line 116 in body/test/body.test.ts

View workflow job for this annotation

GitHub Actions / Run tests / Run tests (OS: ubuntu-latest, Node: 18)

'client' is never reassigned. Use 'const' instead

Check failure on line 116 in body/test/body.test.ts

View workflow job for this annotation

GitHub Actions / Run tests / Run tests (OS: ubuntu-latest, Node: 20)

'client' is never reassigned. Use 'const' instead

client.end("hello, world!");

Expand Down

0 comments on commit 9917645

Please sign in to comment.