Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings
This repository was archived by the owner on Jan 21, 2024. It is now read-only.

Commit 3037861

Browse filesBrowse files
committed
Add ESLint and Prettier
1 parent b945d09 commit 3037861
Copy full SHA for 3037861

8 files changed

+987
-71
lines changed

‎.eslintrc.yml

Copy file name to clipboard
+13Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
root: true
2+
parser: '@typescript-eslint/parser'
3+
plugins: ['@typescript-eslint']
4+
extends:
5+
- eslint:recommended
6+
- plugin:@typescript-eslint/eslint-recommended
7+
- plugin:@typescript-eslint/recommended
8+
- prettier/@typescript-eslint
9+
rules:
10+
# '@typescript-eslint/explicit-function-return-type': 0
11+
'@typescript-eslint/no-use-before-define':
12+
- 2
13+
- functions: false

‎.prettierrc.yml

Copy file name to clipboard
+5Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
arrowParens: avoid
2+
bracketSpacing: false
3+
semi: false
4+
singleQuote: true
5+
trailingComma: none

‎__test__/async-function.test.ts

Copy file name to clipboard
+6-4Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,28 @@
1+
/* eslint-disable @typescript-eslint/no-explicit-any */
2+
13
import {callAsyncFunction} from '../src/async-function'
24

35
describe('callAsyncFunction', () => {
46
test('calls the function with its arguments', async () => {
5-
const result = await callAsyncFunction({foo: 'bar'}, 'return foo')
7+
const result = await callAsyncFunction({foo: 'bar'} as any, 'return foo')
68
expect(result).toEqual('bar')
79
})
810

911
test('throws on ReferenceError', async () => {
1012
expect.assertions(1)
1113

1214
try {
13-
await callAsyncFunction({}, 'proces')
15+
await callAsyncFunction({} as any, 'proces')
1416
} catch (err) {
1517
expect(err).toBeInstanceOf(ReferenceError)
1618
}
1719
})
1820

1921
test('can access process', async () => {
20-
await callAsyncFunction({}, 'process')
22+
await callAsyncFunction({} as any, 'process')
2123
})
2224

2325
test('can access console', async () => {
24-
await callAsyncFunction({}, 'console')
26+
await callAsyncFunction({} as any, 'console')
2527
})
2628
})

‎dist/index.js

Copy file name to clipboardExpand all lines: dist/index.js
+4-8Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -9274,7 +9274,7 @@ var core = __webpack_require__(470);
92749274
var lib_github = __webpack_require__(469);
92759275

92769276
// CONCATENATED MODULE: ./src/async-function.ts
9277-
const AsyncFunction = Object.getPrototypeOf(async () => { }).constructor;
9277+
const AsyncFunction = Object.getPrototypeOf(async () => null).constructor;
92789278
function callAsyncFunction(args, source) {
92799279
const fn = new AsyncFunction(...Object.keys(args), source);
92809280
return fn(...Object.values(args));
@@ -9300,7 +9300,7 @@ async function main() {
93009300
opts.previews = previews.split(',');
93019301
const github = new lib_github.GitHub(token, opts);
93029302
const script = Object(core.getInput)('script', { required: true });
9303-
// Using property/value shorthand on `require` (e.g. `{require}`) causes compilatin errors.
9303+
// Using property/value shorthand on `require` (e.g. `{require}`) causes compilation errors.
93049304
const result = await callAsyncFunction({ require: __webpack_require__(875), github, context: lib_github.context, core: core }, script);
93059305
let encoding = Object(core.getInput)('result-encoding');
93069306
encoding = encoding ? encoding : 'json';
@@ -9317,14 +9317,10 @@ async function main() {
93179317
}
93189318
Object(core.setOutput)('result', output);
93199319
}
9320+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
93209321
function handleError(err) {
93219322
console.error(err);
9322-
if (err && err.message) {
9323-
Object(core.setFailed)(err.message);
9324-
}
9325-
else {
9326-
Object(core.setFailed)(`Unhandled error: ${err}`);
9327-
}
9323+
Object(core.setFailed)(`Unhandled error: ${err}`);
93289324
}
93299325

93309326

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.