refactor: Fix eslint warnings (#3698)
* Update dependencies and remove typescript version pinning (fixed upstream) * Fix esling warnings (disabled any and script lang checks) Rewrote clipboard copy (Fixes #3407) Run prettier --------- Co-authored-by: Oleg Lobanov <oleg@lobanov.me>
This commit is contained in:
@@ -34,7 +34,7 @@ const props = defineProps<{
|
||||
|
||||
const items = computed(() => {
|
||||
const relativePath = route.path.replace(props.base, "");
|
||||
let parts = relativePath.split("/");
|
||||
const parts = relativePath.split("/");
|
||||
|
||||
if (parts[0] === "") {
|
||||
parts.shift();
|
||||
@@ -44,7 +44,7 @@ const items = computed(() => {
|
||||
parts.pop();
|
||||
}
|
||||
|
||||
let breadcrumbs: BreadCrumb[] = [];
|
||||
const breadcrumbs: BreadCrumb[] = [];
|
||||
|
||||
for (let i = 0; i < parts.length; i++) {
|
||||
if (i === 0) {
|
||||
|
||||
@@ -46,7 +46,7 @@ https://raw.githubusercontent.com/dzwillia/vue-simple-progress/master/src/compon
|
||||
|
||||
<script>
|
||||
// We're leaving this untouched as you can read in the beginning
|
||||
var isNumber = function (n) {
|
||||
const isNumber = function (n) {
|
||||
return !isNaN(parseFloat(n)) && isFinite(n);
|
||||
};
|
||||
|
||||
@@ -107,7 +107,7 @@ export default {
|
||||
},
|
||||
computed: {
|
||||
pct() {
|
||||
var pct = (this.val / this.max) * 100;
|
||||
let pct = (this.val / this.max) * 100;
|
||||
pct = pct.toFixed(2);
|
||||
return Math.min(pct, this.max);
|
||||
},
|
||||
@@ -160,7 +160,7 @@ export default {
|
||||
return isNumber(this.fontSize) ? this.fontSize : 13;
|
||||
},
|
||||
progress_style() {
|
||||
var style = {
|
||||
const style = {
|
||||
background: this.bgColor,
|
||||
};
|
||||
|
||||
@@ -177,7 +177,7 @@ export default {
|
||||
return style;
|
||||
},
|
||||
bar_style() {
|
||||
var style = {
|
||||
const style = {
|
||||
background: this.barColor,
|
||||
width: this.pct + "%",
|
||||
height: this.size_px + "px",
|
||||
@@ -198,7 +198,7 @@ export default {
|
||||
return style;
|
||||
},
|
||||
text_style() {
|
||||
var style = {
|
||||
const style = {
|
||||
color: this.textFgColor,
|
||||
"font-size": this.text_font_size + "px",
|
||||
"text-align": this.textAlign,
|
||||
|
||||
@@ -163,7 +163,7 @@ export default {
|
||||
this.canInput = false;
|
||||
event.target.innerHTML = "";
|
||||
|
||||
let results = {
|
||||
const results = {
|
||||
text: `${cmd}\n\n`,
|
||||
};
|
||||
|
||||
@@ -180,7 +180,7 @@ export default {
|
||||
},
|
||||
() => {
|
||||
results.text = results.text
|
||||
// eslint-disable-next-line no-control-regex
|
||||
|
||||
.replace(/\u001b\[[0-9;]+m/g, "") // Filter ANSI color for now
|
||||
.trimEnd();
|
||||
this.canInput = true;
|
||||
|
||||
@@ -158,7 +158,7 @@ export default {
|
||||
methods: {
|
||||
...mapActions(useLayoutStore, ["closeHovers", "showHover"]),
|
||||
async fetchUsage() {
|
||||
let path = this.$route.path.endsWith("/")
|
||||
const path = this.$route.path.endsWith("/")
|
||||
? this.$route.path
|
||||
: this.$route.path + "/";
|
||||
let usageStats = USAGE_DEFAULT;
|
||||
@@ -166,7 +166,7 @@ export default {
|
||||
return Object.assign(this.usage, usageStats);
|
||||
}
|
||||
try {
|
||||
let usage = await api.usage(path);
|
||||
const usage = await api.usage(path);
|
||||
usageStats = {
|
||||
used: prettyBytes(usage.used, { binary: true }),
|
||||
total: prettyBytes(usage.total, { binary: true }),
|
||||
|
||||
@@ -102,10 +102,11 @@ const decodeUTIF = () => {
|
||||
if (document?.location?.pathname === undefined) {
|
||||
return;
|
||||
}
|
||||
let suff = document.location.pathname.split(".")?.pop()?.toLowerCase() ?? "";
|
||||
const suff =
|
||||
document.location.pathname.split(".")?.pop()?.toLowerCase() ?? "";
|
||||
|
||||
if (sufs.indexOf(suff) == -1) return false;
|
||||
let xhr = new XMLHttpRequest();
|
||||
const xhr = new XMLHttpRequest();
|
||||
UTIF._xhrs.push(xhr);
|
||||
UTIF._imgs.push(imgex.value);
|
||||
xhr.open("GET", props.src);
|
||||
@@ -230,7 +231,7 @@ const touchMove = (event: TouchEvent) => {
|
||||
if (imgex.value === null) {
|
||||
return;
|
||||
}
|
||||
let step = imgex.value.width / 5;
|
||||
const step = imgex.value.width / 5;
|
||||
if (event.targetTouches.length === 2) {
|
||||
moveDisabled.value = true;
|
||||
if (disabledTimer.value) clearTimeout(disabledTimer.value);
|
||||
@@ -239,9 +240,9 @@ const touchMove = (event: TouchEvent) => {
|
||||
props.moveDisabledTime
|
||||
);
|
||||
|
||||
let p1 = event.targetTouches[0];
|
||||
let p2 = event.targetTouches[1];
|
||||
let touchDistance = Math.sqrt(
|
||||
const p1 = event.targetTouches[0];
|
||||
const p2 = event.targetTouches[1];
|
||||
const touchDistance = Math.sqrt(
|
||||
Math.pow(p2.pageX - p1.pageX, 2) + Math.pow(p2.pageY - p1.pageY, 2)
|
||||
);
|
||||
if (!lastTouchDistance.value) {
|
||||
@@ -253,8 +254,8 @@ const touchMove = (event: TouchEvent) => {
|
||||
setZoom();
|
||||
} else if (event.targetTouches.length === 1) {
|
||||
if (moveDisabled.value) return;
|
||||
let x = event.targetTouches[0].pageX - (lastX.value ?? 0);
|
||||
let y = event.targetTouches[0].pageY - (lastY.value ?? 0);
|
||||
const x = event.targetTouches[0].pageX - (lastX.value ?? 0);
|
||||
const y = event.targetTouches[0].pageY - (lastY.value ?? 0);
|
||||
if (Math.abs(x) >= step && Math.abs(y) >= step) return;
|
||||
lastX.value = event.targetTouches[0].pageX;
|
||||
lastY.value = event.targetTouches[0].pageY;
|
||||
@@ -268,8 +269,8 @@ const doMove = (x: number, y: number) => {
|
||||
}
|
||||
const style = imgex.value.style;
|
||||
|
||||
let posX = pxStringToNumber(style.left) + x;
|
||||
let posY = pxStringToNumber(style.top) + y;
|
||||
const posX = pxStringToNumber(style.left) + x;
|
||||
const posY = pxStringToNumber(style.top) + y;
|
||||
|
||||
style.left = posX + "px";
|
||||
style.top = posY + "px";
|
||||
|
||||
@@ -82,7 +82,7 @@ const isDraggable = computed(
|
||||
const canDrop = computed(() => {
|
||||
if (!props.isDir || props.readOnly) return false;
|
||||
|
||||
for (let i of fileStore.selected) {
|
||||
for (const i of fileStore.selected) {
|
||||
if (fileStore.req?.items[i].url === props.url) {
|
||||
return false;
|
||||
}
|
||||
@@ -156,9 +156,9 @@ const drop = async (event: Event) => {
|
||||
}
|
||||
}
|
||||
|
||||
let items: any[] = [];
|
||||
const items: any[] = [];
|
||||
|
||||
for (let i of fileStore.selected) {
|
||||
for (const i of fileStore.selected) {
|
||||
if (fileStore.req) {
|
||||
items.push({
|
||||
from: fileStore.req?.items[i].url,
|
||||
@@ -172,10 +172,10 @@ const drop = async (event: Event) => {
|
||||
if (el === null) {
|
||||
return;
|
||||
}
|
||||
let path = el.__vue__.url;
|
||||
let baseItems = (await api.fetch(path)).items;
|
||||
const path = el.__vue__.url;
|
||||
const baseItems = (await api.fetch(path)).items;
|
||||
|
||||
let action = (overwrite: boolean, rename: boolean) => {
|
||||
const action = (overwrite: boolean, rename: boolean) => {
|
||||
api
|
||||
.move(items, overwrite, rename)
|
||||
.then(() => {
|
||||
@@ -184,7 +184,7 @@ const drop = async (event: Event) => {
|
||||
.catch($showError);
|
||||
};
|
||||
|
||||
let conflict = upload.checkConflict(items, baseItems);
|
||||
const conflict = upload.checkConflict(items, baseItems);
|
||||
|
||||
let overwrite = false;
|
||||
let rename = false;
|
||||
|
||||
@@ -73,11 +73,16 @@ const initVideoPlayer = async () => {
|
||||
const langOpt = { language: "videoPlayerLocal" };
|
||||
// support for playback at different speeds.
|
||||
const playbackRatesOpt = { playbackRates: [0.5, 1, 1.5, 2, 2.5, 3] };
|
||||
let options = getOptions(props.options, langOpt, srcOpt, playbackRatesOpt);
|
||||
const options = getOptions(
|
||||
props.options,
|
||||
langOpt,
|
||||
srcOpt,
|
||||
playbackRatesOpt
|
||||
);
|
||||
player.value = videojs(videoPlayer.value!, options, () => {});
|
||||
|
||||
// TODO: need to test on mobile
|
||||
// @ts-ignore
|
||||
// @ts-expect-error no ts definition for mobileUi
|
||||
player.value!.mobileUi();
|
||||
} catch (error) {
|
||||
console.error("Error initializing video player:", error);
|
||||
|
||||
@@ -82,10 +82,10 @@ export default {
|
||||
...mapActions(useLayoutStore, ["showHover", "closeHovers"]),
|
||||
copy: async function (event) {
|
||||
event.preventDefault();
|
||||
let items = [];
|
||||
const items = [];
|
||||
|
||||
// Create a new promise for each file.
|
||||
for (let item of this.selected) {
|
||||
for (const item of this.selected) {
|
||||
items.push({
|
||||
from: this.req.items[item].url,
|
||||
to: this.dest + encodeURIComponent(this.req.items[item].name),
|
||||
@@ -93,7 +93,7 @@ export default {
|
||||
});
|
||||
}
|
||||
|
||||
let action = async (overwrite, rename) => {
|
||||
const action = async (overwrite, rename) => {
|
||||
buttons.loading("copy");
|
||||
|
||||
await api
|
||||
@@ -122,8 +122,8 @@ export default {
|
||||
return;
|
||||
}
|
||||
|
||||
let dstItems = (await api.fetch(this.dest)).items;
|
||||
let conflict = upload.checkConflict(items, dstItems);
|
||||
const dstItems = (await api.fetch(this.dest)).items;
|
||||
const conflict = upload.checkConflict(items, dstItems);
|
||||
|
||||
let overwrite = false;
|
||||
let rename = false;
|
||||
|
||||
@@ -74,8 +74,8 @@ export default {
|
||||
return;
|
||||
}
|
||||
|
||||
let promises = [];
|
||||
for (let index of this.selected) {
|
||||
const promises = [];
|
||||
for (const index of this.selected) {
|
||||
promises.push(api.remove(this.req.items[index].url));
|
||||
}
|
||||
|
||||
|
||||
@@ -43,7 +43,7 @@ export default {
|
||||
submit: async function () {
|
||||
this.updateRequest(null);
|
||||
|
||||
let uri = url.removeLastDir(this.$route.path) + "/";
|
||||
const uri = url.removeLastDir(this.$route.path) + "/";
|
||||
this.$router.push({ path: uri });
|
||||
},
|
||||
},
|
||||
|
||||
@@ -80,7 +80,7 @@ export default {
|
||||
|
||||
// Otherwise we add every directory to the
|
||||
// move options.
|
||||
for (let item of req.items) {
|
||||
for (const item of req.items) {
|
||||
if (!item.isDir) continue;
|
||||
|
||||
this.items.push({
|
||||
@@ -93,12 +93,12 @@ export default {
|
||||
// Retrieves the URL of the directory the user
|
||||
// just clicked in and fill the options with its
|
||||
// content.
|
||||
let uri = event.currentTarget.dataset.url;
|
||||
const uri = event.currentTarget.dataset.url;
|
||||
|
||||
files.fetch(uri).then(this.fillOptions).catch(this.$showError);
|
||||
},
|
||||
touchstart(event) {
|
||||
let url = event.currentTarget.dataset.url;
|
||||
const url = event.currentTarget.dataset.url;
|
||||
|
||||
// In 300 milliseconds, we shall reset the count.
|
||||
setTimeout(() => {
|
||||
|
||||
@@ -124,7 +124,7 @@ export default {
|
||||
|
||||
let sum = 0;
|
||||
|
||||
for (let selected of this.selected) {
|
||||
for (const selected of this.selected) {
|
||||
sum += this.req.items[selected].size;
|
||||
}
|
||||
|
||||
|
||||
@@ -81,9 +81,9 @@ export default {
|
||||
...mapActions(useLayoutStore, ["showHover", "closeHovers"]),
|
||||
move: async function (event) {
|
||||
event.preventDefault();
|
||||
let items = [];
|
||||
const items = [];
|
||||
|
||||
for (let item of this.selected) {
|
||||
for (const item of this.selected) {
|
||||
items.push({
|
||||
from: this.req.items[item].url,
|
||||
to: this.dest + encodeURIComponent(this.req.items[item].name),
|
||||
@@ -91,7 +91,7 @@ export default {
|
||||
});
|
||||
}
|
||||
|
||||
let action = async (overwrite, rename) => {
|
||||
const action = async (overwrite, rename) => {
|
||||
buttons.loading("move");
|
||||
|
||||
await api
|
||||
@@ -106,8 +106,8 @@ export default {
|
||||
});
|
||||
};
|
||||
|
||||
let dstItems = (await api.fetch(this.dest)).items;
|
||||
let conflict = upload.checkConflict(items, dstItems);
|
||||
const dstItems = (await api.fetch(this.dest)).items;
|
||||
const conflict = upload.checkConflict(items, dstItems);
|
||||
|
||||
let overwrite = false;
|
||||
let rename = false;
|
||||
|
||||
@@ -196,13 +196,23 @@ export default {
|
||||
methods: {
|
||||
...mapActions(useLayoutStore, ["closeHovers"]),
|
||||
copyToClipboard: function (text) {
|
||||
copy(text).then(
|
||||
copy({ text }).then(
|
||||
() => {
|
||||
// clipboard successfully set
|
||||
this.$showSuccess(this.$t("success.linkCopied"));
|
||||
},
|
||||
() => {
|
||||
// clipboard write failed
|
||||
copy({ text }, { permission: true }).then(
|
||||
() => {
|
||||
// clipboard successfully set
|
||||
this.$showSuccess(this.$t("success.linkCopied"));
|
||||
},
|
||||
(e) => {
|
||||
// clipboard write failed
|
||||
this.$showError(e);
|
||||
}
|
||||
);
|
||||
}
|
||||
);
|
||||
},
|
||||
|
||||
@@ -48,10 +48,10 @@ const layoutStore = useLayoutStore();
|
||||
|
||||
// TODO: this is a copy of the same function in FileListing.vue
|
||||
const uploadInput = (event: Event) => {
|
||||
let files = (event.currentTarget as HTMLInputElement)?.files;
|
||||
const files = (event.currentTarget as HTMLInputElement)?.files;
|
||||
if (files === null) return;
|
||||
|
||||
let folder_upload = !!files[0].webkitRelativePath;
|
||||
const folder_upload = !!files[0].webkitRelativePath;
|
||||
|
||||
const uploadFiles: UploadList = [];
|
||||
for (let i = 0; i < files.length; i++) {
|
||||
@@ -66,8 +66,8 @@ const uploadInput = (event: Event) => {
|
||||
});
|
||||
}
|
||||
|
||||
let path = route.path.endsWith("/") ? route.path : route.path + "/";
|
||||
let conflict = upload.checkConflict(uploadFiles, fileStore.req!.items);
|
||||
const path = route.path.endsWith("/") ? route.path : route.path + "/";
|
||||
const conflict = upload.checkConflict(uploadFiles, fileStore.req!.items);
|
||||
|
||||
if (conflict) {
|
||||
layoutStore.showHover({
|
||||
|
||||
@@ -13,7 +13,7 @@ export default {
|
||||
name: "languages",
|
||||
props: ["locale"],
|
||||
data() {
|
||||
let dataObj = {};
|
||||
const dataObj = {};
|
||||
const locales = {
|
||||
he: "עברית",
|
||||
hu: "Magyar",
|
||||
|
||||
@@ -39,7 +39,7 @@ export default {
|
||||
methods: {
|
||||
remove(event, index) {
|
||||
event.preventDefault();
|
||||
let rules = [...this.rules];
|
||||
const rules = [...this.rules];
|
||||
rules.splice(index, 1);
|
||||
this.$emit("update:rules", [...rules]);
|
||||
},
|
||||
|
||||
@@ -17,7 +17,6 @@ defineProps<{
|
||||
}>();
|
||||
|
||||
const emit = defineEmits<{
|
||||
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
||||
(e: "update:theme", val: string | null): void;
|
||||
}>();
|
||||
|
||||
|
||||
@@ -116,7 +116,7 @@ watch(createUserDirData, () => {
|
||||
if (props.user?.scope) {
|
||||
props.user.scope = createUserDirData.value
|
||||
? ""
|
||||
: originalUserScope.value ?? "";
|
||||
: (originalUserScope.value ?? "");
|
||||
}
|
||||
});
|
||||
</script>
|
||||
|
||||
Reference in New Issue
Block a user