Skip to content

Commit b72cdb2

Browse files
Bump the dev-dependencies group with 2 updates (#448)
* Bump the dev-dependencies group with 2 updates Bumps the dev-dependencies group with 2 updates: [@types/node](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/HEAD/types/node) and [typescript-eslint](https://github.com/typescript-eslint/typescript-eslint/tree/HEAD/packages/typescript-eslint). Updates `@types/node` from 16.18.106 to 16.18.108 - [Release notes](https://github.com/DefinitelyTyped/DefinitelyTyped/releases) - [Commits](https://github.com/DefinitelyTyped/DefinitelyTyped/commits/HEAD/types/node) Updates `typescript-eslint` from 8.0.1 to 8.4.0 - [Release notes](https://github.com/typescript-eslint/typescript-eslint/releases) - [Changelog](https://github.com/typescript-eslint/typescript-eslint/blob/main/packages/typescript-eslint/CHANGELOG.md) - [Commits](https://github.com/typescript-eslint/typescript-eslint/commits/v8.4.0/packages/typescript-eslint) --- updated-dependencies: - dependency-name: "@types/node" dependency-type: direct:development update-type: version-update:semver-patch dependency-group: dev-dependencies - dependency-name: typescript-eslint dependency-type: direct:development update-type: version-update:semver-minor dependency-group: dev-dependencies ... Signed-off-by: dependabot[bot] <[email protected]> * Fix eslint errors --------- Signed-off-by: dependabot[bot] <[email protected]> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Colin Casey <[email protected]>
1 parent 93d550b commit b72cdb2

File tree

9 files changed

+75
-126
lines changed

9 files changed

+75
-126
lines changed

lib/__tests__/cookieJar.spec.ts

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,7 @@ describe('CookieJar', () => {
134134
cookieJar.setCookie('=b', 'http://example.com/index.html', {
135135
loose: false,
136136
}),
137-
).rejects.toThrowError('Cookie failed to parse')
137+
).rejects.toThrow('Cookie failed to parse')
138138
})
139139

140140
it('should not default to loose: true when using map', () => {
@@ -254,7 +254,7 @@ describe('CookieJar', () => {
254254
'a=b; Domain=fooxample.com; Path=/',
255255
'http://example.com/index.html',
256256
),
257-
).rejects.toThrowError(
257+
).rejects.toThrow(
258258
"Cookie not in this host's domain. Cookie:fooxample.com Request:example.com",
259259
)
260260
})
@@ -266,7 +266,7 @@ describe('CookieJar', () => {
266266
'a=b; Domain=www.example.com; Path=/',
267267
'http://example.com/index.html',
268268
),
269-
).rejects.toThrowError(
269+
).rejects.toThrow(
270270
"Cookie not in this host's domain. Cookie:www.example.com Request:example.com",
271271
)
272272
})
@@ -301,7 +301,7 @@ describe('CookieJar', () => {
301301
'http://example.com/index.html',
302302
{ http: false },
303303
),
304-
).rejects.toThrowError("Cookie is HttpOnly and this isn't an HTTP API")
304+
).rejects.toThrow("Cookie is HttpOnly and this isn't an HTTP API")
305305
})
306306

307307
it('should not fail when using an httpOnly cookie when using a non-HTTP API', async () => {
@@ -1069,7 +1069,7 @@ describe('setCookie errors', () => {
10691069
const cookieJar = new CookieJar()
10701070
await expect(
10711071
cookieJar.setCookie('i=9; Domain=kyoto.jp; Path=/', 'http://kyoto.jp'),
1072-
).rejects.toThrowError('Cookie has domain set to a public suffix')
1072+
).rejects.toThrow('Cookie has domain set to a public suffix')
10731073
})
10741074

10751075
it('should throw an error if domains do not match', async () => {
@@ -1079,7 +1079,7 @@ describe('setCookie errors', () => {
10791079
'j=10; Domain=google.com; Path=/',
10801080
'http://google.ca',
10811081
),
1082-
).rejects.toThrowError(
1082+
).rejects.toThrow(
10831083
`Cookie not in this host's domain. Cookie:google.com Request:google.ca`,
10841084
)
10851085
})
@@ -1097,7 +1097,7 @@ describe('setCookie errors', () => {
10971097
'http://example.ca',
10981098
{ http: false },
10991099
),
1100-
).rejects.toThrowError("old Cookie is HttpOnly and this isn't an HTTP API")
1100+
).rejects.toThrow("old Cookie is HttpOnly and this isn't an HTTP API")
11011101

11021102
const cookies = await cookieJar.getCookies('http://example.ca', {
11031103
http: true,
@@ -1149,7 +1149,7 @@ it('should fix issue #132', async () => {
11491149
await expect(
11501150
// @ts-expect-error test case is explicitly testing invalid input
11511151
cookieJar.setCookie({ key: 'x', value: 'y' }, 'http://example.com/'),
1152-
).rejects.toThrowError(
1152+
).rejects.toThrow(
11531153
'First argument to setCookie must be a Cookie object or string',
11541154
)
11551155
})
@@ -1186,9 +1186,9 @@ it('should fix issue #145 - missing 2nd url parameter', async () => {
11861186

11871187
it('should fix issue #197 - CookieJar().setCookie throws an error when empty cookie is passed', async () => {
11881188
const cookieJar = new CookieJar()
1189-
await expect(
1190-
cookieJar.setCookie('', 'https://google.com'),
1191-
).rejects.toThrowError('Cookie failed to parse')
1189+
await expect(cookieJar.setCookie('', 'https://google.com')).rejects.toThrow(
1190+
'Cookie failed to parse',
1191+
)
11921192
})
11931193

11941194
it('should fix issue #282 - Prototype pollution when setting a cookie with the domain __proto__', () => {

lib/__tests__/cookiePrefixes.spec.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,7 @@ describe('When `prefixSecurity` is enabled for `CookieJar`', () => {
132132
insecureUrl,
133133
{},
134134
),
135-
).rejects.toThrowError(
135+
).rejects.toThrow(
136136
'Cookie has __Secure prefix but Secure attribute is not set',
137137
)
138138
})
@@ -161,7 +161,7 @@ describe('When `prefixSecurity` is enabled for `CookieJar`', () => {
161161
secureUrl,
162162
{},
163163
),
164-
).rejects.toThrowError(
164+
).rejects.toThrow(
165165
`Cookie has __Host prefix but either Secure or HostOnly attribute is not set or Path is not '/'`,
166166
)
167167
})

lib/__tests__/jarSerialization.spec.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ describe('cookieJar serialization', () => {
6565
store.synchronous = true
6666

6767
const jar = new CookieJar(store)
68-
expect(() => jar.toJSON()).toThrowError(
68+
expect(() => jar.toJSON()).toThrow(
6969
'getAllCookies is not implemented (therefore jar cannot be serialized)',
7070
)
7171
})
@@ -76,7 +76,7 @@ describe('cookieJar serialization', () => {
7676
const store = new MemoryCookieStore()
7777
store.synchronous = false
7878
const jar = new CookieJar(store)
79-
expect(() => jar.toJSON()).toThrowError(
79+
expect(() => jar.toJSON()).toThrow(
8080
'CookieJar store is not synchronous; use async API instead.',
8181
)
8282
})
@@ -165,7 +165,7 @@ describe('cookieJar serialization', () => {
165165
it('should raise an error when attempting to synchronously clone to an async store', () => {
166166
const newStore = new MemoryCookieStore()
167167
newStore.synchronous = false
168-
expect(() => jar.cloneSync(newStore)).toThrowError(
168+
expect(() => jar.cloneSync(newStore)).toThrow(
169169
'CookieJar clone destination store is not synchronous; use async API instead.',
170170
)
171171
})

lib/__tests__/removeAll.spec.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ describe('store removeAllCookies API', () => {
7979
_removeCookie.call(store, domain, path, key, callback)
8080
})
8181

82-
await expect(jar.removeAllCookies()).rejects.toThrowError(
82+
await expect(jar.removeAllCookies()).rejects.toThrow(
8383
'something happened 1',
8484
)
8585

lib/__tests__/sameSite.spec.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -139,15 +139,15 @@ describe('Same-Site Cookies', function () {
139139
it('should not allow strict cookie to be set', async () => {
140140
await expect(
141141
cookieJar.setCookie(strict, url, { sameSiteContext: 'none' }),
142-
).rejects.toThrowError(
142+
).rejects.toThrow(
143143
'Cookie is SameSite but this is a cross-origin request',
144144
)
145145
})
146146

147147
it('should not allow lax cookie to be set', async () => {
148148
await expect(
149149
cookieJar.setCookie(lax, url, { sameSiteContext: 'none' }),
150-
).rejects.toThrowError(
150+
).rejects.toThrow(
151151
'Cookie is SameSite but this is a cross-origin request',
152152
)
153153
})

lib/cookie/cookie.ts

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ function parseCookiePair(
7676
if (looseMode) {
7777
if (firstEq === 0) {
7878
// '=' is immediately at start
79-
cookiePair = cookiePair.substr(1)
79+
cookiePair = cookiePair.substring(1)
8080
firstEq = cookiePair.indexOf('=') // might still need to split on '='
8181
}
8282
} else {
@@ -284,8 +284,7 @@ function fromJSON(str: unknown): Cookie | undefined {
284284
if (typeof str === 'string') {
285285
try {
286286
obj = JSON.parse(str)
287-
// eslint-disable-next-line @typescript-eslint/no-unused-vars
288-
} catch (e) {
287+
} catch {
289288
return undefined
290289
}
291290
} else {

lib/cookie/cookieJar.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -662,7 +662,7 @@ export class CookieJar {
662662
): Promise<void> {
663663
return this.putCookie(newCookie).then(
664664
() => cb?.(null),
665-
(error: Error) => cb?.(error),
665+
(error: unknown) => cb?.(error as Error),
666666
)
667667
}
668668
}

lib/cookie/domainMatch.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ export function domainMatch(
9898

9999
/* " * The last character of the string that is not included in the
100100
* domain string is a %x2E (".") character." */
101-
if (_str.substr(idx - 1, 1) !== '.') {
101+
if (_str.substring(idx - 1, idx) !== '.') {
102102
return false // doesn't align on "."
103103
}
104104

0 commit comments

Comments
 (0)