8
0
Fork 0
mirror of https://github.com/actions/setup-python.git synced 2026-02-11 08:09:27 +00:00

chore: migrate tooling configs to ESM format

This commit is contained in:
Priyagupta108 2026-02-06 15:42:14 +05:30
parent a309ff8b42
commit f9978130a7
8 changed files with 1989 additions and 1664 deletions

View file

@ -1,6 +0,0 @@
# Ignore list
/*
# Do not ignore these folders:
!__tests__/
!src/

View file

@ -1,51 +0,0 @@
// This is a reusable configuration file copied from https://github.com/actions/reusable-workflows/tree/main/reusable-configurations. Please don't make changes to this file as it's the subject of an automatic update.
module.exports = {
extends: [
'eslint:recommended',
'plugin:@typescript-eslint/recommended',
'plugin:eslint-plugin-jest/recommended',
'eslint-config-prettier'
],
parser: '@typescript-eslint/parser',
plugins: ['@typescript-eslint', 'eslint-plugin-node', 'eslint-plugin-jest'],
rules: {
'@typescript-eslint/no-require-imports': 'error',
'@typescript-eslint/no-non-null-assertion': 'off',
'@typescript-eslint/no-explicit-any': 'off',
'@typescript-eslint/no-empty-function': 'off',
'@typescript-eslint/ban-ts-comment': [
'error',
{
'ts-ignore': 'allow-with-description'
}
],
'no-console': 'error',
'yoda': 'error',
'prefer-const': [
'error',
{
destructuring: 'all'
}
],
'no-control-regex': 'off',
'no-constant-condition': ['error', {checkLoops: false}],
'node/no-extraneous-import': 'error'
},
overrides: [
{
files: ['**/*{test,spec}.ts'],
rules: {
'@typescript-eslint/no-unused-vars': 'off',
'jest/no-standalone-expect': 'off',
'jest/no-conditional-expect': 'off',
'no-console': 'off',
}
}
],
env: {
node: true,
es6: true,
'jest/globals': true
}
};

59
eslint.config.mjs Normal file
View file

@ -0,0 +1,59 @@
// This is a reusable configuration file copied from https://github.com/actions/reusable-workflows/tree/main/reusable-configurations. Please don't make changes to this file as it's the subject of an automatic update.
import js from '@eslint/js';
import tseslint from 'typescript-eslint';
import jest from 'eslint-plugin-jest';
import prettier from 'eslint-config-prettier';
export default tseslint.config(
js.configs.recommended,
...tseslint.configs.recommended,
prettier,
{
ignores: ['node_modules/**', 'dist/**', 'lib/**', 'coverage/**']
},
{
files: ['**/*.ts'],
languageOptions: {
ecmaVersion: 2022,
sourceType: 'module'
},
rules: {
'@typescript-eslint/no-require-imports': 'error',
'@typescript-eslint/no-non-null-assertion': 'off',
'@typescript-eslint/no-explicit-any': 'off',
'@typescript-eslint/no-empty-function': 'off',
'@typescript-eslint/ban-ts-comment': [
'error',
{
'ts-ignore': 'allow-with-description'
}
],
'no-console': 'error',
'yoda': 'error',
'prefer-const': [
'error',
{
destructuring: 'all'
}
],
'no-control-regex': 'off',
'no-constant-condition': ['error', {checkLoops: false}]
}
},
{
files: ['**/*.test.ts', '**/*.spec.ts'],
plugins: {
jest
},
languageOptions: {
globals: jest.environments.globals.globals
},
rules: {
...jest.configs.recommended.rules,
'@typescript-eslint/no-unused-vars': 'off',
'jest/no-standalone-expect': 'off',
'jest/no-conditional-expect': 'off',
'no-console': 'off'
}
}
);

3506
package-lock.json generated

File diff suppressed because it is too large Load diff

View file

@ -9,10 +9,10 @@
}, },
"scripts": { "scripts": {
"build": "ncc build -o dist/setup src/setup-python.ts && ncc build -o dist/cache-save src/cache-save.ts", "build": "ncc build -o dist/setup src/setup-python.ts && ncc build -o dist/cache-save src/cache-save.ts",
"format": "prettier --no-error-on-unmatched-pattern --config ./.prettierrc.js --write \"**/*.{ts,yml,yaml}\"", "format": "prettier --no-error-on-unmatched-pattern --config ./.prettierrc.cjs --write \"**/*.{ts,yml,yaml}\"",
"format-check": "prettier --no-error-on-unmatched-pattern --config ./.prettierrc.js --check \"**/*.{ts,yml,yaml}\"", "format-check": "prettier --no-error-on-unmatched-pattern --config ./.prettierrc.cjs --check \"**/*.{ts,yml,yaml}\"",
"lint": "eslint --config ./.eslintrc.js \"**/*.ts\"", "lint": "eslint \"**/*.ts\"",
"lint:fix": "eslint --config ./.eslintrc.js \"**/*.ts\" --fix", "lint:fix": "eslint \"**/*.ts\" --fix",
"release": "ncc build -o dist/setup src/setup-python.ts && ncc build -o dist/cache-save src/cache-save.ts && git add -f dist/", "release": "ncc build -o dist/setup src/setup-python.ts && ncc build -o dist/cache-save src/cache-save.ts && git add -f dist/",
"test": "jest --runInBand --coverage" "test": "jest --runInBand --coverage"
}, },
@ -32,27 +32,26 @@
"@actions/core": "^2.0.1", "@actions/core": "^2.0.1",
"@actions/exec": "^2.0.0", "@actions/exec": "^2.0.0",
"@actions/glob": "^0.5.0", "@actions/glob": "^0.5.0",
"@actions/http-client": "^3.0.0", "@actions/http-client": "^2.2.3",
"@actions/io": "^2.0.0", "@actions/io": "^2.0.0",
"@actions/tool-cache": "^2.0.2", "@actions/tool-cache": "^2.0.2",
"@iarna/toml": "^3.0.0", "@iarna/toml": "^3.0.0",
"semver": "^7.7.1" "semver": "^7.7.1"
}, },
"devDependencies": { "devDependencies": {
"@types/jest": "^29.5.12", "@eslint/js": "^9.39.2",
"@types/jest": "^30.0.0",
"@types/node": "^24.10.1", "@types/node": "^24.10.1",
"@types/semver": "^7.7.0", "@types/semver": "^7.7.0",
"@typescript-eslint/eslint-plugin": "^5.54.0",
"@typescript-eslint/parser": "^5.54.0",
"@vercel/ncc": "^0.38.3", "@vercel/ncc": "^0.38.3",
"eslint": "^8.57.0", "eslint": "^9.39.2",
"eslint-config-prettier": "^8.6.0", "eslint-config-prettier": "^10.1.8",
"eslint-plugin-jest": "^27.9.0", "eslint-plugin-jest": "^29.12.2",
"eslint-plugin-node": "^11.1.0", "jest": "^30.2.0",
"jest": "^29.7.0", "jest-circus": "^30.2.0",
"jest-circus": "^29.7.0",
"prettier": "^3.6.2", "prettier": "^3.6.2",
"ts-jest": "^29.3.2", "ts-jest": "^29.3.2",
"typescript": "^5.9.3" "typescript": "^5.9.3",
"typescript-eslint": "^8.54.0"
} }
} }

View file

@ -29,7 +29,7 @@ async function installPipPackages(pipInstall: string) {
const installArgs = pipInstall.trim().split(/\s+/); const installArgs = pipInstall.trim().split(/\s+/);
await exec('python', ['-m', 'pip', 'install', ...installArgs]); await exec('python', ['-m', 'pip', 'install', ...installArgs]);
core.info('Successfully installed pip packages'); core.info('Successfully installed pip packages');
} catch (error) { } catch {
core.setFailed( core.setFailed(
`Failed to install pip packages from "${pipInstall}". Please verify that the package names, versions, or requirements files provided are correct and installable, that the specified packages and versions can be resolved from PyPI or the configured package index, and that your network connection is stable and allows access to the package index.` `Failed to install pip packages from "${pipInstall}". Please verify that the package names, versions, or requirements files provided are correct and installable, that the specified packages and versions can be resolved from PyPI or the configured package index, and that your network connection is stable and allows access to the package index.`
); );