Skip to content

Commit fe1e330

Browse files
committed
Fix linting & run linter in CI
1 parent ecef4a2 commit fe1e330

File tree

8 files changed

+46
-44
lines changed

8 files changed

+46
-44
lines changed

.circleci/config.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,9 @@ jobs:
2424
- run:
2525
name: Transpile Contracts
2626
command: yarn build
27+
- run:
28+
name: Lint
29+
command: yarn lint
2730
- save_cache:
2831
key: compiled-env-{{ .Environment.CIRCLE_SHA1 }}
2932
paths:

package.json

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,9 @@
4040
"transpile-dist": "tsc -p tsconfig.dist.json",
4141
"typechain": "npx hardhat typechain"
4242
},
43+
"resolutions": {
44+
"ganache-cli": "6.12.2"
45+
},
4346
"repository": {
4447
"type": "git",
4548
"url": "git+https://github.com/SetProtocol/index-coop-contracts.git"
@@ -77,8 +80,8 @@
7780
"solidity-coverage": "^0.7.13",
7881
"ts-generator": "^0.1.1",
7982
"ts-node": "^8.10.1",
80-
"tslint": "^5.8.0",
81-
"tslint-eslint-rules": "^5.3.1",
83+
"tslint": "^6.1.3",
84+
"tslint-eslint-rules": "^5.4.0",
8285
"typescript": "^3.9.3"
8386
},
8487
"dependencies": {

tasks/subtasks.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
import {
22
TASK_COMPILE_SOLIDITY_COMPILE,
3-
TASK_TEST_SETUP_TEST_ENVIRONMENT,
43
TASK_COMPILE_SOLIDITY_GET_ARTIFACT_FROM_COMPILATION_OUTPUT,
54
} from "hardhat/builtin-tasks/task-names";
65

test/token/otcEscrow.spec.ts

Lines changed: 20 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ describe("OtcEscrow", () => {
2424
let owner: Account;
2525
let indexGov: Account;
2626
let investor: Account;
27-
27+
2828
let deployer: DeployHelper;
2929
let index: IndexToken;
3030
let usdc: StandardTokenMock;
@@ -33,15 +33,15 @@ describe("OtcEscrow", () => {
3333
[
3434
owner,
3535
indexGov,
36-
investor
36+
investor,
3737
] = await getAccounts();
3838

3939
deployer = new DeployHelper(owner.wallet);
4040

4141
index = await deployer.token.deployIndexToken(owner.address);
4242
await index.transfer(indexGov.address, ether(1000));
4343
usdc = await deployer.mocks.deployStandardTokenMock(owner.address, 6);
44-
await usdc.transfer(investor.address, BigNumber.from(1_000_000 * 10**6));
44+
await usdc.transfer(investor.address, BigNumber.from(1_000_000 * 10 ** 6));
4545
});
4646

4747
addSnapshotBeforeRestoreAfterEach();
@@ -55,11 +55,11 @@ describe("OtcEscrow", () => {
5555
let subjectIndexAmount: BigNumber;
5656

5757
beforeEach(async () => {
58-
const now = await getLastBlockTimestamp()
58+
const now = await getLastBlockTimestamp();
5959
subjectVestingStart = now;
6060
subjectVestingCliff = now.add(60 * 60 * 24 * 183);
6161
subjectVestingEnd = now.add(60 * 60 * 24 * 547);
62-
subjectUSDCAmount = BigNumber.from(100_000 * 10**6);
62+
subjectUSDCAmount = BigNumber.from(100_000 * 10 ** 6);
6363
subjectIndexAmount = ether(100);
6464
});
6565

@@ -102,11 +102,11 @@ describe("OtcEscrow", () => {
102102
let subjectIndexAmount: BigNumber;
103103

104104
beforeEach(async () => {
105-
const now = await getLastBlockTimestamp()
105+
const now = await getLastBlockTimestamp();
106106
subjectVestingStart = now.add(10);
107107
subjectVestingCliff = now.add(60 * 60 * 24 * 183);
108108
subjectVestingEnd = now.add(60 * 60 * 24 * 547);
109-
subjectUSDCAmount = BigNumber.from(100_000 * 10**6);
109+
subjectUSDCAmount = BigNumber.from(100_000 * 10 ** 6);
110110
subjectIndexAmount = ether(100);
111111

112112
subjectOtcEscrow = await deployer.token.deployOtcEscrow(
@@ -120,7 +120,7 @@ describe("OtcEscrow", () => {
120120
usdc.address,
121121
index.address
122122
);
123-
123+
124124
await index.connect(indexGov.wallet).transfer(subjectOtcEscrow.address, subjectIndexAmount);
125125
await usdc.connect(investor.wallet).approve(subjectOtcEscrow.address, subjectUSDCAmount);
126126
});
@@ -149,6 +149,7 @@ describe("OtcEscrow", () => {
149149
it("it should transfer index to the vesting contract", async () => {
150150
await subject();
151151

152+
// tslint:disable-next-line:no-null-keyword
152153
const vestingDeployed = (await subjectOtcEscrow.queryFilter(subjectOtcEscrow.filters.VestingDeployed(null)))[0];
153154
const vestingAddress = vestingDeployed.args?.vesting;
154155

@@ -158,6 +159,7 @@ describe("OtcEscrow", () => {
158159
it("it should set the state variables of the vesting contract correctly", async () => {
159160
await subject();
160161

162+
// tslint:disable-next-line:no-null-keyword
161163
const vestingDeployed = (await subjectOtcEscrow.queryFilter(subjectOtcEscrow.filters.VestingDeployed(null)))[0];
162164
const vestingAddress = vestingDeployed.args?.vesting;
163165

@@ -202,7 +204,7 @@ describe("OtcEscrow", () => {
202204
usdc.address,
203205
index.address
204206
);
205-
207+
206208
await index.connect(indexGov.wallet).transfer(subjectOtcEscrow.address, ether(50));
207209
await usdc.connect(investor.wallet).approve(subjectOtcEscrow.address, subjectUSDCAmount);
208210
});
@@ -224,9 +226,9 @@ describe("OtcEscrow", () => {
224226
});
225227

226228
context("when the sender does not have enough USDC", async () => {
227-
229+
228230
beforeEach(async () => {
229-
231+
230232
subjectOtcEscrow = await deployer.token.deployOtcEscrow(
231233
await getRandomAddress(),
232234
indexGov.address,
@@ -238,7 +240,7 @@ describe("OtcEscrow", () => {
238240
usdc.address,
239241
index.address
240242
);
241-
243+
242244
await index.connect(indexGov.wallet).transfer(subjectOtcEscrow.address, subjectIndexAmount);
243245
await usdc.connect(investor.wallet).approve(subjectOtcEscrow.address, subjectUSDCAmount);
244246
});
@@ -259,7 +261,7 @@ describe("OtcEscrow", () => {
259261
}
260262

261263
it("should revert", async () => {
262-
264+
263265
await expect(subject()).to.be.revertedWith("swap already executed");
264266
});
265267
});
@@ -275,11 +277,11 @@ describe("OtcEscrow", () => {
275277
let subjectIndexAmount: BigNumber;
276278

277279
beforeEach(async () => {
278-
const now = await getLastBlockTimestamp()
280+
const now = await getLastBlockTimestamp();
279281
subjectVestingStart = now.add(10);
280282
subjectVestingCliff = now.add(60 * 60 * 24 * 183);
281283
subjectVestingEnd = now.add(60 * 60 * 24 * 547);
282-
subjectUSDCAmount = BigNumber.from(100_000 * 10**6);
284+
subjectUSDCAmount = BigNumber.from(100_000 * 10 ** 6);
283285
subjectIndexAmount = ether(100);
284286

285287
subjectOtcEscrow = await deployer.token.deployOtcEscrow(
@@ -293,7 +295,7 @@ describe("OtcEscrow", () => {
293295
usdc.address,
294296
index.address
295297
);
296-
298+
297299
await index.connect(indexGov.wallet).transfer(subjectOtcEscrow.address, subjectIndexAmount);
298300
await usdc.connect(investor.wallet).approve(subjectOtcEscrow.address, subjectUSDCAmount);
299301
});
@@ -337,11 +339,11 @@ describe("OtcEscrow", () => {
337339
let subjectIndexAmount: BigNumber;
338340

339341
beforeEach(async () => {
340-
const now = await getLastBlockTimestamp()
342+
const now = await getLastBlockTimestamp();
341343
subjectVestingStart = now.add(10);
342344
subjectVestingCliff = now.add(60 * 60 * 24 * 183);
343345
subjectVestingEnd = now.add(60 * 60 * 24 * 547);
344-
subjectUSDCAmount = BigNumber.from(100_000 * 10**6);
346+
subjectUSDCAmount = BigNumber.from(100_000 * 10 ** 6);
345347
subjectIndexAmount = ether(100);
346348

347349
subjectOtcEscrow = await deployer.token.deployOtcEscrow(

utils/common/protocolUtils.ts

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,6 @@
11
import { JsonRpcProvider, Web3Provider } from "@ethersproject/providers";
22

3-
import { BigNumber } from "@ethersproject/bignumber";
4-
import { ethers, constants } from "ethers";
5-
6-
import { EMPTY_BYTES } from "../constants";
7-
import { Address } from "../types";
8-
9-
const { AddressZero } = constants;
3+
import { ethers } from "ethers";
104

115
export class ProtocolUtils {
126
public _provider: Web3Provider | JsonRpcProvider;
@@ -20,10 +14,10 @@ export class ProtocolUtils {
2014
throw new Error("Invalid transaction hash");
2115
}
2216

23-
const abi = ['event SetTokenCreated(address indexed _setToken, address _manager, string _name, string _symbol)'];
17+
const abi = ["event SetTokenCreated(address indexed _setToken, address _manager, string _name, string _symbol)"];
2418
const iface = new ethers.utils.Interface(abi);
2519

26-
const topic = ethers.utils.id('SetTokenCreated(address,address,string,string)');
20+
const topic = ethers.utils.id("SetTokenCreated(address,address,string,string)");
2721
const logs = await this._provider.getLogs({
2822
fromBlock: "latest",
2923
toBlock: "latest",

utils/contracts.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,5 +4,5 @@ export { RewardsDistributionRecipient } from "../typechain/RewardsDistributionRe
44
export { StakingRewards } from "../typechain/StakingRewards";
55
export { StakingRewardsV2 } from "../typechain/StakingRewardsV2";
66
export { Vesting } from "../typechain/Vesting";
7-
export { OtcEscrow } from "../typechain/OtcEscrow"
7+
export { OtcEscrow } from "../typechain/OtcEscrow";
88
export { IndexPowah } from "../typechain/IndexPowah";

utils/merkleUtils/merkleTree.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,7 @@ export default class MerkleTree {
9999
if (pairIdx < layer.length) {
100100
return layer[pairIdx];
101101
} else {
102+
// tslint:disable-next-line:no-null-keyword
102103
return null;
103104
}
104105
}

yarn.lock

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -4138,10 +4138,10 @@ functional-red-black-tree@^1.0.1, functional-red-black-tree@~1.0.1:
41384138
resolved "https://registry.yarnpkg.com/functional-red-black-tree/-/functional-red-black-tree-1.0.1.tgz#1b0ab3bd553b2a0d6399d29c0e3ea0b252078327"
41394139
integrity sha1-GwqzvVU7Kg1jmdKcDj6gslIHgyc=
41404140

4141-
ganache-cli@^6.11.0:
4142-
version "6.12.1"
4143-
resolved "https://registry.yarnpkg.com/ganache-cli/-/ganache-cli-6.12.1.tgz#148cf6541494ef1691bd68a77e4414981910cb3e"
4144-
integrity sha512-zoefZLQpQyEJH9jgtVYgM+ENFLAC9iwys07IDCsju2Ieq9KSTLH89RxSP4bhizXKV/h/+qaWpfyCBGWnBfqgIQ==
4141+
ganache-cli@6.12.2, ganache-cli@^6.11.0:
4142+
version "6.12.2"
4143+
resolved "https://registry.yarnpkg.com/ganache-cli/-/ganache-cli-6.12.2.tgz#c0920f7db0d4ac062ffe2375cb004089806f627a"
4144+
integrity sha512-bnmwnJDBDsOWBUP8E/BExWf85TsdDEFelQSzihSJm9VChVO1SHp94YXLP5BlA4j/OTxp0wR4R1Tje9OHOuAJVw==
41454145
dependencies:
41464146
ethereumjs-util "6.2.1"
41474147
source-map-support "0.5.12"
@@ -5999,7 +5999,7 @@ mkdirp@*:
59995999
resolved "https://registry.yarnpkg.com/mkdirp/-/mkdirp-1.0.4.tgz#3eb5ed62622756d79a5f0e2a221dfebad75c2f7e"
60006000
integrity sha512-vVqVZQyf3WLx2Shd0qJ9xuvqgAyKPLAiqITEtqW0oIUjzo3PePDd6fW9iFz30ef7Ysp/oiWqbhszeGWW2T6Gzw==
60016001

6002-
mkdirp@0.5.5, mkdirp@0.5.x, mkdirp@^0.5.0, mkdirp@^0.5.1:
6002+
mkdirp@0.5.5, mkdirp@0.5.x, mkdirp@^0.5.0, mkdirp@^0.5.1, mkdirp@^0.5.3:
60036003
version "0.5.5"
60046004
resolved "https://registry.yarnpkg.com/mkdirp/-/mkdirp-0.5.5.tgz#d91cefd62d1436ca0f41620e251288d420099def"
60056005
integrity sha512-NKmAlESf6jMGym1++R0Ra7wvhV+wFW63FaSOFPwRahvea0gMUcGUhVeAg/0BC0wiv9ih5NYPB1Wn1UEI1/L+xQ==
@@ -8267,12 +8267,12 @@ tslib@1.9.0:
82678267
resolved "https://registry.yarnpkg.com/tslib/-/tslib-1.9.0.tgz#e37a86fda8cbbaf23a057f473c9f4dc64e5fc2e8"
82688268
integrity sha512-f/qGG2tUkrISBlQZEjEqoZ3B2+npJjIf04H1wuAv9iA8i04Icp+61KRXxFdha22670NJopsZCIjhC3SnjPRKrQ==
82698269

8270-
tslib@^1.8.0, tslib@^1.8.1, tslib@^1.9.0, tslib@^1.9.3:
8270+
tslib@^1.13.0, tslib@^1.8.1, tslib@^1.9.0, tslib@^1.9.3:
82718271
version "1.14.1"
82728272
resolved "https://registry.yarnpkg.com/tslib/-/tslib-1.14.1.tgz#cf2d38bdc34a134bcaf1091c41f6619e2f672d00"
82738273
integrity sha512-Xni35NKzjgMrwevysHTCArtLDpPvye8zV/0E4EyYn43P7/7qvQwPh9BGkHewbMulVntbigmcT7rdX3BNo9wRJg==
82748274

8275-
tslint-eslint-rules@^5.3.1:
8275+
tslint-eslint-rules@^5.4.0:
82768276
version "5.4.0"
82778277
resolved "https://registry.yarnpkg.com/tslint-eslint-rules/-/tslint-eslint-rules-5.4.0.tgz#e488cc9181bf193fe5cd7bfca213a7695f1737b5"
82788278
integrity sha512-WlSXE+J2vY/VPgIcqQuijMQiel+UtmXS+4nvK4ZzlDiqBfXse8FAvkNnTcYhnQyOTW5KFM+uRRGXxYhFpuBc6w==
@@ -8281,10 +8281,10 @@ tslint-eslint-rules@^5.3.1:
82818281
tslib "1.9.0"
82828282
tsutils "^3.0.0"
82838283

8284-
tslint@^5.8.0:
8285-
version "5.20.1"
8286-
resolved "https://registry.yarnpkg.com/tslint/-/tslint-5.20.1.tgz#e401e8aeda0152bc44dd07e614034f3f80c67b7d"
8287-
integrity sha512-EcMxhzCFt8k+/UP5r8waCf/lzmeSyVlqxqMEDQE7rWYiQky8KpIBz1JAoYXfROHrPZ1XXd43q8yQnULOLiBRQg==
8284+
tslint@^6.1.3:
8285+
version "6.1.3"
8286+
resolved "https://registry.yarnpkg.com/tslint/-/tslint-6.1.3.tgz#5c23b2eccc32487d5523bd3a470e9aa31789d904"
8287+
integrity sha512-IbR4nkT96EQOvKE2PW/djGz8iGNeJ4rF2mBfiYaR/nvUWYKJhLwimoJKgjIFEIDibBtOevj7BqCRL4oHeWWUCg==
82888288
dependencies:
82898289
"@babel/code-frame" "^7.0.0"
82908290
builtin-modules "^1.1.1"
@@ -8294,10 +8294,10 @@ tslint@^5.8.0:
82948294
glob "^7.1.1"
82958295
js-yaml "^3.13.1"
82968296
minimatch "^3.0.4"
8297-
mkdirp "^0.5.1"
8297+
mkdirp "^0.5.3"
82988298
resolve "^1.3.2"
82998299
semver "^5.3.0"
8300-
tslib "^1.8.0"
8300+
tslib "^1.13.0"
83018301
tsutils "^2.29.0"
83028302

83038303
tsort@0.0.1:

0 commit comments

Comments
 (0)