From 8c8e845dc51015b524f4fc3a23745ac8e9ecfc62 Mon Sep 17 00:00:00 2001 From: Matchu Date: Thu, 13 May 2021 01:13:21 -0700 Subject: [PATCH] Fix eslint for /api Oops, I didn't notice this when bulk-fixing eslint stuff in src! --- api/allWakaValues.js | 10 ++++++---- api/graphql.js | 6 ++++-- api/outfitImage.js | 6 ++++-- api/sendFeedback.js | 6 ++++-- api/uploadLayerImage.js | 8 +++++--- api/validPetPoses.js | 14 +++++++------- package.json | 7 +++++++ 7 files changed, 37 insertions(+), 20 deletions(-) diff --git a/api/allWakaValues.js b/api/allWakaValues.js index b00acd7..56ad430 100644 --- a/api/allWakaValues.js +++ b/api/allWakaValues.js @@ -105,8 +105,8 @@ async function loadWakaValuesByIdOrName() { for (const [ itemName, value = "", - notes = "", - marks = "", + unusedNotes = "", + unusedMarks = "", itemId = "", ] of rows) { const normalizedItemName = normalizeItemName(itemName); @@ -130,9 +130,11 @@ function normalizeItemName(name) { ); } -export default async (req, res) => { +async function handleWithBeeline(req, res) { beeline.withTrace( { name: "api/allWakaValues", operation_name: "api/allWakaValues" }, () => handle(req, res) ); -}; +} + +export default handleWithBeeline; diff --git a/api/graphql.js b/api/graphql.js index 4a51b3d..8e694c6 100644 --- a/api/graphql.js +++ b/api/graphql.js @@ -13,7 +13,7 @@ const { config } = require("../src/server"); const server = new ApolloServer(config); const serverHandler = server.createHandler(); -export default async (req, res) => { +async function handle(req, res) { await serverHandler(req, res); // 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 await beeline.flush(); res.end(); -}; +} + +export default handle; diff --git a/api/outfitImage.js b/api/outfitImage.js index 72fef32..09b4b2d 100644 --- a/api/outfitImage.js +++ b/api/outfitImage.js @@ -66,9 +66,11 @@ async function handle(req, res) { return res.send(image); } -export default async (req, res) => { +async function handleWithBeeline(req, res) { beeline.withTrace( { name: "api/outfitImage", operation_name: "api/outfitImage" }, () => handle(req, res) ); -}; +} + +export default handleWithBeeline; diff --git a/api/sendFeedback.js b/api/sendFeedback.js index 2b2c07c..3349c8b 100644 --- a/api/sendFeedback.js +++ b/api/sendFeedback.js @@ -46,9 +46,11 @@ async function handle(req, res) { return res.status(200).send(); } -export default async (req, res) => { +async function handleWithBeeline(req, res) { beeline.withTrace( { name: "api/sendFeedback", operation_name: "api/sendFeedback" }, () => handle(req, res) ); -}; +} + +export default handleWithBeeline; diff --git a/api/uploadLayerImage.js b/api/uploadLayerImage.js index d805dde..6eb472a 100644 --- a/api/uploadLayerImage.js +++ b/api/uploadLayerImage.js @@ -63,7 +63,7 @@ async function processImage(assetType, remoteId, size, imageData) { const key = `${assetType}/${id1}/${id2}/${id3}/${remoteId}/${size}x${size}.png`; 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) { @@ -170,9 +170,11 @@ async function handle(req, res) { res.status(200).send(); } -export default async (req, res) => { +async function handleWithBeeline(req, res) { beeline.withTrace( { name: "api/uploadLayerImage", operation_name: "api/uploadLayerImage" }, () => handle(req, res) ); -}; +} + +export default handleWithBeeline; diff --git a/api/validPetPoses.js b/api/validPetPoses.js index df1087c..c788054 100644 --- a/api/validPetPoses.js +++ b/api/validPetPoses.js @@ -71,19 +71,17 @@ export async function getValidPetPoses() { } 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(*)"]; } async function getNumColors(db) { - const [rows, _] = await db.query( - `SELECT count(*) FROM colors WHERE prank = 0` - ); + const [rows] = await db.query(`SELECT count(*) FROM colors WHERE prank = 0`); return rows[0]["count(*)"]; } async function getDistinctPetStates(db) { - const [rows, _] = await db.query(` + const [rows] = await db.query(` SELECT DISTINCT species_id, color_id, mood_id, female, unconverted FROM pet_states 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); } -export default async (req, res) => { +async function handleWithBeeline(req, res) { beeline.withTrace( { name: "api/validPetPoses", operation_name: "api/validPetPoses" }, () => handle(req, res) ); -}; +} + +export default handleWithBeeline; diff --git a/package.json b/package.json index 74db690..46ffb18 100644 --- a/package.json +++ b/package.json @@ -87,6 +87,13 @@ "error" ] } + ], + "import/first": "off", + "no-unused-vars": [ + "warn", + { + "varsIgnorePattern": "^unused" + } ] } },