From 986ba582e5fa4ff345df69ac3d1b240a8d139bd4 Mon Sep 17 00:00:00 2001 From: mzivil <158518982+mzivil@users.noreply.github.com> Date: Fri, 2 Feb 2024 16:06:33 -0500 Subject: [PATCH] fix lint errors --- api/resolvers/item.js | 4 ++-- lib/url.js | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/api/resolvers/item.js b/api/resolvers/item.js index 307e99fc..7da7a5bf 100644 --- a/api/resolvers/item.js +++ b/api/resolvers/item.js @@ -540,7 +540,7 @@ export default { }, dupes: async (parent, { url }, { me, models }) => { const urlObj = new URL(ensureProtocol(url)) - let { hostname, pathname } = urlObj + const { hostname, pathname } = urlObj let hostnameRegex = hostname + '(:[0-9]+)?' const parseResult = parse(urlObj.hostname) @@ -556,7 +556,7 @@ export default { pathnameRegex = pathnameRegex.replace(/%/g, '\\%') pathnameRegex = pathnameRegex.replace(/_/g, '\\_') - let uriRegex = stripTrailingSlash(hostnameRegex + pathnameRegex) + const uriRegex = stripTrailingSlash(hostnameRegex + pathnameRegex) let similar = `(http(s)?://)?${uriRegex}/?` const whitelist = ['news.ycombinator.com/item', 'bitcointalk.org/index.php'] diff --git a/lib/url.js b/lib/url.js index e93174b0..321157dc 100644 --- a/lib/url.js +++ b/lib/url.js @@ -23,7 +23,7 @@ export function removeTracking (value) { return value } -export function stripTrailingSlash(uri) { +export function stripTrailingSlash (uri) { return uri.endsWith('/') ? uri.slice(0, -1) : uri }