From 61289a62f3a07bb3ce42a946fbe657d75a557b60 Mon Sep 17 00:00:00 2001 From: Tom French <15848336+TomAFrench@users.noreply.github.com> Date: Tue, 26 Sep 2023 10:58:29 +0100 Subject: [PATCH] chore: fix linting in `acvm_js` (#2837) --- .github/workflows/acvm-test-acvm-js.yml | 14 ++--------- acvm-repo/acvm_js/.eslintrc.js | 18 +------------- .../test/browser/execute_circuit.test.ts | 22 ++++++++--------- .../acvm_js/test/node/execute_circuit.test.ts | 24 +++++++++---------- .../acvm_js/test/shared/schnorr_verify.ts | 2 +- 5 files changed, 27 insertions(+), 53 deletions(-) diff --git a/.github/workflows/acvm-test-acvm-js.yml b/.github/workflows/acvm-test-acvm-js.yml index 1ba2369f780..d5a9dc07239 100644 --- a/.github/workflows/acvm-test-acvm-js.yml +++ b/.github/workflows/acvm-test-acvm-js.yml @@ -55,14 +55,9 @@ jobs: - name: Set up test environment uses: ./.github/actions/setup - with: - working-directory: ./acvm-repo/acvm_js - name: Run node tests - working-directory: ./acvm-repo/acvm_js - run: | - yarn - yarn test + run: yarn workspace @noir-lang/acvm_js test test-acvm_js-browser: needs: [build-acvm-js-package] @@ -81,17 +76,12 @@ jobs: - name: Set up test environment uses: ./.github/actions/setup - with: - working-directory: ./acvm-repo/acvm_js - name: Install playwright deps - working-directory: ./acvm-repo/acvm_js run: | npx playwright install npx playwright install-deps - name: Run browser tests working-directory: ./acvm-repo/acvm_js - run: | - yarn - yarn test:browser \ No newline at end of file + run: yarn workspace @noir-lang/acvm_js test:browser diff --git a/acvm-repo/acvm_js/.eslintrc.js b/acvm-repo/acvm_js/.eslintrc.js index b1346a8792f..33335c2a877 100644 --- a/acvm-repo/acvm_js/.eslintrc.js +++ b/acvm-repo/acvm_js/.eslintrc.js @@ -1,19 +1,3 @@ module.exports = { - root: true, - parser: "@typescript-eslint/parser", - plugins: ["@typescript-eslint", "prettier"], - extends: ["eslint:recommended", "plugin:@typescript-eslint/recommended"], - rules: { - "comma-spacing": ["error", { before: false, after: true }], - "no-unused-vars": "off", - "@typescript-eslint/no-unused-vars": [ - "warn", // or "error" - { - argsIgnorePattern: "^_", - varsIgnorePattern: "^_", - caughtErrorsIgnorePattern: "^_", - }, - ], - "prettier/prettier": "error", - }, + extends: ["../../.eslintrc.js"], }; diff --git a/acvm-repo/acvm_js/test/browser/execute_circuit.test.ts b/acvm-repo/acvm_js/test/browser/execute_circuit.test.ts index 407aa830c65..280b08abed3 100644 --- a/acvm-repo/acvm_js/test/browser/execute_circuit.test.ts +++ b/acvm-repo/acvm_js/test/browser/execute_circuit.test.ts @@ -24,7 +24,7 @@ it("successfully executes circuit and extracts return value", async () => { initialWitnessMap, () => { throw Error("unexpected oracle"); - } + }, ); // Solved witness should be consistent with initial witness @@ -50,7 +50,7 @@ it("successfully processes simple brillig foreign call opcodes", async () => { let observedInputs: string[][] = []; const foreignCallHandler: ForeignCallHandler = async ( name: string, - inputs: string[][] + inputs: string[][], ) => { // Throwing inside the oracle callback causes a timeout so we log the observed values // and defer the check against expected values until after the execution is complete. @@ -63,7 +63,7 @@ it("successfully processes simple brillig foreign call opcodes", async () => { const solved_witness: WitnessMap = await executeCircuit( bytecode, initialWitnessMap, - foreignCallHandler + foreignCallHandler, ); // Check that expected values were passed to oracle callback. @@ -89,7 +89,7 @@ it("successfully processes complex brillig foreign call opcodes", async () => { let observedInputs: string[][] = []; const foreignCallHandler: ForeignCallHandler = async ( name: string, - inputs: string[][] + inputs: string[][], ) => { // Throwing inside the oracle callback causes a timeout so we log the observed values // and defer the check against expected values until after the execution is complete. @@ -102,7 +102,7 @@ it("successfully processes complex brillig foreign call opcodes", async () => { const solved_witness: WitnessMap = await executeCircuit( bytecode, initialWitnessMap, - foreignCallHandler + foreignCallHandler, ); // Check that expected values were passed to oracle callback. @@ -124,7 +124,7 @@ it("successfully executes a Pedersen opcode", async function () { initialWitnessMap, () => { throw Error("unexpected oracle"); - } + }, ); expect(solvedWitness).to.be.deep.eq(expectedWitnessMap); @@ -140,7 +140,7 @@ it("successfully executes a FixedBaseScalarMul opcode", async () => { initialWitnessMap, () => { throw Error("unexpected oracle"); - } + }, ); expect(solvedWitness).to.be.deep.eq(expectedWitnessMap); @@ -156,7 +156,7 @@ it("successfully executes a SchnorrVerify opcode", async () => { initialWitnessMap, () => { throw Error("unexpected oracle"); - } + }, ); expect(solvedWitness).to.be.deep.eq(expectedWitnessMap); @@ -172,7 +172,7 @@ it("successfully executes a MemoryOp opcode", async () => { initialWitnessMap, () => { throw Error("unexpected oracle"); - } + }, ); expect(solvedWitness).to.be.deep.eq(expectedWitnessMap); @@ -194,7 +194,7 @@ it("successfully executes two circuits with same backend", async function () { initialWitnessMap, () => { throw Error("unexpected oracle"); - } + }, ); expect(solvedWitness0).to.be.deep.eq(expectedWitnessMap); @@ -205,7 +205,7 @@ it("successfully executes two circuits with same backend", async function () { initialWitnessMap, () => { throw Error("unexpected oracle"); - } + }, ); expect(solvedWitness1).to.be.deep.eq(expectedWitnessMap); }); diff --git a/acvm-repo/acvm_js/test/node/execute_circuit.test.ts b/acvm-repo/acvm_js/test/node/execute_circuit.test.ts index dac93b9f10c..0523d01b9ca 100644 --- a/acvm-repo/acvm_js/test/node/execute_circuit.test.ts +++ b/acvm-repo/acvm_js/test/node/execute_circuit.test.ts @@ -17,7 +17,7 @@ it("successfully executes circuit and extracts return value", async () => { initialWitnessMap, () => { throw Error("unexpected oracle"); - } + }, ); // Solved witness should be consistent with initial witness @@ -43,7 +43,7 @@ it("successfully processes simple brillig foreign call opcodes", async () => { let observedInputs: string[][] = []; const foreignCallHandler: ForeignCallHandler = async ( name: string, - inputs: string[][] + inputs: string[][], ) => { // Throwing inside the oracle callback causes a timeout so we log the observed values // and defer the check against expected values until after the execution is complete. @@ -56,7 +56,7 @@ it("successfully processes simple brillig foreign call opcodes", async () => { const solved_witness: WitnessMap = await executeCircuit( bytecode, initialWitnessMap, - foreignCallHandler + foreignCallHandler, ); // Check that expected values were passed to oracle callback. @@ -82,7 +82,7 @@ it("successfully processes complex brillig foreign call opcodes", async () => { let observedInputs: string[][] = []; const foreignCallHandler: ForeignCallHandler = async ( name: string, - inputs: string[][] + inputs: string[][], ) => { // Throwing inside the oracle callback causes a timeout so we log the observed values // and defer the check against expected values until after the execution is complete. @@ -95,7 +95,7 @@ it("successfully processes complex brillig foreign call opcodes", async () => { const solved_witness: WitnessMap = await executeCircuit( bytecode, initialWitnessMap, - foreignCallHandler + foreignCallHandler, ); // Check that expected values were passed to oracle callback. @@ -118,7 +118,7 @@ it("successfully executes a Pedersen opcode", async function () { initialWitnessMap, () => { throw Error("unexpected oracle"); - } + }, ); expect(solvedWitness).to.be.deep.eq(expectedWitnessMap); @@ -134,7 +134,7 @@ it("successfully executes a FixedBaseScalarMul opcode", async () => { initialWitnessMap, () => { throw Error("unexpected oracle"); - } + }, ); expect(solvedWitness).to.be.deep.eq(expectedWitnessMap); @@ -150,7 +150,7 @@ it("successfully executes a SchnorrVerify opcode", async () => { initialWitnessMap, () => { throw Error("unexpected oracle"); - } + }, ); expect(solvedWitness).to.be.deep.eq(expectedWitnessMap); @@ -166,7 +166,7 @@ it("successfully executes a MemoryOp opcode", async () => { initialWitnessMap, () => { throw Error("unexpected oracle"); - } + }, ); expect(solvedWitness).to.be.deep.eq(expectedWitnessMap); @@ -190,7 +190,7 @@ it("successfully executes two circuits with same backend", async function () { initialWitnessMap, () => { throw Error("unexpected oracle"); - } + }, ); const solvedWitness1 = await executeCircuitWithBlackBoxSolver( @@ -199,7 +199,7 @@ it("successfully executes two circuits with same backend", async function () { initialWitnessMap, () => { throw Error("unexpected oracle"); - } + }, ); expect(solvedWitness0).to.be.deep.eq(expectedWitnessMap); @@ -225,7 +225,7 @@ it("successfully executes 500 circuits with same backend", async function () { initialWitnessMap, () => { throw Error("unexpected oracle"); - } + }, ); expect(solvedWitness).to.be.deep.eq(expectedWitnessMap); diff --git a/acvm-repo/acvm_js/test/shared/schnorr_verify.ts b/acvm-repo/acvm_js/test/shared/schnorr_verify.ts index fa91713474e..de9e61e757c 100644 --- a/acvm-repo/acvm_js/test/shared/schnorr_verify.ts +++ b/acvm-repo/acvm_js/test/shared/schnorr_verify.ts @@ -101,5 +101,5 @@ export const initialWitnessMap = new Map([ export const expectedWitnessMap = new Map(initialWitnessMap).set( 77, - "0x0000000000000000000000000000000000000000000000000000000000000001" + "0x0000000000000000000000000000000000000000000000000000000000000001", );