Skip to content

Commit a0a65c3

Browse files
committed
Fixes eslint parser config
1 parent 0a179e2 commit a0a65c3

8 files changed

+324
-325
lines changed

.eslintrc.js

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,14 @@
11
module.exports = {
2-
extends: ['plugin:@api3/eslint-plugin-commons/universal', 'plugin:@api3/eslint-plugin-commons/jest'],
2+
root: true,
3+
parser: '@typescript-eslint/parser',
4+
plugins: ['@typescript-eslint'],
35
parserOptions: {
4-
project: ['./tsconfig.json'],
6+
project: './tsconfig.json',
57
},
8+
extends: [
9+
'plugin:@api3/eslint-plugin-commons/universal',
10+
'plugin:@api3/eslint-plugin-commons/jest',
11+
],
612
rules: {
713
camelcase: 'off',
814
'no-nested-ternary': 'off',
@@ -26,4 +32,5 @@ module.exports = {
2632
'@typescript-eslint/no-unsafe-call': 'off',
2733
'@typescript-eslint/require-await': 'off',
2834
},
35+
ignorePatterns: ['typechain-types/*'],
2936
};
Lines changed: 24 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -1,35 +1,29 @@
1-
import { DeployFunction } from 'hardhat-deploy/types';
2-
import { HardhatRuntimeEnvironment } from 'hardhat/types';
1+
import type { HardhatRuntimeEnvironment } from 'hardhat/types';
32

4-
const func: DeployFunction = async function (hre: HardhatRuntimeEnvironment) {
5-
const { deployments, getUnnamedAccounts } = hre;
6-
const { deploy, log } = deployments;
3+
module.exports = async ({ getUnnamedAccounts, deployments, ethers }: HardhatRuntimeEnvironment) => {
4+
const { deploy, log } = deployments;
75

8-
const [deployerAddress] = await getUnnamedAccounts();
9-
if (!deployerAddress) {
10-
throw new Error("No deployer address found.");
11-
}
12-
log(`Deployer address: ${deployerAddress}`);
6+
const [deployerAddress] = await getUnnamedAccounts();
7+
if (!deployerAddress) {
8+
throw new Error('No deployer address found.');
9+
}
10+
log(`Deployer address: ${deployerAddress}`);
1311

14-
const proxyAddress = process.env.PROXY;
15-
if (!proxyAddress) {
16-
throw new Error("PROXY environment variable not set. Please provide the address of the proxy contract.");
17-
}
18-
if (!hre.ethers.isAddress(proxyAddress)) {
19-
throw new Error(`Invalid address provided for PROXY: ${proxyAddress}`);
20-
}
21-
log(`Proxy address: ${proxyAddress}`);
12+
const proxyAddress = process.env.PROXY;
13+
if (!proxyAddress) {
14+
throw new Error('PROXY environment variable not set. Please provide the address of the proxy contract.');
15+
}
16+
if (!ethers.isAddress(proxyAddress)) {
17+
throw new Error(`Invalid address provided for PROXY: ${proxyAddress}`);
18+
}
19+
log(`Proxy address: ${proxyAddress}`);
2220

23-
await deployments
24-
.get("InverseApi3ReaderProxyV1")
25-
.catch(async () => {
26-
return deploy("InverseApi3ReaderProxyV1", {
27-
from: deployerAddress,
28-
args: [proxyAddress],
29-
log: true,
30-
});
31-
});
21+
await deployments.get('InverseApi3ReaderProxyV1').catch(async () => {
22+
return deploy('InverseApi3ReaderProxyV1', {
23+
from: deployerAddress,
24+
args: [proxyAddress],
25+
log: true,
26+
});
27+
});
3228
};
33-
34-
export default func;
35-
func.tags = ['InverseApi3ReaderProxyV1'];
29+
module.exports.tags = ['InverseApi3ReaderProxyV1'];
Lines changed: 37 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -1,48 +1,44 @@
1-
import { DeployFunction, DeploymentsExtension } from 'hardhat-deploy/types';
2-
import { HardhatRuntimeEnvironment } from 'hardhat/types';
1+
import type { HardhatRuntimeEnvironment } from 'hardhat/types';
2+
import type { DeploymentsExtension } from 'hardhat-deploy/types';
33

44
const deployTestFeed = async (deployments: DeploymentsExtension, deployerAddress: string) => {
5-
const { address: scaledApi3FeedProxyV1Address } = await deployments
6-
.get("ScaledApi3FeedProxyV1")
7-
.catch(async () => {
8-
return deployments.deploy("ScaledApi3FeedProxyV1", {
9-
from: deployerAddress,
10-
args: ["0x5b0cf2b36a65a6BB085D501B971e4c102B9Cd473", 8],
11-
log: true,
12-
});
13-
});
14-
return scaledApi3FeedProxyV1Address;
15-
}
5+
const { address: scaledApi3FeedProxyV1Address } = await deployments.get('ScaledApi3FeedProxyV1').catch(async () => {
6+
return deployments.deploy('ScaledApi3FeedProxyV1', {
7+
from: deployerAddress,
8+
args: ['0x5b0cf2b36a65a6BB085D501B971e4c102B9Cd473', 8],
9+
log: true,
10+
});
11+
});
12+
return scaledApi3FeedProxyV1Address;
13+
};
1614

17-
const func: DeployFunction = async function (hre: HardhatRuntimeEnvironment) {
18-
const { deployments, getUnnamedAccounts, network } = hre;
19-
const { deploy, log } = deployments;
15+
module.exports = async ({ getUnnamedAccounts, deployments, network, ethers }: HardhatRuntimeEnvironment) => {
16+
const { deploy, log } = deployments;
2017

21-
const [deployerAddress] = await getUnnamedAccounts();
22-
if (!deployerAddress) {
23-
throw new Error("No deployer address found.");
24-
}
25-
log(`Deployer address: ${deployerAddress}`);
18+
const [deployerAddress] = await getUnnamedAccounts();
19+
if (!deployerAddress) {
20+
throw new Error('No deployer address found.');
21+
}
22+
log(`Deployer address: ${deployerAddress}`);
2623

27-
const feedAddress = network.name !== "hardhat" ? process.env.FEED : await deployTestFeed(deployments, deployerAddress);
28-
if (!feedAddress) {
29-
throw new Error("FEED environment variable not set. Please provide the address of the AggregatorV2V3Interface contract.");
30-
}
31-
if (!hre.ethers.isAddress(feedAddress)) {
32-
throw new Error(`Invalid address provided for FEED: ${feedAddress}`);
33-
}
34-
log(`Feed address: ${feedAddress}`);
24+
const feedAddress =
25+
network.name === 'hardhat' ? await deployTestFeed(deployments, deployerAddress) : process.env.FEED;
26+
if (!feedAddress) {
27+
throw new Error(
28+
'FEED environment variable not set. Please provide the address of the AggregatorV2V3Interface contract.'
29+
);
30+
}
31+
if (!ethers.isAddress(feedAddress)) {
32+
throw new Error(`Invalid address provided for FEED: ${feedAddress}`);
33+
}
34+
log(`Feed address: ${feedAddress}`);
3535

36-
await deployments
37-
.get("NormalizedApi3ReaderProxyV1")
38-
.catch(async () => {
39-
return deploy("NormalizedApi3ReaderProxyV1", {
40-
from: deployerAddress,
41-
args: [feedAddress],
42-
log: true,
43-
});
44-
});
36+
await deployments.get('NormalizedApi3ReaderProxyV1').catch(async () => {
37+
return deploy('NormalizedApi3ReaderProxyV1', {
38+
from: deployerAddress,
39+
args: [feedAddress],
40+
log: true,
41+
});
42+
});
4543
};
46-
47-
export default func;
48-
func.tags = ['NormalizedApi3ReaderProxyV1'];
44+
module.exports.tags = ['NormalizedApi3ReaderProxyV1'];
Lines changed: 32 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -1,44 +1,38 @@
1-
import { DeployFunction } from 'hardhat-deploy/types';
2-
import { HardhatRuntimeEnvironment } from 'hardhat/types';
1+
import type { HardhatRuntimeEnvironment } from 'hardhat/types';
32

4-
const func: DeployFunction = async function (hre: HardhatRuntimeEnvironment) {
5-
const { deployments, getUnnamedAccounts } = hre;
6-
const { deploy, log } = deployments;
3+
module.exports = async ({ getUnnamedAccounts, deployments, ethers }: HardhatRuntimeEnvironment) => {
4+
const { deploy, log } = deployments;
75

8-
const [deployerAddress] = await getUnnamedAccounts();
9-
if (!deployerAddress) {
10-
throw new Error("No deployer address found.");
11-
}
12-
log(`Deployer address: ${deployerAddress}`);
6+
const [deployerAddress] = await getUnnamedAccounts();
7+
if (!deployerAddress) {
8+
throw new Error('No deployer address found.');
9+
}
10+
log(`Deployer address: ${deployerAddress}`);
1311

14-
const proxy1Address = process.env.PROXY1;
15-
if (!proxy1Address) {
16-
throw new Error("PROXY1 environment variable not set. Please provide the address of the first proxy contract.");
17-
}
18-
if (!hre.ethers.isAddress(proxy1Address)) {
19-
throw new Error(`Invalid address provided for PROXY1: ${proxy1Address}`);
20-
}
21-
log(`Proxy 1 address: ${proxy1Address}`);
12+
const proxy1Address = process.env.PROXY1;
13+
if (!proxy1Address) {
14+
throw new Error('PROXY1 environment variable not set. Please provide the address of the first proxy contract.');
15+
}
16+
if (!ethers.isAddress(proxy1Address)) {
17+
throw new Error(`Invalid address provided for PROXY1: ${proxy1Address}`);
18+
}
19+
log(`Proxy 1 address: ${proxy1Address}`);
2220

23-
const proxy2Address = process.env.PROXY2;
24-
if (!proxy2Address) {
25-
throw new Error("PROXY2 environment variable not set. Please provide the address of the second proxy contract.");
26-
}
27-
if (!hre.ethers.isAddress(proxy2Address)) {
28-
throw new Error(`Invalid address provided for PROXY2: ${proxy2Address}`);
29-
}
30-
log(`Proxy 2 address: ${proxy2Address}`);
21+
const proxy2Address = process.env.PROXY2;
22+
if (!proxy2Address) {
23+
throw new Error('PROXY2 environment variable not set. Please provide the address of the second proxy contract.');
24+
}
25+
if (!ethers.isAddress(proxy2Address)) {
26+
throw new Error(`Invalid address provided for PROXY2: ${proxy2Address}`);
27+
}
28+
log(`Proxy 2 address: ${proxy2Address}`);
3129

32-
await deployments
33-
.get("ProductApi3ReaderProxyV1")
34-
.catch(async () => {
35-
return deploy("ProductApi3ReaderProxyV1", {
36-
from: deployerAddress,
37-
args: [proxy1Address, proxy2Address],
38-
log: true,
39-
});
40-
});
30+
await deployments.get('ProductApi3ReaderProxyV1').catch(async () => {
31+
return deploy('ProductApi3ReaderProxyV1', {
32+
from: deployerAddress,
33+
args: [proxy1Address, proxy2Address],
34+
log: true,
35+
});
36+
});
4137
};
42-
43-
export default func;
44-
func.tags = ['ProductApi3ReaderProxyV1'];
38+
module.exports.tags = ['ProductApi3ReaderProxyV1'];
Lines changed: 42 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -1,51 +1,50 @@
1-
import { DeployFunction, DeploymentsExtension } from 'hardhat-deploy/types';
2-
import { HardhatRuntimeEnvironment } from 'hardhat/types';
1+
import type { HardhatRuntimeEnvironment } from 'hardhat/types';
2+
import type { DeploymentsExtension } from 'hardhat-deploy/types';
33

44
const deployTestProxy = async (deployments: DeploymentsExtension, deployerAddress: string) => {
5-
const { address: inverseApi3ReaderProxyV1Address } = await deployments
6-
.get("InverseApi3ReaderProxyV1")
7-
.catch(async () => {
8-
return deployments.deploy("InverseApi3ReaderProxyV1", {
9-
from: deployerAddress,
10-
args: ["0x5b0cf2b36a65a6BB085D501B971e4c102B9Cd473"],
11-
log: true,
12-
});
13-
});
14-
return inverseApi3ReaderProxyV1Address;
15-
}
5+
const { address: inverseApi3ReaderProxyV1Address } = await deployments
6+
.get('InverseApi3ReaderProxyV1')
7+
.catch(async () => {
8+
return deployments.deploy('InverseApi3ReaderProxyV1', {
9+
from: deployerAddress,
10+
args: ['0x5b0cf2b36a65a6BB085D501B971e4c102B9Cd473'],
11+
log: true,
12+
});
13+
});
14+
return inverseApi3ReaderProxyV1Address;
15+
};
1616

17-
const func: DeployFunction = async function (hre: HardhatRuntimeEnvironment) {
18-
const { deployments, getUnnamedAccounts, network } = hre;
19-
const { deploy, log } = deployments;
17+
module.exports = async ({ getUnnamedAccounts, deployments, network, ethers }: HardhatRuntimeEnvironment) => {
18+
const { deploy, log } = deployments;
2019

21-
const [deployerAddress] = await getUnnamedAccounts();
22-
if (!deployerAddress) {
23-
throw new Error("No deployer address found.");
24-
}
25-
log(`Deployer address: ${deployerAddress}`);
20+
const [deployerAddress] = await getUnnamedAccounts();
21+
if (!deployerAddress) {
22+
throw new Error('No deployer address found.');
23+
}
24+
log(`Deployer address: ${deployerAddress}`);
2625

27-
const proxyAddress = network.name !== "hardhat" ? process.env.PROXY : await deployTestProxy(deployments, deployerAddress);
28-
if (!proxyAddress) {
29-
throw new Error("PROXY environment variable not set. Please provide the address of the Api3ReaderProxy contract.");
30-
}
31-
if (!hre.ethers.isAddress(proxyAddress)) {
32-
throw new Error(`Invalid address provided for PROXY: ${proxyAddress}`);
33-
}
34-
log(`Proxy address: ${proxyAddress}`);
26+
if (!process.env.DECIMALS) {
27+
throw new Error('DECIMALS environment variable not set. Please provide the number of decimals to use.');
28+
}
29+
const decimals = Number.parseInt(process.env.DECIMALS, 10);
30+
log(`Decimals: ${decimals}`);
3531

36-
const decimals = process.env.DECIMALS ? parseInt(process.env.DECIMALS) : 18;
37-
log(`Decimals: ${decimals}`);
32+
const proxyAddress =
33+
network.name === 'hardhat' ? await deployTestProxy(deployments, deployerAddress) : process.env.PROXY;
34+
if (!proxyAddress) {
35+
throw new Error('PROXY environment variable not set. Please provide the address of the Api3ReaderProxy contract.');
36+
}
37+
if (!ethers.isAddress(proxyAddress)) {
38+
throw new Error(`Invalid address provided for PROXY: ${proxyAddress}`);
39+
}
40+
log(`Proxy address: ${proxyAddress}`);
3841

39-
await deployments
40-
.get("ScaledApi3FeedProxyV1")
41-
.catch(async () => {
42-
return deploy("ScaledApi3FeedProxyV1", {
43-
from: deployerAddress,
44-
args: [proxyAddress, decimals],
45-
log: true,
46-
});
47-
});
42+
await deployments.get('ScaledApi3FeedProxyV1').catch(async () => {
43+
return deploy('ScaledApi3FeedProxyV1', {
44+
from: deployerAddress,
45+
args: [proxyAddress, decimals],
46+
log: true,
47+
});
48+
});
4849
};
49-
50-
export default func;
51-
func.tags = ['ScaledApi3FeedProxyV1'];
50+
module.exports.tags = ['ScaledApi3FeedProxyV1'];

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@
4747
"@typescript-eslint/eslint-plugin": "^7.18.0",
4848
"@typescript-eslint/parser": "^7.18.0",
4949
"chai": "^4.5.0",
50-
"eslint": "8.57.0",
50+
"eslint": "8.57.1",
5151
"ethers": "^6.14.0",
5252
"glob": "^11.0.2",
5353
"hardhat": "^2.24.0",

0 commit comments

Comments
 (0)