1
0
Fork 0

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 format
pull/817/head
Thomas Boop 2021-05-21 09:19:40 -04:00 committed by GitHub
parent 8dc2d6eb6a
commit 0d74e9080a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
19 changed files with 10148 additions and 12836 deletions

View File

@ -1,3 +1,4 @@
node_modules/
packages/*/node_modules/
packages/*/lib/
packages/glob/__tests__/_temp

View File

@ -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",

View File

@ -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

23500
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -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"
}
}

View File

@ -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 {

View File

@ -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(),

View File

@ -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()

View File

@ -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')
}

View File

@ -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)

View File

@ -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)

View File

@ -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()

View File

@ -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,

View File

@ -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)
}

View File

@ -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

View File

@ -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

View File

@ -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
) {

View File

@ -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()

View File

@ -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'