Skip to content

Commit e33887e

Browse files
committed
Update linter and formatter
1 parent 9d80a71 commit e33887e

File tree

69 files changed

+2033
-2043
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

69 files changed

+2033
-2043
lines changed

.eslintrc.js

+10-12
Original file line numberDiff line numberDiff line change
@@ -4,19 +4,17 @@ module.exports = {
44
es6: true,
55
node: true,
66
},
7-
plugins: ['prettier'],
8-
extends: [
9-
'eslint:recommended',
10-
'plugin:prettier/recommended', // Enables eslint-plugin-prettier and displays prettier errors as ESLint errors. Make sure this is always the last configuration in the extends array.
11-
],
7+
extends: ['@offchainlabs/eslint-config-typescript/base'],
128
parserOptions: {
139
ecmaVersion: 2018, // Allows for the parsing of modern ECMAScript features
1410
sourceType: 'module', // Allows for the use of imports
1511
},
16-
rules: {
17-
'prettier/prettier': 'error',
18-
'no-unused-vars': 'off',
19-
'prefer-const': [2, { destructuring: 'all' }],
20-
'object-curly-spacing': ['error', 'always'],
21-
},
22-
}
12+
overrides: [
13+
{
14+
files: ['*.js', '*.ts'],
15+
rules: {
16+
'@typescript-eslint/no-var-requires': 'off',
17+
},
18+
},
19+
],
20+
};

.github/workflows/format.yml

+22
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
name: Check format
2+
run-name: Checking format
3+
4+
on:
5+
pull_request:
6+
branches:
7+
- master
8+
9+
jobs:
10+
check-formatting:
11+
name: "Check Formatting"
12+
runs-on: ubuntu-latest
13+
needs: install
14+
steps:
15+
- name: Checkout files
16+
uses: actions/checkout@v4
17+
18+
- name: Install node_modules
19+
uses: OffchainLabs/actions/node-modules/install@main
20+
21+
- name: Check formatting with Prettier
22+
run: yarn format:check

.github/workflows/test-all.yml

+5-5
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,12 @@ on:
77
- master
88

99
env:
10-
PRIVATE_KEY: "b6b15c8cb491557369f3c7d2c287b053eb229daa9c22138887752191c9520659"
11-
CHAIN_RPC: "http://127.0.0.1:3347"
12-
PARENT_CHAIN_RPC: "http://127.0.0.1:8547"
10+
PRIVATE_KEY: 'b6b15c8cb491557369f3c7d2c287b053eb229daa9c22138887752191c9520659'
11+
CHAIN_RPC: 'http://127.0.0.1:3347'
12+
PARENT_CHAIN_RPC: 'http://127.0.0.1:8547'
1313
# Env variables for specific tutorials
14-
L1_RPC: "http://127.0.0.1:8545"
15-
TransferTo: "0x3f1Eae7D46d88F08fc2F8ed27FCb2AB183EB2d0E"
14+
L1_RPC: 'http://127.0.0.1:8545'
15+
TransferTo: '0x3f1Eae7D46d88F08fc2F8ed27FCb2AB183EB2d0E'
1616

1717
jobs:
1818
test-all:

.prettierrc.js

+2-12
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,12 @@
11
module.exports = {
2-
semi: false,
3-
trailingComma: 'es5',
4-
singleQuote: true,
5-
printWidth: 80,
6-
tabWidth: 2,
7-
arrowParens: 'avoid',
8-
bracketSpacing: true,
2+
...require('@offchainlabs/prettier-config'),
93
overrides: [
104
{
115
files: '*.sol',
126
options: {
13-
printWidth: 100,
147
tabWidth: 4,
15-
useTabs: false,
168
singleQuote: false,
17-
bracketSpacing: true,
18-
explicitTypes: 'always',
199
},
2010
},
2111
],
22-
}
12+
};

package.json

+12-6
Original file line numberDiff line numberDiff line change
@@ -12,17 +12,23 @@
1212
},
1313
"scripts": {
1414
"lint": "eslint .",
15-
"format": "prettier './**/*.{js,json,md,yml,sol}' --write && yarn run lint --fix",
15+
"prettier:format": "prettier './**/*.{js,json,md,sol,ts,yml}' --write && yarn run lint --fix",
16+
"prettier:check": "prettier './**/*.{js,json,md,sol,ts,yml}' --check && yarn run lint",
1617
"testAll": "tests/runAll.sh"
1718
},
1819
"devDependencies": {
20+
"@offchainlabs/eslint-config-typescript": "^0.2.1",
21+
"@offchainlabs/prettier-config": "0.2.1",
22+
"@typescript-eslint/eslint-plugin": "^5.62.0",
23+
"@typescript-eslint/parser": "^5.62.0",
1924
"chai": "^4.3.4",
20-
"eslint": "^8.15.0",
21-
"eslint-config-prettier": "^8.3.0",
25+
"eslint": "^8.57.0",
26+
"eslint-config-prettier": "^8.10.0",
27+
"eslint-plugin-jest": "^27.9.0",
2228
"eslint-plugin-mocha": "^9.0.0",
23-
"eslint-plugin-prettier": "^4.0.0",
24-
"prettier": "^2.3.2",
25-
"prettier-plugin-solidity": "^1.0.0-beta.17"
29+
"eslint-plugin-prettier": "^4.2.0",
30+
"prettier": "^2.8.8",
31+
"prettier-plugin-solidity": "^1.4.2"
2632
},
2733
"dependencies": {
2834
"@arbitrum/sdk": "^4.0.1",
+3-3
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
require('@nomiclabs/hardhat-ethers')
2-
const { hardhatConfig } = require('arb-shared-dependencies')
1+
require('@nomiclabs/hardhat-ethers');
2+
const { hardhatConfig } = require('arb-shared-dependencies');
33

4-
module.exports = hardhatConfig
4+
module.exports = hardhatConfig;
+35-43
Original file line numberDiff line numberDiff line change
@@ -1,83 +1,75 @@
1-
const { providers, Wallet } = require('ethers')
2-
const hre = require('hardhat')
1+
const { providers, Wallet } = require('ethers');
2+
const hre = require('hardhat');
33
const {
44
ArbAddressTable__factory,
5-
} = require('@arbitrum/sdk/dist/lib/abi/factories/ArbAddressTable__factory')
6-
const { arbLog, requireEnvVariables } = require('arb-shared-dependencies')
7-
const {
8-
ARB_ADDRESS_TABLE_ADDRESS,
9-
} = require('@arbitrum/sdk/dist/lib/dataEntities/constants')
10-
require('dotenv').config()
11-
requireEnvVariables(['PRIVATE_KEY', 'CHAIN_RPC'])
5+
} = require('@arbitrum/sdk/dist/lib/abi/factories/ArbAddressTable__factory');
6+
const { arbLog, requireEnvVariables } = require('arb-shared-dependencies');
7+
const { ARB_ADDRESS_TABLE_ADDRESS } = require('@arbitrum/sdk/dist/lib/dataEntities/constants');
8+
require('dotenv').config();
9+
requireEnvVariables(['PRIVATE_KEY', 'CHAIN_RPC']);
1210

1311
/**
1412
* Set up: instantiate wallets connected to providers
1513
*/
16-
const walletPrivateKey = process.env.PRIVATE_KEY
17-
const provider = new providers.JsonRpcProvider(process.env.CHAIN_RPC)
18-
const wallet = new Wallet(walletPrivateKey, provider)
14+
const walletPrivateKey = process.env.PRIVATE_KEY;
15+
const provider = new providers.JsonRpcProvider(process.env.CHAIN_RPC);
16+
const wallet = new Wallet(walletPrivateKey, provider);
1917

2018
async function main() {
21-
await arbLog('Using the Address Table')
19+
await arbLog('Using the Address Table');
2220

2321
/**
2422
* Deploy ArbitrumVIP contract
2523
*/
2624
const ArbitrumVIPContract = await (
2725
await hre.ethers.getContractFactory('ArbitrumVIP')
28-
).connect(wallet)
29-
console.log('Deploying ArbitrumVIP contract...')
30-
const arbitrumVIP = await ArbitrumVIPContract.deploy()
31-
await arbitrumVIP.deployed()
32-
console.log('ArbitrumVIP deployed to:', arbitrumVIP.address)
26+
).connect(wallet);
27+
console.log('Deploying ArbitrumVIP contract...');
28+
const arbitrumVIP = await ArbitrumVIPContract.deploy();
29+
await arbitrumVIP.deployed();
30+
console.log('ArbitrumVIP deployed to:', arbitrumVIP.address);
3331

34-
const myAddress = wallet.address
32+
const myAddress = wallet.address;
3533

3634
/**
3735
* Connect to the Arbitrum Address table pre-compile contract
3836
*/
39-
const arbAddressTable = ArbAddressTable__factory.connect(
40-
ARB_ADDRESS_TABLE_ADDRESS,
41-
wallet
42-
)
37+
const arbAddressTable = ArbAddressTable__factory.connect(ARB_ADDRESS_TABLE_ADDRESS, wallet);
4338

44-
//**
45-
/* Let's find out if our address is registered in the table:
39+
/**
40+
* Let's find out if our address is registered in the table:
4641
*/
47-
const addressIsRegistered = await arbAddressTable.addressExists(myAddress)
42+
const addressIsRegistered = await arbAddressTable.addressExists(myAddress);
4843

4944
if (!addressIsRegistered) {
50-
//**
51-
/* If it isn't registered yet, let's register it!
45+
/**
46+
* If it isn't registered yet, let's register it!
5247
*/
53-
54-
const txnRes = await arbAddressTable.register(myAddress)
55-
const txnRec = await txnRes.wait()
56-
console.log(`Successfully registered address ${myAddress} to address table`)
48+
const txnRes = await arbAddressTable.register(myAddress);
49+
await txnRes.wait();
50+
console.log(`Successfully registered address ${myAddress} to address table`);
5751
} else {
58-
console.log(`Address ${myAddress} already (previously) registered to table`)
52+
console.log(`Address ${myAddress} already (previously) registered to table`);
5953
}
6054
/**
6155
* Now that we know it's registered, let's go ahead and retrieve its index
6256
*/
63-
const addressIndex = await arbAddressTable.lookup(myAddress)
57+
const addressIndex = await arbAddressTable.lookup(myAddress);
6458

6559
/**
6660
* From here on out we can use this index instead of our address as a parameter into any contract with affordances to look up out address in the address data.
6761
*/
6862

69-
const txnRes = await arbitrumVIP.addVIPPoints(addressIndex)
70-
await txnRes.wait()
63+
const txnRes = await arbitrumVIP.addVIPPoints(addressIndex);
64+
await txnRes.wait();
7165
/**
7266
* We got VIP points, and we minimized the calldata required, saving us precious gas. Yay rollups!
7367
*/
74-
console.log(
75-
`Successfully added VIP points using address w/ index ${addressIndex.toNumber()}`
76-
)
68+
console.log(`Successfully added VIP points using address w/ index ${addressIndex.toNumber()}`);
7769
}
7870
main()
7971
.then(() => process.exit(0))
80-
.catch(error => {
81-
console.error(error)
82-
process.exit(1)
83-
})
72+
.catch((error) => {
73+
console.error(error);
74+
process.exit(1);
75+
});

packages/arb-shared-dependencies/hardhat.config.js

+4-8
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
require('dotenv').config()
1+
require('dotenv').config();
22
module.exports = {
33
solidity: {
44
compilers: [
@@ -20,15 +20,11 @@ module.exports = {
2020
gas: 2100000,
2121
gasLimit: 0,
2222
url: process.env['L1RPC'] || '',
23-
accounts: process.env['DEVNET_PRIVKEY']
24-
? [process.env['DEVNET_PRIVKEY']]
25-
: [],
23+
accounts: process.env['DEVNET_PRIVKEY'] ? [process.env['DEVNET_PRIVKEY']] : [],
2624
},
2725
l2: {
2826
url: process.env['L2RPC'] || '',
29-
accounts: process.env['DEVNET_PRIVKEY']
30-
? [process.env['DEVNET_PRIVKEY']]
31-
: [],
27+
accounts: process.env['DEVNET_PRIVKEY'] ? [process.env['DEVNET_PRIVKEY']] : [],
3228
},
3329
parent_chain: {
3430
gas: 2100000,
@@ -41,4 +37,4 @@ module.exports = {
4137
accounts: process.env['PRIVATE_KEY'] ? [process.env['PRIVATE_KEY']] : [],
4238
},
4339
},
44-
}
40+
};
+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
declare module 'arb-shared-dependencies'
1+
declare module 'arb-shared-dependencies';

0 commit comments

Comments
 (0)