diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml new file mode 100644 index 0000000..73f8b7d --- /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 + 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 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/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 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