Skip to content

Commit 7502677

Browse files
committed
Fix linter.
1 parent 0f5bb31 commit 7502677

File tree

1 file changed

+18
-18
lines changed

1 file changed

+18
-18
lines changed

packages/remix/src/utils/getIpAddress.ts

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -30,29 +30,29 @@ import { isIP } from 'net';
3030
export function getClientIPAddress(headers: Headers): string | null {
3131
// The headers to check, in priority order
3232
const headerNames = [
33-
"X-Client-IP",
34-
"X-Forwarded-For",
35-
"Fly-Client-IP",
36-
"CF-Connecting-IP",
37-
"Fastly-Client-Ip",
38-
"True-Client-Ip",
39-
"X-Real-IP",
40-
"X-Cluster-Client-IP",
41-
"X-Forwarded",
42-
"Forwarded-For",
43-
"Forwarded",
33+
'X-Client-IP',
34+
'X-Forwarded-For',
35+
'Fly-Client-IP',
36+
'CF-Connecting-IP',
37+
'Fastly-Client-Ip',
38+
'True-Client-Ip',
39+
'X-Real-IP',
40+
'X-Cluster-Client-IP',
41+
'X-Forwarded',
42+
'Forwarded-For',
43+
'Forwarded',
4444
];
4545

4646
// This will end up being Array<string | string[] | undefined | null> because of the various possible values a header
4747
// can take
4848
const headerValues = headerNames.map((headerName: string) => {
4949
const value = headers.get(headerName);
50-
51-
if (headerName === "Forwarded") {
50+
51+
if (headerName === 'Forwarded') {
5252
return parseForwardedHeader(value);
5353
}
54-
55-
return value?.split(", ");
54+
55+
return value?.split(', ');
5656
});
5757

5858
// Flatten the array and filter out any falsy entries
@@ -65,7 +65,7 @@ export function getClientIPAddress(headers: Headers): string | null {
6565
}, []);
6666

6767
// Find the first value which is a valid IP address, if any
68-
const ipAddress = flattenedHeaderValues.find((ip) => ip !== null && isIP(ip));
68+
const ipAddress = flattenedHeaderValues.find(ip => ip !== null && isIP(ip));
6969

7070
return ipAddress || null;
7171
}
@@ -75,8 +75,8 @@ function parseForwardedHeader(value: string | null): string | null {
7575
return null;
7676
}
7777

78-
for (const part of value.split(";")) {
79-
if (part.startsWith("for=")) {
78+
for (const part of value.split(';')) {
79+
if (part.startsWith('for=')) {
8080
return part.slice(4);
8181
}
8282
}

0 commit comments

Comments
 (0)