Skip to content

Commit

Permalink
chore(subgraph-service): add lint staged
Browse files Browse the repository at this point in the history
Signed-off-by: Tomás Migone <[email protected]>
  • Loading branch information
tmigone committed Mar 18, 2024
1 parent ecd9767 commit f1daade
Show file tree
Hide file tree
Showing 7 changed files with 335 additions and 42 deletions.
8 changes: 7 additions & 1 deletion .husky/pre-commit
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,11 @@
. "$(dirname -- "$0")/_/husky.sh"

# contracts
cd packages/contracts
pushd packages/contracts
npx --no-install lint-staged
popd

# subgraph service
pushd packages/subgraph-service
npx --no-install lint-staged
popd
2 changes: 1 addition & 1 deletion packages/sdk/src/deployments/lib/address-book.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ export abstract class AddressBook<
* @throws AssertionError if the target file is not a valid address book
* @throws Error if the target file does not exist
*/
constructor(_file: string, _chainId: number, strictAssert: boolean = false) {
constructor(_file: string, _chainId: number, strictAssert = false) {
this.strictAssert = strictAssert
this.file = _file
if (!fs.existsSync(this.file)) throw new Error(`Address book path provided does not exist!`)
Expand Down
4 changes: 2 additions & 2 deletions packages/sdk/src/deployments/network/actions/staking.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ export const allocateFrom: GraphNetworkAction<{
const metadata = ethers.constants.HashZero

console.log(`\nAllocating ${amount} tokens on ${allocationId}...`)
let extraArgs: ethers.Overrides = {}
const extraArgs: ethers.Overrides = {}
if (process.env.CI) {
extraArgs.gasLimit = BigNumber.from('400000')
}
Expand All @@ -59,7 +59,7 @@ export const allocateFrom: GraphNetworkAction<{
allocationId,
metadata,
proof,
extraArgs
extraArgs,
)
await tx.wait()
}
Expand Down
6 changes: 3 additions & 3 deletions packages/subgraph-service/contracts/SubgraphService.sol
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
// SPDX-License-Identifier: GPL-3.0
pragma solidity >=0.4.0 <0.9.0;

import { Test } from "@graphprotocol/contracts/contracts/staking/IHorizonStaking.sol";
import {Test} from "@graphprotocol/contracts/contracts/staking/IHorizonStaking.sol";

contract SimpleTest is Test {
function test() external {}
}
function test() external {}
}
15 changes: 15 additions & 0 deletions packages/subgraph-service/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,24 @@
"ethers": "^6.4.0",
"hardhat": "^2.20.1",
"hardhat-gas-reporter": "^1.0.8",
"lint-staged": "^15.2.2",
"solidity-coverage": "^0.8.0",
"ts-node": ">=8.0.0",
"typechain": "^8.3.0",
"typescript": "^5.3.3"
},
"lint-staged": {
"contracts/**/*.sol": [
"yarn lint:sol"
],
"**/*.ts": [
"yarn lint:ts"
],
"**/*.js": [
"yarn lint:ts"
],
"**/*.json": [
"yarn lint:ts"
]
}
}
14 changes: 0 additions & 14 deletions packages/subgraph-service/test/Lock.ts
Original file line number Diff line number Diff line change
Expand Up @@ -71,20 +71,6 @@ describe('Lock', function () {
)
})

it('Should revert with the right error if called from another account', async function () {
const { lock, unlockTime, otherAccount } = await loadFixture(
deployOneYearLockFixture,
)

// We can increase the time in Hardhat Network
await time.increaseTo(unlockTime)

// We use lock.connect() to send a transaction from another account
await expect(lock.connect(otherAccount).withdraw()).to.be.revertedWith(
'You aren\'t the owner',
)
})

it('Shouldn\'t fail if the unlockTime has arrived and the owner calls it', async function () {
const { lock, unlockTime } = await loadFixture(
deployOneYearLockFixture,
Expand Down
Loading

0 comments on commit f1daade

Please sign in to comment.