Skip to content

Commit

Permalink
Merge pull request #156 from Cyberbeni/eslint-recommended
Browse files Browse the repository at this point in the history
Update TS base eslint config to recommendedTypeChecked
Cyberbeni authored Oct 16, 2024
2 parents b9f49c0 + 16eab7c commit 2a687a7
Showing 4 changed files with 17 additions and 7 deletions.
2 changes: 1 addition & 1 deletion dist/index.js

Large diffs are not rendered by default.

5 changes: 3 additions & 2 deletions eslint.config.mjs
Original file line number Diff line number Diff line change
@@ -12,7 +12,7 @@ export default ts.config({
extends: [
stylistic.configs["recommended-flat"],
js.configs.recommended,
...ts.configs.recommended,
...ts.configs.recommendedTypeChecked,
],
languageOptions: {
parser: ts.parser,
@@ -35,6 +35,7 @@ export default ts.config({
"@stylistic/brace-style": ["warn", "1tbs"],
"@stylistic/lines-between-class-members": "off",

"@typescript-eslint/no-floating-promises": ["error", { "ignoreVoid": true }]
"@typescript-eslint/no-floating-promises": ["error", { "ignoreVoid": true }],
"@typescript-eslint/require-await": "off",
}
})
14 changes: 11 additions & 3 deletions src/helpers.ts
Original file line number Diff line number Diff line change
@@ -20,10 +20,18 @@ export async function getUuid(url: string, commitHash: string): Promise<string>
return _uuid(`${url}-${commitHash}-${additionalInfo}`, '6050636b-7499-41d4-b9c6-756aff9856d0')
}

export function logError(error: unknown): void {
export function errorMessage(error: unknown): string {
if (error instanceof Error) {
core.info(error.message)
return error.message
} else if (error instanceof String) {
return error.valueOf()
} else if (typeof error === 'string') {
return error
} else {
core.info(`Unexpected error type: '${typeof error}'`)
return `Unexpected error type: '${typeof error}'`
}
}

export function logError(error: unknown): void {
core.info(errorMessage(error))
}
3 changes: 2 additions & 1 deletion src/main.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import * as core from '@actions/core'
import { SwiftToolInstaller } from './installer'
import { errorMessage } from './helpers'

async function main(): Promise<void> {
// Inputs
@@ -14,5 +15,5 @@ async function main(): Promise<void> {
}

main().catch((error) => {
core.setFailed(error.message)
core.setFailed(errorMessage(error))
})

0 comments on commit 2a687a7

Please sign in to comment.