Merge pull request #902 from crazy-max/dev-deps

update dev dependencies
This commit is contained in:
CrazyMax
2025-12-16 10:05:22 +01:00
committed by GitHub
23 changed files with 1824 additions and 1611 deletions

View File

@@ -1,4 +0,0 @@
/.yarn/**
/lib/**
/coverage/**
/node_modules/**

View File

@@ -1,36 +0,0 @@
{
"env": {
"node": true,
"es6": true,
"mocha": true,
"jest": true
},
"extends": [
"eslint:recommended",
"plugin:@typescript-eslint/eslint-recommended",
"plugin:@typescript-eslint/recommended",
"plugin:import/errors",
"plugin:import/typescript", // this is needed to allow importing typescript files from JS
"plugin:import/warnings",
"plugin:jest/recommended",
"plugin:prettier/recommended"
],
"parser": "@typescript-eslint/parser",
"parserOptions": {
"ecmaVersion": 2023,
"sourceType": "module"
},
"plugins": [
"@typescript-eslint",
"jest",
"prettier"
],
"rules": {
"import/no-unresolved": [
"error", {
"ignore": ["csv-parse/sync", "@octokit/openapi-types"]
}
],
"jest/no-disabled-tests": 0
}
}

View File

@@ -49,7 +49,6 @@ describe('exists', () => {
const execSpy = jest.spyOn(Exec, 'getExecOutput');
const builder = new Builder();
await builder.exists('foo');
// eslint-disable-next-line jest/no-standalone-expect
expect(execSpy).toHaveBeenCalledWith(`docker`, ['buildx', 'inspect', 'foo'], {
silent: true,
ignoreReturnCode: true

View File

@@ -91,7 +91,6 @@ describe('isAvailable', () => {
standalone: false
});
await buildx.isAvailable();
// eslint-disable-next-line jest/no-standalone-expect
expect(execSpy).toHaveBeenCalledWith(`docker`, ['buildx'], {
silent: true,
ignoreReturnCode: true
@@ -103,7 +102,6 @@ describe('isAvailable', () => {
standalone: true
});
await buildx.isAvailable();
// eslint-disable-next-line jest/no-standalone-expect
expect(execSpy).toHaveBeenCalledWith(`buildx`, [], {
silent: true,
ignoreReturnCode: true

View File

@@ -94,7 +94,6 @@ describe('download', () => {
});
describe('build', () => {
// eslint-disable-next-line jest/no-disabled-tests
it.skip('builds refs/pull/648/head', async () => {
const install = new Install();
const toolPath = await install.build('https://github.com/docker/buildx.git#refs/pull/648/head');
@@ -103,7 +102,6 @@ describe('build', () => {
expect(fs.existsSync(buildxBin)).toBe(true);
}, 100000);
// eslint-disable-next-line jest/no-disabled-tests
it.skip('builds 67bd6f4dc82a9cd96f34133dab3f6f7af803bb14', async () => {
const install = new Install();
const toolPath = await install.build('https://github.com/docker/buildx.git#67bd6f4dc82a9cd96f34133dab3f6f7af803bb14');

View File

@@ -49,7 +49,6 @@ describe('isAvailable', () => {
standalone: false
});
await compose.isAvailable();
// eslint-disable-next-line jest/no-standalone-expect
expect(execSpy).toHaveBeenCalledWith(`docker`, ['compose'], {
silent: true,
ignoreReturnCode: true
@@ -61,7 +60,6 @@ describe('isAvailable', () => {
standalone: true
});
await compose.isAvailable();
// eslint-disable-next-line jest/no-standalone-expect
expect(execSpy).toHaveBeenCalledWith(`compose`, [], {
silent: true,
ignoreReturnCode: true

View File

@@ -29,7 +29,6 @@ describe('isAvailable', () => {
const execSpy = jest.spyOn(Exec, 'getExecOutput');
const cosign = new Cosign();
await cosign.isAvailable();
// eslint-disable-next-line jest/no-standalone-expect
expect(execSpy).toHaveBeenCalledWith(`cosign`, [], {
silent: true,
ignoreReturnCode: true

View File

@@ -57,7 +57,7 @@ describe('isInsideWorkTree', () => {
const execSpy = jest.spyOn(Exec, 'getExecOutput');
try {
await Git.isInsideWorkTree();
} catch (err) {
} catch {
// noop
}
expect(execSpy).toHaveBeenCalledWith(`git`, ['rev-parse', '--is-inside-work-tree'], {
@@ -81,7 +81,7 @@ describe('remoteURL', () => {
const execSpy = jest.spyOn(Exec, 'getExecOutput');
try {
await Git.remoteURL();
} catch (err) {
} catch {
// noop
}
expect(execSpy).toHaveBeenCalledWith(`git`, ['remote', 'get-url', 'origin'], {
@@ -415,7 +415,7 @@ describe('fullCommit', () => {
const execSpy = jest.spyOn(Exec, 'getExecOutput');
try {
await Git.fullCommit();
} catch (err) {
} catch {
// noop
}
expect(execSpy).toHaveBeenCalledWith(`git`, ['show', '--format=%H', 'HEAD', '--quiet', '--'], {
@@ -430,7 +430,7 @@ describe('shortCommit', () => {
const execSpy = jest.spyOn(Exec, 'getExecOutput');
try {
await Git.shortCommit();
} catch (err) {
} catch {
// noop
}
expect(execSpy).toHaveBeenCalledWith(`git`, ['show', '--format=%h', 'HEAD', '--quiet', '--'], {
@@ -445,7 +445,7 @@ describe('tag', () => {
const execSpy = jest.spyOn(Exec, 'getExecOutput');
try {
await Git.tag();
} catch (err) {
} catch {
// noop
}
expect(execSpy).toHaveBeenCalledWith(`git`, ['tag', '--points-at', 'HEAD', '--sort', '-version:creatordate'], {

View File

@@ -141,6 +141,7 @@ describe('actionsRuntimeToken', () => {
it('malformed', async () => {
process.env.ACTIONS_RUNTIME_TOKEN = 'foo';
expect(() => {
// eslint-disable-next-line @typescript-eslint/no-unused-expressions
GitHub.actionsRuntimeToken;
}).toThrow();
});

View File

@@ -85,7 +85,6 @@ describe('isAvailable', () => {
const execSpy = jest.spyOn(Exec, 'getExecOutput');
const regctl = new Regctl();
await regctl.isAvailable();
// eslint-disable-next-line jest/no-standalone-expect
expect(execSpy).toHaveBeenCalledWith(`regctl`, [], {
silent: true,
ignoreReturnCode: true

View File

@@ -14,16 +14,14 @@
* limitations under the License.
*/
// eslint-disable-next-line @typescript-eslint/no-var-requires
/* eslint-disable @typescript-eslint/no-require-imports */
const fs = require('fs');
module.exports = results => {
const allSkipped = results.testResults.every(result => {
return result.skipped;
});
const allSkipped = results.testResults.every(result => result.skipped);
if (allSkipped) {
console.log('All tests were skipped!');
// create an empty file to signal that all tests were skipped for CI
fs.mkdirSync('./coverage', {recursive: true});
fs.closeSync(fs.openSync('./coverage/allSkipped.txt', 'w'));
}
return results;

View File

@@ -46,7 +46,6 @@ describe('isAvailable', () => {
const execSpy = jest.spyOn(Exec, 'getExecOutput');
const undock = new Undock();
await undock.isAvailable();
// eslint-disable-next-line jest/no-standalone-expect
expect(execSpy).toHaveBeenCalledWith(`undock`, [], {
silent: true,
ignoreReturnCode: true

84
eslint.config.js Normal file
View File

@@ -0,0 +1,84 @@
/**
* Copyright 2025 actions-toolkit authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/* eslint-disable @typescript-eslint/no-require-imports */
const {defineConfig, globalIgnores} = require('eslint/config');
const {fixupConfigRules, fixupPluginRules} = require('@eslint/compat');
const typescriptEslint = require('@typescript-eslint/eslint-plugin');
const jestPlugin = require('eslint-plugin-jest');
const prettier = require('eslint-plugin-prettier');
const globals = require('globals');
const tsParser = require('@typescript-eslint/parser');
const js = require('@eslint/js');
const {FlatCompat} = require('@eslint/eslintrc');
// __dirname and __filename exist natively in CommonJS
const compat = new FlatCompat({
baseDirectory: __dirname,
recommendedConfig: js.configs.recommended,
allConfig: js.configs.all
});
module.exports = defineConfig([
globalIgnores(['.yarn/**/*', 'lib/**/*', 'coverage/**/*', 'node_modules/**/*']),
{
extends: fixupConfigRules(
compat.extends(
'eslint:recommended',
'plugin:@typescript-eslint/eslint-recommended',
'plugin:@typescript-eslint/recommended',
'plugin:import/errors',
'plugin:import/typescript',
'plugin:import/warnings',
'plugin:jest/recommended',
'plugin:prettier/recommended'
)
),
plugins: {
'@typescript-eslint': fixupPluginRules(typescriptEslint),
jest: fixupPluginRules(jestPlugin),
prettier: fixupPluginRules(prettier)
},
languageOptions: {
globals: {
...globals.node,
...globals.mocha,
...globals.jest
},
parser: tsParser,
ecmaVersion: 2023,
sourceType: 'commonjs'
},
rules: {
'@typescript-eslint/no-require-imports': [
'error',
{
allowAsImport: true
}
],
'import/no-unresolved': [
'error',
{
ignore: ['csv-parse/sync', '@octokit/openapi-types']
}
],
'jest/no-disabled-tests': 0
}
}
]);

View File

@@ -26,6 +26,6 @@ module.exports = {
moduleNameMapper: {
'^csv-parse/sync': '<rootDir>/node_modules/csv-parse/dist/cjs/sync.cjs'
},
testResultsProcessor: './__tests__/testResultsProcessor.ts',
testResultsProcessor: '<rootDir>/__tests__/testResultsProcessor.js',
verbose: false
};

View File

@@ -14,9 +14,10 @@
* limitations under the License.
*/
import fs from 'fs';
import os from 'os';
import path from 'path';
/* eslint-disable @typescript-eslint/no-require-imports */
const fs = require('fs');
const os = require('os');
const path = require('path');
const tmpDir = fs.mkdtempSync(path.join(os.tmpdir(), 'docker-actions-toolkit-'));
@@ -28,9 +29,7 @@ process.env = Object.assign({}, process.env, {
GITHUB_RUN_NUMBER: 15,
RUNNER_TEMP: path.join(tmpDir, 'runner-temp'),
RUNNER_TOOL_CACHE: path.join(tmpDir, 'runner-tool-cache')
}) as {
[key: string]: string;
};
});
module.exports = {
clearMocks: true,
@@ -46,6 +45,6 @@ module.exports = {
},
collectCoverageFrom: ['src/**/{!(index.ts),}.ts'],
coveragePathIgnorePatterns: ['lib/', 'node_modules/', '__mocks__/', '__tests__/'],
testResultsProcessor: './__tests__/testResultsProcessor.ts',
testResultsProcessor: '<rootDir>/__tests__/testResultsProcessor.js',
verbose: true
};

View File

@@ -12,9 +12,9 @@
"prettier:fix": "prettier --write \"./**/*.ts\"",
"test": "jest",
"test:coverage": "jest --coverage",
"test:itg": "jest -c jest.config.itg.ts --runInBand --detectOpenHandles",
"test:itg-list": "jest -c jest.config.itg.ts --listTests",
"test:itg-coverage": "jest --coverage -c jest.config.itg.ts --runInBand --detectOpenHandles"
"test:itg": "jest -c jest.config.itg.js --runInBand",
"test:itg-list": "jest -c jest.config.itg.js --listTests",
"test:itg-coverage": "jest -c jest.config.itg.js --coverage --runInBand"
},
"repository": {
"type": "git",
@@ -70,27 +70,30 @@
"tmp": "^0.2.5"
},
"devDependencies": {
"@eslint/compat": "^2.0.0",
"@eslint/eslintrc": "^3.3.3",
"@eslint/js": "^9.39.2",
"@sigstore/rekor-types": "^3.0.0",
"@types/gunzip-maybe": "^1.4.2",
"@types/gunzip-maybe": "^1.4.3",
"@types/he": "^1.2.3",
"@types/js-yaml": "^4.0.9",
"@types/node": "^20.19.9",
"@types/node": "^20.19.27",
"@types/semver": "^7.7.1",
"@types/tar-stream": "^3.1.4",
"@types/tmp": "^0.2.6",
"@typescript-eslint/eslint-plugin": "^7.18.0",
"@typescript-eslint/parser": "^7.18.0",
"dotenv": "^17.2.1",
"eslint": "^8.57.1",
"eslint-config-prettier": "^9.1.2",
"@typescript-eslint/eslint-plugin": "^8.50.0",
"@typescript-eslint/parser": "^8.50.0",
"dotenv": "^17.2.3",
"eslint": "^9.39.2",
"eslint-config-prettier": "^10.1.8",
"eslint-plugin-import": "^2.32.0",
"eslint-plugin-jest": "^28.14.0",
"eslint-plugin-prettier": "^5.5.3",
"jest": "^29.7.0",
"prettier": "^3.6.2",
"rimraf": "^6.0.1",
"ts-jest": "^29.4.1",
"eslint-plugin-jest": "^29.5.0",
"eslint-plugin-prettier": "^5.5.4",
"jest": "^30.2.0",
"prettier": "^3.7.4",
"rimraf": "^6.1.2",
"ts-jest": "^29.4.6",
"ts-node": "^10.9.2",
"typescript": "^5.9.2"
"typescript": "^5.9.3"
}
}

View File

@@ -85,7 +85,7 @@ export class BuildKit {
if (!bkversion) {
try {
bkversion = await this.getVersionWithinImage(node.name || '');
} catch (e) {
} catch {
core.debug(`BuildKit.versionSatisfies ${node.name}: can't get version`);
return false;
}

View File

@@ -169,7 +169,7 @@ export class Build {
}
try {
return core.getBooleanInput(name) ? `builder-id=${GitHub.workflowRunURL(true)}` : 'false';
} catch (err) {
} catch {
// not a valid boolean, so we assume it's a string
return Build.resolveProvenanceAttrs(input);
}
@@ -302,7 +302,7 @@ export class Build {
// https://github.com/docker/buildx/blob/8abef5908705e49f7ba88ef8c957e1127b597a2a/util/buildflags/attests.go#L13-L21
const v = Util.parseBool(attr);
res.push(`disabled=${!v}`);
} catch (err) {
} catch {
res.push(attr);
}
}

View File

@@ -148,7 +148,7 @@ export class Buildx {
let url: URL;
try {
url = new URL(endpoint);
} catch (e) {
} catch {
return [];
}
if (url.protocol != 'tcp:') {
@@ -280,7 +280,7 @@ export class Buildx {
const fnGitURL = function (inp: string): GitURL | undefined {
try {
return Git.parseURL(inp);
} catch (e) {
} catch {
// noop
}
};

View File

@@ -60,7 +60,7 @@ export class Docker {
silent: true
});
return true;
} catch (e) {
} catch {
return false;
}
}

View File

@@ -69,7 +69,6 @@ export interface ContextInfo {
Name: string;
// eslint-disable-next-line @typescript-eslint/no-explicit-any
Metadata: any;
// eslint-disable-next-line @typescript-eslint/no-explicit-any
Endpoints: Record<string, EndpointInfo>;
TLSMaterial: Record<string, Array<string>>;
Storage: StorageInfo;

View File

@@ -82,7 +82,7 @@ export class Util {
let url;
try {
url = new URL(urlStr);
} catch (e) {
} catch {
return false;
}
return url.protocol === 'http:' || url.protocol === 'https:';
@@ -115,10 +115,10 @@ export class Util {
};
}
public static isDirectory(p) {
public static isDirectory(p: string) {
try {
return fs.lstatSync(p).isDirectory();
} catch (_) {
} catch {
// noop
}
return false;

3211
yarn.lock

File diff suppressed because it is too large Load Diff