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:
@@ -1,4 +1,4 @@
|
||||
import type { key_val } from "./ae_utils";
|
||||
import type { key_val } from './ae_utils';
|
||||
|
||||
/* This utility function processes specific data string.
|
||||
* MECARD
|
||||
@@ -14,78 +14,77 @@ import type { key_val } from "./ae_utils";
|
||||
* gn: Given First Name
|
||||
* fn: Family Last Name
|
||||
* em: Email Address
|
||||
*/
|
||||
*/
|
||||
// Updated 2022-02-11
|
||||
|
||||
export const process_data_string = function process_data_string(data_string: string) {
|
||||
console.log('*** process_data_string() ***');
|
||||
// console.log(data_string);
|
||||
if (!data_string || data_string.length < 1) {
|
||||
console.log('No data string found.');
|
||||
return false;
|
||||
}
|
||||
|
||||
export let process_data_string = function process_data_string(data_string: string) {
|
||||
console.log('*** process_data_string() ***');
|
||||
// console.log(data_string);
|
||||
if (!data_string || data_string.length < 1) {
|
||||
console.log('No data string found.');
|
||||
return false;
|
||||
}
|
||||
const obj: key_val = {};
|
||||
|
||||
let obj: key_val = {};
|
||||
const colon_index = data_string.indexOf(':');
|
||||
if (colon_index) {
|
||||
const data_string_type = data_string.slice(0, colon_index);
|
||||
console.log(data_string_type);
|
||||
|
||||
let colon_index = data_string.indexOf(':');
|
||||
if (colon_index) {
|
||||
let data_string_type = data_string.slice(0, colon_index);
|
||||
console.log(data_string_type);
|
||||
obj['qr_type'] = data_string_type;
|
||||
|
||||
obj['qr_type'] = data_string_type;
|
||||
if (data_string_type == 'MECARD') {
|
||||
const mecard_str = data_string.slice(colon_index + 1);
|
||||
console.log(mecard_str);
|
||||
|
||||
if (data_string_type == 'MECARD') {
|
||||
let mecard_str = data_string.slice(colon_index + 1);
|
||||
console.log(mecard_str);
|
||||
obj['str'] = mecard_str;
|
||||
} else if (data_string_type == 'OBJ') {
|
||||
const key_value_str = data_string.slice(colon_index + 1);
|
||||
console.log(key_value_str);
|
||||
const key_value_array = key_value_str.split(',');
|
||||
// console.log(key_value_array);
|
||||
const ot_colon_index = key_value_array[0].indexOf(':');
|
||||
const obj_type = key_value_array[0].slice(ot_colon_index + 1);
|
||||
// console.log(obj_type);
|
||||
const oi_colon_index = key_value_array[1].indexOf(':');
|
||||
const obj_id = key_value_array[1].slice(oi_colon_index + 1);
|
||||
// console.log(obj_id);
|
||||
obj['type'] = obj_type;
|
||||
obj['id'] = obj_id;
|
||||
} else if (data_string_type == 'JSON') {
|
||||
const partial_json_str = data_string.slice(colon_index + 1);
|
||||
console.log(partial_json_str);
|
||||
const json_str = `{${partial_json_str}}`;
|
||||
console.log(json_str);
|
||||
|
||||
obj['str'] = mecard_str;
|
||||
} else if (data_string_type == 'OBJ') {
|
||||
let key_value_str = data_string.slice(colon_index + 1);
|
||||
console.log(key_value_str);
|
||||
let key_value_array = key_value_str.split(',');
|
||||
// console.log(key_value_array);
|
||||
let ot_colon_index = key_value_array[0].indexOf(':');
|
||||
let obj_type = key_value_array[0].slice(ot_colon_index + 1);
|
||||
// console.log(obj_type);
|
||||
let oi_colon_index = key_value_array[1].indexOf(':');
|
||||
let obj_id = key_value_array[1].slice(oi_colon_index + 1);
|
||||
// console.log(obj_id);
|
||||
obj['type'] = obj_type;
|
||||
obj['id'] = obj_id;
|
||||
} else if (data_string_type == 'JSON') {
|
||||
let partial_json_str = data_string.slice(colon_index + 1);
|
||||
console.log(partial_json_str);
|
||||
let json_str = `{${partial_json_str}}`;
|
||||
console.log(json_str);
|
||||
obj['json'] = JSON.parse(json_str);
|
||||
} else if (data_string_type == 'STR') {
|
||||
const str = data_string.slice(colon_index + 1);
|
||||
console.log(str);
|
||||
|
||||
obj['json'] = JSON.parse(json_str);
|
||||
} else if (data_string_type == 'STR') {
|
||||
let str = data_string.slice(colon_index + 1);
|
||||
console.log(str);
|
||||
obj['str'] = str;
|
||||
} else if (data_string_type == 'http' || data_string_type == 'https') {
|
||||
console.log(`http or https: ${data_string}`);
|
||||
|
||||
obj['str'] = str;
|
||||
} else if (data_string_type == 'http' || data_string_type == 'https') {
|
||||
console.log(`http or https: ${data_string}`);
|
||||
obj['type'] = 'url';
|
||||
obj['url'] = data_string;
|
||||
} else {
|
||||
console.log('The unknown data string type was found. Returning the string part.');
|
||||
const unknown_str = data_string.slice(colon_index + 1);
|
||||
console.log(unknown_str);
|
||||
|
||||
obj['type'] = 'url';
|
||||
obj['url'] = data_string;
|
||||
} else {
|
||||
console.log('The unknown data string type was found. Returning the string part.');
|
||||
let unknown_str = data_string.slice(colon_index + 1);
|
||||
console.log(unknown_str);
|
||||
obj['str'] = unknown_str;
|
||||
}
|
||||
} else {
|
||||
console.log('The data string type was not found. Returning the entire string.');
|
||||
console.log(data_string);
|
||||
|
||||
obj['str'] = unknown_str;
|
||||
}
|
||||
} else {
|
||||
console.log('The data string type was not found. Returning the entire string.');
|
||||
console.log(data_string);
|
||||
obj['qr_type'] = 'UNKNOWN';
|
||||
obj['str'] = data_string;
|
||||
// return false;
|
||||
}
|
||||
|
||||
obj['qr_type'] = 'UNKNOWN';
|
||||
obj['str'] = data_string;
|
||||
// return false;
|
||||
}
|
||||
|
||||
console.log(obj);
|
||||
return obj; // Returns an object
|
||||
console.log(obj);
|
||||
return obj; // Returns an object
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user