diff --git a/core/.husky/pre-commit b/.husky/pre-commit similarity index 60% rename from core/.husky/pre-commit rename to .husky/pre-commit index 01b89ff66..ecd1ce930 100755 --- a/core/.husky/pre-commit +++ b/.husky/pre-commit @@ -1,4 +1,4 @@ #!/usr/bin/env sh . "$(dirname -- "$0")/_/husky.sh" -cd core && yarn lint && yarn test +npx lint-staged --allow-empty \ No newline at end of file diff --git a/contracts/v0.2/remappings.txt b/contracts/v0.2/remappings.txt new file mode 100644 index 000000000..a69e53176 --- /dev/null +++ b/contracts/v0.2/remappings.txt @@ -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/ diff --git a/core/.eslintrc b/core/.eslintrc index 349cce55f..62e89b8d3 100644 --- a/core/.eslintrc +++ b/core/.eslintrc @@ -5,7 +5,8 @@ "prettier", "eslint:recommended", "plugin:@typescript-eslint/eslint-recommended", - "plugin:@typescript-eslint/recommended" + "plugin:@typescript-eslint/recommended", + "plugin:prettier/recommended" ], "plugins": [ "prettier", @@ -13,9 +14,7 @@ ], "rules": { "no-throw-literal": "error", - "prettier/prettier": [ - "error" - ], + "prettier/prettier": "error", "@typescript-eslint/ban-ts-comment": "off", "@typescript-eslint/no-unused-vars": [ "warn", diff --git a/core/package.json b/core/package.json index 233ba76b0..7973838bb 100644 --- a/core/package.json +++ b/core/package.json @@ -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", @@ -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", @@ -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", diff --git a/lint-staged.config.js b/lint-staged.config.js new file mode 100644 index 000000000..498193248 --- /dev/null +++ b/lint-staged.config.js @@ -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", +}; diff --git a/package.json b/package.json index 770dfa484..67c51e9ba 100644 --- a/package.json +++ b/package.json @@ -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", @@ -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" } } diff --git a/yarn.lock b/yarn.lock index 083cd27e4..3a156440e 100644 --- a/yarn.lock +++ b/yarn.lock @@ -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== + iconv-lite@0.4.24, iconv-lite@^0.4.24: version "0.4.24" resolved "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.4.24.tgz"