From 47805110b2304ca7a7aaf610c4f97bdfc9ff4676 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Thu, 1 Aug 2024 12:47:57 +0000 Subject: [PATCH 1/2] chore(deps): bump @snapshot-labs/eslint-config-base Bumps @snapshot-labs/eslint-config-base from 0.1.0-beta.15 to 0.1.0-beta.18. --- updated-dependencies: - dependency-name: "@snapshot-labs/eslint-config-base" dependency-type: indirect update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- yarn.lock | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/yarn.lock b/yarn.lock index 87188ee5..ed1ab922 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2099,9 +2099,9 @@ "@sinonjs/commons" "^1.7.0" "@snapshot-labs/eslint-config-base@^0.1.0-beta.15": - version "0.1.0-beta.15" - resolved "https://registry.yarnpkg.com/@snapshot-labs/eslint-config-base/-/eslint-config-base-0.1.0-beta.15.tgz#2f64a21a0590d0ffea8a82852ab4bd5742495daa" - integrity sha512-uqOqCDTsl92e1k3edaGweQCSlDo9mU8I1ejqXCJHHDr/ZZyBldd8R73qOjhEVdYBtbdHd97QRdKh3JhMjzhrtg== + version "0.1.0-beta.18" + resolved "https://registry.yarnpkg.com/@snapshot-labs/eslint-config-base/-/eslint-config-base-0.1.0-beta.18.tgz#b39a1e6f14e7cdccbc02a70ae52e8a49459a41c3" + integrity sha512-OLB5Lcw+SUkjVhz6lo4oTCFthEkQrczh6t73dW4wmlug+OSAUPa8Uk9mh//b1Dsc4kQuh63CRVwRChJQlsuUHg== dependencies: "@typescript-eslint/eslint-plugin" "^6.7.3" "@typescript-eslint/parser" "^6.7.3" From ebabd5a49a61084202ea21ae9ba5163133d1fa95 Mon Sep 17 00:00:00 2001 From: ChaituVR Date: Thu, 1 Aug 2024 21:13:57 +0530 Subject: [PATCH 2/2] lint fixes --- src/aws.ts | 4 ++-- src/helpers/keycard.ts | 2 +- src/index.ts | 8 ++++---- src/methods.test.ts | 4 ++-- src/methods.ts | 4 ++-- src/requestDeduplicator.test.ts | 2 +- src/requestDeduplicator.ts | 2 +- src/rpc.test.ts | 9 ++++----- src/rpc.ts | 22 +++++++++++----------- src/scores.test.ts | 4 ++-- src/scores.ts | 2 +- src/utils.test.ts | 16 ++++++++-------- src/utils.ts | 2 +- 13 files changed, 40 insertions(+), 41 deletions(-) diff --git a/src/aws.ts b/src/aws.ts index 62434499..44899b5c 100644 --- a/src/aws.ts +++ b/src/aws.ts @@ -1,7 +1,7 @@ -import * as AWS from '@aws-sdk/client-s3'; import { Readable } from 'stream'; +import * as AWS from '@aws-sdk/client-s3'; import { capture } from '@snapshot-labs/snapshot-sentry'; -import { AWS_CACHE_KEY, APP_NAME } from './constants'; +import { APP_NAME, AWS_CACHE_KEY } from './constants'; let client; const bucket = process.env.AWS_BUCKET_NAME; diff --git a/src/helpers/keycard.ts b/src/helpers/keycard.ts index dcd4c71b..9766dc80 100644 --- a/src/helpers/keycard.ts +++ b/src/helpers/keycard.ts @@ -1,6 +1,6 @@ import { Keycard } from '@snapshot-labs/keycard'; -import { rpcError } from '../utils'; import { APP_NAME } from '../constants'; +import { rpcError } from '../utils'; const keycard = new Keycard({ app: APP_NAME, diff --git a/src/index.ts b/src/index.ts index b1b6df9d..34a4331e 100644 --- a/src/index.ts +++ b/src/index.ts @@ -1,12 +1,12 @@ import 'dotenv/config'; -import express from 'express'; +import { fallbackLogger, initLogger } from '@snapshot-labs/snapshot-sentry'; import cors from 'cors'; -import { initLogger, fallbackLogger } from '@snapshot-labs/snapshot-sentry'; +import express from 'express'; import { checkKeycard } from './helpers/keycard'; -import rpc from './rpc'; -import { rpcError } from './utils'; import rateLimit from './helpers/rateLimit'; import initMetrics from './metrics'; +import rpc from './rpc'; +import { rpcError } from './utils'; const app = express(); const PORT = process.env.PORT ?? 3003; diff --git a/src/methods.test.ts b/src/methods.test.ts index e0925541..6014fcf0 100644 --- a/src/methods.test.ts +++ b/src/methods.test.ts @@ -1,7 +1,7 @@ -import { getVp, validate } from './methods'; import snapshot from '@snapshot-labs/strategies'; -import { getCurrentBlockNum, sha256 } from './utils'; +import { getVp, validate } from './methods'; import * as redisModule from './redis'; +import { getCurrentBlockNum, sha256 } from './utils'; jest.mock('@snapshot-labs/strategies'); jest.mock('./utils'); diff --git a/src/methods.ts b/src/methods.ts index 24e79cc1..4fb6a454 100644 --- a/src/methods.ts +++ b/src/methods.ts @@ -1,7 +1,7 @@ import snapshot from '@snapshot-labs/strategies'; -import redis from './redis'; -import { sha256, getCurrentBlockNum } from './utils'; import disabled from './disabled.json'; +import redis from './redis'; +import { getCurrentBlockNum, sha256 } from './utils'; interface GetVpRequestParams { address: string; diff --git a/src/requestDeduplicator.test.ts b/src/requestDeduplicator.test.ts index ea789809..929256ad 100644 --- a/src/requestDeduplicator.test.ts +++ b/src/requestDeduplicator.test.ts @@ -1,5 +1,5 @@ -import serve from './requestDeduplicator'; import { requestDeduplicatorSize } from './metrics'; +import serve from './requestDeduplicator'; jest.mock('./utils', () => ({ sha256: jest.fn(id => `hashed_${id}`) diff --git a/src/requestDeduplicator.ts b/src/requestDeduplicator.ts index 458046a4..79b0e7c0 100644 --- a/src/requestDeduplicator.ts +++ b/src/requestDeduplicator.ts @@ -1,5 +1,5 @@ -import { sha256 } from './utils'; import { requestDeduplicatorSize } from './metrics'; +import { sha256 } from './utils'; const ongoingRequests = new Map(); diff --git a/src/rpc.test.ts b/src/rpc.test.ts index 871f8b5b..7e086fba 100644 --- a/src/rpc.test.ts +++ b/src/rpc.test.ts @@ -1,12 +1,11 @@ -import request from 'supertest'; - import express from 'express'; -import router from './rpc'; -import serve from './requestDeduplicator'; +import request from 'supertest'; import getStrategies from './helpers/strategies'; import getValidations from './helpers/validations'; +import { getVp, validate } from './methods'; +import serve from './requestDeduplicator'; +import router from './rpc'; import scores from './scores'; -import { validate, getVp } from './methods'; import * as utils from './utils'; jest.mock('./methods', () => ({ diff --git a/src/rpc.ts b/src/rpc.ts index 6938bc3d..c0e97dfa 100644 --- a/src/rpc.ts +++ b/src/rpc.ts @@ -1,21 +1,21 @@ -import express from 'express'; import { getAddress } from '@ethersproject/address'; +import { capture } from '@snapshot-labs/snapshot-sentry'; +import express from 'express'; +import { EMPTY_ADDRESS, MAX_STRATEGIES } from './constants'; +import disabled from './disabled.json'; +import getStrategies from './helpers/strategies'; +import getValidations from './helpers/validations'; +import { getVp, validate } from './methods'; +import serve from './requestDeduplicator'; import scores from './scores'; import { + blockNumByNetwork, + checkInvalidStrategies, formatStrategies, - rpcSuccess, rpcError, - blockNumByNetwork, - checkInvalidStrategies + rpcSuccess } from './utils'; import { version } from '../package.json'; -import { getVp, validate } from './methods'; -import getStrategies from './helpers/strategies'; -import getValidations from './helpers/validations'; -import disabled from './disabled.json'; -import serve from './requestDeduplicator'; -import { capture } from '@snapshot-labs/snapshot-sentry'; -import { EMPTY_ADDRESS, MAX_STRATEGIES } from './constants'; const router = express.Router(); diff --git a/src/scores.test.ts b/src/scores.test.ts index a850c031..abdc65f5 100644 --- a/src/scores.test.ts +++ b/src/scores.test.ts @@ -1,7 +1,7 @@ -import scores from './scores'; +import snapshot from '@snapshot-labs/strategies'; import { get, set } from './aws'; +import scores from './scores'; import { getCurrentBlockNum, sha256 } from './utils'; -import snapshot from '@snapshot-labs/strategies'; jest.mock('./utils'); jest.mock('./aws'); diff --git a/src/scores.ts b/src/scores.ts index 7c8151e8..b6a27a94 100644 --- a/src/scores.ts +++ b/src/scores.ts @@ -1,7 +1,7 @@ import snapshot from '@snapshot-labs/strategies'; import { get, set } from './aws'; -import { getCurrentBlockNum, sha256 } from './utils'; import serve from './requestDeduplicator'; +import { getCurrentBlockNum, sha256 } from './utils'; const broviderUrl = process.env.BROVIDER_URL || 'https://rpc.snapshot.org'; diff --git a/src/utils.test.ts b/src/utils.test.ts index 621660b9..442b9145 100644 --- a/src/utils.test.ts +++ b/src/utils.test.ts @@ -1,19 +1,19 @@ const originalBroviderUrl = process.env.BROVIDER_URL; process.env.BROVIDER_URL = 'test.brovider.url'; +import { createHash } from 'crypto'; +import snapshot from '@snapshot-labs/strategies'; +import { MAX_STRATEGIES } from './constants'; import { - getCurrentBlockNum, blockNumByNetwork, - getIp, - rpcError, clone, - sha256, formatStrategies, - rpcSuccess + getCurrentBlockNum, + getIp, + rpcError, + rpcSuccess, + sha256 } from './utils'; -import snapshot from '@snapshot-labs/strategies'; -import { createHash } from 'crypto'; -import { MAX_STRATEGIES } from './constants'; jest.mock('@snapshot-labs/strategies'); jest.mock('crypto', () => ({ diff --git a/src/utils.ts b/src/utils.ts index 9710eb96..c07e1d0d 100644 --- a/src/utils.ts +++ b/src/utils.ts @@ -1,5 +1,5 @@ -import snapshot from '@snapshot-labs/strategies'; import { createHash } from 'crypto'; +import snapshot from '@snapshot-labs/strategies'; import { MAX_STRATEGIES } from './constants'; import getStrategies from './helpers/strategies';