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 f498913

Browse filesBrowse files
authored
Merge pull request actions#48 from actions/code-quality
Code quality improvements
2 parents ca14121 + 58f0ff8 commit f498913
Copy full SHA for f498913

File tree

12 files changed

+1004
-73
lines changed
Filter options

12 files changed

+1004
-73
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

‎.github/workflows/ci.yml

Copy file name to clipboardExpand all lines: .github/workflows/ci.yml
+1Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,4 +15,5 @@ jobs:
1515
key: ${{runner.os}}-npm-${{hashFiles('**/package-lock.json')}}
1616
restore-keys: ${{runner.os}}-npm-
1717
- run: npm ci
18+
- run: npm run style:check
1819
- run: npm test

‎.gitignore

Copy file name to clipboard
+2-1Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
1-
node_modules
1+
/node_modules/
2+
!/.vscode/

‎.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

‎.vscode/settings.json

Copy file name to clipboard
+10Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
{
2+
"editor.formatOnSave": true,
3+
"editor.codeActionsOnSave": {
4+
"source.organizeImports": true
5+
},
6+
"files.exclude": {
7+
"**/dist": true,
8+
"**/node_modules": true
9+
}
10+
}

‎__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

‎docs/development.md

Copy file name to clipboardExpand all lines: docs/development.md
+2-1Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,8 @@ bash> npm run build
1515

1616
It also has a pre-commit hook configured via
1717
[husky](https://www.npmjs.com/package/husky) that should run the build script
18-
before each commit.
18+
before each commit. Additionally, this hook formats code and lints it, as
19+
well.
1920

2021
## Releasing
2122

0 commit comments

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