Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: Lint on build #806

Merged
merged 2 commits into from
Dec 10, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 0 additions & 18 deletions .eslintrc.json

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Check Build
name: Build

on: pull_request

Expand Down
24 changes: 24 additions & 0 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
name: Lint

on: pull_request

jobs:
lint:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v3
with:
ref: ${{ github.ref }}

- name: Set up Node.js
uses: actions/setup-node@v3
with:
node-version: "18"
cache: "yarn"

- name: Install dependencies
run: yarn install

- name: Run lint
run: yarn lint
File renamed without changes.
3 changes: 0 additions & 3 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -54,9 +54,6 @@ web_modules/
# Optional npm cache directory
.npm

# Optional eslint cache
.eslintcache

# Optional stylelint cache
.stylelintcache

Expand Down
11 changes: 1 addition & 10 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,9 @@
"start:run": "node --experimental-specifier-resolution=node ./dist/index.js",
"start:docker": "docker compose --profile engine --env-file ./.env up --remove-orphans",
"start:docker-force-build": "docker compose --profile engine --env-file ./.env up --remove-orphans --build",
"lint:fix": "eslint --fix 'src/**/*.ts'",
"test:unit": "vitest",
"test:coverage": "vitest run --coverage",
"lint": "yarn biome lint",
"copy-files": "cp -r ./src/prisma ./dist/"
},
"dependencies": {
Expand Down Expand Up @@ -82,21 +82,12 @@
"@types/pg": "^8.6.6",
"@types/uuid": "^9.0.1",
"@types/ws": "^8.5.5",
"@typescript-eslint/eslint-plugin": "^5.55.0",
"@typescript-eslint/parser": "^5.55.0",
"@vitest/coverage-v8": "^2.0.3",
"eslint": "^9.3.0",
"eslint-config-prettier": "^8.7.0",
"openapi-typescript-codegen": "^0.25.0",
"prettier": "^2.8.7",
"prool": "^0.0.16",
"typescript": "^5.1.3",
"vitest": "^2.0.3"
},
"lint-staged": {
"*.{js,ts}": "eslint --cache --fix",
"*.{js,ts,md}": "prettier --write"
},
"prisma": {
"schema": "./src/prisma/schema.prisma"
},
Expand Down
8 changes: 4 additions & 4 deletions src/server/routes/admin/nonces.ts
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ export async function getNonceDetailsRoute(fastify: FastifyInstance) {
const { walletAddress, chain } = request.query;
const result = await getNonceDetails({
walletAddress: walletAddress ? getAddress(walletAddress) : undefined,
chainId: chain ? parseInt(chain) : undefined,
chainId: chain ? Number.parseInt(chain) : undefined,
});

reply.status(StatusCodes.OK).send({
Expand Down Expand Up @@ -144,12 +144,12 @@ export const getNonceDetails = async ({
walletAddress: key.walletAddress,
chainId: key.chainId,
onchainNonce: onchainNonces[index],
lastUsedNonce: parseInt(lastUsedNonceResult[1] as string) ?? 0,
lastUsedNonce: Number.parseInt(lastUsedNonceResult[1] as string) ?? 0,
sentNonces: (sentNoncesResult[1] as string[])
.map((nonce) => parseInt(nonce))
.map((nonce) => Number.parseInt(nonce))
.sort((a, b) => b - a),
recycledNonces: (recycledNoncesResult[1] as string[])
.map((nonce) => parseInt(nonce))
.map((nonce) => Number.parseInt(nonce))
.sort((a, b) => b - a),
};
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,8 +78,8 @@ export async function erc721SetClaimConditions(fastify: FastifyInstance) {
return {
...item,
startTime: item.startTime
? isUnixEpochTimestamp(parseInt(item.startTime.toString()))
? new Date(parseInt(item.startTime.toString()) * 1000)
? isUnixEpochTimestamp(Number.parseInt(item.startTime.toString()))
? new Date(Number.parseInt(item.startTime.toString()) * 1000)
: new Date(item.startTime)
: undefined,
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,10 +80,11 @@ export async function erc721UpdateClaimConditions(fastify: FastifyInstance) {
...claimConditionInput,
startTime: claimConditionInput.startTime
? isUnixEpochTimestamp(
parseInt(claimConditionInput.startTime.toString()),
Number.parseInt(claimConditionInput.startTime.toString()),
)
? new Date(
parseInt(claimConditionInput.startTime.toString()) * 1000,
Number.parseInt(claimConditionInput.startTime.toString()) *
1000,
)
: new Date(claimConditionInput.startTime)
: undefined,
Expand Down
2 changes: 1 addition & 1 deletion src/shared/db/relayer/get-relayer-by-id.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ export const getRelayerById = async ({ id }: GetRelayerByIdParams) => {

return {
...relayer,
chainId: parseInt(relayer.chainId),
chainId: Number.parseInt(relayer.chainId),
allowedContracts: relayer.allowedContracts
? (JSON.parse(relayer.allowedContracts).map((contractAddress: string) =>
contractAddress.toLowerCase(),
Expand Down
4 changes: 2 additions & 2 deletions src/shared/db/wallets/nonce-map.ts
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ export const getNonceMap = async (args: {
for (let i = 0; i < elementsWithScores.length; i += 2) {
result.push({
queueId: elementsWithScores[i],
nonce: parseInt(elementsWithScores[i + 1]),
nonce: Number.parseInt(elementsWithScores[i + 1]),
});
}
return result;
Expand All @@ -73,7 +73,7 @@ export const pruneNonceMaps = async () => {
let numDeleted = 0;
for (const [error, result] of results) {
if (!error) {
numDeleted += parseInt(result as string);
numDeleted += Number.parseInt(result as string);
}
}
return numDeleted;
Expand Down
4 changes: 2 additions & 2 deletions src/shared/utils/cron/is-valid-cron.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ export const isValidCron = (input: string): boolean => {

let parsedSecondsValue: number | null = null;
if (seconds.startsWith("*/")) {
parsedSecondsValue = parseInt(seconds.split("/")[1]);
parsedSecondsValue = Number.parseInt(seconds.split("/")[1]);
}

// Check for specific invalid patterns in seconds field
Expand Down Expand Up @@ -66,7 +66,7 @@ const checkCronFieldInterval = (
fieldName: string,
) => {
if (field.startsWith("*/")) {
const parsedValue = parseInt(field.split("/")[1]);
const parsedValue = Number.parseInt(field.split("/")[1]);
if (parsedValue < minValue || parsedValue > maxValue) {
throw createCustomError(
`Invalid cron expression. ${fieldName} must be between ${minValue} and ${maxValue} when using an interval.`,
Expand Down
2 changes: 1 addition & 1 deletion src/worker/queues/process-event-logs-queue.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ export class ProcessEventsLogQueue {
// This backoff attempts at intervals:
// 30s, 1m, 2m, 4m, 8m, 16m, 32m, ~1h, ~2h, ~4h
for (let i = 0; i < requeryDelays.length; i++) {
const delay = parseInt(requeryDelays[i]) * 1000;
const delay = Number.parseInt(requeryDelays[i]) * 1000;
const attempts = i === requeryDelays.length - 1 ? 10 : 0;
await this.q.add(jobName, serialized, {
delay,
Expand Down
2 changes: 1 addition & 1 deletion src/worker/queues/process-transaction-receipts-queue.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ export class ProcessTransactionReceiptsQueue {
// This backoff attempts at intervals:
// 30s, 1m, 2m, 4m, 8m, 16m, 32m, ~1h, ~2h, ~4h
for (let i = 0; i < requeryDelays.length; i++) {
const delay = parseInt(requeryDelays[i]) * 1000;
const delay = Number.parseInt(requeryDelays[i]) * 1000;
const attempts = i === requeryDelays.length - 1 ? 10 : 0;
await this.q.add(jobName, serialized, {
delay,
Expand Down
4 changes: 2 additions & 2 deletions src/worker/tasks/cancel-recycled-nonces-worker.ts
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ const handler: Processor<any, void, string> = async (job: Job<string>) => {
const fromRecycledNoncesKey = (key: string) => {
const [_, chainId, walletAddress] = key.split(":");
return {
chainId: parseInt(chainId),
chainId: Number.parseInt(chainId),
walletAddress: walletAddress as Address,
};
};
Expand All @@ -89,5 +89,5 @@ const getAndDeleteRecycledNonces = async (key: string) => {
throw new Error(`Error getting members of ${key}: ${error}`);
}
// No need to sort here as ZRANGE returns elements in ascending order
return (nonces as string[]).map((v) => parseInt(v));
return (nonces as string[]).map((v) => Number.parseInt(v));
};
3 changes: 0 additions & 3 deletions tests/e2e/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -71,9 +71,6 @@ web_modules/

.npm

# Optional eslint cache

.eslintcache

# Optional stylelint cache

Expand Down
Loading
Loading