Skip to content

Commit

Permalink
foundry vscode integration settings (#1485)
Browse files Browse the repository at this point in the history
* remappings.tsx for vscode intellisense

* onsave formatting with prettier and forge

* remove .vscode dir

* implement husky and lint staged for sol files

* move precommit logic from core/ to root
  • Loading branch information
Intizar-T authored May 14, 2024
1 parent 39eb117 commit ee7f616
Show file tree
Hide file tree
Showing 7 changed files with 30 additions and 11 deletions.
2 changes: 1 addition & 1 deletion core/.husky/pre-commit → .husky/pre-commit
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/bin/env sh
. "$(dirname -- "$0")/_/husky.sh"

cd core && yarn lint && yarn test
npx lint-staged --allow-empty
6 changes: 6 additions & 0 deletions contracts/v0.2/remappings.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
@openzeppelin/contracts/=lib/openzeppelin-contracts/contracts/
ds-test/=lib/forge-std/lib/ds-test/src/
erc4626-tests/=lib/openzeppelin-contracts/lib/erc4626-tests/
forge-std/=lib/forge-std/src/
openzeppelin-contracts/=lib/openzeppelin-contracts/
solidity-stringutils/=lib/solidity-stringutils/
7 changes: 3 additions & 4 deletions core/.eslintrc
Original file line number Diff line number Diff line change
Expand Up @@ -5,17 +5,16 @@
"prettier",
"eslint:recommended",
"plugin:@typescript-eslint/eslint-recommended",
"plugin:@typescript-eslint/recommended"
"plugin:@typescript-eslint/recommended",
"plugin:prettier/recommended"
],
"plugins": [
"prettier",
"@typescript-eslint"
],
"rules": {
"no-throw-literal": "error",
"prettier/prettier": [
"error"
],
"prettier/prettier": "error",
"@typescript-eslint/ban-ts-comment": "off",
"@typescript-eslint/no-unused-vars": [
"warn",
Expand Down
6 changes: 2 additions & 4 deletions core/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@
"homepage": "https://github.com/Bisonai/orakl/tree/master/core#orakl-network-core",
"license": "MIT",
"scripts": {
"prepare": "cd .. && husky install core/.husky",
"clean": "rm -rf dist",
"prebuild": "yarn --cwd='../' vrf build && yarn --cwd='../' contracts-v01 build && yarn --cwd='../' util build",
"build": "yarn clean && tsc",
Expand Down Expand Up @@ -64,13 +63,13 @@
"aggregator-hash": "node --no-warnings --import=specifier-resolution-node/register --experimental-json-modules dist/cli/generate-aggregator-hash.js",
"flush": "node --no-warnings --import=specifier-resolution-node/register --experimental-json-modules dist/tools/flush-queues.js",
"test": "node --no-warnings --experimental-vm-modules node_modules/.bin/jest",
"lint": "DEBUG=eslint:cli-engine eslint 'src/**/*.ts' 'src/*.ts' 'test/*.ts'",
"lint": "DEBUG=eslint:cli-engine eslint --fix",
"bull-dashboard": "docker-compose -f docker-compose.bull-monitor.yaml up"
},
"dependencies": {
"@bisonai/orakl-contracts": "*",
"@bisonai/orakl-vrf": "*",
"@bisonai/orakl-util": "*",
"@bisonai/orakl-vrf": "*",
"@ethersproject/experimental": "^5.7.0",
"@slack/webhook": "^6.1.0",
"axios": "^1.2.2",
Expand Down Expand Up @@ -99,7 +98,6 @@
"eslint": "^8.30.0",
"eslint-config-prettier": "^8.5.0",
"eslint-plugin-prettier": "^4.2.1",
"husky": "^8.0.2",
"jest": "^29.3.1",
"prettier": "^2.8.1",
"prettier-plugin-organize-imports": "^3.2.3",
Expand Down
7 changes: 7 additions & 0 deletions lint-staged.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
module.exports = {
"contracts/v0.2/**/*.sol": "yarn contracts-v02 lint",

"core/**/*": "yarn core test test",
"core/src/**/*.ts": "yarn core lint",
"core/test/**/*.ts": "yarn core lint",
};
8 changes: 6 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,10 @@
]
},
"dependencies": {},
"devDependencies": {},
"devDependencies": {
"husky": "^9.0.11",
"lint-staged": "^15.2.2"
},
"scripts": {
"cli": "yarn workspace @bisonai/orakl-cli",
"contracts": "yarn workspace @bisonai/orakl-contracts",
Expand All @@ -35,6 +38,7 @@
"l2-api": "yarn workspace @bisonai/orakl-l2-api",
"monitor": "yarn workspace @bisonai/orakl-monitor",
"vrf": "yarn workspace @bisonai/orakl-vrf",
"util": "yarn workspace @bisonai/orakl-util"
"util": "yarn workspace @bisonai/orakl-util",
"prepare": "husky install && chmod +x .husky/pre-commit"
}
}
5 changes: 5 additions & 0 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -7329,6 +7329,11 @@ husky@^8.0.2:
resolved "https://registry.npmjs.org/husky/-/husky-8.0.3.tgz"
integrity sha512-+dQSyqPh4x1hlO1swXBiNb2HzTDN1I2IGLQx1GrBuiqFJfoMrnZWwVmatvSiO+Iz8fBUnf+lekwNo4c2LlXItg==

husky@^9.0.11:
version "9.0.11"
resolved "https://registry.yarnpkg.com/husky/-/husky-9.0.11.tgz#fc91df4c756050de41b3e478b2158b87c1e79af9"
integrity sha512-AB6lFlbwwyIqMdHYhwPe+kjOC3Oc5P3nThEoW/AaO2BX3vJDjWPFxYLxokUZOo6RNX20He3AaT8sESs9NJcmEw==

[email protected], iconv-lite@^0.4.24:
version "0.4.24"
resolved "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.4.24.tgz"
Expand Down

0 comments on commit ee7f616

Please sign in to comment.