Skip to content

Commit 09284ef

Browse files
authored
feat(eslint): properly ignore paths in ignores config (#957)
* feat(eslint): properly ignore paths Signed-off-by: Tomás Migone <[email protected]> * chore(token-distribution): apply latest linting rules Signed-off-by: Tomás Migone <[email protected]> --------- Signed-off-by: Tomás Migone <[email protected]>
1 parent fce8f74 commit 09284ef

File tree

16 files changed

+75
-57
lines changed

16 files changed

+75
-57
lines changed

packages/eslint-graph-config/README.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,12 @@ module.exports = [
4040
'@typescript-eslint/no-unsafe-argument': 'off',
4141
},
4242
},
43+
{
44+
ignores: [
45+
'library/*', // ignore its contents
46+
'!node_modules/mylibrary/' // unignore `node_modules/mylibrary` directory
47+
]
48+
}
4349
]
4450
```
4551

packages/eslint-graph-config/index.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,6 @@ export default [
3131
'no-only-tests': noOnlyTests,
3232
'no-secrets': noSecrets,
3333
},
34-
ignores: ['dist/*', 'node_modules/*', 'build/*'],
3534
rules: {
3635
'prefer-const': 'warn',
3736
'@typescript-eslint/no-inferrable-types': 'warn',
@@ -47,4 +46,7 @@ export default [
4746
'@stylistic/brace-style': ['error', '1tbs'],
4847
},
4948
},
49+
{
50+
ignores: ['**/dist/*', '**/node_modules/*', '**/build/*', '**/cache/*', '**/.graphclient/*'],
51+
},
5052
]

packages/token-distribution/deploy/1_test.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,14 @@ import { utils } from 'ethers'
22
import consola from 'consola'
33

44
import { HardhatRuntimeEnvironment } from 'hardhat/types'
5-
import { DeployFunction } from 'hardhat-deploy/types'
5+
import { DeployFunction, DeployOptions } from 'hardhat-deploy/types'
66

77
const { parseEther } = utils
88

99
const logger = consola.create({})
1010

1111
const func: DeployFunction = async function (hre: HardhatRuntimeEnvironment) {
12-
const { deploy } = hre.deployments
12+
const deploy = (name: string, options: DeployOptions) => hre.deployments.deploy(name, options)
1313
const { deployer } = await hre.getNamedAccounts()
1414

1515
// -- Fake Graph Token --

packages/token-distribution/deploy/2_l1_manager_wallet.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import { utils } from 'ethers'
33

44
import '@nomiclabs/hardhat-ethers'
55
import { HardhatRuntimeEnvironment } from 'hardhat/types'
6-
import { DeployFunction } from 'hardhat-deploy/types'
6+
import { DeployFunction, DeployOptions } from 'hardhat-deploy/types'
77

88
import { GraphTokenMock } from '../build/typechain/contracts/GraphTokenMock'
99
import { GraphTokenLockManager } from '../build/typechain/contracts/GraphTokenLockManager'
@@ -14,7 +14,7 @@ const { parseEther, formatEther } = utils
1414
const logger = consola.create({})
1515

1616
const func: DeployFunction = async function (hre: HardhatRuntimeEnvironment) {
17-
const { deploy } = hre.deployments
17+
const deploy = (name: string, options: DeployOptions) => hre.deployments.deploy(name, options)
1818
const { deployer } = await hre.getNamedAccounts()
1919

2020
// -- Graph Token --

packages/token-distribution/deploy/3_l2_wallet.ts

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,14 @@
11
import consola from 'consola'
22
import '@nomiclabs/hardhat-ethers'
33
import { HardhatRuntimeEnvironment } from 'hardhat/types'
4-
import { DeployFunction } from 'hardhat-deploy/types'
4+
import { DeployFunction, DeployOptions } from 'hardhat-deploy/types'
55

66
import { getDeploymentName } from './lib/utils'
77

8-
98
const logger = consola.create({})
109

1110
const func: DeployFunction = async function (hre: HardhatRuntimeEnvironment) {
12-
const { deploy } = hre.deployments
11+
const deploy = (name: string, options: DeployOptions) => hre.deployments.deploy(name, options)
1312
const { deployer } = await hre.getNamedAccounts()
1413

1514
// Deploy the master copy of GraphTokenLockWallet

packages/token-distribution/deploy/4_l1_transfer_tool.ts

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
import consola from 'consola'
2-
import { utils } from 'ethers'
32

43
import '@nomiclabs/hardhat-ethers'
54
import { HardhatRuntimeEnvironment } from 'hardhat/types'
@@ -50,12 +49,12 @@ const func: DeployFunction = async function (hre: HardhatRuntimeEnvironment) {
5049
owner = deployer
5150
logger.warn(`No owner address provided, will use the deployer address as owner: ${owner}`)
5251
}
53-
52+
5453
// Deploy the L1GraphTokenLockTransferTool with a proxy.
5554
// hardhat-deploy doesn't get along with constructor arguments in the implementation
5655
// combined with an OpenZeppelin transparent proxy, so we need to do this using
5756
// the OpenZeppelin hardhat-upgrades tooling, and save the deployment manually.
58-
57+
5958
// TODO modify this to use upgradeProxy if a deployment already exists?
6059
logger.info('Deploying L1GraphTokenLockTransferTool proxy...')
6160
const transferToolFactory = await ethers.getContractFactory('L1GraphTokenLockTransferTool')

packages/token-distribution/deploy/5_l2_manager.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import { utils } from 'ethers'
33

44
import '@nomiclabs/hardhat-ethers'
55
import { HardhatRuntimeEnvironment } from 'hardhat/types'
6-
import { DeployFunction } from 'hardhat-deploy/types'
6+
import { DeployFunction, DeployOptions } from 'hardhat-deploy/types'
77

88
import { GraphTokenMock } from '../build/typechain/contracts/GraphTokenMock'
99
import { askConfirm, getDeploymentName, promptContractAddress } from './lib/utils'
@@ -14,7 +14,7 @@ const { parseEther, formatEther } = utils
1414
const logger = consola.create({})
1515

1616
const func: DeployFunction = async function (hre: HardhatRuntimeEnvironment) {
17-
const { deploy } = hre.deployments
17+
const deploy = (name: string, options: DeployOptions) => hre.deployments.deploy(name, options)
1818
const { deployer } = await hre.getNamedAccounts()
1919

2020
// -- Graph Token --

packages/token-distribution/deploy/6_l2_transfer_tool.ts

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
import consola from 'consola'
2-
import { utils } from 'ethers'
32

43
import '@nomiclabs/hardhat-ethers'
54
import { HardhatRuntimeEnvironment } from 'hardhat/types'
@@ -18,8 +17,6 @@ const artifacts = new Artifacts(ARTIFACTS_PATH)
1817
const l2TransferToolAbi = artifacts.readArtifactSync('L2GraphTokenLockTransferTool').abi
1918

2019
const func: DeployFunction = async function (hre: HardhatRuntimeEnvironment) {
21-
const { deployer } = await hre.getNamedAccounts()
22-
2320
// -- Graph Token --
2421

2522
// Get the addresses we will use
@@ -40,12 +37,12 @@ const func: DeployFunction = async function (hre: HardhatRuntimeEnvironment) {
4037
logger.warn('No L1 GRT address provided')
4138
process.exit(1)
4239
}
43-
40+
4441
// Deploy the L2GraphTokenLockTransferTool with a proxy.
4542
// hardhat-deploy doesn't get along with constructor arguments in the implementation
4643
// combined with an OpenZeppelin transparent proxy, so we need to do this using
4744
// the OpenZeppelin hardhat-upgrades tooling, and save the deployment manually.
48-
45+
4946
// TODO modify this to use upgradeProxy if a deployment already exists?
5047
logger.info('Deploying L2GraphTokenLockTransferTool proxy...')
5148
const transferToolFactory = await ethers.getContractFactory('L2GraphTokenLockTransferTool')

packages/token-distribution/deploy/lib/utils.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,10 @@ export const askConfirm = async (message: string) => {
1212
type: 'confirm',
1313
message,
1414
})
15-
return res.confirm
15+
return res.confirm ? res.confirm as boolean : false
1616
}
1717

18-
export const promptContractAddress = async (name: string, logger: Consola): Promise<string|null> => {
18+
export const promptContractAddress = async (name: string, logger: Consola): Promise<string | null> => {
1919
const res1 = await inquirer.prompt({
2020
name: 'contract',
2121
type: 'input',
@@ -37,5 +37,5 @@ export const getDeploymentName = async (defaultName: string): Promise<string> =>
3737
default: defaultName,
3838
message: 'Save deployment as?',
3939
})
40-
return res['deployment-name']
40+
return res['deployment-name'] as string
4141
}

packages/token-distribution/hardhat.config.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,7 @@ function setupNetworkConfig(config) {
8080

8181
// Env
8282

83+
// eslint-disable-next-line @typescript-eslint/no-misused-promises
8384
extendEnvironment(async (hre) => {
8485
const accounts = await hre.ethers.getSigners()
8586
try {
@@ -152,7 +153,6 @@ const config = {
152153
},
153154
},
154155
etherscan: {
155-
//url: process.env.ETHERSCAN_API_URL,
156156
apiKey: process.env.ETHERSCAN_API_KEY,
157157
customChains: [
158158
{
@@ -163,7 +163,7 @@ const config = {
163163
browserURL: 'https://sepolia.arbiscan.io',
164164
},
165165
},
166-
]
166+
],
167167
},
168168
typechain: {
169169
outDir: 'build/typechain/contracts',

0 commit comments

Comments
 (0)