Skip to content

Commit af815e3

Browse files
committed
chore: fixed linting, using BiomeJS for JS/TS and solhint/prettier for Solidity
1 parent 0896c69 commit af815e3

37 files changed

+773
-1425
lines changed

.eslintrc.json

Lines changed: 0 additions & 38 deletions
This file was deleted.

.prettierrc.json

Lines changed: 0 additions & 15 deletions
This file was deleted.

.vscode/settings.json

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,11 @@
11
{
2-
"files.associations": {
3-
"*.css": "tailwindcss"
4-
}
5-
}
2+
"files.associations": {
3+
"*.css": "tailwindcss"
4+
},
5+
"editor.defaultFormatter": "biomejs.biome",
6+
"editor.formatOnSave": true,
7+
"editor.codeActionsOnSave": {
8+
"source.organizeImports.biome": true,
9+
"quickfix.biome": true
10+
}
11+
}

biome/biome.base.json

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
{
2+
"$schema": "https://biomejs.dev/schemas/1.6.1/schema.json",
3+
"organizeImports": {
4+
"enabled": true
5+
},
6+
"linter": {
7+
"enabled": true,
8+
"rules": {
9+
"recommended": true,
10+
"correctness": {
11+
"noUnusedVariables": "error"
12+
},
13+
"suspicious": {
14+
"noExplicitAny": "error"
15+
},
16+
"style": {
17+
"noNonNullAssertion": "error"
18+
}
19+
}
20+
},
21+
"formatter": {
22+
"enabled": true,
23+
"formatWithErrors": false,
24+
"indentStyle": "space",
25+
"indentWidth": 2,
26+
"lineWidth": 100,
27+
"ignore": []
28+
},
29+
"javascript": {
30+
"formatter": {
31+
"quoteStyle": "double",
32+
"trailingComma": "es5",
33+
"semicolons": "always"
34+
}
35+
}
36+
}

contracts/.prettierrc.json

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
{
2+
"htmlWhitespaceSensitivity": "css",
3+
"printWidth": 120,
4+
"trailingComma": "es5",
5+
"plugins": [
6+
"prettier-plugin-solidity"
7+
],
8+
"overrides": [
9+
{
10+
"files": "*.sol",
11+
"options": {
12+
"parser": "solidity-parse",
13+
"printWidth": 120,
14+
"tabWidth": 4,
15+
"useTabs": false,
16+
"singleQuote": false,
17+
"bracketSpacing": false
18+
}
19+
}
20+
]
21+
}

.solhint.json renamed to contracts/.solhint.json

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,15 @@
44
"prettier"
55
],
66
"rules": {
7+
"compiler-version": [
8+
"error",
9+
"^0.7.0 || ^0.8.0"
10+
],
711
"prettier/prettier": "error",
812
"max-line-length": "off",
913
"check-send-result": "off",
1014
"not-rely-on-time": "off",
1115
"multiple-sends": "off",
12-
"compiler-version": "off",
1316
"quotes": "warn",
1417
"func-visibility": [
1518
"error",
@@ -18,4 +21,4 @@
1821
}
1922
]
2023
}
21-
}
24+
}

contracts/biome.json

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
{
2+
"extends": [
3+
"../biome/biome.base.json"
4+
],
5+
"files": {
6+
"ignore": [
7+
"src/**/*",
8+
"test/**",
9+
"typechain/**/*",
10+
"node_modules/**",
11+
"artifacts/**",
12+
"cache/**",
13+
"coverage/**"
14+
]
15+
}
16+
}

contracts/deploy/01-home-proxy.js

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,9 @@ async function deployHomeProxy({ deployments, getChainId, ethers, config, networ
1111
const { deploy } = deployments;
1212
const chainId = await getChainId();
1313
const proxyConfigs = [arbitrumProxy, gnosisProxy, optimismProxy, polygonProxy, zksyncProxy];
14-
const proxyConfig = proxyConfigs.find((config) => config.supportedChainIds.includes(Number(chainId)));
14+
const proxyConfig = proxyConfigs.find((config) =>
15+
config.supportedChainIds.includes(Number(chainId))
16+
);
1517
if (!proxyConfig) {
1618
throw new Error(`No home proxy configuration supports chain ID ${chainId}`);
1719
}
@@ -44,6 +46,7 @@ async function deployHomeProxy({ deployments, getChainId, ethers, config, networ
4446
}
4547

4648
deployHomeProxy.tags = ["HomeChain"];
47-
deployHomeProxy.skip = async ({ getChainId }) => !HOME_CHAIN_IDS.includes(Number(await getChainId()));
49+
deployHomeProxy.skip = async ({ getChainId }) =>
50+
!HOME_CHAIN_IDS.includes(Number(await getChainId()));
4851

4952
module.exports = deployHomeProxy;

contracts/deploy/02-foreign-proxy.js

Lines changed: 20 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,16 +13,26 @@ const loserAppealPeriodMultiplier = 5000;
1313
async function getHomeDeployments({ companionNetworks, homeNetworkName, homeChainId }) {
1414
let homeNetwork;
1515
for await (const [key, network] of Object.entries(companionNetworks))
16-
if (key.startsWith("home") && String(await network.getChainId()) === String(homeChainId)) homeNetwork = network;
16+
if (key.startsWith("home") && String(await network.getChainId()) === String(homeChainId))
17+
homeNetwork = network;
1718
if (!homeNetwork) throw new Error(`Home network ${homeNetworkName} not configured correctly`);
1819
return homeNetwork.deployments;
1920
}
2021

21-
async function deployForeignProxy({ deployments, getChainId, ethers, companionNetworks, config, network }) {
22+
async function deployForeignProxy({
23+
deployments,
24+
getChainId,
25+
ethers,
26+
companionNetworks,
27+
config,
28+
network,
29+
}) {
2230
const homeNetworkName = process.env.HOME_NETWORK;
2331
if (!homeNetworkName) throw new Error("HOME_NETWORK environment variable must be set");
2432
const proxyConfigs = [arbitrumProxy, gnosisProxy, optimismProxy, polygonProxy, zksyncProxy];
25-
const proxyConfig = proxyConfigs.find((config) => config.supportedHomeChains.includes(homeNetworkName));
33+
const proxyConfig = proxyConfigs.find((config) =>
34+
config.supportedHomeChains.includes(homeNetworkName)
35+
);
2636
if (!proxyConfig) {
2737
throw new Error(`No foreign proxy configuration supports home network ${homeNetworkName}`);
2838
}
@@ -37,7 +47,11 @@ async function deployForeignProxy({ deployments, getChainId, ethers, companionNe
3747
const parameters = proxyConfig.foreignParameters[homeNetworkName];
3848
const homeProxyName = proxyConfig.getHomeProxyName(homeNetworkName);
3949
const homeChainId = config.networks[homeNetworkName].chainId;
40-
const homeDeployments = await getHomeDeployments({ companionNetworks, homeNetworkName, homeChainId });
50+
const homeDeployments = await getHomeDeployments({
51+
companionNetworks,
52+
homeNetworkName,
53+
homeChainId,
54+
});
4155
const homeProxy = await homeDeployments.get(homeProxyName).then((homeProxy) => homeProxy.address);
4256

4357
const foreignProxy = await proxyConfig.deployForeignProxy({
@@ -56,6 +70,7 @@ async function deployForeignProxy({ deployments, getChainId, ethers, companionNe
5670
}
5771

5872
deployForeignProxy.tags = ["ForeignChain"];
59-
deployForeignProxy.skip = async ({ getChainId }) => !FOREIGN_CHAIN_IDS.includes(Number(await getChainId()));
73+
deployForeignProxy.skip = async ({ getChainId }) =>
74+
!FOREIGN_CHAIN_IDS.includes(Number(await getChainId()));
6075

6176
module.exports = deployForeignProxy;

contracts/deploy/foreign/arbitrum.js

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,16 @@ const foreignParameters = {
1515
},
1616
};
1717

18-
async function deployForeignProxy({ deploy, from, parameters, homeNetworkName, homeProxy, arbitrator, courts, multipliers }) {
18+
async function deployForeignProxy({
19+
deploy,
20+
from,
21+
parameters,
22+
homeNetworkName,
23+
homeProxy,
24+
arbitrator,
25+
courts,
26+
multipliers,
27+
}) {
1928
const { numberOfJurors, inbox } = parameters;
2029
const metaEvidence = getMetaEvidenceCID(homeNetworkName);
2130
const arbitratorExtraData = encodeExtraData(courts.oracle, numberOfJurors);

0 commit comments

Comments
 (0)