Fix eslint for /api

Oops, I didn't notice this when bulk-fixing eslint stuff in src!
This commit is contained in:
Emi Matchu 2021-05-13 01:13:21 -07:00
parent e56c5d9a9c
commit 8c8e845dc5
7 changed files with 37 additions and 20 deletions

View file

@ -105,8 +105,8 @@ async function loadWakaValuesByIdOrName() {
for (const [ for (const [
itemName, itemName,
value = "", value = "",
notes = "", unusedNotes = "",
marks = "", unusedMarks = "",
itemId = "", itemId = "",
] of rows) { ] of rows) {
const normalizedItemName = normalizeItemName(itemName); const normalizedItemName = normalizeItemName(itemName);
@ -130,9 +130,11 @@ function normalizeItemName(name) {
); );
} }
export default async (req, res) => { async function handleWithBeeline(req, res) {
beeline.withTrace( beeline.withTrace(
{ name: "api/allWakaValues", operation_name: "api/allWakaValues" }, { name: "api/allWakaValues", operation_name: "api/allWakaValues" },
() => handle(req, res) () => handle(req, res)
); );
}; }
export default handleWithBeeline;

View file

@ -13,7 +13,7 @@ const { config } = require("../src/server");
const server = new ApolloServer(config); const server = new ApolloServer(config);
const serverHandler = server.createHandler(); const serverHandler = server.createHandler();
export default async (req, res) => { async function handle(req, res) {
await serverHandler(req, res); await serverHandler(req, res);
// As a sneaky trick, we require the Honeycomb trace to finish before the // As a sneaky trick, we require the Honeycomb trace to finish before the
@ -22,4 +22,6 @@ export default async (req, res) => {
// https://vercel.com/docs/platform/limits#streaming-responses // https://vercel.com/docs/platform/limits#streaming-responses
await beeline.flush(); await beeline.flush();
res.end(); res.end();
}; }
export default handle;

View file

@ -66,9 +66,11 @@ async function handle(req, res) {
return res.send(image); return res.send(image);
} }
export default async (req, res) => { async function handleWithBeeline(req, res) {
beeline.withTrace( beeline.withTrace(
{ name: "api/outfitImage", operation_name: "api/outfitImage" }, { name: "api/outfitImage", operation_name: "api/outfitImage" },
() => handle(req, res) () => handle(req, res)
); );
}; }
export default handleWithBeeline;

View file

@ -46,9 +46,11 @@ async function handle(req, res) {
return res.status(200).send(); return res.status(200).send();
} }
export default async (req, res) => { async function handleWithBeeline(req, res) {
beeline.withTrace( beeline.withTrace(
{ name: "api/sendFeedback", operation_name: "api/sendFeedback" }, { name: "api/sendFeedback", operation_name: "api/sendFeedback" },
() => handle(req, res) () => handle(req, res)
); );
}; }
export default handleWithBeeline;

View file

@ -63,7 +63,7 @@ async function processImage(assetType, remoteId, size, imageData) {
const key = `${assetType}/${id1}/${id2}/${id3}/${remoteId}/${size}x${size}.png`; const key = `${assetType}/${id1}/${id2}/${id3}/${remoteId}/${size}x${size}.png`;
await upload("impress-asset-images", key, imageData); await upload("impress-asset-images", key, imageData);
console.log(`Successfully uploaded ${key} to impress-asset-images`); console.info(`Successfully uploaded ${key} to impress-asset-images`);
} }
async function handle(req, res) { async function handle(req, res) {
@ -170,9 +170,11 @@ async function handle(req, res) {
res.status(200).send(); res.status(200).send();
} }
export default async (req, res) => { async function handleWithBeeline(req, res) {
beeline.withTrace( beeline.withTrace(
{ name: "api/uploadLayerImage", operation_name: "api/uploadLayerImage" }, { name: "api/uploadLayerImage", operation_name: "api/uploadLayerImage" },
() => handle(req, res) () => handle(req, res)
); );
}; }
export default handleWithBeeline;

View file

@ -71,19 +71,17 @@ export async function getValidPetPoses() {
} }
async function getNumSpecies(db) { async function getNumSpecies(db) {
const [rows, _] = await db.query(`SELECT count(*) FROM species`); const [rows] = await db.query(`SELECT count(*) FROM species`);
return rows[0]["count(*)"]; return rows[0]["count(*)"];
} }
async function getNumColors(db) { async function getNumColors(db) {
const [rows, _] = await db.query( const [rows] = await db.query(`SELECT count(*) FROM colors WHERE prank = 0`);
`SELECT count(*) FROM colors WHERE prank = 0`
);
return rows[0]["count(*)"]; return rows[0]["count(*)"];
} }
async function getDistinctPetStates(db) { async function getDistinctPetStates(db) {
const [rows, _] = await db.query(` const [rows] = await db.query(`
SELECT DISTINCT species_id, color_id, mood_id, female, unconverted SELECT DISTINCT species_id, color_id, mood_id, female, unconverted
FROM pet_states FROM pet_states
INNER JOIN pet_types ON pet_types.id = pet_states.pet_type_id INNER JOIN pet_types ON pet_types.id = pet_states.pet_type_id
@ -101,9 +99,11 @@ async function handle(req, res) {
res.status(200).send(buffer); res.status(200).send(buffer);
} }
export default async (req, res) => { async function handleWithBeeline(req, res) {
beeline.withTrace( beeline.withTrace(
{ name: "api/validPetPoses", operation_name: "api/validPetPoses" }, { name: "api/validPetPoses", operation_name: "api/validPetPoses" },
() => handle(req, res) () => handle(req, res)
); );
}; }
export default handleWithBeeline;

View file

@ -87,6 +87,13 @@
"error" "error"
] ]
} }
],
"import/first": "off",
"no-unused-vars": [
"warn",
{
"varsIgnorePattern": "^unused"
}
] ]
} }
}, },