Skip to content

Commit d992e9c

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

6 files changed

+149
-154
lines changed

.eslintrc.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
module.exports = {
22
extends: ['plugin:@api3/eslint-plugin-commons/universal', 'plugin:@api3/eslint-plugin-commons/jest'],
33
parserOptions: {
4-
project: ['./tsconfig.json'],
4+
project: ['**/tsconfig.json'],
55
},
66
rules: {
77
camelcase: 'off',
Lines changed: 26 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -1,35 +1,31 @@
1-
import { DeployFunction } from 'hardhat-deploy/types';
2-
import { HardhatRuntimeEnvironment } from 'hardhat/types';
1+
import type { HardhatRuntimeEnvironment } from 'hardhat/types';
2+
import type { DeployFunction } from 'hardhat-deploy/types';
33

4-
const func: DeployFunction = async function (hre: HardhatRuntimeEnvironment) {
5-
const { deployments, getUnnamedAccounts } = hre;
6-
const { deploy, log } = deployments;
4+
export const func: DeployFunction = async function (hre: HardhatRuntimeEnvironment) {
5+
const { deployments, getUnnamedAccounts } = hre;
6+
const { deploy, log } = deployments;
77

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

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}`);
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}`);
2222

23-
await deployments
24-
.get("InverseApi3ReaderProxyV1")
25-
.catch(async () => {
26-
return deploy("InverseApi3ReaderProxyV1", {
27-
from: deployerAddress,
28-
args: [proxyAddress],
29-
log: true,
30-
});
31-
});
23+
await deployments.get('InverseApi3ReaderProxyV1').catch(async () => {
24+
return deploy('InverseApi3ReaderProxyV1', {
25+
from: deployerAddress,
26+
args: [proxyAddress],
27+
log: true,
28+
});
29+
});
3230
};
33-
34-
export default func;
35-
func.tags = ['InverseApi3ReaderProxyV1'];
31+
func.tags = ['InverseApi3ReaderProxyV1'];
Lines changed: 38 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -1,48 +1,45 @@
1-
import { DeployFunction, DeploymentsExtension } from 'hardhat-deploy/types';
2-
import { HardhatRuntimeEnvironment } from 'hardhat/types';
1+
import type { HardhatRuntimeEnvironment } from 'hardhat/types';
2+
import type { DeployFunction, 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+
export const func: DeployFunction = async function (hre: HardhatRuntimeEnvironment) {
16+
const { deployments, getUnnamedAccounts, network } = hre;
17+
const { deploy, log } = deployments;
2018

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

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

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

4-
const func: DeployFunction = async function (hre: HardhatRuntimeEnvironment) {
5-
const { deployments, getUnnamedAccounts } = hre;
6-
const { deploy, log } = deployments;
4+
export const func: DeployFunction = async function (hre: HardhatRuntimeEnvironment) {
5+
const { deployments, getUnnamedAccounts } = hre;
6+
const { deploy, log } = deployments;
77

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

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}`);
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}`);
2222

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}`);
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}`);
3131

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-
});
32+
await deployments.get('ProductApi3ReaderProxyV1').catch(async () => {
33+
return deploy('ProductApi3ReaderProxyV1', {
34+
from: deployerAddress,
35+
args: [proxy1Address, proxy2Address],
36+
log: true,
37+
});
38+
});
4139
};
42-
43-
export default func;
44-
func.tags = ['ProductApi3ReaderProxyV1'];
40+
func.tags = ['ProductApi3ReaderProxyV1'];
Lines changed: 40 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -1,51 +1,48 @@
1-
import { DeployFunction, DeploymentsExtension } from 'hardhat-deploy/types';
2-
import { HardhatRuntimeEnvironment } from 'hardhat/types';
1+
import type { HardhatRuntimeEnvironment } from 'hardhat/types';
2+
import type { DeployFunction, 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+
export const func: DeployFunction = async function (hre: HardhatRuntimeEnvironment) {
18+
const { deployments, getUnnamedAccounts, network } = hre;
19+
const { deploy, log } = deployments;
2020

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

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}`);
27+
const proxyAddress =
28+
network.name === 'hardhat' ? await deployTestProxy(deployments, deployerAddress) : process.env.PROXY;
29+
if (!proxyAddress) {
30+
throw new Error('PROXY environment variable not set. Please provide the address of the Api3ReaderProxy contract.');
31+
}
32+
if (!hre.ethers.isAddress(proxyAddress)) {
33+
throw new Error(`Invalid address provided for PROXY: ${proxyAddress}`);
34+
}
35+
log(`Proxy address: ${proxyAddress}`);
3536

36-
const decimals = process.env.DECIMALS ? parseInt(process.env.DECIMALS) : 18;
37-
log(`Decimals: ${decimals}`);
37+
const decimals = process.env.DECIMALS ? Number.parseInt(process.env.DECIMALS, 10) : 18;
38+
log(`Decimals: ${decimals}`);
3839

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-
});
40+
await deployments.get('ScaledApi3FeedProxyV1').catch(async () => {
41+
return deploy('ScaledApi3FeedProxyV1', {
42+
from: deployerAddress,
43+
args: [proxyAddress, decimals],
44+
log: true,
45+
});
46+
});
4847
};
49-
50-
export default func;
51-
func.tags = ['ScaledApi3FeedProxyV1'];
48+
func.tags = ['ScaledApi3FeedProxyV1'];

tsconfig.json

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,5 +28,14 @@
2828
"baseUrl": "./",
2929
"outDir": "./dist"
3030
},
31-
"include": ["**/*", ".eslintrc.js"]
31+
"exclude": ["dist/**/*", "node_modules/**/*"],
32+
"include": [
33+
"./deploy/**/*",
34+
"./scripts/**/*",
35+
"./src/**/*",
36+
"./test/**/*",
37+
".eslintrc.js",
38+
".solcover.js",
39+
"hardhat*.config.ts"
40+
]
3241
}

0 commit comments

Comments
 (0)