Skip to content

Commit 04fdca0

Browse files
authored
chore: Lint on build (#806)
* chore: Biome linter fixes * chore: Add lint on build
1 parent f6959c3 commit 04fdca0

File tree

18 files changed

+64
-554
lines changed

18 files changed

+64
-554
lines changed

.eslintrc.json

Lines changed: 0 additions & 18 deletions
This file was deleted.

.github/workflows/check-build.yml renamed to .github/workflows/build.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: Check Build
1+
name: Build
22

33
on: pull_request
44

.github/workflows/lint.yml

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
name: Lint
2+
3+
on: pull_request
4+
5+
jobs:
6+
lint:
7+
runs-on: ubuntu-latest
8+
steps:
9+
- name: Checkout code
10+
uses: actions/checkout@v3
11+
with:
12+
ref: ${{ github.ref }}
13+
14+
- name: Set up Node.js
15+
uses: actions/setup-node@v3
16+
with:
17+
node-version: "18"
18+
cache: "yarn"
19+
20+
- name: Install dependencies
21+
run: yarn install
22+
23+
- name: Run lint
24+
run: yarn lint
File renamed without changes.

.gitignore

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -54,9 +54,6 @@ web_modules/
5454
# Optional npm cache directory
5555
.npm
5656

57-
# Optional eslint cache
58-
.eslintcache
59-
6057
# Optional stylelint cache
6158
.stylelintcache
6259

package.json

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,9 @@
2121
"start:run": "node --experimental-specifier-resolution=node ./dist/index.js",
2222
"start:docker": "docker compose --profile engine --env-file ./.env up --remove-orphans",
2323
"start:docker-force-build": "docker compose --profile engine --env-file ./.env up --remove-orphans --build",
24-
"lint:fix": "eslint --fix 'src/**/*.ts'",
2524
"test:unit": "vitest",
2625
"test:coverage": "vitest run --coverage",
26+
"lint": "yarn biome lint",
2727
"copy-files": "cp -r ./src/prisma ./dist/"
2828
},
2929
"dependencies": {
@@ -82,21 +82,12 @@
8282
"@types/pg": "^8.6.6",
8383
"@types/uuid": "^9.0.1",
8484
"@types/ws": "^8.5.5",
85-
"@typescript-eslint/eslint-plugin": "^5.55.0",
86-
"@typescript-eslint/parser": "^5.55.0",
8785
"@vitest/coverage-v8": "^2.0.3",
88-
"eslint": "^9.3.0",
89-
"eslint-config-prettier": "^8.7.0",
9086
"openapi-typescript-codegen": "^0.25.0",
91-
"prettier": "^2.8.7",
9287
"prool": "^0.0.16",
9388
"typescript": "^5.1.3",
9489
"vitest": "^2.0.3"
9590
},
96-
"lint-staged": {
97-
"*.{js,ts}": "eslint --cache --fix",
98-
"*.{js,ts,md}": "prettier --write"
99-
},
10091
"prisma": {
10192
"schema": "./src/prisma/schema.prisma"
10293
},

src/server/routes/admin/nonces.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ export async function getNonceDetailsRoute(fastify: FastifyInstance) {
9191
const { walletAddress, chain } = request.query;
9292
const result = await getNonceDetails({
9393
walletAddress: walletAddress ? getAddress(walletAddress) : undefined,
94-
chainId: chain ? parseInt(chain) : undefined,
94+
chainId: chain ? Number.parseInt(chain) : undefined,
9595
});
9696

9797
reply.status(StatusCodes.OK).send({
@@ -144,12 +144,12 @@ export const getNonceDetails = async ({
144144
walletAddress: key.walletAddress,
145145
chainId: key.chainId,
146146
onchainNonce: onchainNonces[index],
147-
lastUsedNonce: parseInt(lastUsedNonceResult[1] as string) ?? 0,
147+
lastUsedNonce: Number.parseInt(lastUsedNonceResult[1] as string) ?? 0,
148148
sentNonces: (sentNoncesResult[1] as string[])
149-
.map((nonce) => parseInt(nonce))
149+
.map((nonce) => Number.parseInt(nonce))
150150
.sort((a, b) => b - a),
151151
recycledNonces: (recycledNoncesResult[1] as string[])
152-
.map((nonce) => parseInt(nonce))
152+
.map((nonce) => Number.parseInt(nonce))
153153
.sort((a, b) => b - a),
154154
};
155155
});

src/server/routes/contract/extensions/erc721/write/set-claim-conditions.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -78,8 +78,8 @@ export async function erc721SetClaimConditions(fastify: FastifyInstance) {
7878
return {
7979
...item,
8080
startTime: item.startTime
81-
? isUnixEpochTimestamp(parseInt(item.startTime.toString()))
82-
? new Date(parseInt(item.startTime.toString()) * 1000)
81+
? isUnixEpochTimestamp(Number.parseInt(item.startTime.toString()))
82+
? new Date(Number.parseInt(item.startTime.toString()) * 1000)
8383
: new Date(item.startTime)
8484
: undefined,
8585
};

src/server/routes/contract/extensions/erc721/write/update-claim-conditions.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -80,10 +80,11 @@ export async function erc721UpdateClaimConditions(fastify: FastifyInstance) {
8080
...claimConditionInput,
8181
startTime: claimConditionInput.startTime
8282
? isUnixEpochTimestamp(
83-
parseInt(claimConditionInput.startTime.toString()),
83+
Number.parseInt(claimConditionInput.startTime.toString()),
8484
)
8585
? new Date(
86-
parseInt(claimConditionInput.startTime.toString()) * 1000,
86+
Number.parseInt(claimConditionInput.startTime.toString()) *
87+
1000,
8788
)
8889
: new Date(claimConditionInput.startTime)
8990
: undefined,

src/shared/db/relayer/get-relayer-by-id.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ export const getRelayerById = async ({ id }: GetRelayerByIdParams) => {
1717

1818
return {
1919
...relayer,
20-
chainId: parseInt(relayer.chainId),
20+
chainId: Number.parseInt(relayer.chainId),
2121
allowedContracts: relayer.allowedContracts
2222
? (JSON.parse(relayer.allowedContracts).map((contractAddress: string) =>
2323
contractAddress.toLowerCase(),

src/shared/db/wallets/nonce-map.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ export const getNonceMap = async (args: {
5353
for (let i = 0; i < elementsWithScores.length; i += 2) {
5454
result.push({
5555
queueId: elementsWithScores[i],
56-
nonce: parseInt(elementsWithScores[i + 1]),
56+
nonce: Number.parseInt(elementsWithScores[i + 1]),
5757
});
5858
}
5959
return result;
@@ -73,7 +73,7 @@ export const pruneNonceMaps = async () => {
7373
let numDeleted = 0;
7474
for (const [error, result] of results) {
7575
if (!error) {
76-
numDeleted += parseInt(result as string);
76+
numDeleted += Number.parseInt(result as string);
7777
}
7878
}
7979
return numDeleted;

src/shared/utils/cron/is-valid-cron.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ export const isValidCron = (input: string): boolean => {
2828

2929
let parsedSecondsValue: number | null = null;
3030
if (seconds.startsWith("*/")) {
31-
parsedSecondsValue = parseInt(seconds.split("/")[1]);
31+
parsedSecondsValue = Number.parseInt(seconds.split("/")[1]);
3232
}
3333

3434
// Check for specific invalid patterns in seconds field
@@ -66,7 +66,7 @@ const checkCronFieldInterval = (
6666
fieldName: string,
6767
) => {
6868
if (field.startsWith("*/")) {
69-
const parsedValue = parseInt(field.split("/")[1]);
69+
const parsedValue = Number.parseInt(field.split("/")[1]);
7070
if (parsedValue < minValue || parsedValue > maxValue) {
7171
throw createCustomError(
7272
`Invalid cron expression. ${fieldName} must be between ${minValue} and ${maxValue} when using an interval.`,

src/worker/queues/process-event-logs-queue.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ export class ProcessEventsLogQueue {
3636
// This backoff attempts at intervals:
3737
// 30s, 1m, 2m, 4m, 8m, 16m, 32m, ~1h, ~2h, ~4h
3838
for (let i = 0; i < requeryDelays.length; i++) {
39-
const delay = parseInt(requeryDelays[i]) * 1000;
39+
const delay = Number.parseInt(requeryDelays[i]) * 1000;
4040
const attempts = i === requeryDelays.length - 1 ? 10 : 0;
4141
await this.q.add(jobName, serialized, {
4242
delay,

src/worker/queues/process-transaction-receipts-queue.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ export class ProcessTransactionReceiptsQueue {
3636
// This backoff attempts at intervals:
3737
// 30s, 1m, 2m, 4m, 8m, 16m, 32m, ~1h, ~2h, ~4h
3838
for (let i = 0; i < requeryDelays.length; i++) {
39-
const delay = parseInt(requeryDelays[i]) * 1000;
39+
const delay = Number.parseInt(requeryDelays[i]) * 1000;
4040
const attempts = i === requeryDelays.length - 1 ? 10 : 0;
4141
await this.q.add(jobName, serialized, {
4242
delay,

src/worker/tasks/cancel-recycled-nonces-worker.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ const handler: Processor<any, void, string> = async (job: Job<string>) => {
6868
const fromRecycledNoncesKey = (key: string) => {
6969
const [_, chainId, walletAddress] = key.split(":");
7070
return {
71-
chainId: parseInt(chainId),
71+
chainId: Number.parseInt(chainId),
7272
walletAddress: walletAddress as Address,
7373
};
7474
};
@@ -89,5 +89,5 @@ const getAndDeleteRecycledNonces = async (key: string) => {
8989
throw new Error(`Error getting members of ${key}: ${error}`);
9090
}
9191
// No need to sort here as ZRANGE returns elements in ascending order
92-
return (nonces as string[]).map((v) => parseInt(v));
92+
return (nonces as string[]).map((v) => Number.parseInt(v));
9393
};

tests/e2e/.gitignore

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -71,9 +71,6 @@ web_modules/
7171

7272
.npm
7373

74-
# Optional eslint cache
75-
76-
.eslintcache
7774

7875
# Optional stylelint cache
7976

0 commit comments

Comments
 (0)