fix: fix all the eslint issues

This commit is contained in:
Amin Yahyaabadi 2024-04-03 01:20:06 -07:00
parent 1d9b24d3a2
commit cceb0f93f2
No known key found for this signature in database
GPG Key ID: F52AF77F636088F0
21 changed files with 40 additions and 35 deletions

View File

@ -67,7 +67,7 @@ jobs:
run: |
if [ "$(git diff --ignore-space-at-eol --text dist/ | wc -l)" -gt "0" ]; then
echo "Detected uncommitted changes after build. See status below:"
git diff --ignore-space-at-eol --text dist/
git diff --ignore-space-at-eol --text dist/ ':(exclude)*.js.map'
exit 1
fi

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -93,7 +93,7 @@ export async function activateLLVM(directory: string) {
const ld = process.env.LD_LIBRARY_PATH ?? ""
const dyld = process.env.DYLD_LIBRARY_PATH ?? ""
const actPromises: Promise<any>[] = [
const actPromises: Promise<void>[] = [
// the output of this action
addEnv("LLVM_PATH", directory),

View File

@ -60,7 +60,7 @@ async function patchAptLLVMScript(path: string, target_path: string, majorVersio
}
function debugScript(script: string) {
if (!process.env.NODE_DEBUG) {
if (process.env.NODE_DEBUG !== "1" && process.env.NODE_DEBUG !== "true") {
return script.replace(/set -eux/g, "set -eu")
}
return script

View File

@ -14,8 +14,8 @@ describe("setup-msvc", () => {
await setupMSVC("", "", process.arch)
console.log(which.sync("cl"))
} catch (err) {
if ("toString" in (err as any)) {
warning((err as any).toString())
if (err instanceof Error) {
warning(err.toString())
}
}
})
@ -30,8 +30,8 @@ describe("setup-msvc", () => {
await setupMSVC(`${version}`, "", process.arch)
console.log(which.sync("cl"))
} catch (err) {
if ("toString" in (err as any)) {
warning((err as any).toString())
if (err instanceof Error) {
warning(err.toString())
}
}
})

View File

@ -26,7 +26,7 @@ export async function setupPowershell(version: string | undefined, _setupDir: st
if (isArch()) {
return setupPacmanPack("powershell-bin", version, "yay")
} else if (hasDnf()) {
setupDnfPack([{ name: "curl" }])
await setupDnfPack([{ name: "curl" }])
execRootSync("/bin/bash", [
"-c",
`curl https://packages.microsoft.com/config/rhel/8/prod.repo | sudo tee /etc/yum.repos.d/microsoft.repo`,

View File

@ -130,7 +130,10 @@ async function setupPythonSystem(setupDir: string, version: string) {
case "darwin": {
installInfo = await setupBrewPack("python3", version)
// add the python and pip binaries to the path
const brewPythonPrefix = await execa("brew", ["--prefix", "python"], { stdio: "pipe" })
const brewPythonPrefix: {
stdout: string
stderr: string
} = await execa("brew", ["--prefix", "python"], { stdio: "pipe" })
const brewPythonBin = join(brewPythonPrefix.stdout, "libexec", "bin")
await addPath(brewPythonBin)
@ -176,6 +179,7 @@ async function isPythonUpToDate(candidate: string, binDir?: string) {
}
}
}
// eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
const pythonBinPaths = (await which(candidate, { nothrow: true, all: true })) ?? []
for (const pythonBinPath of pythonBinPaths) {
// eslint-disable-next-line no-await-in-loop
@ -215,10 +219,11 @@ async function findPip() {
async function isPipUptoDate(pip: string) {
try {
// eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
const pipPaths = (await which(pip, { nothrow: true, all: true })) ?? []
for (const pipPath of pipPaths) {
// eslint-disable-next-line no-await-in-loop
if (pipPath !== null && (await isBinUptoDate(pipPath, MinVersions.pip!))) {
if (await isBinUptoDate(pipPath, MinVersions.pip!)) {
return pipPath
}
}

View File

@ -43,7 +43,7 @@ function detectUsingOsVersion() {
}
// #46~22.04.1-Ubuntu SMP ...
const osVersion = os.version()
const osVersion: string = os.version()
const versionSplitted = osVersion.split(".")
const majorVersion = parseInt(versionSplitted[0].replace("#", ""), 10)
const minorVersion = parseInt(versionSplitted[1].replace("~", ""), 10)

View File

@ -55,6 +55,6 @@ export async function extractTarByExe(file: string, dest: string, flags = ["--st
}
}
grantUserWriteAccess(dest)
await grantUserWriteAccess(dest)
return dest
}

View File

@ -220,10 +220,10 @@ export async function addAptKeyViaDownload(name: string, url: string) {
export async function updateAptAlternatives(name: string, path: string, priority: number = 40) {
if (GITHUB_ACTIONS) {
return execRoot("update-alternatives", ["--install", `/usr/bin/${name}`, name, path, priority.toString()])
await execRoot("update-alternatives", ["--install", `/usr/bin/${name}`, name, path, priority.toString()])
} else {
await sourceCpprc()
return appendFile(
await appendFile(
cpprc_path,
`\nif [ $UID -eq 0 ]; then update-alternatives --install /usr/bin/${name} ${name} ${path} ${priority}; fi\n`,
)