Skip to content

Commit

Permalink
Bump prettier from 2.8.8 to 3.0.3 (#467)
Browse files Browse the repository at this point in the history
* Bump prettier from 2.8.8 to 3.0.3

Bumps [prettier](https://github.com/prettier/prettier) from 2.8.8 to 3.0.3.
- [Release notes](https://github.com/prettier/prettier/releases)
- [Changelog](https://github.com/prettier/prettier/blob/main/CHANGELOG.md)
- [Commits](prettier/prettier@2.8.8...3.0.3)

---
updated-dependencies:
- dependency-name: prettier
  dependency-type: direct:development
  update-type: version-update:semver-major
...
  • Loading branch information
dependabot[bot] authored Oct 6, 2023
1 parent 4e6b9ce commit 301e531
Show file tree
Hide file tree
Showing 7 changed files with 55 additions and 55 deletions.
6 changes: 3 additions & 3 deletions __tests__/test_views.ts
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ test("test views filtered by user", async () => {
expect(responseJson.data.length).toEqual(1);

expect(prismaMock.view.findMany).toBeCalledWith(
expect.not.objectContaining({ take: expect.anything() })
expect.not.objectContaining({ take: expect.anything() }),
);
});

Expand All @@ -77,7 +77,7 @@ test("test views filtered by user and with limit", async () => {
expect(responseJson.data.length).toEqual(1);

expect(prismaMock.view.findMany).toBeCalledWith(
expect.objectContaining({ take: 1 })
expect.objectContaining({ take: 1 }),
);
});

Expand All @@ -101,7 +101,7 @@ test("test views selfMitigation filtering", async () => {
expect(responseJson.data.length).toEqual(1);

expect(prismaMock.view.findMany).toBeCalledWith(
expect.objectContaining({ take: 1 })
expect.objectContaining({ take: 1 }),
);
});

Expand Down
18 changes: 9 additions & 9 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@
"jest-mock-extended": "^3.0.5",
"lint-staged": "^14.0.1",
"nodemon": "^3.0.1",
"prettier": "^2.8.8",
"prettier": "^3.0.3",
"prisma": "^5.2.0",
"supertest": "^6.3.3",
"ts-jest": "^28.0.8",
Expand Down
60 changes: 30 additions & 30 deletions src/app.ts
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ app.use(
// We use the same expiration here so that the we don't get stale access token
// See comments about hacks below with how / when we generate the access token
maxAge: env.ACCESS_TOKEN_EXPIRES_HOURS * 60 * 60 * 1000,
})
}),
);

// -------------------------------------------------
Expand All @@ -85,7 +85,7 @@ app.use(
const transparentGifPath = path.join(
__dirname,
"../responses",
"transparent.gif"
"transparent.gif",
);
if (!fs.existsSync(transparentGifPath)) {
throw Error(`No such file: ${transparentGifPath}`);
Expand Down Expand Up @@ -134,7 +134,7 @@ const UseJwt = [
async function processImage(
trackId: string,
req: Request,
res: Response
res: Response,
): Promise<void> {
const clientIp = req.ip;
const userAgent = req.headers["user-agent"];
Expand Down Expand Up @@ -187,7 +187,7 @@ app.get(
query("trackId").isString().isUUID(),
async (req: Request, res: Response): Promise<void> => {
await imageRoute(req, res);
}
},
);

app.get(
Expand All @@ -197,12 +197,12 @@ app.get(
param("trackId").isString().isUUID(),
async (req: Request, res: Response): Promise<void> => {
await imageRoute(req, res);
}
},
);

const getViewsForTracker = async (
threadId: string,
userId: string
userId: string,
): Promise<null | View[]> => {
const trackers = await prisma.tracker.findMany({
where: { userId, threadId },
Expand All @@ -216,7 +216,7 @@ const getViewsForTracker = async (
}

const cleanViews = (
tracker: Tracker & { views: View[] }
tracker: Tracker & { views: View[] },
): (View & { tracker: Tracker })[] => {
const { views: viewsRaw, ...trackerNoViews } = tracker;
const views = viewsRaw.map((view) => ({
Expand All @@ -237,7 +237,7 @@ const getViewsForTracker = async (
const timeFromTrackToViewSec = dayjs(firstView.createdAt).diff(
dayjs(tracker.createdAt),
"second",
true
true,
);

if (timeFromTrackToViewSec < env.SELF_VIEW_THRESHOLD_SEC) {
Expand Down Expand Up @@ -284,7 +284,7 @@ app.get(

res.json({ data: views });
return;
}
},
);

app.options("/api/v1/views/", corsMiddleware);
Expand Down Expand Up @@ -356,13 +356,13 @@ app.get(
dayjs(view.createdAt).diff(
dayjs(view.tracker.createdAt),
"second",
true
) >= env.SELF_VIEW_THRESHOLD_SEC
true,
) >= env.SELF_VIEW_THRESHOLD_SEC,
);

res.json({ data: views });
return;
}
},
);

const parseScheduledSendAt = (scheduledTimestamp: any): Date | null => {
Expand All @@ -376,7 +376,7 @@ const parseScheduledSendAt = (scheduledTimestamp: any): Date | null => {
};

const getSessionUsers = (
session: CookieSessionInterfaces.CookieSessionObject
session: CookieSessionInterfaces.CookieSessionObject,
): UserData[] => {
return (session.users as UserData[] | undefined) ?? [];
};
Expand Down Expand Up @@ -463,7 +463,7 @@ app.post(
res.status(400).json({});
return;
}
}
},
);

type UserData = {
Expand All @@ -475,7 +475,7 @@ type UserData = {
};

async function getAccessToken(
userId: string
userId: string,
): Promise<{ accessToken: string; expiresIn: number }> {
const subject = String(userId);

Expand Down Expand Up @@ -549,7 +549,7 @@ app.get(
const currentUsers = getSessionUsers(session);
// splice out this email if we already track it
const otherUsers = currentUsers.filter(
(currentUser) => currentUser.emailAccount !== userData.emailAccount
(currentUser) => currentUser.emailAccount !== userData.emailAccount,
);
session.users = [userData, ...otherUsers] as UserData[];

Expand All @@ -559,7 +559,7 @@ app.get(
// That way errors are surfaced

return;
}
},
);

// this logouts from everything
Expand Down Expand Up @@ -644,7 +644,7 @@ app.post(
}

return;
}
},
);

// The name of this can change now that is just returns the token
Expand Down Expand Up @@ -673,7 +673,7 @@ app.post(
// This can be called more than once and just reads off the session
// A little hacky
const userData = getSessionUsers(session).find(
(user) => user.emailToken == token
(user) => user.emailToken == token,
);

if (userData === undefined) {
Expand All @@ -683,7 +683,7 @@ app.post(

res.status(200).json(userData);
return;
}
},
);

app.post(
Expand All @@ -709,9 +709,9 @@ app.post(
emailAccount: user.email,
trackingSlug: user.slug,
},
})
}),
);
}
},
);

// Probably not needed long term
Expand All @@ -724,7 +724,7 @@ app.post(
"/api/v1/stunnel",
corsMiddleware,
express.text({ limit: env.SENTRY_TUNNEL_SIZE_LIMIT }),
sentryTunnelHandler
sentryTunnelHandler,
);

// See https://github.com/oauthjs/node-oauth2-server for specification
Expand All @@ -743,7 +743,7 @@ const OAuthServerModel: AuthorizationCodeModel = {
clientSecret &&
!crypto.timingSafeEqual(
Buffer.from(env.GMAIL_ADDON_CLIENT_SECRET),
Buffer.from(clientSecret)
Buffer.from(clientSecret),
)
)
return null;
Expand All @@ -758,7 +758,7 @@ const OAuthServerModel: AuthorizationCodeModel = {
return user.accessToken;
},
getAuthorizationCode: async (
authorizationCode
authorizationCode,
): Promise<AuthorizationCode> => {
// here we just parse the jwt that send out
// we should verify
Expand Down Expand Up @@ -788,7 +788,7 @@ const OAuthServerModel: AuthorizationCodeModel = {
saveAuthorizationCode: async (
code,
client,
user
user,
): Promise<AuthorizationCode> => {
const authorizationCode = await jsonwebtoken.sign(
{
Expand All @@ -803,7 +803,7 @@ const OAuthServerModel: AuthorizationCodeModel = {
// Should we track any of these?
// expiresIn,
// subject,
}
},
);
return {
...code,
Expand Down Expand Up @@ -856,7 +856,7 @@ app.get(
// use the query param `login_hint` to to identify the user
// this is a "silent" auth in that we don't prompt the user for anything
const login_hint_user = currentUsers.find(
(user) => user.emailAccount == login_hint
(user) => user.emailAccount == login_hint,
);

if (login_hint_user === undefined) {
Expand All @@ -873,12 +873,12 @@ app.get(
response.locals.login_hint_user = login_hint_user;
next();
},
oauth.authorize()
oauth.authorize(),
);
app.post(
"/o/oauth2/token",
express.urlencoded({ extended: false }),
oauth.token()
oauth.token(),
);

// The error handler must be before any other error middleware and after all controllers
Expand Down
20 changes: 10 additions & 10 deletions src/client-info.ts
Original file line number Diff line number Diff line change
Expand Up @@ -128,15 +128,15 @@ async function getICloudEgressDataRaw2(): Promise<ICloudEgressDatum[] | null> {
}

export async function getICloudEgressEntry(
clientIp: string
clientIp: string,
): Promise<ICloudEgressDatum | null> {
const iCloudEgressData = await getICloudEgressData();
if (iCloudEgressData === null) {
return null;
}
const clientIpAddress = IPCIDR.createAddress(clientIp);
const iCloudEgressEntry = iCloudEgressData.find((entry) =>
clientIpAddress.isInSubnet(entry.cidr)
clientIpAddress.isInSubnet(entry.cidr),
);
return iCloudEgressEntry ?? null;
}
Expand Down Expand Up @@ -180,9 +180,9 @@ async function lookupIpwhois(clientIp: string): Promise<ClientIpGeo | null> {
Sentry.captureException(
new Error(
`Unable to fetch IP geo data ${resp.status}: ${JSON.stringify(
respJson
)}`
)
respJson,
)}`,
),
);
}
return clientIpGeo;
Expand All @@ -191,7 +191,7 @@ async function lookupIpwhois(clientIp: string): Promise<ClientIpGeo | null> {
async function lookupIpApi(clientIp: string): Promise<ClientIpGeo | null> {
let clientIpGeo: ClientIpGeo | null = null;
const resp = await fetchWithTimeout(
`http://ip-api.com/json/${clientIp}?fields=status,message,country,countryCode,region,regionName,city,district,zip,lat,lon,timezone,isp,org,as,asname,mobile,proxy,hosting`
`http://ip-api.com/json/${clientIp}?fields=status,message,country,countryCode,region,regionName,city,district,zip,lat,lon,timezone,isp,org,as,asname,mobile,proxy,hosting`,
);
clientIpGeo = { source: "ip-api" };
if (resp.ok) {
Expand Down Expand Up @@ -261,17 +261,17 @@ async function lookupIpApi(clientIp: string): Promise<ClientIpGeo | null> {
Sentry.captureException(
new Error(
`Unable to fetch IP geo data ${resp.status}: ${JSON.stringify(
respJson
)}`
)
respJson,
)}`,
),
);
}
return clientIpGeo;
}

export async function getClientIpGeo(
clientIp: string,
userAgent: string | undefined
userAgent: string | undefined,
): Promise<ClientIpGeo | null> {
let clientIpGeo: ClientIpGeo | null = null;

Expand Down
2 changes: 1 addition & 1 deletion src/sentry-tunnel.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ const knownProjectIds = [env.SENTRY_PROJECT_ID_EXTENSION];

const sentryTunnelHandler = async (
req: Request,
res: Response
res: Response,
): Promise<void> => {
try {
const envelope = req.body;
Expand Down
Loading

0 comments on commit 301e531

Please sign in to comment.