Skip to content
This repository has been archived by the owner on Jan 25, 2025. It is now read-only.

126: Add linter command to CI #136

Merged
merged 4 commits into from
Apr 9, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 26 additions & 0 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
@@ -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
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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": [],
Expand Down
3 changes: 2 additions & 1 deletion src/base-resource.ts
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,8 @@ export default class ShortcutResource<Interface = BaseInterface> {
public async save(): Promise<void> {
if (this.id) {
await this.update()
} else {
}
else {
await this.create()
}
}
Expand Down
3 changes: 2 additions & 1 deletion src/client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
7 changes: 4 additions & 3 deletions src/stories/history/actions/history-action.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import {getHeaders} from '@sx/utils/headers'
import UUID from '@sx/utils/uuid'


class HistoryAction extends ShortcutResource<HistoryActionInterface> implements HistoryActionInterface{
class HistoryAction extends ShortcutResource<HistoryActionInterface> implements HistoryActionInterface {
public availableOperations: ResourceOperation[] = []

constructor(init: HistoryActionInterface) {
Expand All @@ -23,7 +23,8 @@ class HistoryAction extends ShortcutResource<HistoryActionInterface> implements
get owners(): Promise<Member[]> {
if (!this.ownerIds) {
return Promise.resolve([])
} else {
}
else {
const service = new MembersService({headers: getHeaders()})
return service.getMany(this.ownerIds)
}
Expand Down Expand Up @@ -51,4 +52,4 @@ class HistoryAction extends ShortcutResource<HistoryActionInterface> implements
labelIds?: number[]
}

export default HistoryAction
export default HistoryAction
3 changes: 2 additions & 1 deletion src/uploaded-files/uploaded-files-service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,8 @@ export default class UploadedFilesService extends BaseService<UploadedFile, Uplo
const data = response.data as UploadedFileApiData
const uploadedFile = convertApiFields(data) as UploadedFileInterface
return this.factory(uploadedFile)
} catch (error) {
}
catch (error) {
throw new Error('Failed to upload file: ' + error)
}
}
Expand Down