Add and configure ESLint and update configuration for Prettier (#617)

* Add ESLint, update Prettier

* Update docs

* Update tests

* Update licenses

* Fix review points
This commit is contained in:
Ivan
2023-03-09 12:44:56 +02:00
committed by GitHub
parent 7b9ef6fc5a
commit ec365b4eba
36 changed files with 3733 additions and 505 deletions

View File

@ -1,2 +1 @@
const CACHE_DEPENDENCY_BACKUP_PATH: string = '**/pyproject.toml';
export {CACHE_DEPENDENCY_BACKUP_PATH};
export const CACHE_DEPENDENCY_BACKUP_PATH = '**/pyproject.toml';

View File

@ -15,7 +15,7 @@ class PipCache extends CacheDistributor {
constructor(
private pythonVersion: string,
cacheDependencyPath: string = '**/requirements.txt'
cacheDependencyPath = '**/requirements.txt'
) {
super('pip', cacheDependencyPath);
}

View File

@ -65,17 +65,14 @@ export async function findPyPyVersion(
));
if (!installDir) {
({
installDir,
resolvedPythonVersion,
resolvedPyPyVersion
} = await pypyInstall.installPyPy(
pypyVersionSpec.pypyVersion,
pypyVersionSpec.pythonVersion,
architecture,
allowPreReleases,
releases
));
({installDir, resolvedPythonVersion, resolvedPyPyVersion} =
await pypyInstall.installPyPy(
pypyVersionSpec.pypyVersion,
pypyVersionSpec.pythonVersion,
architecture,
allowPreReleases,
releases
));
}
const pipDir = IS_WINDOWS ? 'Scripts' : 'bin';
@ -145,7 +142,7 @@ export function parsePyPyVersion(versionSpec: string): IPyPyVersionSpec {
const versions = versionSpec.split('-').filter(item => !!item);
if (/^(pypy)(.+)/.test(versions[0])) {
let pythonVersion = versions[0].replace('pypy', '');
const pythonVersion = versions[0].replace('pypy', '');
versions.splice(0, 1, 'pypy', pythonVersion);
}

View File

@ -63,7 +63,7 @@ export async function installPyPy(
}
const {foundAsset, resolvedPythonVersion, resolvedPyPyVersion} = releaseData;
let downloadUrl = `${foundAsset.download_url}`;
const downloadUrl = `${foundAsset.download_url}`;
core.info(`Downloading PyPy from "${downloadUrl}" ...`);
@ -143,7 +143,7 @@ async function createPyPySymlink(
const pythonMinor = semver.minor(version);
const pypyBinaryPostfix = pythonBinaryPostfix === 2 ? '' : '3';
const pypyMajorMinorBinaryPostfix = `${pythonBinaryPostfix}.${pythonMinor}`;
let binaryExtension = IS_WINDOWS ? '.exe' : '';
const binaryExtension = IS_WINDOWS ? '.exe' : '';
core.info('Creating symlinks...');
createSymlinkInFolder(

View File

@ -23,7 +23,7 @@ async function cacheDependencies(cache: string, pythonVersion: string) {
}
function resolveVersionInput() {
let versions = core.getMultilineInput('python-version');
const versions = core.getMultilineInput('python-version');
let versionFile = core.getInput('python-version-file');
if (versions.length && versionFile) {

View File

@ -1,3 +1,4 @@
/* eslint no-unsafe-finally: "off" */
import * as cache from '@actions/cache';
import * as core from '@actions/core';
import fs from 'fs';
@ -71,7 +72,7 @@ export function getPyPyVersionFromPath(installDir: string) {
*/
export function readExactPyPyVersionFile(installDir: string) {
let pypyVersion = '';
let fileVersion = path.join(installDir, PYPY_VERSION_FILE);
const fileVersion = path.join(installDir, PYPY_VERSION_FILE);
if (fs.existsSync(fileVersion)) {
pypyVersion = fs.readFileSync(fileVersion).toString().trim();
}