Add ESLint and Prettier

This commit is contained in:
Jonathan Clem
2020-05-18 11:26:47 -04:00
parent b945d091bf
commit 3037861304
8 changed files with 987 additions and 71 deletions

View File

@@ -1,11 +1,20 @@
const AsyncFunction = Object.getPrototypeOf(async () => {}).constructor
import * as core from '@actions/core'
import {GitHub} from '@actions/github'
import {Context} from '@actions/github/lib/context'
type AsyncFunctionArguments = {[key: string]: any}
const AsyncFunction = Object.getPrototypeOf(async () => null).constructor
export function callAsyncFunction(
type AsyncFunctionArguments = {
context: Context
core: typeof core
github: GitHub
require: NodeRequire
}
export function callAsyncFunction<T>(
args: AsyncFunctionArguments,
source: string
): Promise<any> {
): Promise<T> {
const fn = new AsyncFunction(...Object.keys(args), source)
return fn(...Object.values(args))
}