Update prettier/eslint

This commit is contained in:
2021-05-03 16:51:50 -05:00
parent 9246b33440
commit 7cb3094305
52 changed files with 312 additions and 968 deletions

View File

@@ -40,12 +40,7 @@ const _vcRuntimeExists = () => {
args2.push('REG_SZ');
_execProcessGetOutput(cmd, null, args2)
.then((lines) => {
const value = lines[2]
.trim()
.substr(args2[3].length)
.trim()
.substr(6)
.trim();
const value = lines[2].trim().substr(args2[3].length).trim().substr(6).trim();
if (
value.includes(
IS_64BIT
@@ -84,20 +79,14 @@ const _createTreeNodes = (fileList) => {
let tree = {};
const directorySort = (a, b) => {
return !!a.directory === !!b.directory
? a.name.localeCompare(b.name)
: a.directory
? -1
: 1;
return !!a.directory === !!b.directory ? a.name.localeCompare(b.name) : a.directory ? -1 : 1;
};
const addNode = (obj) => {
let fullPath;
const idx = obj.skylink.indexOf('/');
if (idx > -1) {
fullPath = path
.join(obj.directory, obj.skylink.substr(idx + 1))
.replace(/\\/g, '/');
fullPath = path.join(obj.directory, obj.skylink.substr(idx + 1)).replace(/\\/g, '/');
} else {
fullPath = path.join(obj.directory, obj.filename).replace(/\\/g, '/');
}
@@ -403,8 +392,7 @@ module.exports.detectRepertoryMounts = (version, providerList) => {
provider,
!Constants.PROVIDER_LIST.includes(provider) &&
provider.toLowerCase().startsWith('remote'),
!Constants.PROVIDER_LIST.includes(provider) &&
provider.toLowerCase().startsWith('s3')
!Constants.PROVIDER_LIST.includes(provider) && provider.toLowerCase().startsWith('s3')
);
args.push('-status');
@@ -420,12 +408,10 @@ module.exports.detectRepertoryMounts = (version, providerList) => {
});
process.on('exit', () => {
mountState[provider] =
_tryParse(result, defaultData)[provider] || defaultData;
mountState[provider] = _tryParse(result, defaultData)[provider] || defaultData;
if (
mountState[provider].Active &&
(mountState[provider].Location === 'elevating' ||
mountState[provider].Location === '')
(mountState[provider].Location === 'elevating' || mountState[provider].Location === '')
) {
setTimeout(() => {
grabStatus(index);
@@ -441,12 +427,7 @@ module.exports.detectRepertoryMounts = (version, providerList) => {
});
};
module.exports.downloadFile = (
url,
destination,
progressCallback,
completeCallback
) => {
module.exports.downloadFile = (url, destination, progressCallback, completeCallback) => {
try {
if (fs.existsSync(destination)) {
fs.unlinkSync(destination);
@@ -482,9 +463,7 @@ module.exports.downloadFile = (
if (downloaded === 0) {
completeCallback(new Error('Received 0 bytes'));
} else if (downloaded !== total) {
completeCallback(
new Error('Received incorrect number of bytes')
);
completeCallback(new Error('Received incorrect number of bytes'));
} else {
completeCallback();
}
@@ -536,9 +515,7 @@ module.exports.executeAsync = (command, args = []) => {
const launchProcess = (count, timeout) => {
let cmd = path.basename(command);
const working =
cmd.length === command.length
? null
: command.substr(0, command.length - cmd.length);
cmd.length === command.length ? null : command.substr(0, command.length - cmd.length);
let processOptions = {
detached: true,
shell: false,
@@ -626,14 +603,7 @@ module.exports.executeScript = (script) => {
});
};
module.exports.executeMount = (
version,
provider,
remote,
s3,
location,
exitCallback
) => {
module.exports.executeMount = (version, provider, remote, s3, location, exitCallback) => {
return new Promise((resolve) => {
const repertoryExec = _getRepertoryExec(version);
const processOptions = {
@@ -876,12 +846,7 @@ module.exports.getMissingDependencies = (dependencies) => {
} else {
for (const dep of dependencies) {
try {
if (
!(
fs.lstatSync(dep.file).isFile() ||
fs.lstatSync(dep.file).isSymbolicLink()
)
) {
if (!(fs.lstatSync(dep.file).isFile() || fs.lstatSync(dep.file).isSymbolicLink())) {
missing.push(dep);
}
} catch (e) {
@@ -1037,10 +1002,7 @@ module.exports.importSkylinks = (version, jsonArray) => {
};
// https://stackoverflow.com/questions/31645738/how-to-create-full-path-with-nodes-fs-mkdirsync
module.exports.mkDirByPathSync = (
targetDir,
{ isRelativeToScript = false } = {}
) => {
module.exports.mkDirByPathSync = (targetDir, { isRelativeToScript = false } = {}) => {
const sep = path.sep;
const initDir = path.isAbsolute(targetDir) ? sep : '';
const baseDir = isRelativeToScript ? __dirname : '.';
@@ -1099,20 +1061,11 @@ module.exports.performWindowsUninstall = (names) => {
args2.push('REG_SZ');
_execProcessGetOutput(cmd, null, args2)
.then((lines) => {
const value = lines[2]
.trim()
.substr(args2[3].length)
.trim()
.substr(6)
.trim();
const value = lines[2].trim().substr(args2[3].length).trim().substr(6).trim();
if (names.includes(value)) {
const items = line.split('\\');
const productCode = items[items.length - 1];
_executeProcess('msiexec.exe', null, [
'/x',
productCode,
'/norestart',
])
_executeProcess('msiexec.exe', null, ['/x', productCode, '/norestart'])
.then((code) => {
if (code === 0 || code === 3010 || code === 1641) {
resolve(true);
@@ -1150,14 +1103,7 @@ module.exports.removeDirectoryRecursively = _removeDirectoryRecursively;
module.exports.resolvePath = _resolvePath;
module.exports.setConfigValue = (
name,
value,
provider,
remote,
s3,
version
) => {
module.exports.setConfigValue = (name, value, provider, remote, s3, version) => {
return new Promise((resolve, reject) => {
const repertoryExec = _getRepertoryExec(version);
const processOptions = {
@@ -1290,15 +1236,7 @@ module.exports.verifySignature = (file, signatureFile, publicKeyFile) => {
const executeVerify = (openssl) => {
execFile(
openssl,
[
'dgst',
'-sha256',
'-verify',
publicKeyFile,
'-signature',
signatureFile,
file,
],
['dgst', '-sha256', '-verify', publicKeyFile, '-signature', signatureFile, file],
(err, stdout) => {
if (err) {
reject(err);