mirror of https://github.com/actions/toolkit
Re-enable the audit tools step and update dependencies (#815)
* update package versions * run audit * fix eslint config * linter updates * re-enable audit * update timeouts test * pass done into callback * fix formatpull/817/head
parent
8dc2d6eb6a
commit
0d74e9080a
|
@ -1,3 +1,4 @@
|
|||
node_modules/
|
||||
packages/*/node_modules/
|
||||
packages/*/lib/
|
||||
packages/*/lib/
|
||||
packages/glob/__tests__/_temp
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"plugins": ["jest", "@typescript-eslint"],
|
||||
"extends": ["plugin:github/es6"],
|
||||
"extends": ["plugin:github/recommended"],
|
||||
"parser": "@typescript-eslint/parser",
|
||||
"parserOptions": {
|
||||
"ecmaVersion": 9,
|
||||
|
@ -9,20 +9,34 @@
|
|||
},
|
||||
"rules": {
|
||||
"eslint-comments/no-use": "off",
|
||||
"github/no-then": "off",
|
||||
"import/no-namespace": "off",
|
||||
"no-shadow": "off",
|
||||
"no-unused-vars": "off",
|
||||
"no-undef": "off",
|
||||
"@typescript-eslint/no-unused-vars": "error",
|
||||
"@typescript-eslint/explicit-member-accessibility": ["error", {"accessibility": "no-public"}],
|
||||
"@typescript-eslint/no-require-imports": "error",
|
||||
"@typescript-eslint/array-type": "error",
|
||||
"@typescript-eslint/await-thenable": "error",
|
||||
"@typescript-eslint/ban-ts-ignore": "error",
|
||||
"@typescript-eslint/ban-ts-comment": "error",
|
||||
"camelcase": "off",
|
||||
"@typescript-eslint/camelcase": "off",
|
||||
"@typescript-eslint/class-name-casing": "error",
|
||||
"@typescript-eslint/consistent-type-assertions": "off",
|
||||
"@typescript-eslint/explicit-function-return-type": ["error", {"allowExpressions": true}],
|
||||
"@typescript-eslint/func-call-spacing": ["error", "never"],
|
||||
"@typescript-eslint/generic-type-naming": ["error", "^[A-Z][A-Za-z]*$"],
|
||||
"@typescript-eslint/naming-convention": [
|
||||
"error",
|
||||
{
|
||||
"format": null,
|
||||
"filter": {
|
||||
// you can expand this regex as you find more cases that require quoting that you want to allow
|
||||
"regex": "^[A-Z][A-Za-z]*$",
|
||||
"match": true
|
||||
},
|
||||
"selector": "memberLike"
|
||||
}
|
||||
],
|
||||
"@typescript-eslint/no-array-constructor": "error",
|
||||
"@typescript-eslint/no-empty-interface": "error",
|
||||
"@typescript-eslint/no-explicit-any": "error",
|
||||
|
@ -32,7 +46,6 @@
|
|||
"@typescript-eslint/no-misused-new": "error",
|
||||
"@typescript-eslint/no-namespace": "error",
|
||||
"@typescript-eslint/no-non-null-assertion": "warn",
|
||||
"@typescript-eslint/no-object-literal-type-assertion": "error",
|
||||
"@typescript-eslint/no-unnecessary-qualifier": "error",
|
||||
"@typescript-eslint/no-unnecessary-type-assertion": "error",
|
||||
"@typescript-eslint/no-useless-constructor": "error",
|
||||
|
@ -40,7 +53,6 @@
|
|||
"@typescript-eslint/prefer-for-of": "warn",
|
||||
"@typescript-eslint/prefer-function-type": "warn",
|
||||
"@typescript-eslint/prefer-includes": "error",
|
||||
"@typescript-eslint/prefer-interface": "error",
|
||||
"@typescript-eslint/prefer-string-starts-ends-with": "error",
|
||||
"@typescript-eslint/promise-function-async": "error",
|
||||
"@typescript-eslint/require-array-sort-compare": "error",
|
||||
|
|
|
@ -31,8 +31,8 @@ jobs:
|
|||
- name: Bootstrap
|
||||
run: npm run bootstrap
|
||||
|
||||
# - name: audit tools #disabled while we wait for https://github.com/actions/toolkit/issues/539
|
||||
# run: npm audit --audit-level=moderate
|
||||
- name: audit tools #disabled while we wait for https://github.com/actions/toolkit/issues/539
|
||||
run: npm audit --audit-level=moderate
|
||||
|
||||
- name: audit packages
|
||||
run: npm run audit-all
|
||||
|
|
File diff suppressed because it is too large
Load Diff
24
package.json
24
package.json
|
@ -13,20 +13,20 @@
|
|||
"test": "jest --testTimeout 10000"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@types/jest": "^24.0.11",
|
||||
"@types/node": "^12.12.47",
|
||||
"@types/signale": "^1.2.1",
|
||||
"@typescript-eslint/parser": "^2.2.7",
|
||||
"concurrently": "^4.1.0",
|
||||
"eslint": "^5.16.0",
|
||||
"eslint-plugin-github": "^2.0.0",
|
||||
"eslint-plugin-jest": "^22.5.1",
|
||||
"@types/jest": "^24.9.1",
|
||||
"@types/node": "^12.20.13",
|
||||
"@types/signale": "^1.4.1",
|
||||
"@typescript-eslint/parser": "^4.0.0",
|
||||
"concurrently": "^6.1.0",
|
||||
"eslint": "^7.23.0",
|
||||
"eslint-plugin-github": "^4.1.3",
|
||||
"eslint-plugin-jest": "^22.21.0",
|
||||
"flow-bin": "^0.115.0",
|
||||
"jest": "^25.1.0",
|
||||
"jest-circus": "^24.7.1",
|
||||
"lerna": "^3.18.4",
|
||||
"jest": "^26.6.3",
|
||||
"jest-circus": "^24.9.0",
|
||||
"lerna": "^4.0.0",
|
||||
"prettier": "^1.19.1",
|
||||
"ts-jest": "^25.4.0",
|
||||
"ts-jest": "^26.5.6",
|
||||
"typescript": "^3.9.9"
|
||||
}
|
||||
}
|
||||
|
|
|
@ -357,7 +357,7 @@ describe('Download Tests', () => {
|
|||
plaintext: Buffer | string
|
||||
): Promise<Buffer> {
|
||||
if (isGzip) {
|
||||
return <Buffer>await promisify(gzip)(plaintext)
|
||||
return await promisify(gzip)(plaintext)
|
||||
} else if (typeof plaintext === 'string') {
|
||||
return Buffer.from(plaintext, defaultEncoding)
|
||||
} else {
|
||||
|
|
|
@ -69,7 +69,7 @@ export async function retry(
|
|||
throw Error(`${name} failed: ${errorMessage}`)
|
||||
}
|
||||
|
||||
export async function retryHttpClientRequest<T>(
|
||||
export async function retryHttpClientRequest(
|
||||
name: string,
|
||||
method: () => Promise<IHttpClientResponse>,
|
||||
customErrorMessages: Map<number, string> = new Map(),
|
||||
|
|
|
@ -87,7 +87,7 @@ test('download progress tracked correctly', () => {
|
|||
expect(progress.isDone()).toBe(true)
|
||||
})
|
||||
|
||||
test('display timer works correctly', () => {
|
||||
test('display timer works correctly', done => {
|
||||
const progress = new DownloadProgress(1000)
|
||||
|
||||
const infoMock = jest.spyOn(core, 'info')
|
||||
|
@ -103,6 +103,7 @@ test('display timer works correctly', () => {
|
|||
const test2 = (): void => {
|
||||
check()
|
||||
expect(progress.timeoutHandle).toBeUndefined()
|
||||
done()
|
||||
}
|
||||
|
||||
// Validate the progress is displayed, stop the timer, and call test2.
|
||||
|
@ -112,7 +113,7 @@ test('display timer works correctly', () => {
|
|||
progress.stopDisplayTimer()
|
||||
progress.setReceivedBytes(1000)
|
||||
|
||||
setTimeout(() => test2(), 100)
|
||||
setTimeout(() => test2(), 500)
|
||||
}
|
||||
|
||||
// Start the timer, update the received bytes, and call test1.
|
||||
|
@ -122,7 +123,7 @@ test('display timer works correctly', () => {
|
|||
|
||||
progress.setReceivedBytes(500)
|
||||
|
||||
setTimeout(() => test1(), 100)
|
||||
setTimeout(() => test1(), 500)
|
||||
}
|
||||
|
||||
start()
|
||||
|
|
|
@ -30,7 +30,6 @@ async function handleResponse(
|
|||
response: ITestResponse | undefined
|
||||
): Promise<ITestResponse> {
|
||||
if (!response) {
|
||||
// eslint-disable-next-line no-undef
|
||||
fail('Retry method called too many times')
|
||||
}
|
||||
|
||||
|
|
|
@ -18,7 +18,6 @@ beforeAll(() => {
|
|||
jest.spyOn(core, 'warning').mockImplementation(() => {})
|
||||
jest.spyOn(core, 'error').mockImplementation(() => {})
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/promise-function-async
|
||||
jest.spyOn(cacheUtils, 'getCacheFileName').mockImplementation(cm => {
|
||||
const actualUtils = jest.requireActual('../src/internal/cacheUtils')
|
||||
return actualUtils.getCacheFileName(cm)
|
||||
|
|
|
@ -17,7 +17,6 @@ beforeAll(() => {
|
|||
jest.spyOn(core, 'warning').mockImplementation(() => {})
|
||||
jest.spyOn(core, 'error').mockImplementation(() => {})
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/promise-function-async
|
||||
jest.spyOn(cacheUtils, 'getCacheFileName').mockImplementation(cm => {
|
||||
const actualUtils = jest.requireActual('../src/internal/cacheUtils')
|
||||
return actualUtils.getCacheFileName(cm)
|
||||
|
|
|
@ -133,7 +133,7 @@ export class DownloadProgress {
|
|||
*
|
||||
* @param delayInMs the delay between each write
|
||||
*/
|
||||
startDisplayTimer(delayInMs: number = 1000): void {
|
||||
startDisplayTimer(delayInMs = 1000): void {
|
||||
const displayCallback = (): void => {
|
||||
this.display()
|
||||
|
||||
|
|
|
@ -120,7 +120,7 @@ export async function retryTypedResponse<T>(
|
|||
)
|
||||
}
|
||||
|
||||
export async function retryHttpClientResponse<T>(
|
||||
export async function retryHttpClientResponse(
|
||||
name: string,
|
||||
method: () => Promise<IHttpClientResponse>,
|
||||
maxAttempts = DefaultRetryAttempts,
|
||||
|
|
|
@ -29,7 +29,7 @@ export function issueCommand(
|
|||
process.stdout.write(cmd.toString() + os.EOL)
|
||||
}
|
||||
|
||||
export function issue(name: string, message: string = ''): void {
|
||||
export function issue(name: string, message = ''): void {
|
||||
issueCommand(name, {}, message)
|
||||
}
|
||||
|
||||
|
|
|
@ -619,13 +619,13 @@ class ExecState extends events.EventEmitter {
|
|||
}
|
||||
}
|
||||
|
||||
processClosed: boolean = false // tracks whether the process has exited and stdio is closed
|
||||
processError: string = ''
|
||||
processExitCode: number = 0
|
||||
processExited: boolean = false // tracks whether the process has exited
|
||||
processStderr: boolean = false // tracks whether stderr was written to
|
||||
processClosed = false // tracks whether the process has exited and stdio is closed
|
||||
processError = ''
|
||||
processExitCode = 0
|
||||
processExited = false // tracks whether the process has exited
|
||||
processStderr = false // tracks whether stderr was written to
|
||||
private delay = 10000 // 10 seconds
|
||||
private done: boolean = false
|
||||
private done = false
|
||||
private options: im.ExecOptions
|
||||
private timeout: NodeJS.Timer | null = null
|
||||
private toolPath: string
|
||||
|
|
|
@ -2,6 +2,7 @@ import * as path from 'path'
|
|||
import {Context} from '../src/context'
|
||||
|
||||
/* eslint-disable @typescript-eslint/no-require-imports */
|
||||
/* eslint-disable @typescript-eslint/no-var-requires */
|
||||
|
||||
describe('@actions/context', () => {
|
||||
let context: Context
|
||||
|
|
|
@ -48,10 +48,6 @@ export class Pattern {
|
|||
*/
|
||||
private readonly isImplicitPattern: boolean
|
||||
|
||||
/* eslint-disable no-dupe-class-members */
|
||||
// Disable no-dupe-class-members due to false positive for method overload
|
||||
// https://github.com/typescript-eslint/typescript-eslint/issues/291
|
||||
|
||||
constructor(pattern: string)
|
||||
constructor(
|
||||
pattern: string,
|
||||
|
@ -67,7 +63,7 @@ export class Pattern {
|
|||
)
|
||||
constructor(
|
||||
patternOrNegate: string | boolean,
|
||||
isImplicitPattern: boolean = false,
|
||||
isImplicitPattern = false,
|
||||
segments?: string[],
|
||||
homedir?: string
|
||||
) {
|
||||
|
|
|
@ -33,7 +33,7 @@ export async function exists(fsPath: string): Promise<boolean> {
|
|||
|
||||
export async function isDirectory(
|
||||
fsPath: string,
|
||||
useStat: boolean = false
|
||||
useStat = false
|
||||
): Promise<boolean> {
|
||||
const stats = useStat ? await stat(fsPath) : await lstat(fsPath)
|
||||
return stats.isDirectory()
|
||||
|
|
|
@ -122,11 +122,9 @@ describe('@actions/tool-cache', function() {
|
|||
|
||||
setResponseMessageFactory(() => {
|
||||
const readStream = new stream.Readable()
|
||||
/* eslint-disable @typescript-eslint/unbound-method */
|
||||
readStream._read = () => {
|
||||
readStream.destroy(new Error('uh oh'))
|
||||
}
|
||||
/* eslint-enable @typescript-eslint/unbound-method */
|
||||
return readStream
|
||||
})
|
||||
|
||||
|
@ -149,7 +147,6 @@ describe('@actions/tool-cache', function() {
|
|||
.get('/retries-error-from-response-message-stream')
|
||||
.reply(200, {})
|
||||
|
||||
/* eslint-disable @typescript-eslint/unbound-method */
|
||||
let attempt = 1
|
||||
setResponseMessageFactory(() => {
|
||||
const readStream = new stream.Readable()
|
||||
|
@ -170,7 +167,6 @@ describe('@actions/tool-cache', function() {
|
|||
|
||||
return readStream
|
||||
})
|
||||
/* eslint-enable @typescript-eslint/unbound-method */
|
||||
|
||||
const downPath = await tc.downloadTool(
|
||||
'http://example.com/retries-error-from-response-message-stream'
|
||||
|
|
Loading…
Reference in New Issue