Skip to content

Commit 2eb49a0

Browse files
committed
chore: update toolshed to use latest lint config
Signed-off-by: Tomás Migone <tomas@edgeandnode.com>
1 parent a7d22d9 commit 2eb49a0

40 files changed

+226
-283
lines changed

.gitignore

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -47,20 +47,17 @@ bin/
4747

4848
# Coverage and other reports
4949
coverage/
50-
coverage/
5150
reports/
5251
coverage.json
5352
lcov.info
5453
hardhat-dependency-compiler/
5554

5655
# Local test files
57-
addresses-local.json
5856
localNetwork.json
5957
arbitrum-addresses-local.json
60-
tx-*.log
6158
addresses-fork.json
6259
addresses-hardhat.json
63-
addresses-local-network.json
60+
addresses-local*.json
6461

6562
# Keys
6663
.keystore
@@ -74,6 +71,8 @@ packages/issuance/lib/forge-std/
7471
# Graph client
7572
.graphclient
7673

74+
# Tx builder and logger
75+
tx-*.log
7776
tx-builder-*.json
7877
!tx-builder-template.json
7978

eslint.config.mjs

Lines changed: 11 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -154,15 +154,6 @@ export default [
154154
},
155155
rules: {
156156
'unused-imports/no-unused-imports': 'warn',
157-
'unused-imports/no-unused-vars': [
158-
'warn',
159-
{
160-
vars: 'all',
161-
varsIgnorePattern: '^_',
162-
args: 'after-used',
163-
argsIgnorePattern: '^_',
164-
},
165-
],
166157
},
167158
},
168159

@@ -205,8 +196,9 @@ export default [
205196
'@typescript-eslint/no-unused-vars': [
206197
'error',
207198
{
208-
varsIgnorePattern: 'Null|Active|Closed|graph|_i',
209-
argsIgnorePattern: '_',
199+
varsIgnorePattern: '^_|Null|Active|Closed|graph|_i',
200+
argsIgnorePattern: '^_',
201+
caughtErrorsIgnorePattern: '^_',
210202
},
211203
],
212204
},
@@ -231,8 +223,8 @@ export default [
231223
'no-unused-vars': [
232224
'error',
233225
{
234-
varsIgnorePattern: 'Null|Active|Closed|graph|_i',
235-
argsIgnorePattern: '_',
226+
varsIgnorePattern: '^_|Null|Active|Closed|graph|_i',
227+
argsIgnorePattern: '^_',
236228
},
237229
],
238230
},
@@ -266,12 +258,16 @@ export default [
266258
// Additional global ignores and unignores
267259
{
268260
ignores: [
269-
// Keep any patterns that might not be in .gitignore
261+
// Autogenerated GraphClient files (committed but should not be linted)
262+
'**/.graphclient-extracted/**',
263+
'**/.graphclient/**',
264+
// Third-party dependencies (Forge libraries, etc.)
265+
'**/lib/**',
270266
],
271267
},
272268

273269
// Explicitly include packages that should be linted
274270
{
275271
files: ['packages/**/*.{js,ts,cjs,mjs,jsx,tsx}'],
276272
},
277-
]
273+
]

packages/toolshed/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,4 +31,4 @@ import { hardhatBaseConfig } from '@graphprotocol/toolshed/hardhat';
3131

3232
// Import utility functions
3333
import { printBanner } from '@graphprotocol/toolshed/utils';
34-
```
34+
```

packages/toolshed/eslint.config.js

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

packages/toolshed/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131
"build": "tsc",
3232
"watch": "tsc --watch",
3333
"prepublishOnly": "tsc",
34-
"lint": "eslint '**/*.{js,ts}' --fix",
34+
"lint": "eslint --fix --cache '**/*.{js,ts,cjs,mjs,jsx,tsx}'; prettier -w --cache --log-level warn '**/*.{js,ts,cjs,mjs,jsx,tsx}'",
3535
"clean": "rm -rf dist"
3636
},
3737
"keywords": [

packages/toolshed/prettier.config.cjs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
const baseConfig = require('../../prettier.config.cjs')
2+
3+
module.exports = {
4+
...baseConfig,
5+
}

packages/toolshed/src/core/abi.ts

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,10 @@
1-
/* eslint-disable @typescript-eslint/no-unsafe-member-access */
21
// eslint-disable-next-line @typescript-eslint/no-explicit-any
32
export function mergeABIs(abi1: any[], abi2: any[]) {
43
for (const item of abi2) {
5-
if (abi1.find(v => v.name === item.name) === undefined) {
4+
if (abi1.find((v) => v.name === item.name) === undefined) {
65
abi1.push(item)
76
}
87
}
98

10-
// eslint-disable-next-line @typescript-eslint/no-unsafe-return
119
return abi1
1210
}

packages/toolshed/src/core/accounts.ts

Lines changed: 15 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,10 @@ export async function getAccounts(provider: HardhatEthersProvider): Promise<Grap
3535
governor: await getGovernor(provider, GraphAccountIndex.Governor),
3636
arbitrator: await getArbitrator(provider, GraphAccountIndex.Arbitrator),
3737
pauseGuardian: await getPauseGuardian(provider, GraphAccountIndex.PauseGuardian),
38-
subgraphAvailabilityOracle: await getSubgraphAvailabilityOracle(provider, GraphAccountIndex.SubgraphAvailabilityOracle),
38+
subgraphAvailabilityOracle: await getSubgraphAvailabilityOracle(
39+
provider,
40+
GraphAccountIndex.SubgraphAvailabilityOracle,
41+
),
3942
gateway: await getGateway(provider, GraphAccountIndex.Gateway),
4043
test: await getTestAccounts(provider),
4144
}
@@ -53,11 +56,17 @@ export async function getArbitrator(provider: HardhatEthersProvider, accountInde
5356
return _getAccount(provider, accountIndex)
5457
}
5558

56-
export async function getPauseGuardian(provider: HardhatEthersProvider, accountIndex = GraphAccountIndex.PauseGuardian) {
59+
export async function getPauseGuardian(
60+
provider: HardhatEthersProvider,
61+
accountIndex = GraphAccountIndex.PauseGuardian,
62+
) {
5763
return _getAccount(provider, accountIndex)
5864
}
5965

60-
export async function getSubgraphAvailabilityOracle(provider: HardhatEthersProvider, accountIndex = GraphAccountIndex.SubgraphAvailabilityOracle) {
66+
export async function getSubgraphAvailabilityOracle(
67+
provider: HardhatEthersProvider,
68+
accountIndex = GraphAccountIndex.SubgraphAvailabilityOracle,
69+
) {
6170
return _getAccount(provider, accountIndex)
6271
}
6372

@@ -66,15 +75,13 @@ export async function getGateway(provider: HardhatEthersProvider, accountIndex =
6675
}
6776

6877
export async function getTestAccounts(provider: HardhatEthersProvider) {
69-
const accounts = await provider.send('eth_accounts', []) as string[]
70-
const numReservedAccounts = Object.values(GraphAccountIndex).filter(v => typeof v === 'number').length
78+
const accounts = (await provider.send('eth_accounts', [])) as string[]
79+
const numReservedAccounts = Object.values(GraphAccountIndex).filter((v) => typeof v === 'number').length
7180
if (accounts.length < numReservedAccounts) {
7281
return []
7382
}
7483
return await Promise.all(
75-
accounts
76-
.slice(numReservedAccounts)
77-
.map(async account => await _getAccount(provider, account)),
84+
accounts.slice(numReservedAccounts).map(async (account) => await _getAccount(provider, account)),
7885
)
7986
}
8087

packages/toolshed/src/core/allocation.ts

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,11 @@
11
import { ethers, id } from 'ethers'
2+
23
import { randomHexBytes } from '../lib/bytes'
34

45
// For legacy allocations in the staking contract
56
export async function generateLegacyAllocationProof(indexerAddress: string, allocationPrivateKey: string) {
67
const wallet = new ethers.Wallet(allocationPrivateKey)
7-
const messageHash = ethers.solidityPackedKeccak256(
8-
['address', 'address'],
9-
[indexerAddress, wallet.address],
10-
)
8+
const messageHash = ethers.solidityPackedKeccak256(['address', 'address'], [indexerAddress, wallet.address])
119
const messageHashBytes = ethers.getBytes(messageHash)
1210
return wallet.signMessage(messageHashBytes)
1311
}

packages/toolshed/src/core/attestations.ts

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,12 @@
11
import { ethers, id, Wallet } from 'ethers'
22

3-
export const EIP712_DISPUTE_MANAGER_DOMAIN_SALT = ethers.getBytes('0xa070ffb1cd7409649bf77822cce74495468e06dbfaef09556838bf188679b9c2')
3+
export const EIP712_DISPUTE_MANAGER_DOMAIN_SALT = ethers.getBytes(
4+
'0xa070ffb1cd7409649bf77822cce74495468e06dbfaef09556838bf188679b9c2',
5+
)
46

5-
export const EIP712_ATTESTATION_PROOF_TYPEHASH = id('Receipt(bytes32 requestCID,bytes32 responseCID,bytes32 subgraphDeploymentID)')
7+
export const EIP712_ATTESTATION_PROOF_TYPEHASH = id(
8+
'Receipt(bytes32 requestCID,bytes32 responseCID,bytes32 subgraphDeploymentID)',
9+
)
610
export const EIP712_ATTESTATION_PROOF_TYPES = {
711
Receipt: [
812
{ name: 'requestCID', type: 'bytes32' },

0 commit comments

Comments
 (0)