From 32f0b43b99ddd406ac5d4015c15bb6bcca9f5a40 Mon Sep 17 00:00:00 2001 From: Manuel Leduc Date: Tue, 17 Dec 2024 17:18:44 +0100 Subject: [PATCH] [Misc] Enforce a limit of 10 statements per method body --- api/src/components/defaultWikiConfig.ts | 2 ++ .../attachments-default/src/defaultAttachmentPreview.ts | 2 ++ .../authentication-xwiki/src/XWikiAuthenticationManager.ts | 4 ++++ core/backends/backend-dexie/src/wrappingOfflineStorage.ts | 4 ++++ core/backends/backend-github/src/githubStorage.ts | 2 ++ core/backends/backend-nextcloud/src/nextcloudStorage.ts | 2 ++ core/backends/backend-xwiki/src/xwikiStorage.ts | 6 ++++++ .../document/document-default/src/defaultDocumentService.ts | 2 ++ core/hierarchy/hierarchy-default/src/utils.ts | 2 ++ .../hierarchy-xwiki/src/components/componentsInit.ts | 2 ++ .../history/history-github/src/components/componentsInit.ts | 2 ++ core/history/history-xwiki/src/components/componentsInit.ts | 4 ++++ .../src/nextcloudLinkSuggestService.ts | 2 ++ core/model/model-click-listener/src/DefaultClickListener.ts | 2 ++ .../src/filesystemModelReferenceSerializer.ts | 2 ++ .../src/nextcloudModelReferenceSerializer.ts | 2 ++ .../src/xWikiModelReferenceSerializer.ts | 2 ++ .../src/filesystemRemoteURLParser.ts | 2 ++ .../model-remote-url-xwiki/src/xWikiRemoteURLParser.ts | 2 ++ core/navigation-tree/navigation-tree-default/src/utils.ts | 2 ++ .../navigation-tree-github/src/components/componentsInit.ts | 2 ++ .../src/components/componentsInit.ts | 2 ++ .../navigation-tree-xwiki/src/components/componentsInit.ts | 6 ++++++ core/page-actions/page-actions-ui/src/vue/DeletePage.vue | 2 ++ ds/dsfr/src/components/dsfrDesignSystemLoader.ts | 2 ++ ds/shoelace/src/components/shoelaceDesignSystemLoader.ts | 2 ++ ds/shoelace/src/vue/__tests__/x-alert.test.ts | 2 ++ ds/shoelace/src/vue/x-navigation-tree-item.vue | 4 ++++ ds/shoelace/src/vue/x-navigation-tree.vue | 2 ++ ds/vuetify/src/components/vuetifyDesignSystemLoader.ts | 2 ++ ds/vuetify/src/vue/x-navigation-tree.vue | 6 ++++++ editors/tiptap/src/components/extensions/link-suggest.ts | 5 ++++- editors/tiptap/src/extensions/autoSaver.ts | 2 ++ editors/tiptap/src/extensions/markdown.ts | 4 ++++ electron/storage/src/electron/main/index.ts | 4 ++++ eslint.config.mjs | 1 + extension-manager/src/components/cristalLoader.ts | 4 ++++ extension-manager/src/components/defaultExtensionManager.ts | 2 ++ lib/src/components/DefaultCristalApp.ts | 6 ++++++ lib/src/components/cristalAppLoader.ts | 4 ++++ lib/src/staticBuild.ts | 2 ++ macros/src/components/defaultMacroProvider.ts | 2 ++ rendering/rendering/src/components/marked-macro.ts | 2 ++ sharedworker/impl/src/components/worker.ts | 6 ++++++ skin/src/components/componentsInit.ts | 2 ++ skin/src/components/defaultSkinManager.ts | 2 ++ skin/src/vue/__tests__/c-content.test.ts | 2 ++ skin/src/vue/c-edit.vue | 2 ++ skin/src/vue/c-field.vue | 2 ++ skin/src/vue/contentTools.ts | 2 ++ 50 files changed, 137 insertions(+), 1 deletion(-) diff --git a/api/src/components/defaultWikiConfig.ts b/api/src/components/defaultWikiConfig.ts index 182886055..02e5c4d6f 100644 --- a/api/src/components/defaultWikiConfig.ts +++ b/api/src/components/defaultWikiConfig.ts @@ -102,6 +102,8 @@ export class DefaultWikiConfig implements WikiConfig { this.designSystem = configObject.designSystem; } + // TODO: reduce the number of statements in the following method and reactivate the disabled eslint rule. + // eslint-disable-next-line max-statements setupOfflineStorage(): void { this.logger.debug("Checking offline storage"); if (this.offline && this.cristal) { diff --git a/core/attachments/attachments-default/src/defaultAttachmentPreview.ts b/core/attachments/attachments-default/src/defaultAttachmentPreview.ts index 776894c1b..b5e241cee 100644 --- a/core/attachments/attachments-default/src/defaultAttachmentPreview.ts +++ b/core/attachments/attachments-default/src/defaultAttachmentPreview.ts @@ -104,6 +104,8 @@ class DefaultAttachmentPreview implements AttachmentPreview { this.refs = storeToRefs(this.store); } + // TODO: reduce the number of statements in the following method and reactivate the disabled eslint rule. + // eslint-disable-next-line max-statements async preview(attachmentReference: AttachmentReference): Promise { this.store.startLoading(); try { diff --git a/core/authentication/authentication-xwiki/src/XWikiAuthenticationManager.ts b/core/authentication/authentication-xwiki/src/XWikiAuthenticationManager.ts index 5eec5c798..7599c213a 100644 --- a/core/authentication/authentication-xwiki/src/XWikiAuthenticationManager.ts +++ b/core/authentication/authentication-xwiki/src/XWikiAuthenticationManager.ts @@ -45,6 +45,8 @@ export class XWikiAuthenticationManager implements AuthenticationManager { private readonly accessTokenCookieKeyPrefix = "accessToken"; + // TODO: reduce the number of statements in the following method and reactivate the disabled eslint rule. + // eslint-disable-next-line max-statements start(): void { const config = this.cristalApp.getWikiConfig(); const authorizationUrl = new URL(`${config.baseURL}/oidc/authorization`); @@ -71,6 +73,8 @@ export class XWikiAuthenticationManager implements AuthenticationManager { window.location.href = authorizationUrl.toString(); } + // TODO: reduce the number of statements in the following method and reactivate the disabled eslint rule. + // eslint-disable-next-line max-statements async callback(): Promise { const href = new URL(window.location.href); const code = href.searchParams.get("code"); diff --git a/core/backends/backend-dexie/src/wrappingOfflineStorage.ts b/core/backends/backend-dexie/src/wrappingOfflineStorage.ts index c09eaca68..4769b955f 100644 --- a/core/backends/backend-dexie/src/wrappingOfflineStorage.ts +++ b/core/backends/backend-dexie/src/wrappingOfflineStorage.ts @@ -84,6 +84,8 @@ export class WrappingOfflineStorage implements WrappingStorage { return this.storage.getImageURL(page, image); } + // TODO: reduce the number of statements in the following method and reactivate the disabled eslint rule. + // eslint-disable-next-line max-statements public async getPageContent( page: string, syntax: string, @@ -151,6 +153,8 @@ export class WrappingOfflineStorage implements WrappingStorage { } } + // TODO: reduce the number of statements in the following method and reactivate the disabled eslint rule. + // eslint-disable-next-line max-statements public async updatePageContent( page: string, syntax: string, diff --git a/core/backends/backend-github/src/githubStorage.ts b/core/backends/backend-github/src/githubStorage.ts index 3e3f83141..84cab8900 100644 --- a/core/backends/backend-github/src/githubStorage.ts +++ b/core/backends/backend-github/src/githubStorage.ts @@ -76,6 +76,8 @@ export class GitHubStorage extends AbstractStorage { return "" + hash; }; + // TODO: reduce the number of statements in the following method and reactivate the disabled eslint rule. + // eslint-disable-next-line max-statements async getPageContent( page: string, syntax: string, diff --git a/core/backends/backend-nextcloud/src/nextcloudStorage.ts b/core/backends/backend-nextcloud/src/nextcloudStorage.ts index 714cca1ee..8bf633a03 100644 --- a/core/backends/backend-nextcloud/src/nextcloudStorage.ts +++ b/core/backends/backend-nextcloud/src/nextcloudStorage.ts @@ -87,6 +87,8 @@ export class NextcloudStorage extends AbstractStorage { } } + // TODO: reduce the number of statements in the following method and reactivate the disabled eslint rule. + // eslint-disable-next-line max-statements async getAttachments(page: string): Promise { const response = await fetch(this.getAttachmentsBasePath(page), { method: "PROPFIND", diff --git a/core/backends/backend-xwiki/src/xwikiStorage.ts b/core/backends/backend-xwiki/src/xwikiStorage.ts index 4e87759e7..59f3b46ff 100644 --- a/core/backends/backend-xwiki/src/xwikiStorage.ts +++ b/core/backends/backend-xwiki/src/xwikiStorage.ts @@ -123,6 +123,8 @@ export class XWikiStorage extends AbstractStorage { return imageURL; } + // TODO: reduce the number of statements in the following method and reactivate the disabled eslint rule. + // eslint-disable-next-line max-statements async getPageContent( page: string, syntax: string, @@ -219,6 +221,8 @@ export class XWikiStorage extends AbstractStorage { } } + // TODO: reduce the number of statements in the following method and reactivate the disabled eslint rule. + // eslint-disable-next-line max-statements async getPanelContent(panel: string, contextPage: string): Promise { const url = this.wikiConfig.baseURL + @@ -239,6 +243,8 @@ export class XWikiStorage extends AbstractStorage { return panelContentData; } + // TODO: reduce the number of statements in the following method and reactivate the disabled eslint rule. + // eslint-disable-next-line max-statements async getEditField(document: Document, fieldName: string): Promise { // http://localhost:15680/xwiki/bin/get/Blog/BlogIntroduction?xpage=display&mode=edit&property=Blog.BlogPostClass.category // http://localhost:15680/xwiki/bin/get/Help/Applications/Movies/Modern%20Times?xpage=display&mode=edit&property=Help.Applications.Movies.Code.MoviesClass%5B0%5D.staticList1&type=object&language= diff --git a/core/document/document-default/src/defaultDocumentService.ts b/core/document/document-default/src/defaultDocumentService.ts index 8dc808b8c..183dbd723 100644 --- a/core/document/document-default/src/defaultDocumentService.ts +++ b/core/document/document-default/src/defaultDocumentService.ts @@ -85,6 +85,8 @@ function createStore(cristal: CristalApp): DocumentStoreDefinition { this.document = undefined; this.error = undefined; }, + // TODO: reduce the number of statements in the following method and reactivate the disabled eslint rule. + // eslint-disable-next-line max-statements async update( documentReference: string, requeue: boolean, diff --git a/core/hierarchy/hierarchy-default/src/utils.ts b/core/hierarchy/hierarchy-default/src/utils.ts index 65c1a2481..729efdc45 100644 --- a/core/hierarchy/hierarchy-default/src/utils.ts +++ b/core/hierarchy/hierarchy-default/src/utils.ts @@ -30,6 +30,8 @@ import type { PageHierarchyItem } from "@xwiki/cristal-hierarchy-api"; * @returns the page hierarchy * @since 0.10 **/ +// TODO: reduce the number of statements in the following method and reactivate the disabled eslint rule. +// eslint-disable-next-line max-statements export async function getPageHierarchyFromPath( pageData: PageData, cristalApp: CristalApp, diff --git a/core/hierarchy/hierarchy-xwiki/src/components/componentsInit.ts b/core/hierarchy/hierarchy-xwiki/src/components/componentsInit.ts index ed5fa0eda..f954ece26 100644 --- a/core/hierarchy/hierarchy-xwiki/src/components/componentsInit.ts +++ b/core/hierarchy/hierarchy-xwiki/src/components/componentsInit.ts @@ -58,6 +58,8 @@ class XWikiPageHierarchyResolver implements PageHierarchyResolver { this.logger.setModule("storage.components.XWikiPageHierarchyResolver"); } + // TODO: reduce the number of statements in the following method and reactivate the disabled eslint rule. + // eslint-disable-next-line max-statements async getPageHierarchy( pageData: PageData, ): Promise> { diff --git a/core/history/history-github/src/components/componentsInit.ts b/core/history/history-github/src/components/componentsInit.ts index 0f7f46565..baa582b84 100644 --- a/core/history/history-github/src/components/componentsInit.ts +++ b/core/history/history-github/src/components/componentsInit.ts @@ -42,6 +42,8 @@ class GitHubPageRevisionManager implements PageRevisionManager { this.logger.setModule("history-github.GitHubPageRevisionManager"); } + // TODO: reduce the number of statements in the following method and reactivate the disabled eslint rule. + // eslint-disable-next-line max-statements async getRevisions(pageData: PageData): Promise> { const revisions: Array = []; if (pageData) { diff --git a/core/history/history-xwiki/src/components/componentsInit.ts b/core/history/history-xwiki/src/components/componentsInit.ts index ad8456f2e..39f93a767 100644 --- a/core/history/history-xwiki/src/components/componentsInit.ts +++ b/core/history/history-xwiki/src/components/componentsInit.ts @@ -49,6 +49,8 @@ class XWikiPageRevisionManager implements PageRevisionManager { this.logger.setModule("history.xwiki.XWikiPageRevisionManager"); } + // TODO: reduce the number of statements in the following method and reactivate the disabled eslint rule. + // eslint-disable-next-line max-statements async getRevisions( pageData: PageData, limit?: number, @@ -135,6 +137,8 @@ class XWikiPageRevisionManager implements PageRevisionManager { } } + // TODO: reduce the number of statements in the following method and reactivate the disabled eslint rule. + // eslint-disable-next-line max-statements private async getUserName(userId: string): Promise { const restApiUrl = getRestSpacesApiUrl(this.cristalApp.getWikiConfig(), userId) + diff --git a/core/link-suggest/link-suggest-nextcloud/src/nextcloudLinkSuggestService.ts b/core/link-suggest/link-suggest-nextcloud/src/nextcloudLinkSuggestService.ts index 7046bfd82..8e2c7cf51 100644 --- a/core/link-suggest/link-suggest-nextcloud/src/nextcloudLinkSuggestService.ts +++ b/core/link-suggest/link-suggest-nextcloud/src/nextcloudLinkSuggestService.ts @@ -37,6 +37,8 @@ export class NextcloudLinkSuggestService implements LinkSuggestService { @inject("CristalApp") private readonly cristalApp: CristalApp, ) {} + // TODO: reduce the number of statements in the following method and reactivate the disabled eslint rule. + // eslint-disable-next-line max-statements async getLinks(query: string): Promise { const baseRestURL = this.cristalApp .getWikiConfig() diff --git a/core/model/model-click-listener/src/DefaultClickListener.ts b/core/model/model-click-listener/src/DefaultClickListener.ts index d1b55f7c2..9fe737c0c 100644 --- a/core/model/model-click-listener/src/DefaultClickListener.ts +++ b/core/model/model-click-listener/src/DefaultClickListener.ts @@ -65,6 +65,8 @@ class DefaultClickListener implements ClickListener { ); } + // TODO: reduce the number of statements in the following method and reactivate the disabled eslint rule. + // eslint-disable-next-line max-statements handleURL(url: string, href?: string): void { const remoteURLParser = this.remoteURLParserProvider.get()!; const modelReferenceSerializer = diff --git a/core/model/model-reference/model-reference-filesystem/src/filesystemModelReferenceSerializer.ts b/core/model/model-reference/model-reference-filesystem/src/filesystemModelReferenceSerializer.ts index 832fc0ed7..e250d530c 100644 --- a/core/model/model-reference/model-reference-filesystem/src/filesystemModelReferenceSerializer.ts +++ b/core/model/model-reference/model-reference-filesystem/src/filesystemModelReferenceSerializer.ts @@ -33,6 +33,8 @@ import { injectable } from "inversify"; export class FileSystemModelReferenceSerializer implements ModelReferenceSerializer { + // TODO: reduce the number of statements in the following method and reactivate the disabled eslint rule. + // eslint-disable-next-line max-statements serialize(reference?: EntityReference): string | undefined { if (!reference) { return undefined; diff --git a/core/model/model-reference/model-reference-nextcloud/src/nextcloudModelReferenceSerializer.ts b/core/model/model-reference/model-reference-nextcloud/src/nextcloudModelReferenceSerializer.ts index 9e3eb6bed..d7832e823 100644 --- a/core/model/model-reference/model-reference-nextcloud/src/nextcloudModelReferenceSerializer.ts +++ b/core/model/model-reference/model-reference-nextcloud/src/nextcloudModelReferenceSerializer.ts @@ -33,6 +33,8 @@ import { injectable } from "inversify"; export class NextcloudModelReferenceSerializer implements ModelReferenceSerializer { + // TODO: reduce the number of statements in the following method and reactivate the disabled eslint rule. + // eslint-disable-next-line max-statements serialize(reference?: EntityReference): string | undefined { if (!reference) { return undefined; diff --git a/core/model/model-reference/model-reference-xwiki/src/xWikiModelReferenceSerializer.ts b/core/model/model-reference/model-reference-xwiki/src/xWikiModelReferenceSerializer.ts index 21bebed59..1f5c82e67 100644 --- a/core/model/model-reference/model-reference-xwiki/src/xWikiModelReferenceSerializer.ts +++ b/core/model/model-reference/model-reference-xwiki/src/xWikiModelReferenceSerializer.ts @@ -38,6 +38,8 @@ export class XWikiModelReferenceSerializer implements ModelReferenceSerializer { return segment.replace(/(\.|\\)/g, "\\$1"); } + // TODO: reduce the number of statements in the following method and reactivate the disabled eslint rule. + // eslint-disable-next-line max-statements serialize(reference?: EntityReference): string | undefined { if (!reference) { return undefined; diff --git a/core/model/model-remote-url/model-remote-url-filesystem/model-remote-url-filesystem-default/src/filesystemRemoteURLParser.ts b/core/model/model-remote-url/model-remote-url-filesystem/model-remote-url-filesystem-default/src/filesystemRemoteURLParser.ts index 64d059072..af5aa3c6b 100644 --- a/core/model/model-remote-url/model-remote-url-filesystem/model-remote-url-filesystem-default/src/filesystemRemoteURLParser.ts +++ b/core/model/model-remote-url/model-remote-url-filesystem/model-remote-url-filesystem-default/src/filesystemRemoteURLParser.ts @@ -30,6 +30,8 @@ import { injectable } from "inversify"; @injectable() class FileSystemRemoteURLParser implements RemoteURLParser { + // TODO: reduce the number of statements in the following method and reactivate the disabled eslint rule. + // eslint-disable-next-line max-statements parse(urlStr: string): EntityReference | undefined { const startWithFilesystemProtocol = urlStr.startsWith(`${protocol}://`); if (!startWithFilesystemProtocol && urlStr.includes("://")) { diff --git a/core/model/model-remote-url/model-remote-url-xwiki/src/xWikiRemoteURLParser.ts b/core/model/model-remote-url/model-remote-url-xwiki/src/xWikiRemoteURLParser.ts index e71304146..bdc73d9c8 100644 --- a/core/model/model-remote-url/model-remote-url-xwiki/src/xWikiRemoteURLParser.ts +++ b/core/model/model-remote-url/model-remote-url-xwiki/src/xWikiRemoteURLParser.ts @@ -34,6 +34,8 @@ class XWikiRemoteURLParser implements RemoteURLParser { @inject("CristalApp") private readonly cristalApp: CristalApp, ) {} + // TODO: reduce the number of statements in the following method and reactivate the disabled eslint rule. + // eslint-disable-next-line max-statements parse(urlStr: string): EntityReference { const baseURLstr = this.cristalApp.getWikiConfig().baseURL; if (!urlStr.startsWith(baseURLstr)) { diff --git a/core/navigation-tree/navigation-tree-default/src/utils.ts b/core/navigation-tree/navigation-tree-default/src/utils.ts index 9f8b6fb10..a1ac31258 100644 --- a/core/navigation-tree/navigation-tree-default/src/utils.ts +++ b/core/navigation-tree/navigation-tree-default/src/utils.ts @@ -27,6 +27,8 @@ import type { PageData } from "@xwiki/cristal-api"; * @returns the parents nodes ids * @since 0.10 **/ +// TODO: reduce the number of statements in the following method and reactivate the disabled eslint rule. +// eslint-disable-next-line max-statements export function getParentNodesIdFromPath(page?: PageData): Array { const result: Array = []; if (page) { diff --git a/core/navigation-tree/navigation-tree-github/src/components/componentsInit.ts b/core/navigation-tree/navigation-tree-github/src/components/componentsInit.ts index f68177c40..7285a71cb 100644 --- a/core/navigation-tree/navigation-tree-github/src/components/componentsInit.ts +++ b/core/navigation-tree/navigation-tree-github/src/components/componentsInit.ts @@ -49,6 +49,8 @@ class GitHubNavigationTreeSource implements NavigationTreeSource { this.cristalApp = cristalApp; } + // TODO: reduce the number of statements in the following method and reactivate the disabled eslint rule. + // eslint-disable-next-line max-statements async getChildNodes(id?: string): Promise> { const currentId = id ? id : ""; const navigationTree: Array = []; diff --git a/core/navigation-tree/navigation-tree-nextcloud/src/components/componentsInit.ts b/core/navigation-tree/navigation-tree-nextcloud/src/components/componentsInit.ts index 751499ef8..8a91d4eea 100644 --- a/core/navigation-tree/navigation-tree-nextcloud/src/components/componentsInit.ts +++ b/core/navigation-tree/navigation-tree-nextcloud/src/components/componentsInit.ts @@ -81,6 +81,8 @@ class NextcloudNavigationTreeSource implements NavigationTreeSource { return navigationTree; } + // TODO: reduce the number of statements in the following method and reactivate the disabled eslint rule. + // eslint-disable-next-line max-statements private async getSubDirectories(directory: string): Promise> { const subdirectories: Array = []; try { diff --git a/core/navigation-tree/navigation-tree-xwiki/src/components/componentsInit.ts b/core/navigation-tree/navigation-tree-xwiki/src/components/componentsInit.ts index bf839c7d4..157c12b13 100644 --- a/core/navigation-tree/navigation-tree-xwiki/src/components/componentsInit.ts +++ b/core/navigation-tree/navigation-tree-xwiki/src/components/componentsInit.ts @@ -54,6 +54,8 @@ class XWikiNavigationTreeSource implements NavigationTreeSource { ); } + // TODO: reduce the number of statements in the following method and reactivate the disabled eslint rule. + // eslint-disable-next-line max-statements async getChildNodes(id?: string): Promise> { const currentId = id ? id : "#"; const navigationTree: Array = []; @@ -78,6 +80,8 @@ class XWikiNavigationTreeSource implements NavigationTreeSource { return navigationTree; } + // TODO: reduce the number of statements in the following method and reactivate the disabled eslint rule. + // eslint-disable-next-line max-statements getParentNodesId(page?: PageData): Array { const result = []; if (page) { @@ -105,6 +109,8 @@ class XWikiNavigationTreeSource implements NavigationTreeSource { return result; } + // TODO: reduce the number of statements in the following method and reactivate the disabled eslint rule. + // eslint-disable-next-line max-statements private async fetchNodes( currentId: string, headers: { Accept: string; Authorization?: string }, diff --git a/core/page-actions/page-actions-ui/src/vue/DeletePage.vue b/core/page-actions/page-actions-ui/src/vue/DeletePage.vue index 67e9a577e..ef832f774 100644 --- a/core/page-actions/page-actions-ui/src/vue/DeletePage.vue +++ b/core/page-actions/page-actions-ui/src/vue/DeletePage.vue @@ -49,6 +49,8 @@ const documentService = cristal .get("DocumentService"); const deleteDialogOpen: Ref = ref(false); +// TODO: reduce the number of statements in the following method and reactivate the disabled eslint rule. +// eslint-disable-next-line max-statements async function deletePage() { const hierarchy: Array = await cristal .getContainer() diff --git a/ds/dsfr/src/components/dsfrDesignSystemLoader.ts b/ds/dsfr/src/components/dsfrDesignSystemLoader.ts index d2817e58e..708b44a17 100644 --- a/ds/dsfr/src/components/dsfrDesignSystemLoader.ts +++ b/ds/dsfr/src/components/dsfrDesignSystemLoader.ts @@ -28,6 +28,8 @@ import type { App } from "vue"; @injectable() export class DSFRDesignSystemLoader implements DesignSystemLoader { + // TODO: reduce the number of statements in the following method and reactivate the disabled eslint rule. + // eslint-disable-next-line max-statements loadDesignSystem(app: App): void { // Loading specific components from DSFR app.use(VueDsfr); diff --git a/ds/shoelace/src/components/shoelaceDesignSystemLoader.ts b/ds/shoelace/src/components/shoelaceDesignSystemLoader.ts index 9e5fc6105..d4ead0021 100644 --- a/ds/shoelace/src/components/shoelaceDesignSystemLoader.ts +++ b/ds/shoelace/src/components/shoelaceDesignSystemLoader.ts @@ -25,6 +25,8 @@ import type { App } from "vue"; @injectable() export class ShoelaceDesignSystemLoader implements DesignSystemLoader { + // TODO: reduce the number of statements in the following method and reactivate the disabled eslint rule. + // eslint-disable-next-line max-statements loadDesignSystem(app: App): void { registerAsyncComponent(app, "XLoad", () => import("../vue/x-load.vue")); registerAsyncComponent(app, "XAvatar", () => import("../vue/x-avatar.vue")); diff --git a/ds/shoelace/src/vue/__tests__/x-alert.test.ts b/ds/shoelace/src/vue/__tests__/x-alert.test.ts index adfe32b6e..7dacbf6b8 100644 --- a/ds/shoelace/src/vue/__tests__/x-alert.test.ts +++ b/ds/shoelace/src/vue/__tests__/x-alert.test.ts @@ -23,6 +23,8 @@ import { shallowMount } from "@vue/test-utils"; import { describe, expect, it } from "vitest"; describe("x-alert", () => { + // TODO: reduce the number of statements in the following method and reactivate the disabled eslint rule. + // eslint-disable-next-line max-statements it("has a description", () => { const xAlert = shallowMount(XAlert, { props: { diff --git a/ds/shoelace/src/vue/x-navigation-tree-item.vue b/ds/shoelace/src/vue/x-navigation-tree-item.vue index 4caea59de..9a77674f5 100644 --- a/ds/shoelace/src/vue/x-navigation-tree-item.vue +++ b/ds/shoelace/src/vue/x-navigation-tree-item.vue @@ -86,6 +86,8 @@ async function lazyLoadChildren() { current.value?.removeAttribute("lazy"); } +// TODO: reduce the number of statements in the following method and reactivate the disabled eslint rule. +// eslint-disable-next-line max-statements async function expandTree(nodesToExpand: string[]) { if (nodesToExpand[0] == props.node.id) { if (nodesToExpand.length > 1) { @@ -128,6 +130,8 @@ function onDocumentDelete(parents: string[]) { } } +// TODO: reduce the number of statements in the following method and reactivate the disabled eslint rule. +// eslint-disable-next-line max-statements async function onDocumentUpdate(parents: string[]) { for (const i of nodes.value.keys()) { if (nodes.value[i].id == parents[0]) { diff --git a/ds/shoelace/src/vue/x-navigation-tree.vue b/ds/shoelace/src/vue/x-navigation-tree.vue index aae42c35e..e90d0f85c 100644 --- a/ds/shoelace/src/vue/x-navigation-tree.vue +++ b/ds/shoelace/src/vue/x-navigation-tree.vue @@ -120,6 +120,8 @@ async function onDocumentDelete(page: PageData) { } } +// TODO: reduce the number of statements in the following method and reactivate the disabled eslint rule. +// eslint-disable-next-line max-statements async function onDocumentUpdate(page: PageData) { const parents = treeSource.getParentNodesId(page); diff --git a/ds/vuetify/src/components/vuetifyDesignSystemLoader.ts b/ds/vuetify/src/components/vuetifyDesignSystemLoader.ts index e702d2ee4..4055b5626 100644 --- a/ds/vuetify/src/components/vuetifyDesignSystemLoader.ts +++ b/ds/vuetify/src/components/vuetifyDesignSystemLoader.ts @@ -33,6 +33,8 @@ import type { App } from "vue"; @injectable() export class VuetifyDesignSystemLoader implements DesignSystemLoader { + // TODO: reduce the number of statements in the following method and reactivate the disabled eslint rule. + // eslint-disable-next-line max-statements loadDesignSystem(app: App): void { /* // Manuel importing to reduce build size diff --git a/ds/vuetify/src/vue/x-navigation-tree.vue b/ds/vuetify/src/vue/x-navigation-tree.vue index 2d01b4cb0..18e97e96c 100644 --- a/ds/vuetify/src/vue/x-navigation-tree.vue +++ b/ds/vuetify/src/vue/x-navigation-tree.vue @@ -90,6 +90,8 @@ onBeforeMount(async () => { watch(() => props.currentPage, expandTree); +// TODO: reduce the number of statements in the following method and reactivate the disabled eslint rule. +// eslint-disable-next-line max-statements async function expandTree() { if (props.currentPage && !isExpanding) { isExpanding = true; @@ -160,6 +162,8 @@ function clearSelection() { } } +// TODO: reduce the number of statements in the following method and reactivate the disabled eslint rule. +// eslint-disable-next-line max-statements async function onDocumentDelete(page: PageData) { const parents = treeSource.getParentNodesId(page); let currentItems: TreeItem[] | undefined = rootNodes.value; @@ -179,6 +183,8 @@ async function onDocumentDelete(page: PageData) { } } +// TODO: reduce the number of statements in the following method and reactivate the disabled eslint rule. +// eslint-disable-next-line max-statements async function onDocumentUpdate(page: PageData) { const parents = treeSource.getParentNodesId(page); let currentParent: string | undefined = undefined; diff --git a/editors/tiptap/src/components/extensions/link-suggest.ts b/editors/tiptap/src/components/extensions/link-suggest.ts index 1b8a4f837..075ee831b 100644 --- a/editors/tiptap/src/components/extensions/link-suggest.ts +++ b/editors/tiptap/src/components/extensions/link-suggest.ts @@ -97,10 +97,11 @@ function loadLinkSuggest( /** * Build a function returning an array of link suggestions from a string. * @param linkSuggest - the link suggestion service to use - * @param wikiConfig - the wiki configuration to use */ function initSuggestionsService(linkSuggest: LinkSuggestService | undefined) { // Return an array of suggestions from a query + // TODO: reduce the number of statements in the following method and reactivate the disabled eslint rule. + // eslint-disable-next-line max-statements return async function ({ query, }: { @@ -186,6 +187,8 @@ function renderItems( return false; }, + // TODO: reduce the number of statements in the following method and reactivate the disabled eslint rule. + // eslint-disable-next-line max-statements onStart(props: { items: LinkSuggestionActionDescriptor[]; editor: Editor; diff --git a/editors/tiptap/src/extensions/autoSaver.ts b/editors/tiptap/src/extensions/autoSaver.ts index f8d06e2a8..81bd1ee47 100644 --- a/editors/tiptap/src/extensions/autoSaver.ts +++ b/editors/tiptap/src/extensions/autoSaver.ts @@ -146,6 +146,8 @@ class AutoSaver extends EventEmitter { /** * @param providedAuthors - provide a set of user when manually triggering this save. */ + // TODO: reduce the number of statements in the following method and reactivate the disabled eslint rule. + // eslint-disable-next-line max-statements async save(providedAuthors?: User[]): Promise { const authors = providedAuthors ?? this.getAuthors(); if (authors.length == 0) { diff --git a/editors/tiptap/src/extensions/markdown.ts b/editors/tiptap/src/extensions/markdown.ts index 38574db70..e7e72ea2c 100644 --- a/editors/tiptap/src/extensions/markdown.ts +++ b/editors/tiptap/src/extensions/markdown.ts @@ -50,6 +50,8 @@ function appendIfNotEmpty( * Parse a string in look for internal links. Returns a array of string or InternalLink types. * @param content - a string to parse */ +// TODO: reduce the number of statements in the following method and reactivate the disabled eslint rule. +// eslint-disable-next-line max-statements function parseStringForInternalLinks( content: string, ): (string | InternalLink)[] { @@ -105,6 +107,8 @@ export default Markdown.extend({ // We replace the content of the current block node only if at least a link has been found. if (hasLink(internalTokens)) { blockToken.content = ""; + // TODO: reduce the number of statements in the following method and reactivate the disabled eslint rule. + // eslint-disable-next-line max-statements blockToken.children = internalTokens.flatMap((v) => { if (typeof v == "string") { const token = new state.Token("text", "span", 0); diff --git a/electron/storage/src/electron/main/index.ts b/electron/storage/src/electron/main/index.ts index b5a2406e1..a0c140c50 100644 --- a/electron/storage/src/electron/main/index.ts +++ b/electron/storage/src/electron/main/index.ts @@ -145,6 +145,8 @@ async function isWithin(root: string, path: string) { * @param title - the title of the page * @since 0.8 */ +// TODO: reduce the number of statements in the following method and reactivate the disabled eslint rule. +// eslint-disable-next-line max-statements async function savePage( path: string, content: string, @@ -228,6 +230,8 @@ async function deletePage(path: string): Promise { await shell.trashItem(path.replace(/\/page.json$/, "")); } +// TODO: reduce the number of statements in the following method and reactivate the disabled eslint rule. +// eslint-disable-next-line max-statements export default function load(): void { protocol.handle(cristalFSProtocol, async (request) => { const path = join( diff --git a/eslint.config.mjs b/eslint.config.mjs index e9cd15f0f..b0f63ebdf 100644 --- a/eslint.config.mjs +++ b/eslint.config.mjs @@ -77,6 +77,7 @@ export default [ "import/group-exports": "error", "import/consistent-type-specifier-style": ["error", "prefer-top-level"], curly: "error", + "max-statements": "error", }, }, { diff --git a/extension-manager/src/components/cristalLoader.ts b/extension-manager/src/components/cristalLoader.ts index b970e1d02..4f0faaf0f 100644 --- a/extension-manager/src/components/cristalLoader.ts +++ b/extension-manager/src/components/cristalLoader.ts @@ -45,6 +45,8 @@ export class CristalLoader { return logger; } + // TODO: reduce the number of statements in the following method and reactivate the disabled eslint rule. + // eslint-disable-next-line max-statements public async loadExtensionManager( staticExtensionManager: boolean, ): Promise { @@ -84,6 +86,8 @@ export class CristalLoader { } } + // TODO: reduce the number of statements in the following method and reactivate the disabled eslint rule. + // eslint-disable-next-line max-statements public async loadExtensions( staticExtensionManager: boolean, staticBuild: boolean, diff --git a/extension-manager/src/components/defaultExtensionManager.ts b/extension-manager/src/components/defaultExtensionManager.ts index 5f94f38bd..ff552ddfe 100644 --- a/extension-manager/src/components/defaultExtensionManager.ts +++ b/extension-manager/src/components/defaultExtensionManager.ts @@ -68,6 +68,8 @@ export class DefaultExtensionManager this.remoteExtensionDefaultEntryFile = remoteExtensionDefaultEntryFile; } + // TODO: reduce the number of statements in the following method and reactivate the disabled eslint rule. + // eslint-disable-next-line max-statements async loadExtension( extensionName: string, container: Container, diff --git a/lib/src/components/DefaultCristalApp.ts b/lib/src/components/DefaultCristalApp.ts index 32048f9fa..e305c76a1 100644 --- a/lib/src/components/DefaultCristalApp.ts +++ b/lib/src/components/DefaultCristalApp.ts @@ -83,6 +83,8 @@ export class DefaultCristalApp implements CristalApp { public isElectron: boolean; public availableConfigurations: Map; + // TODO: reduce the number of statements in the following method and reactivate the disabled eslint rule. + // eslint-disable-next-line max-statements constructor( @inject("ExtensionManager") extensionManager: ExtensionManager, @inject("SkinManager") skinManager: SkinManager, @@ -232,6 +234,8 @@ export class DefaultCristalApp implements CristalApp { * content is allowed. When undefinied, default to true. * @since 0.8 */ + // TODO: reduce the number of statements in the following method and reactivate the disabled eslint rule. + // eslint-disable-next-line max-statements async loadPage(options?: { requeue: boolean }): Promise { try { this.logger?.debug("Loading page", this.page.name); @@ -392,6 +396,8 @@ export class DefaultCristalApp implements CristalApp { return page; } + // TODO: reduce the number of statements in the following method and reactivate the disabled eslint rule. + // eslint-disable-next-line max-statements async run(): Promise { this.logger?.debug("Before vue"); diff --git a/lib/src/components/cristalAppLoader.ts b/lib/src/components/cristalAppLoader.ts index 28c946087..5df3b3cea 100644 --- a/lib/src/components/cristalAppLoader.ts +++ b/lib/src/components/cristalAppLoader.ts @@ -58,6 +58,8 @@ class CristalAppLoader extends CristalLoader { super(extensionList); } + // TODO: reduce the number of statements in the following method and reactivate the disabled eslint rule. + // eslint-disable-next-line max-statements public async loadApp( config: { [s: string]: T }, isElectron: boolean, @@ -114,6 +116,8 @@ class CristalAppLoader extends CristalLoader { } } + // TODO: reduce the number of statements in the following method and reactivate the disabled eslint rule. + // eslint-disable-next-line max-statements public async launchApp( forceStaticMode: boolean, loadConfig: () => Promise>, diff --git a/lib/src/staticBuild.ts b/lib/src/staticBuild.ts index 611c643bf..1613bc7c3 100644 --- a/lib/src/staticBuild.ts +++ b/lib/src/staticBuild.ts @@ -69,6 +69,8 @@ import { ComponentInit as UIExtensionDefaultComponentInit } from "@xwiki/cristal import type { Container } from "inversify"; export class StaticBuild { + // TODO: reduce the number of statements in the following method and reactivate the disabled eslint rule. + // eslint-disable-next-line max-statements public static init( container: Container, forceStaticBuild: boolean, diff --git a/macros/src/components/defaultMacroProvider.ts b/macros/src/components/defaultMacroProvider.ts index 018a770b6..a3fb22c83 100644 --- a/macros/src/components/defaultMacroProvider.ts +++ b/macros/src/components/defaultMacroProvider.ts @@ -37,6 +37,8 @@ export abstract class DefaultMacroProvider return "vue"; } + // TODO: reduce the number of statements in the following method and reactivate the disabled eslint rule. + // eslint-disable-next-line max-statements parseParameters(element: HTMLElement): MacroData { const macroData = new DefaultMacroData(); const attrs = element.getAttributeNames(); diff --git a/rendering/rendering/src/components/marked-macro.ts b/rendering/rendering/src/components/marked-macro.ts index 11f9b0db9..a2a1a6219 100644 --- a/rendering/rendering/src/components/marked-macro.ts +++ b/rendering/rendering/src/components/marked-macro.ts @@ -45,6 +45,8 @@ const macro: TokenizerExtension | RendererExtension = { start(this: TokenizerThis, src: string) { return src.match(startReg)?.index; }, + // TODO: reduce the number of statements in the following method and reactivate the disabled eslint rule. + // eslint-disable-next-line max-statements tokenizer(src: string): Tokens.Generic | undefined { const lines = src.split(/\n/); let endReg = null; diff --git a/sharedworker/impl/src/components/worker.ts b/sharedworker/impl/src/components/worker.ts index dcd047124..c194fd8ad 100644 --- a/sharedworker/impl/src/components/worker.ts +++ b/sharedworker/impl/src/components/worker.ts @@ -89,6 +89,8 @@ export class Worker implements MyWorker { } } + // TODO: reduce the number of statements in the following method and reactivate the disabled eslint rule. + // eslint-disable-next-line max-statements public async handleQueueItem(page: string): Promise { console.log("Handling queue item code ready to process", page); @@ -142,6 +144,8 @@ export class Worker implements MyWorker { return this.queue.length; } + // TODO: reduce the number of statements in the following method and reactivate the disabled eslint rule. + // eslint-disable-next-line max-statements public getWikiConfig(configName: string): WikiConfig | undefined { const wikiConfigObject = this.configMap.get(configName); if (wikiConfigObject == null) { @@ -191,6 +195,8 @@ export class Worker implements MyWorker { } } + // TODO: reduce the number of statements in the following method and reactivate the disabled eslint rule. + // eslint-disable-next-line max-statements public async initialize(): Promise { console.log("Starting initialize"); const extensionList: Array = ["storage"]; diff --git a/skin/src/components/componentsInit.ts b/skin/src/components/componentsInit.ts index c1a3aa164..157ec5f1f 100644 --- a/skin/src/components/componentsInit.ts +++ b/skin/src/components/componentsInit.ts @@ -38,6 +38,8 @@ import type { Container } from "inversify"; export default class ComponentInit { logger: Logger; + // TODO: reduce the number of statements in the following method and reactivate the disabled eslint rule. + // eslint-disable-next-line max-statements constructor(container: Container) { this.logger = container.get("Logger"); this.logger.setModule("skin.components.componentsInit"); diff --git a/skin/src/components/defaultSkinManager.ts b/skin/src/components/defaultSkinManager.ts index 8c365aeab..f73872e8d 100644 --- a/skin/src/components/defaultSkinManager.ts +++ b/skin/src/components/defaultSkinManager.ts @@ -44,6 +44,8 @@ export class DefaultSkinManager implements SkinManager { public templates: Map; public designSystem: string = ""; + // TODO: reduce the number of statements in the following method and reactivate the disabled eslint rule. + // eslint-disable-next-line max-statements constructor() { this.templates = new Map(); this.templates.set("view", View); diff --git a/skin/src/vue/__tests__/c-content.test.ts b/skin/src/vue/__tests__/c-content.test.ts index acdade9a5..13a34ae54 100644 --- a/skin/src/vue/__tests__/c-content.test.ts +++ b/skin/src/vue/__tests__/c-content.test.ts @@ -34,6 +34,8 @@ import { beforeAll, describe, expect, it, vi } from "vitest"; import { ref } from "vue"; import { useRoute } from "vue-router"; +// TODO: reduce the number of statements in the following method and reactivate the disabled eslint rule. +// eslint-disable-next-line max-statements function mountCComponent(params: { isLoading?: boolean; error?: string; diff --git a/skin/src/vue/c-edit.vue b/skin/src/vue/c-edit.vue index 12d7d52b2..6ddf6e67b 100644 --- a/skin/src/vue/c-edit.vue +++ b/skin/src/vue/c-edit.vue @@ -33,6 +33,8 @@ export default { logger = cristal.getLogger("skin.vue.editor"); } }, + // TODO: reduce the number of statements in the following method and reactivate the disabled eslint rule. + // eslint-disable-next-line max-statements data() { logger?.debug("Editor UIX components are ", comps); if (!comps || comps.length == 0) { diff --git a/skin/src/vue/c-field.vue b/skin/src/vue/c-field.vue index 3bfd6e73d..34a08260e 100644 --- a/skin/src/vue/c-field.vue +++ b/skin/src/vue/c-field.vue @@ -50,6 +50,8 @@ export default defineComponent({ mode: { type: String, required: true }, type: { type: String, required: false, default: () => undefined }, }, + // TODO: reduce the number of statements in the following method and reactivate the disabled eslint rule. + // eslint-disable-next-line max-statements setup(props) { const cristal = inject("cristal")!; logger = cristal.getLogger("skin.vue.field"); diff --git a/skin/src/vue/contentTools.ts b/skin/src/vue/contentTools.ts index 81737470e..ea29ba42f 100644 --- a/skin/src/vue/contentTools.ts +++ b/skin/src/vue/contentTools.ts @@ -263,6 +263,8 @@ export class ContentTools { * \