refactor: replace 'let' with 'const' for better variable scoping and immutability
This commit is contained in:
@@ -34,7 +34,7 @@ import { useLocalStorage } from "foxact/use-local-storage";
|
||||
import { LogLevel } from "@/hooks/use-log-data";
|
||||
|
||||
const appWindow = getCurrentWebviewWindow();
|
||||
export let portableFlag = false;
|
||||
export const portableFlag = false;
|
||||
|
||||
dayjs.extend(relativeTime);
|
||||
|
||||
|
||||
@@ -166,7 +166,7 @@ const ProfilePage = () => {
|
||||
async (event: any) => {
|
||||
const paths = event.payload.paths;
|
||||
|
||||
for (let file of paths) {
|
||||
for (const file of paths) {
|
||||
if (!file.endsWith(".yaml") && !file.endsWith(".yml")) {
|
||||
showNotice("error", t("Only YAML Files Supported"));
|
||||
continue;
|
||||
@@ -181,7 +181,7 @@ const ProfilePage = () => {
|
||||
self_proxy: false,
|
||||
},
|
||||
} as IProfileItem;
|
||||
let data = await readTextFile(file);
|
||||
const data = await readTextFile(file);
|
||||
await createProfile(item, data);
|
||||
await mutateProfiles();
|
||||
}
|
||||
|
||||
@@ -101,12 +101,12 @@ const TestPage = () => {
|
||||
const { active, over } = event;
|
||||
if (over) {
|
||||
if (active.id !== over.id) {
|
||||
let old_index = testList.findIndex((x) => x.uid === active.id);
|
||||
let new_index = testList.findIndex((x) => x.uid === over.id);
|
||||
const old_index = testList.findIndex((x) => x.uid === active.id);
|
||||
const new_index = testList.findIndex((x) => x.uid === over.id);
|
||||
if (old_index < 0 || new_index < 0) {
|
||||
return;
|
||||
}
|
||||
let newList = reorder(testList, old_index, new_index);
|
||||
const newList = reorder(testList, old_index, new_index);
|
||||
await mutateVerge({ ...verge, test_list: newList }, false);
|
||||
await patchVerge({ test_list: newList });
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user