From ce0ee4d0d5a5cd16616eed4a83367ed93dfafe6e Mon Sep 17 00:00:00 2001 From: Jens Astrup Date: Tue, 9 Apr 2024 19:46:52 -0400 Subject: [PATCH 1/4] Add linter command to CI --- .github/workflows/lint.yml | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 .github/workflows/lint.yml diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml new file mode 100644 index 0000000..6576f5d --- /dev/null +++ b/.github/workflows/lint.yml @@ -0,0 +1,26 @@ +name: Run Linter + +on: + push: + branches: [ develop ] + pull_request: + types: [ opened, synchronize, reopened ] + paths: + - 'src/**' + - 'tests/**' + +jobs: + lint: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - name: Use Node.js 18.x + uses: actions/setup-node@v4.0.2 + with: + node-version: 21.x + - name: Install Yarn + run: npm install -g yarn + - name: Install dependencies + run: yarn install --immutable + - name: Run linter + run: npm run lint From da6415601c4ba8188ee950a9b81769065f04669c Mon Sep 17 00:00:00 2001 From: Jens Astrup Date: Tue, 9 Apr 2024 19:48:35 -0400 Subject: [PATCH 2/4] Clean up one piece of lint to trigger linter --- src/client.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/client.ts b/src/client.ts index ebfe7c3..2054df9 100644 --- a/src/client.ts +++ b/src/client.ts @@ -25,7 +25,8 @@ export default class Client { 'Content-Type': 'application/json', 'Shortcut-Token': this.shortcutApiKey } - } else if (!process.env.SHORTCUT_API_KEY) throw new Error('Shortcut API Key not found') + } + else if (!process.env.SHORTCUT_API_KEY) throw new Error('Shortcut API Key not found') return { 'Content-Type': 'application/json', 'Shortcut-Token': process.env.SHORTCUT_API_KEY From 1f0e097bc131b1e33cb5c959c8b56484ba458527 Mon Sep 17 00:00:00 2001 From: Jens Astrup Date: Tue, 9 Apr 2024 19:49:52 -0400 Subject: [PATCH 3/4] Correct step name --- .github/workflows/lint.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index 6576f5d..73f8b7d 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -14,7 +14,7 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - - name: Use Node.js 18.x + - name: Use Node.js uses: actions/setup-node@v4.0.2 with: node-version: 21.x From 90c4676a44634f1e4eb59a02b400c4aa85f333cc Mon Sep 17 00:00:00 2001 From: Jens Astrup Date: Tue, 9 Apr 2024 19:52:56 -0400 Subject: [PATCH 4/4] Update command, clean up lint --- package.json | 2 +- src/base-resource.ts | 3 ++- src/stories/history/actions/history-action.ts | 7 ++++--- src/uploaded-files/uploaded-files-service.ts | 3 ++- 4 files changed, 9 insertions(+), 6 deletions(-) diff --git a/package.json b/package.json index 98bf4db..45884b2 100644 --- a/package.json +++ b/package.json @@ -20,7 +20,7 @@ "prepublishOnly": "npm run build", "test": "jest", "docs": "npx typedoc", - "lint": "eslint . --ext .ts", + "lint": "eslint --ext ts src tests", "lint:fix": "eslint . --ext .ts --fix" }, "keywords": [], diff --git a/src/base-resource.ts b/src/base-resource.ts index cc126ef..1dc4661 100644 --- a/src/base-resource.ts +++ b/src/base-resource.ts @@ -120,7 +120,8 @@ export default class ShortcutResource { public async save(): Promise { if (this.id) { await this.update() - } else { + } + else { await this.create() } } diff --git a/src/stories/history/actions/history-action.ts b/src/stories/history/actions/history-action.ts index b82892e..829da00 100644 --- a/src/stories/history/actions/history-action.ts +++ b/src/stories/history/actions/history-action.ts @@ -8,7 +8,7 @@ import {getHeaders} from '@sx/utils/headers' import UUID from '@sx/utils/uuid' -class HistoryAction extends ShortcutResource implements HistoryActionInterface{ +class HistoryAction extends ShortcutResource implements HistoryActionInterface { public availableOperations: ResourceOperation[] = [] constructor(init: HistoryActionInterface) { @@ -23,7 +23,8 @@ class HistoryAction extends ShortcutResource implements get owners(): Promise { if (!this.ownerIds) { return Promise.resolve([]) - } else { + } + else { const service = new MembersService({headers: getHeaders()}) return service.getMany(this.ownerIds) } @@ -51,4 +52,4 @@ class HistoryAction extends ShortcutResource implements labelIds?: number[] } -export default HistoryAction \ No newline at end of file +export default HistoryAction diff --git a/src/uploaded-files/uploaded-files-service.ts b/src/uploaded-files/uploaded-files-service.ts index 57e8197..41c5db2 100644 --- a/src/uploaded-files/uploaded-files-service.ts +++ b/src/uploaded-files/uploaded-files-service.ts @@ -34,7 +34,8 @@ export default class UploadedFilesService extends BaseService