update frontend lib : eslint + typescript - #1815

This commit is contained in:
Laurent GAY
2025-10-23 11:46:17 +02:00
committed by setop
parent bbf78fa198
commit c3e7f03f54
24 changed files with 1939 additions and 1339 deletions

View File

@@ -22,7 +22,6 @@ type schemaType = {
possibleTypes: possibleTypes[];
};
// eslint-disable-next-line no-underscore-dangle
const types = introspectionQueryResultData.__schema.types as schemaType[];
export const possibleTypes = types.reduce(
(acc, type) => {
@@ -205,7 +204,7 @@ function doMerge<T = any>(
// exception here, instead of recovering by appending incoming
// onto the existing array.
res = [...merged, ...previous];
// eslint-disable-next-line no-underscore-dangle
res = uniqBy(res, (elem: any) => elem.__ref);
}
return res;

View File

@@ -189,6 +189,7 @@ const parentDirectory = computed((): string | undefined | null => {
const parentPathResult = parentPath(subjectParams.value.resource_path);
const directory = parentPathResult?.split("/");
const res = directory?.pop();
// eslint-disable-next-line @typescript-eslint/no-unused-expressions
res === "" ? null : res;
}
return null;

View File

@@ -5,8 +5,6 @@ import { EditorView } from "prosemirror-view";
import Image from "@tiptap/extension-image";
import { provideApolloClient, useMutation } from "@vue/apollo-composable";
/* eslint-disable class-methods-use-this */
const CustomImage = Image.extend({
name: "image",
addAttributes() {

View File

@@ -908,6 +908,7 @@ const openDeleteEventModal = () => {
onConfirm: (result: string) => {
console.debug("calling delete event", result);
if (result.trim() === event.value?.title) {
// eslint-disable-next-line @typescript-eslint/no-unused-expressions
event.value?.id ? deleteEvent({ eventId: event.value?.id }) : null;
}
},

View File

@@ -313,7 +313,6 @@ const actualLabel = computed((): string => {
return props.label ?? t("Find an address");
});
// eslint-disable-next-line class-methods-use-this
const canShowLocateMeButton = computed((): boolean => {
return window.isSecureContext;
});
@@ -446,7 +445,6 @@ const reverseGeoCode = async (e: LatLng, zoom: number) => {
}
};
// eslint-disable-next-line no-undef
const getLocation = async (): Promise<GeolocationPosition> => {
let errorMessage = t("Failed to get location.");
return new Promise((resolve, reject) => {

View File

@@ -130,6 +130,7 @@ const move = (event: any, type: any) => {
moving.value = false;
if (cardP.value < -30) {
opened.value = false;
// eslint-disable-next-line no-constant-binary-expression
cardP.value = (-cardH.value ?? 0) - stripe.value;
document.body.style.overflow = "";
emit("closed");

View File

@@ -150,7 +150,7 @@ onMounted(async () => {
setLatLng(...initialView.value);
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore
// eslint-disable-next-line no-underscore-dangle
mapElement.value._onResize();
mapElement.value.on("click", () => {
activeElement.value = null;

View File

@@ -100,6 +100,7 @@ const webFingerFetch = async (
hostname: string,
identity: string
): Promise<string> => {
// eslint-disable-next-line no-undef
const scheme = process.env.NODE_ENV === "production" ? "https" : "http";
const data = await (
await fetch(

View File

@@ -5,7 +5,6 @@ import {
} from "./datetime";
export default {
// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types
install(vue: any): void {
vue.filter("formatDateString", formatDateString);
vue.filter("formatTimeString", formatTimeString);

View File

@@ -21,7 +21,7 @@ declare const self: ServiceWorkerGlobalScope;
// Use with precache injection
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore
// eslint-disable-next-line no-underscore-dangle
precacheAndRoute(self.__WB_MANIFEST);
registerRoute(

View File

@@ -44,7 +44,6 @@ function getLocalAnonymousParticipations(): Map<
function purgeOldParticipations(
participations: Map<string, IAnonymousParticipation>
): Map<string, IAnonymousParticipation> {
// eslint-disable-next-line no-restricted-syntax
for (const [hashedUUID, { expiration }] of participations) {
if (expiration < new Date()) {
participations.delete(hashedUUID);

2
src/shims-tsx.d.ts vendored
View File

@@ -2,7 +2,9 @@ import Vue, { VNode } from "vue";
declare global {
namespace JSX {
// eslint-disable-next-line @typescript-eslint/no-empty-object-type
interface Element extends VNode {}
// eslint-disable-next-line @typescript-eslint/no-empty-object-type
interface ElementClass extends Vue {}
interface IntrinsicElements {
[elem: string]: any;

2
src/shims-vue.d.ts vendored
View File

@@ -1,7 +1,7 @@
declare module "*.vue" {
import type { DefineComponent } from "vue";
// eslint-disable-next-line @typescript-eslint/ban-types
// eslint-disable-next-line @typescript-eslint/no-empty-object-type
const component: DefineComponent<{}, {}, {}>;
export default component;
}

View File

@@ -1,4 +1,3 @@
/* eslint-disable no-unused-vars */
export enum InstanceTermsType {
DEFAULT = "DEFAULT",
URL = "URL",

View File

@@ -242,7 +242,6 @@ export class EventModel implements IEvent {
export function removeTypeName(entity: any): any {
if (entity?.__typename) {
// eslint-disable-next-line @typescript-eslint/no-unused-vars
const { __typename, ...purgedEntity } = entity;
return purgedEntity;
}

View File

@@ -528,7 +528,6 @@ const handleErrors = (absintheErrors: AbsintheGraphQLErrors): void => {
}
};
// eslint-disable-next-line class-methods-use-this
const getInstanceHost = computed((): string => {
return MOBILIZON_INSTANCE_HOST;
});

View File

@@ -811,7 +811,6 @@ const eventOptions = computed({
onMounted(async () => {
observer.value = new IntersectionObserver(
(entries) => {
// eslint-disable-next-line no-restricted-syntax
for (const entry of entries) {
if (entry) {
showFixedNavbar.value = !entry.isIntersecting;
@@ -1344,7 +1343,6 @@ const timezones = computed((): Record<string, string[]> => {
prefix2: string,
suffix2: string
) => {
// eslint-disable-next-line no-param-reassign
(acc2[prefix2] = acc2[prefix2] || []).push(suffix2);
return acc2;
};
@@ -1357,7 +1355,6 @@ const timezones = computed((): Record<string, string[]> => {
);
});
// eslint-disable-next-line class-methods-use-this
const sanitizeTimezone = (timezone: string): string => {
return timezone
.split("_")

View File

@@ -463,7 +463,6 @@ onMounted(async () => {
observer.value = new IntersectionObserver(
(entries) => {
// eslint-disable-next-line no-restricted-syntax
for (const entry of entries) {
if (entry) {
loadComments.value = entry.isIntersecting || loadComments.value;

View File

@@ -578,8 +578,7 @@ onReverseGeocodeResult((result) => {
const fetchAndSaveCurrentLocationName = async ({
coords: { latitude, longitude, accuracy },
}: // eslint-disable-next-line no-undef
GeolocationPosition) => {
}: GeolocationPosition) => {
reverseGeoCodeInformation.latitude = latitude;
reverseGeoCodeInformation.longitude = longitude;
reverseGeoCodeInformation.accuracy = accuracy;

View File

@@ -484,7 +484,6 @@ const createResourceButtonLabel = computed((): string => {
return createSentenceForType(newResource.type);
});
// eslint-disable-next-line class-methods-use-this
const postRefreshQueries = (): InternalRefetchQueriesInclude => {
return [
{

View File

@@ -254,7 +254,6 @@ const timezones = computed((): Record<string, string[]> => {
prefix2: string,
suffix2: string
) => {
// eslint-disable-next-line no-param-reassign
(acc2[prefix2] = acc2[prefix2] || []).push(suffix2);
return acc2;
};