From 5b432881aab32acf74f529f064c5748b4993fd5e Mon Sep 17 00:00:00 2001 From: Frank Harrison Date: Tue, 12 Nov 2024 06:44:51 +0000 Subject: [PATCH 1/4] chore(lint): reasonably disables @typescript-eslint/no-unnecessary-type-assertion ... as the extra asserts in this code base seem more useful My personal preference is to be explicit with typing and this eslint check is counter to that. Also in the areas where this linting error are triggered it seems useful to have the type asserts as they help code-clarity --- .eslintrc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.eslintrc b/.eslintrc index 64c653b..c3e64a1 100644 --- a/.eslintrc +++ b/.eslintrc @@ -26,7 +26,7 @@ "@typescript-eslint/no-floating-promises": "warn", "no-async-promise-executor": "warn", "@typescript-eslint/no-explicit-any": "off", - "@typescript-eslint/no-unnecessary-type-assertion": "error", + "@typescript-eslint/no-unnecessary-type-assertion": "off", "no-constant-condition": [ "error", { From db0df3a539e99f0d731d69bcc28da2ba1ea4859a Mon Sep 17 00:00:00 2001 From: Frank Harrison Date: Tue, 12 Nov 2024 06:41:05 +0000 Subject: [PATCH 2/4] chore(cicd): creates a node.js.yml workflow to run `npm run check` on push and PRs This should help ensure the code-quality stays as good as it already is, and/or improve it over time. --- .github/workflows/node.js.yml | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) create mode 100644 .github/workflows/node.js.yml diff --git a/.github/workflows/node.js.yml b/.github/workflows/node.js.yml new file mode 100644 index 0000000..68e31e4 --- /dev/null +++ b/.github/workflows/node.js.yml @@ -0,0 +1,31 @@ +# This workflow will do a clean installation of node dependencies, cache/restore them, build the source code and run tests across different versions of node +# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-nodejs + +name: Node.js CI + +on: + push: + branches: [ "main" ] + pull_request: + branches: [ "main" ] + +jobs: + build: + + runs-on: ubuntu-latest + + strategy: + matrix: + node-version: [18.x, 20.x, 22.x] + # See supported Node.js release schedule at https://nodejs.org/en/about/releases/ + + steps: + - uses: actions/checkout@v4 + - name: Use Node.js ${{ matrix.node-version }} + uses: actions/setup-node@v4 + with: + node-version: ${{ matrix.node-version }} + cache: 'npm' + - run: npm ci + - run: npm run build + - run: npm run check From b6ec967f83a8197ad82c1c30d8e88c48866c2998 Mon Sep 17 00:00:00 2001 From: Frank Harrison Date: Tue, 12 Nov 2024 07:06:06 +0000 Subject: [PATCH 3/4] chore(docs): adds CONTRIBUTING.md with submodule info This helps fix a gotcha for future contributors. --- CONTRIBUTING.md | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 CONTRIBUTING.md diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md new file mode 100644 index 0000000..1fd10ae --- /dev/null +++ b/CONTRIBUTING.md @@ -0,0 +1,22 @@ +# Contributing to obsidian-livesync + +## Getting started + +### Initialise livesync-commonlib submodule + +We use a git submodule to reference common code, you will need this before +building and testing will work. + +```sh +# Initialise the submodules after initiali clone +git submodule init +# Update to get the latest code +git submodule update +``` + +# Guidelines + +1. Run `npm run check` before creating any PR + +TODO. + From d70173c4d8f576c6835d03a0779c56c7d5caa833 Mon Sep 17 00:00:00 2001 From: Frank Harrison Date: Tue, 12 Nov 2024 07:08:16 +0000 Subject: [PATCH 4/4] chore(cicd): adds subnmodule support to the workflow This will get the workflow running without code-infra errors, but it will not pass linting, yet. --- .github/workflows/node.js.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/node.js.yml b/.github/workflows/node.js.yml index 68e31e4..806ff3c 100644 --- a/.github/workflows/node.js.yml +++ b/.github/workflows/node.js.yml @@ -26,6 +26,8 @@ jobs: with: node-version: ${{ matrix.node-version }} cache: 'npm' + - run: git submodule init + - run: git submodule update - run: npm ci - run: npm run build - run: npm run check