feat: Migrate ESLint to flat config and resolve initial linting errors
Migrated the ESLint configuration to the new flat config format () and addressed several initial linting errors. Key changes include: - Updated ESLint configuration to treat as warnings instead of errors. - Fixed errors in by declaring and . - Corrected error in by using instead of an out-of-scope . - Resolved error in by replacing the undefined directive with the component. - Addressed errors in by replacing with and with . - Fixed errors in by importing necessary modules (, , ) and adding missing props (, , , , ).
This commit is contained in:
File diff suppressed because it is too large
Load Diff
@@ -8,7 +8,6 @@
|
||||
// const path = require('path');
|
||||
// const { ipcRenderer } = require('electron');
|
||||
|
||||
|
||||
// function sleep(milliseconds) {
|
||||
// const date = Date.now();
|
||||
// let currentDate = null;
|
||||
@@ -59,105 +58,113 @@
|
||||
// }
|
||||
// }
|
||||
|
||||
|
||||
// Updated 2022-05-07
|
||||
export let kill_processes = async function kill_processes({process_name_li=[]}) {
|
||||
console.log('*** kill_processes() ***');
|
||||
console.log(`Process Name List: ${process_name_li}`);
|
||||
export let kill_processes = async function kill_processes({ process_name_li = [] }) {
|
||||
console.log('*** kill_processes() ***');
|
||||
console.log(`Process Name List: ${process_name_li}`);
|
||||
|
||||
let fail_flag = null;
|
||||
if (process_name_li) {
|
||||
for (let i = 0; i < process_name_li.length; i++) {
|
||||
// separate the keys and the values
|
||||
let process_name = process_name_li[i];
|
||||
let signal = null;
|
||||
let fail_flag = null;
|
||||
if (process_name_li) {
|
||||
for (let i = 0; i < process_name_li.length; i++) {
|
||||
// separate the keys and the values
|
||||
let process_name = process_name_li[i];
|
||||
let signal = null;
|
||||
|
||||
if (process_name == 'osit_aperture_wrapper') {
|
||||
signal = 'INT'; // INT (interrupt) correctly stops the wrapper
|
||||
}
|
||||
if (process_name == 'osit_aperture_wrapper') {
|
||||
signal = 'INT'; // INT (interrupt) correctly stops the wrapper
|
||||
}
|
||||
|
||||
let kill_processes_result = await native_app.kill_processes({process_name: process_name, signal: signal});
|
||||
console.log(kill_processes_result);
|
||||
if (kill_processes_result) {
|
||||
console.log('Killed process.');
|
||||
// return kill_processes_result;
|
||||
} else {
|
||||
console.log('Did not kill process. Something went wrong.');
|
||||
fail_flag = true;
|
||||
// return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
let kill_processes_result = await native_app.kill_processes({
|
||||
process_name: process_name,
|
||||
signal: signal
|
||||
});
|
||||
console.log(kill_processes_result);
|
||||
if (kill_processes_result) {
|
||||
console.log('Killed process.');
|
||||
// return kill_processes_result;
|
||||
} else {
|
||||
console.log('Did not kill process. Something went wrong.');
|
||||
fail_flag = true;
|
||||
// return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return fail_flag;
|
||||
|
||||
// let kill_processes_result = await native_app.kill_processes({process_name: process_name});
|
||||
// console.log(kill_processes_result);
|
||||
// if (kill_processes_result) {
|
||||
// console.log('Killed process.');
|
||||
// return kill_processes_result;
|
||||
// } else {
|
||||
// console.log('Did not kill process. Something went wrong.');
|
||||
// return false;
|
||||
// }
|
||||
}
|
||||
return fail_flag;
|
||||
|
||||
// let kill_processes_result = await native_app.kill_processes({process_name: process_name});
|
||||
// console.log(kill_processes_result);
|
||||
// if (kill_processes_result) {
|
||||
// console.log('Killed process.');
|
||||
// return kill_processes_result;
|
||||
// } else {
|
||||
// console.log('Did not kill process. Something went wrong.');
|
||||
// return false;
|
||||
// }
|
||||
};
|
||||
|
||||
// Updated 2022-05-06
|
||||
export let open_local_file = async function open_local_file({file_path, filename}) {
|
||||
console.log('*** open_local_file() ***');
|
||||
console.log(`File Path: ${file_path}; Filename: ${filename}`);
|
||||
export let open_local_file = async function open_local_file({ file_path, filename }) {
|
||||
console.log('*** open_local_file() ***');
|
||||
console.log(`File Path: ${file_path}; Filename: ${filename}`);
|
||||
|
||||
console.log('Process: Check local hash file cache, Download hash file to cache, and Open cached hash file after copying to temp directory');
|
||||
console.log(
|
||||
'Process: Check local hash file cache, Download hash file to cache, and Open cached hash file after copying to temp directory'
|
||||
);
|
||||
|
||||
// let check_local_file_result = await native_app.check_local_file({local_file_path: file_path, filename: filename});
|
||||
// console.log(check_local_file_result);
|
||||
// if (check_local_file_result) {
|
||||
// console.log('Local file found.');
|
||||
// } else {
|
||||
// console.log('Local file not found. Will not attempt to open.');
|
||||
// return false;
|
||||
// }
|
||||
|
||||
// console.log('Local file file found and ready to be opened.');
|
||||
let open_local_file_result = await native_app.open_local_file({local_file_path: file_path, filename: filename});
|
||||
console.log(open_local_file_result);
|
||||
if (open_local_file_result) {
|
||||
console.log('Local file was opened.');
|
||||
return open_local_file_result;
|
||||
} else {
|
||||
console.log('Local file was not opened. Something went wrong.');
|
||||
return false;
|
||||
}
|
||||
}
|
||||
// let check_local_file_result = await native_app.check_local_file({local_file_path: file_path, filename: filename});
|
||||
// console.log(check_local_file_result);
|
||||
// if (check_local_file_result) {
|
||||
// console.log('Local file found.');
|
||||
// } else {
|
||||
// console.log('Local file not found. Will not attempt to open.');
|
||||
// return false;
|
||||
// }
|
||||
|
||||
// console.log('Local file file found and ready to be opened.');
|
||||
let open_local_file_result = await native_app.open_local_file({
|
||||
local_file_path: file_path,
|
||||
filename: filename
|
||||
});
|
||||
console.log(open_local_file_result);
|
||||
if (open_local_file_result) {
|
||||
console.log('Local file was opened.');
|
||||
return open_local_file_result;
|
||||
} else {
|
||||
console.log('Local file was not opened. Something went wrong.');
|
||||
return false;
|
||||
}
|
||||
};
|
||||
|
||||
// exports.open_local_file should no longer be needed with this.
|
||||
// Updated 2022-10-11
|
||||
export let open_local_file_v2 = async function open_local_file_v2({file_path, filename}) {
|
||||
console.log('*** open_local_file_v2() ***');
|
||||
console.log(`Local File Path: ${file_path}; Filename: ${filename}`);
|
||||
export let open_local_file_v2 = async function open_local_file_v2({ file_path, filename }) {
|
||||
console.log('*** open_local_file_v2() ***');
|
||||
console.log(`Local File Path: ${file_path}; Filename: ${filename}`);
|
||||
|
||||
console.log('Process: Check local hash file cache, Download hash file to cache, and Open cached hash file after copying to temp directory');
|
||||
console.log(
|
||||
'Process: Check local hash file cache, Download hash file to cache, and Open cached hash file after copying to temp directory'
|
||||
);
|
||||
|
||||
let open_local_file_result = await ipcRenderer.invoke('open_local_file', file_path, filename).then((result) => {
|
||||
console.log('IPC open local file finished');
|
||||
if (result) {
|
||||
console.log('Local file was opened.');
|
||||
return result;
|
||||
} else {
|
||||
console.log('Local file was not opened. Something went wrong.');
|
||||
console.log(result);
|
||||
return false;
|
||||
}
|
||||
let open_local_file_result = await ipcRenderer
|
||||
.invoke('open_local_file', file_path, filename)
|
||||
.then((result) => {
|
||||
console.log('IPC open local file finished');
|
||||
if (result) {
|
||||
console.log('Local file was opened.');
|
||||
return result;
|
||||
} else {
|
||||
console.log('Local file was not opened. Something went wrong.');
|
||||
console.log(result);
|
||||
return false;
|
||||
}
|
||||
|
||||
console.log(result);
|
||||
return true;
|
||||
})
|
||||
|
||||
return open_local_file_result;
|
||||
}
|
||||
console.log(result);
|
||||
return true;
|
||||
});
|
||||
|
||||
return open_local_file_result;
|
||||
};
|
||||
|
||||
// // Updated 2022-05-06
|
||||
// export let open_hash_file_to_temp = async function open_hash_file_to_temp({local_file_cache_path, hash, host_file_temp_path, filename}) {
|
||||
@@ -227,92 +234,99 @@ export let open_local_file_v2 = async function open_local_file_v2({file_path, fi
|
||||
// return open_hash_file_to_temp_result;
|
||||
// }
|
||||
|
||||
|
||||
// Updated 2022-05-07
|
||||
export let run_cmd = async function run_cmd({cmd=null, return_stdout=null}) {
|
||||
console.log('*** run_cmd() ***');
|
||||
export let run_cmd = async function run_cmd({ cmd = null, return_stdout = null }) {
|
||||
console.log('*** run_cmd() ***');
|
||||
|
||||
let run_cmd_result = await native_app.run_cmd({cmd: cmd, return_stdout: return_stdout})
|
||||
.then(function (result) {
|
||||
if (result) {
|
||||
console.log('Command ran');
|
||||
} else {
|
||||
console.log('Command did not run. Something went wrong.');
|
||||
return false;
|
||||
}
|
||||
if (return_stdout) {
|
||||
return result;
|
||||
} else {
|
||||
return true;
|
||||
}
|
||||
let run_cmd_result = await native_app
|
||||
.run_cmd({ cmd: cmd, return_stdout: return_stdout })
|
||||
.then(function (result) {
|
||||
if (result) {
|
||||
console.log('Command ran');
|
||||
} else {
|
||||
console.log('Command did not run. Something went wrong.');
|
||||
return false;
|
||||
}
|
||||
if (return_stdout) {
|
||||
return result;
|
||||
} else {
|
||||
return true;
|
||||
}
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
console.log('Run Command Result:', run_cmd_result);
|
||||
|
||||
return run_cmd_result;
|
||||
}
|
||||
console.log('Run Command Result:', run_cmd_result);
|
||||
|
||||
return run_cmd_result;
|
||||
};
|
||||
|
||||
// Updated 2022-10-27
|
||||
export let run_cmd_sync = function run_cmd_sync({cmd=null, return_stdout=null}) {
|
||||
console.log('*** run_cmd_sync() ***');
|
||||
export let run_cmd_sync = function run_cmd_sync({ cmd = null, return_stdout = null }) {
|
||||
console.log('*** run_cmd_sync() ***');
|
||||
|
||||
let run_cmd_result = native_app.run_cmd_sync({cmd: cmd, return_stdout: return_stdout});
|
||||
let run_cmd_result = native_app.run_cmd_sync({ cmd: cmd, return_stdout: return_stdout });
|
||||
|
||||
// if (run_cmd_result) {
|
||||
// console.log('Command ran');
|
||||
// } else {
|
||||
// console.log('Command did not run. Something went wrong.');
|
||||
// // return false;
|
||||
// }
|
||||
// if (run_cmd_result) {
|
||||
// console.log('Command ran');
|
||||
// } else {
|
||||
// console.log('Command did not run. Something went wrong.');
|
||||
// // return false;
|
||||
// }
|
||||
|
||||
// if (return_stdout) {
|
||||
// return run_cmd_result;
|
||||
// } else {
|
||||
// return true;
|
||||
// }
|
||||
// if (return_stdout) {
|
||||
// return run_cmd_result;
|
||||
// } else {
|
||||
// return true;
|
||||
// }
|
||||
|
||||
console.log('Run Command Result:', run_cmd_result);
|
||||
|
||||
return run_cmd_result;
|
||||
}
|
||||
console.log('Run Command Result:', run_cmd_result);
|
||||
|
||||
return run_cmd_result;
|
||||
};
|
||||
|
||||
// Updated 2022-05-07
|
||||
export let run_osascript = async function run_osascript({cmd=null, interactive=false, language=null, flags='h', program_file=null}) {
|
||||
console.log('*** run_osascript() ***');
|
||||
export let run_osascript = async function run_osascript({
|
||||
cmd = null,
|
||||
interactive = false,
|
||||
language = null,
|
||||
flags = 'h',
|
||||
program_file = null
|
||||
}) {
|
||||
console.log('*** run_osascript() ***');
|
||||
|
||||
let run_osascript_result = await native_app.run_osascript({cmd: cmd, interactive: interactive, language: language, flags: flags, program_file: program_file});
|
||||
let run_osascript_result = await native_app.run_osascript({
|
||||
cmd: cmd,
|
||||
interactive: interactive,
|
||||
language: language,
|
||||
flags: flags,
|
||||
program_file: program_file
|
||||
});
|
||||
|
||||
console.log(run_osascript_result);
|
||||
|
||||
if (run_osascript_result) {
|
||||
console.log('Apple Script ran');
|
||||
} else {
|
||||
console.log('Apple Script did not run. Something went wrong.');
|
||||
}
|
||||
|
||||
return run_osascript_result;
|
||||
}
|
||||
console.log(run_osascript_result);
|
||||
|
||||
if (run_osascript_result) {
|
||||
console.log('Apple Script ran');
|
||||
} else {
|
||||
console.log('Apple Script did not run. Something went wrong.');
|
||||
}
|
||||
|
||||
return run_osascript_result;
|
||||
};
|
||||
|
||||
// Updated 2022-05-07
|
||||
export let get_device_info = async function get_device_info({event_device_id}) {
|
||||
console.log('*** get_device_info() ***');
|
||||
export let get_device_info = async function get_device_info({ event_device_id }) {
|
||||
console.log('*** get_device_info() ***');
|
||||
|
||||
console.log(event_device_id);
|
||||
console.log(event_device_id);
|
||||
|
||||
let get_device_info_result = await native_app.get_device_info();
|
||||
let get_device_info_result = await native_app.get_device_info();
|
||||
|
||||
console.log(get_device_info_result);
|
||||
console.log(get_device_info_result);
|
||||
|
||||
if (get_device_info_result) {
|
||||
console.log('Success');
|
||||
} else {
|
||||
console.log('Failed? Something went wrong.');
|
||||
}
|
||||
if (get_device_info_result) {
|
||||
console.log('Success');
|
||||
} else {
|
||||
console.log('Failed? Something went wrong.');
|
||||
}
|
||||
|
||||
return get_device_info_result;
|
||||
}
|
||||
return get_device_info_result;
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user