Skip to content

Commit 62c5878

Browse files
committed
fix linting and prettier configs
1 parent 4744a6f commit 62c5878

File tree

11 files changed

+173
-209
lines changed

11 files changed

+173
-209
lines changed

.eslintrc.js

Lines changed: 3 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -15,20 +15,7 @@ module.exports = {
1515
"plugin:import/typescript",
1616
"plugin:@typescript-eslint/recommended",
1717
"plugin:prettier/recommended",
18-
"prettier/@typescript-eslint",
18+
"prettier",
1919
],
20-
ignorePatterns: ["build/", "node_modules/", "!.prettierrc.js"],
21-
rules: {
22-
"import/order": [
23-
"error",
24-
{
25-
"newlines-between": "always",
26-
alphabetize: {
27-
order: "asc",
28-
},
29-
},
30-
],
31-
"@typescript-eslint/no-explicit-any": "off",
32-
"@typescript-eslint/no-empty-function": "off",
33-
},
34-
};
20+
ignorePatterns: ["build/", "node_modules/", "coverage/", ".openzeppelin"],
21+
}

.prettierrc.json

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
{
2+
"tabWidth": 2,
3+
"semi": false,
4+
"trailingComma": "es5"
5+
}

.solcover.js

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,7 @@
11
module.exports = {
2-
skipFiles: [
3-
"test/Mock.sol",
4-
"test/TestAvatar.sol",
5-
"test/TestContract.sol",
6-
"test/TestFactory.sol",
7-
"test/MultiSend.sol",
8-
],
2+
skipFiles: ["test/TestToken.sol"],
93
mocha: {
104
grep: "@skip-on-coverage", // Find everything with this tag
115
invert: true, // Run the grep's inverse set.
126
},
13-
};
7+
}

README.md

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,3 @@ All contracts are WITHOUT ANY WARRANTY; without even the implied warranty of MER
7777
### License
7878

7979
Created under the [LGPL-3.0+ license](LICENSE).
80-
81-
```
82-
83-
```

contracts/test/TestToken.sol

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import "@openzeppelin/contracts/token/ERC20/ERC20.sol";
66
contract TestToken is ERC20 {
77
address public owner;
88

9-
uint8 tokenDecimals;
9+
uint8 internal tokenDecimals;
1010

1111
constructor(uint8 _decimals) ERC20("Test", "T") {
1212
owner = msg.sender;

hardhat.config.ts

Lines changed: 24 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -1,58 +1,57 @@
1-
import "@typechain/hardhat";
2-
import "@nomiclabs/hardhat-ethers";
3-
import "@nomiclabs/hardhat-waffle";
4-
import "@nomiclabs/hardhat-etherscan";
5-
import "@openzeppelin/hardhat-upgrades";
6-
import "solidity-coverage";
7-
import "hardhat-deploy";
8-
import "hardhat-gas-reporter";
9-
import dotenv from "dotenv";
10-
import yargs from "yargs";
11-
import { HttpNetworkUserConfig } from "hardhat/types";
1+
import "@typechain/hardhat"
2+
import "@nomiclabs/hardhat-ethers"
3+
import "@nomiclabs/hardhat-waffle"
4+
import "@nomiclabs/hardhat-etherscan"
5+
import "@openzeppelin/hardhat-upgrades"
6+
import "solidity-coverage"
7+
import "hardhat-deploy"
8+
import "hardhat-gas-reporter"
9+
import dotenv from "dotenv"
10+
import { HttpNetworkUserConfig } from "hardhat/types"
11+
import yargs from "yargs"
1212

1313
const argv = yargs
1414
.option("network", {
1515
type: "string",
1616
default: "hardhat",
1717
})
1818
.help(false)
19-
.version(false).argv as { network: string };
19+
.version(false).argv as { network: string }
2020

2121
// Load environment variables.
22-
dotenv.config();
23-
const { INFURA_KEY, MNEMONIC, ETHERSCAN_API_KEY, PK } = process.env;
22+
dotenv.config()
23+
const { INFURA_KEY, MNEMONIC, ETHERSCAN_API_KEY, PK } = process.env
2424

25-
import "./src/tasks/initialDeploy";
26-
import "./src/tasks/upgrade";
27-
import "./src/tasks/verify";
25+
import "./src/tasks/initialDeploy"
26+
import "./src/tasks/upgrade"
27+
import "./src/tasks/verify"
2828

2929
const DEFAULT_MNEMONIC =
30-
"candy maple cake sugar pudding cream honey rich smooth crumble sweet treat";
30+
"candy maple cake sugar pudding cream honey rich smooth crumble sweet treat"
3131

32-
const sharedNetworkConfig: HttpNetworkUserConfig = {};
32+
const sharedNetworkConfig: HttpNetworkUserConfig = {}
3333
if (PK) {
34-
sharedNetworkConfig.accounts = [PK];
34+
sharedNetworkConfig.accounts = [PK]
3535
} else {
3636
sharedNetworkConfig.accounts = {
3737
mnemonic: MNEMONIC || DEFAULT_MNEMONIC,
38-
};
38+
}
3939
}
4040

4141
if (["rinkeby", "mainnet"].includes(argv.network) && INFURA_KEY === undefined) {
4242
throw new Error(
4343
`Could not find Infura key in env, unable to connect to network ${argv.network}`
44-
);
44+
)
4545
}
4646

4747
export default {
4848
paths: {
4949
artifacts: "build/artifacts",
5050
cache: "build/cache",
51-
deploy: "src/deploy",
5251
sources: "contracts",
5352
},
5453
solidity: {
55-
compilers: [{ version: "0.8.6" }, { version: "0.6.12" }],
54+
compilers: [{ version: "0.8.6" }],
5655
settings: {
5756
optimizer: {
5857
enabled: true,
@@ -86,12 +85,4 @@ export default {
8685
etherscan: {
8786
apiKey: ETHERSCAN_API_KEY,
8887
},
89-
gasReporter: {
90-
// @ts-ignore-next-line
91-
proxyResolver(transaction) {
92-
throw transaction;
93-
// @ts-ignore-next-line
94-
console.log(this.data);
95-
},
96-
},
97-
};
88+
}

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
"lint:sol": "solhint 'contracts/**/*.sol'",
1818
"lint:ts": "eslint --max-warnings 0 .",
1919
"fmt:sol": "prettier 'contracts/**/*.sol' -w",
20+
"fmt:ts": "prettier '(src|test)/**/*.ts' -w",
2021
"prepack": "yarn build",
2122
"prepare": "husky install"
2223
},

src/tasks/initialDeploy.ts

Lines changed: 14 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,6 @@
1-
import "hardhat-deploy";
2-
import "@nomiclabs/hardhat-ethers";
3-
import { task, types } from "hardhat/config";
4-
5-
interface TokenLockArgs {
6-
owner: string;
7-
token: string;
8-
depositDeadline: number;
9-
lockDuration: number;
10-
name: string;
11-
symbol: string;
12-
}
1+
import "hardhat-deploy"
2+
import "@nomiclabs/hardhat-ethers"
3+
import { task, types } from "hardhat/config"
134

145
task("initialDeploy", "Deploys a fresh TokenLock contract")
156
.addParam("owner", "Address of the owner", undefined, types.string)
@@ -39,28 +30,28 @@ task("initialDeploy", "Deploys a fresh TokenLock contract")
3930
types.string
4031
)
4132
.setAction(async (taskArgs, hre) => {
42-
const [caller] = await hre.ethers.getSigners();
43-
console.log("Using the account:", caller.address);
44-
const TokenLock = await hre.ethers.getContractFactory("TokenLock");
33+
const [caller] = await hre.ethers.getSigners()
34+
console.log("Using the account:", caller.address)
35+
const TokenLock = await hre.ethers.getContractFactory("TokenLock")
4536
const tokenLock = await hre.upgrades.deployProxy(TokenLock, [
4637
taskArgs.owner,
4738
taskArgs.token,
4839
taskArgs.depositDeadline,
4940
taskArgs.lockDuration,
5041
taskArgs.name,
5142
taskArgs.symbol,
52-
]);
43+
])
5344

54-
console.log("TokenLock proxy deployed to:", tokenLock.address);
55-
console.log("Waiting for deploy transaction to be mined...");
45+
console.log("TokenLock proxy deployed to:", tokenLock.address)
46+
console.log("Waiting for deploy transaction to be mined...")
5647

57-
await tokenLock.deployed();
48+
await tokenLock.deployed()
5849
const implementationAddress =
59-
await hre.upgrades.erc1967.getImplementationAddress(tokenLock.address);
50+
await hre.upgrades.erc1967.getImplementationAddress(tokenLock.address)
6051
console.log(
6152
"Using the logic implementation contract deployed at:",
6253
implementationAddress
63-
);
64-
});
54+
)
55+
})
6556

66-
export {};
57+
export {}

src/tasks/upgrade.ts

Lines changed: 11 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
import "hardhat-deploy";
2-
import "@nomiclabs/hardhat-ethers";
1+
import "hardhat-deploy"
2+
import "@nomiclabs/hardhat-ethers"
33

4-
import { task, types } from "hardhat/config";
4+
import { task, types } from "hardhat/config"
55

66
task("upgrade", "Upgrades the logic of an existing TokenLock contract")
77
.addParam(
@@ -11,21 +11,18 @@ task("upgrade", "Upgrades the logic of an existing TokenLock contract")
1111
types.string
1212
)
1313
.setAction(async (taskArgs, hre) => {
14-
const [caller] = await hre.ethers.getSigners();
15-
console.log("Using the account:", caller.address);
16-
const TokenLock = await hre.ethers.getContractFactory("TokenLock");
17-
const tokenLock = await hre.upgrades.upgradeProxy(
18-
taskArgs.proxy,
19-
TokenLock
20-
);
14+
const [caller] = await hre.ethers.getSigners()
15+
console.log("Using the account:", caller.address)
16+
const TokenLock = await hre.ethers.getContractFactory("TokenLock")
17+
const tokenLock = await hre.upgrades.upgradeProxy(taskArgs.proxy, TokenLock)
2118

2219
console.log(
2320
`Latest version of the implementation deployed to: ${tokenLock.address}`
24-
);
21+
)
2522

2623
console.log(
2724
`Proxy at ${taskArgs.proxy} upgraded to use implementation at ${tokenLock.address}`
28-
);
29-
});
25+
)
26+
})
3027

31-
export {};
28+
export {}

src/tasks/verify.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { task, types } from "hardhat/config";
1+
import { task, types } from "hardhat/config"
22

33
task("verifyEtherscan", "Verifies the contract on etherscan")
44
.addParam(
@@ -11,5 +11,5 @@ task("verifyEtherscan", "Verifies the contract on etherscan")
1111
await hardhatRuntime.run("verify", {
1212
address: taskArgs.contract,
1313
constructorArgsParams: [],
14-
});
15-
});
14+
})
15+
})

0 commit comments

Comments
 (0)