diff --git a/.github/workflows/bindings_ci.yml b/.github/workflows/bindings_ci.yml index 155f82439..c468b6755 100644 --- a/.github/workflows/bindings_ci.yml +++ b/.github/workflows/bindings_ci.yml @@ -75,6 +75,34 @@ jobs: - name: Build library & generate bindings run: target/debug/xtask ci bindings + lint-js-bindings: + strategy: + fail-fast: true + matrix: + include: + - name: "[m]-crypto-nodejs" + path: "bindings/matrix-sdk-crypto-nodejs" + - name: "[m]-crypto-js" + path: "bindings/matrix-sdk-crypto-js" + + name: lint ${{ matrix.name }} + runs-on: ubuntu-latest + + steps: + - name: Checkout the repo + uses: actions/checkout@v3 + + - name: Install Node.js + uses: actions/setup-node@v3 + + - name: Install NPM dependencies + working-directory: ${{ matrix.path }} + run: npm install + + - name: run lint + working-directory: ${{ matrix.path }} + run: npm run lint + test-matrix-sdk-crypto-nodejs: name: ${{ matrix.os-name }} [m]-crypto-nodejs, v${{ matrix.node-version }} if: github.event_name == 'push' || !github.event.pull_request.draft diff --git a/bindings/matrix-sdk-crypto-js/.prettierignore b/bindings/matrix-sdk-crypto-js/.prettierignore new file mode 100644 index 000000000..fc5bd9083 --- /dev/null +++ b/bindings/matrix-sdk-crypto-js/.prettierignore @@ -0,0 +1 @@ +/pkg diff --git a/bindings/matrix-sdk-crypto-js/.prettierrc.js b/bindings/matrix-sdk-crypto-js/.prettierrc.js new file mode 100644 index 000000000..f739c10be --- /dev/null +++ b/bindings/matrix-sdk-crypto-js/.prettierrc.js @@ -0,0 +1,9 @@ +// prettier configuration: the same as the conventions used throughout Matrix.org +// see: https://github.com/matrix-org/eslint-plugin-matrix-org/blob/main/.prettierrc.js + +module.exports = { + printWidth: 120, + tabWidth: 4, + quoteProps: "consistent", + trailingComma: "all", +}; diff --git a/bindings/matrix-sdk-crypto-js/package.json b/bindings/matrix-sdk-crypto-js/package.json index a31524259..b5724c0bc 100644 --- a/bindings/matrix-sdk-crypto-js/package.json +++ b/bindings/matrix-sdk-crypto-js/package.json @@ -30,6 +30,7 @@ "cross-env": "^7.0.3", "fake-indexeddb": "^4.0", "jest": "^28.1.0", + "prettier": "^2.8.3", "typedoc": "^0.22.17", "wasm-pack": "^0.10.2", "yargs-parser": "~21.0.1" @@ -38,6 +39,7 @@ "node": ">= 10" }, "scripts": { + "lint": "prettier --check .", "build": "./scripts/build.sh", "test": "jest --verbose", "doc": "typedoc --tsconfig .", diff --git a/bindings/matrix-sdk-crypto-nodejs/.prettierignore b/bindings/matrix-sdk-crypto-nodejs/.prettierignore new file mode 100644 index 000000000..fc5bd9083 --- /dev/null +++ b/bindings/matrix-sdk-crypto-nodejs/.prettierignore @@ -0,0 +1 @@ +/pkg diff --git a/bindings/matrix-sdk-crypto-nodejs/.prettierrc.js b/bindings/matrix-sdk-crypto-nodejs/.prettierrc.js new file mode 100644 index 000000000..f739c10be --- /dev/null +++ b/bindings/matrix-sdk-crypto-nodejs/.prettierrc.js @@ -0,0 +1,9 @@ +// prettier configuration: the same as the conventions used throughout Matrix.org +// see: https://github.com/matrix-org/eslint-plugin-matrix-org/blob/main/.prettierrc.js + +module.exports = { + printWidth: 120, + tabWidth: 4, + quoteProps: "consistent", + trailingComma: "all", +}; diff --git a/bindings/matrix-sdk-crypto-nodejs/package.json b/bindings/matrix-sdk-crypto-nodejs/package.json index d858158e2..e7e3ed1fe 100644 --- a/bindings/matrix-sdk-crypto-nodejs/package.json +++ b/bindings/matrix-sdk-crypto-nodejs/package.json @@ -15,6 +15,7 @@ "devDependencies": { "@napi-rs/cli": "^2.9.0", "jest": "^28.1.0", + "prettier": "^2.8.3", "typedoc": "^0.22.17", "yargs-parser": "~21.0.1" }, @@ -22,6 +23,7 @@ "node": ">= 14" }, "scripts": { + "lint": "prettier --check .", "release-build": "napi build --platform --release --strip", "build": "napi build --platform", "postinstall": "node download-lib.js",