diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index c6d3a4b..ba16f6a 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -71,6 +71,30 @@ jobs: - name: Run Solhint run: yarn solidity:lint + circuit-lint: + name: Circuit Lint + runs-on: ubuntu-latest + steps: + - name: Checkout code + uses: actions/checkout@v4 + + - name: Setup Node.js + uses: actions/setup-node@v4 + with: + node-version: '20' + cache: 'yarn' + + - name: Install dependencies + run: yarn install --frozen-lockfile + + - name: Install Noir + uses: noir-lang/noirup@v0.1.3 + with: + toolchain: '1.0.0-beta.6' + + - name: Run Nargo Format + run: yarn circuit:lint + format-check: name: Format Check runs-on: ubuntu-latest diff --git a/.lintstagedrc.js b/.lintstagedrc.js new file mode 100644 index 0000000..7fd8498 --- /dev/null +++ b/.lintstagedrc.js @@ -0,0 +1,6 @@ +module.exports = { + '*.{js,mjs,ts,tsx}': ['npx eslint --fix', 'prettier --write'], + '*.nr': () => 'cd circuit && nargo fmt', + '*.sol': ['npx hardhat check --fix', 'prettier --write'], + '*.{json,md,yml,yaml}': ['prettier --write'], +}; diff --git a/package.json b/package.json index 89c1300..914a8dc 100644 --- a/package.json +++ b/package.json @@ -36,6 +36,8 @@ }, "scripts": { "vars:list": "npx hardhat vars list", + "circuit:lint": "cd circuit && nargo fmt --check", + "circuit:lint:fix": "cd circuit && nargo fmt", "circuit:build": "cd circuit && nargo build", "circuit:witness": "cd circuit && nargo execute witness", "circuit:vk": "cd circuit && bb write_vk -b ./target/num_diff.json -o ./target --oracle_hash keccak", @@ -57,19 +59,7 @@ "solidity:lint:fix": "npx hardhat check --fix", "format": "prettier --write .", "format:check": "prettier --check .", - "lint:all": "yarn typescript:lint && yarn solidity:lint && yarn format:check" - }, - "lint-staged": { - "*.{js,mjs,ts,tsx}": [ - "eslint --fix", - "prettier --write" - ], - "*.sol": [ - "prettier --write" - ], - "*.{json,md,yml,yaml}": [ - "prettier --write" - ] + "all:lint": "yarn typescript:lint && yarn solidity:lint && yarn circuit:lint && yarn format:check" }, "packageManager": "yarn@1.22.22+sha512.a6b2f7906b721bba3d67d4aff083df04dad64c399707841b7acf00f6b133b7ac24255f2652fa22ae3534329dc6180534e98d17432037ff6fd140556e2bb3137e" }