Apply stricter linting (#24)

This commit is contained in:
Paulo F. Oliveira
2021-03-30 21:58:09 +01:00
committed by GitHub
parent 89cb00455a
commit 0b481810f8
9 changed files with 2640 additions and 282 deletions
+30 -32
View File
@@ -4555,7 +4555,7 @@ try {
/***/ 2127:
/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => {
const {exec} = __nccwpck_require__(1514)
const { exec } = __nccwpck_require__(1514)
const path = __nccwpck_require__(5622)
/**
@@ -4593,10 +4593,10 @@ function checkPlatform() {
}
module.exports = {
installOTP: installOTP,
installElixir: installElixir,
installRebar3: installRebar3,
checkPlatform: checkPlatform,
installOTP,
installElixir,
installRebar3,
checkPlatform,
}
@@ -4606,11 +4606,11 @@ module.exports = {
/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => {
const core = __nccwpck_require__(2186)
const {exec} = __nccwpck_require__(1514)
const installer = __nccwpck_require__(2127)
const { exec } = __nccwpck_require__(1514)
const path = __nccwpck_require__(5622)
const semver = __nccwpck_require__(1383)
const https = __nccwpck_require__(7211)
const installer = __nccwpck_require__(2127)
main().catch((err) => {
core.setFailed(err.message)
@@ -4620,10 +4620,10 @@ async function main() {
installer.checkPlatform()
const osVersion = getRunnerOSVersion()
const otpSpec = core.getInput('otp-version', {required: true})
const otpSpec = core.getInput('otp-version', { required: true })
const otpVersion = await installOTP(otpSpec, osVersion)
const elixirSpec = core.getInput('elixir-version', {required: false})
const elixirSpec = core.getInput('elixir-version', { required: false })
const elixirInstalled = await maybeInstallElixir(elixirSpec, otpVersion)
if (elixirInstalled === true) {
const shouldMixRebar = core.getInput('install-rebar', {
@@ -4636,7 +4636,7 @@ async function main() {
await mix(shouldMixHex, 'hex')
}
const rebar3Spec = core.getInput('rebar3-version', {required: false})
const rebar3Spec = core.getInput('rebar3-version', { required: false })
maybeInstallRebar3(rebar3Spec)
}
@@ -4648,7 +4648,7 @@ async function installOTP(otpSpec, osVersion) {
await installer.installOTP(osVersion, otpVersion)
core.setOutput('otp-version', otpVersion)
prependToPath(`${process.env.RUNNER_TEMP}/.setup-beam/otp/bin`)
console.log(`##[endgroup]`)
console.log('##[endgroup]')
return otpVersion
}
@@ -4662,12 +4662,12 @@ async function maybeInstallElixir(elixirSpec, otpVersion) {
const matchersPath = __nccwpck_require__.ab + ".github"
console.log(`##[add-matcher]${path.join(matchersPath, 'elixir.json')}`)
prependToPath(`${process.env.RUNNER_TEMP}/.setup-beam/elixir/bin`)
console.log(`##[endgroup]`)
console.log('##[endgroup]')
return true
} else {
return false
}
return false
}
async function mix(shouldMix, what) {
@@ -4676,7 +4676,7 @@ async function mix(shouldMix, what) {
const args = [`local.${what}`, '--force']
console.log(`##[group]Running ${cmd} ${args}`)
await exec(cmd, args)
console.log(`##[endgroup]`)
console.log('##[endgroup]')
}
}
@@ -4687,12 +4687,12 @@ async function maybeInstallRebar3(rebar3Spec) {
await installer.installRebar3(rebar3Version)
core.setOutput('rebar3-version', rebar3Version)
prependToPath(`${process.env.RUNNER_TEMP}/.setup-beam/rebar3/bin`)
console.log(`##[endgroup]`)
console.log('##[endgroup]')
return true
} else {
return false
}
return false
}
async function getOTPVersion(otpSpec0, osVersion) {
@@ -4702,7 +4702,7 @@ async function getOTPVersion(otpSpec0, osVersion) {
if (otpSpec[1]) {
throw new Error(
`Requested Erlang/OTP version (from spec ${otpSpec0}) ` +
`should not contain 'OTP-'`,
"should not contain 'OTP-'",
)
}
if (otpSpec) {
@@ -4729,7 +4729,7 @@ async function getElixirVersion(exSpec0, otpVersion) {
if (exSpec[2]) {
throw new Error(
`Requested Elixir / Erlang/OTP version (from spec ${exSpec0} / ${otpVersion}) ` +
`should not contain '-otp-...'`,
"should not contain '-otp-...'",
)
}
if (exSpec) {
@@ -4740,7 +4740,7 @@ async function getElixirVersion(exSpec0, otpVersion) {
`Requested Elixir version (from spec ${exSpec0}) not found in build listing`,
)
}
const otpMatch = otpVersion.match(/^(?:OTP-)?([^\.]+)/)
const otpMatch = otpVersion.match(/^(?:OTP-)?([^.]+)/)
let elixirVersionWithOTP
if (elixirVersions.get(elixirVersion)) {
@@ -4748,7 +4748,7 @@ async function getElixirVersion(exSpec0, otpVersion) {
// We try for a version like `v1.4.5-otp-20`...
if (elixirVersions.get(elixirVersion).includes(otpMatch[1])) {
// ... and it's available: use it!
elixirVersionWithOTP = elixirVersion + `-otp-${otpVersionMajor}`
elixirVersionWithOTP = `${elixirVersion}-otp-${otpVersionMajor}`
core.info(`Using Elixir / -otp- version ${elixirVersionWithOTP}`)
} else {
// ... and it's not available: fallback to the "generic" version (v1.4.5 only).
@@ -4758,7 +4758,7 @@ async function getElixirVersion(exSpec0, otpVersion) {
} else {
throw new Error(
`Requested Elixir / Erlang/OTP version (from spec ${exSpec0} / ${otpVersion}) not ` +
`found in build listing`,
'found in build listing',
)
}
@@ -4786,14 +4786,12 @@ async function getOTPVersions(osVersion) {
otpVersionsListing
.trim()
.split('\n')
.map((line) => {
debugger
.forEach((line) => {
const otpMatch = line.match(/^(OTP-)?([^ ]+)/)
const otpVersion = otpMatch[2]
otpVersions.set(otpVersion, otpMatch[0]) // we keep the original for later reference
})
.sort()
return otpVersions
}
@@ -4837,9 +4835,9 @@ async function getRebar3Versions() {
function getVersionFromSpec(spec, versions) {
if (versions.includes(spec)) {
return spec
} else {
return semver.maxSatisfying(versions, semver.validRange(spec))
}
return semver.maxSatisfying(versions, semver.validRange(spec))
}
function getRunnerOSVersion() {
@@ -4858,7 +4856,7 @@ function get(url) {
.get(
url,
{
headers: {'user-agent': 'setup-beam'},
headers: { 'user-agent': 'setup-beam' },
},
(res) => {
let data = ''
@@ -4881,9 +4879,9 @@ function prependToPath(what) {
}
module.exports = {
getOTPVersion: getOTPVersion,
getElixirVersion: getElixirVersion,
getRebar3Version: getRebar3Version,
getOTPVersion,
getElixirVersion,
getRebar3Version,
}