Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 0 additions & 4 deletions .eslintignore

This file was deleted.

36 changes: 0 additions & 36 deletions .eslintrc.json

This file was deleted.

1 change: 0 additions & 1 deletion __tests__/buildx/builder.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 0 additions & 2 deletions __tests__/buildx/buildx.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down
2 changes: 0 additions & 2 deletions __tests__/buildx/install.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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');
Expand All @@ -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');
Expand Down
2 changes: 0 additions & 2 deletions __tests__/compose/compose.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down
1 change: 0 additions & 1 deletion __tests__/cosign/cosign.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
10 changes: 5 additions & 5 deletions __tests__/git.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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'], {
Expand All @@ -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'], {
Expand Down Expand Up @@ -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', '--'], {
Expand All @@ -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', '--'], {
Expand All @@ -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'], {
Expand Down
1 change: 1 addition & 0 deletions __tests__/github.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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();
});
Expand Down
1 change: 0 additions & 1 deletion __tests__/regclient/regctl.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
1 change: 0 additions & 1 deletion __tests__/undock/undock.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
84 changes: 84 additions & 0 deletions eslint.config.js
Original file line number Diff line number Diff line change
@@ -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
}
}
]);
2 changes: 1 addition & 1 deletion jest.config.itg.ts → jest.config.itg.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
};
13 changes: 6 additions & 7 deletions jest.config.ts → jest.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -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-'));

Expand All @@ -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,
Expand All @@ -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
};
37 changes: 20 additions & 17 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down Expand Up @@ -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"
}
}
2 changes: 1 addition & 1 deletion src/buildkit/buildkit.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down
Loading
Loading