From 62bf5630ecc334723a41ffad4d1d8bfb83388c98 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pau=20Ferrer=20Oca=C3=B1a?= Date: Fri, 24 Nov 2023 12:28:25 +0100 Subject: [PATCH] MOBIE-3947 lint: Fix some linting --- .../services/handlers/mathjaxloader.ts | 2 +- src/addons/mod/scorm/classes/data-model-12.ts | 1 - src/core/classes/sites/authenticated-site.ts | 2 +- .../dynamic-component/dynamic-component.ts | 1 - .../components/mark-required/mark-required.ts | 1 - src/core/directives/auto-rows.ts | 2 +- src/core/directives/swipe-navigation.ts | 1 - .../components/compile-html/compile-html.ts | 4 ---- src/core/features/emulator/services/clipboard.ts | 2 ++ .../features/viewer/components/image/image.ts | 1 - src/core/services/utils/iframe.ts | 15 ++++----------- src/core/services/utils/utils.ts | 4 ++-- src/core/services/ws.ts | 4 ++-- 13 files changed, 13 insertions(+), 27 deletions(-) diff --git a/src/addons/filter/mathjaxloader/services/handlers/mathjaxloader.ts b/src/addons/filter/mathjaxloader/services/handlers/mathjaxloader.ts index 7589f5be83c..7ca996ae74c 100644 --- a/src/addons/filter/mathjaxloader/services/handlers/mathjaxloader.ts +++ b/src/addons/filter/mathjaxloader/services/handlers/mathjaxloader.ts @@ -411,7 +411,7 @@ type MathJaxWindow = Window & { _configured: boolean; // eslint-disable-line @typescript-eslint/naming-convention // Add the configuration to the head and set the lang. configure: (params: Record) => void; - _setLocale: () => void; // eslint-disable-line @typescript-eslint/naming-convention + _setLocale: () => void; typeset: (container: HTMLElement) => void; }; }; diff --git a/src/addons/mod/scorm/classes/data-model-12.ts b/src/addons/mod/scorm/classes/data-model-12.ts index 13d6121b049..3be16edf629 100644 --- a/src/addons/mod/scorm/classes/data-model-12.ts +++ b/src/addons/mod/scorm/classes/data-model-12.ts @@ -81,7 +81,6 @@ const ERROR_STRINGS = { /** * SCORM data model implementation for version 1.2. */ -/* eslint-disable @typescript-eslint/naming-convention */ export class AddonModScormDataModel12 { protected currentUserData: AddonModScormUserDataMap = {}; // Current user data. diff --git a/src/core/classes/sites/authenticated-site.ts b/src/core/classes/sites/authenticated-site.ts index 4a7b57b5656..4fd6fb9fd4d 100644 --- a/src/core/classes/sites/authenticated-site.ts +++ b/src/core/classes/sites/authenticated-site.ts @@ -211,7 +211,7 @@ export class CoreAuthenticatedSite extends CoreUnauthenticatedSite { /** * Check if current user is Admin. - * Works properly since v3.8. See more in: {@link} https://tracker.moodle.org/browse/MDL-65550 + * Works properly since v3.8. See more in: {@link https://tracker.moodle.org/browse/MDL-65550} * * @returns Whether the user is Admin. */ diff --git a/src/core/components/dynamic-component/dynamic-component.ts b/src/core/components/dynamic-component/dynamic-component.ts index 00e48d8c4bb..72876a368e1 100644 --- a/src/core/components/dynamic-component/dynamic-component.ts +++ b/src/core/components/dynamic-component/dynamic-component.ts @@ -59,7 +59,6 @@ import { CoreLogger } from '@singletons/logger'; * The contents of this component will be displayed if no component is supplied or it cannot be created. In the example above, * if no component is supplied then the template will show the message "Cannot render the data.". */ -/* eslint-disable @angular-eslint/no-conflicting-lifecycle */ @Component({ selector: 'core-dynamic-component', templateUrl: 'core-dynamic-component.html', diff --git a/src/core/components/mark-required/mark-required.ts b/src/core/components/mark-required/mark-required.ts index d486ca322a2..8d1ba253a74 100644 --- a/src/core/components/mark-required/mark-required.ts +++ b/src/core/components/mark-required/mark-required.ts @@ -35,7 +35,6 @@ import { Translate } from '@singletons'; }) export class CoreMarkRequiredComponent implements OnInit, AfterViewInit { - // eslint-disable-next-line @angular-eslint/no-input-rename @Input('core-mark-required') coreMarkRequired: boolean | string = true; protected element: HTMLElement; diff --git a/src/core/directives/auto-rows.ts b/src/core/directives/auto-rows.ts index ea631858588..fc8b0a0d061 100644 --- a/src/core/directives/auto-rows.ts +++ b/src/core/directives/auto-rows.ts @@ -28,7 +28,7 @@ export class CoreAutoRowsDirective implements AfterViewInit, OnChanges { protected height = 0; - @Input('core-auto-rows') value?: string; // eslint-disable-line @angular-eslint/no-input-rename + @Input('core-auto-rows') value?: string; @Output() onResize: EventEmitter; // Emit when resizing the textarea. constructor(protected element: ElementRef) { diff --git a/src/core/directives/swipe-navigation.ts b/src/core/directives/swipe-navigation.ts index e73990304c1..ffff2497e63 100644 --- a/src/core/directives/swipe-navigation.ts +++ b/src/core/directives/swipe-navigation.ts @@ -35,7 +35,6 @@ const SWIPE_FRICTION = 0.6; }) export class CoreSwipeNavigationDirective implements AfterViewInit, OnDestroy { - // eslint-disable-next-line @angular-eslint/no-input-rename @Input('core-swipe-navigation') manager?: CoreSwipeNavigationItemsManager; protected element: HTMLElement; diff --git a/src/core/features/compile/components/compile-html/compile-html.ts b/src/core/features/compile/components/compile-html/compile-html.ts index 25a937676eb..97edd339737 100644 --- a/src/core/features/compile/components/compile-html/compile-html.ts +++ b/src/core/features/compile/components/compile-html/compile-html.ts @@ -59,7 +59,6 @@ import { CoreUtils } from '@services/utils/utils'; template: '', styles: [':host { display: contents; }'], }) -// eslint-disable-next-line @angular-eslint/no-conflicting-lifecycle export class CoreCompileHtmlComponent implements OnChanges, OnDestroy, DoCheck { @Input() text!: string; // The HTML text to display. @@ -95,7 +94,6 @@ export class CoreCompileHtmlComponent implements OnChanges, OnDestroy, DoCheck { /** * Detect and act upon changes that Angular can’t or won’t detect on its own (objects and arrays). */ - // eslint-disable-next-line @angular-eslint/no-conflicting-lifecycle ngDoCheck(): void { if (!this.componentInstance || this.creatingComponent) { return; @@ -115,7 +113,6 @@ export class CoreCompileHtmlComponent implements OnChanges, OnDestroy, DoCheck { /** * Detect changes on input properties. */ - // eslint-disable-next-line @angular-eslint/no-conflicting-lifecycle async ngOnChanges(changes: Record): Promise { // Only compile if text/javascript has changed or the forceCompile flag has been set to true. if (this.text !== undefined && (changes.text || changes.javascript || @@ -153,7 +150,6 @@ export class CoreCompileHtmlComponent implements OnChanges, OnDestroy, DoCheck { /** * Component destroyed. */ - // eslint-disable-next-line @angular-eslint/no-conflicting-lifecycle ngOnDestroy(): void { this.componentRef?.destroy(); } diff --git a/src/core/features/emulator/services/clipboard.ts b/src/core/features/emulator/services/clipboard.ts index 24c45dbcdb5..ea5dd472277 100644 --- a/src/core/features/emulator/services/clipboard.ts +++ b/src/core/features/emulator/services/clipboard.ts @@ -46,6 +46,7 @@ export class ClipboardMock extends Clipboard { this.copyTextarea.select(); try { + // eslint-disable-next-line deprecation/deprecation if (document.execCommand('copy')) { resolve(); } else { @@ -71,6 +72,7 @@ export class ClipboardMock extends Clipboard { this.copyTextarea.select(); try { + // eslint-disable-next-line deprecation/deprecation if (document.execCommand('paste')) { resolve(this.copyTextarea.innerHTML); } else { diff --git a/src/core/features/viewer/components/image/image.ts b/src/core/features/viewer/components/image/image.ts index 8342a4baf98..cf1f236d557 100644 --- a/src/core/features/viewer/components/image/image.ts +++ b/src/core/features/viewer/components/image/image.ts @@ -80,7 +80,6 @@ export class CoreViewerImageComponent implements OnInit { this.title = this.title || Translate.instant('core.imageviewer'); } - /** * Close modal. */ diff --git a/src/core/services/utils/iframe.ts b/src/core/services/utils/iframe.ts index 50b28f91dfb..5a2db963ab9 100644 --- a/src/core/services/utils/iframe.ts +++ b/src/core/services/utils/iframe.ts @@ -62,8 +62,6 @@ export class CoreIframeUtilsProvider { * @returns True if frame is online and the app is offline, false otherwise. */ checkOnlineFrameInOffline(element: CoreFrameElement, isSubframe?: boolean): boolean { - // @todo Drop frame tag support to avoid deprecation. - // eslint-disable-next-line deprecation/deprecation const src = 'src' in element ? element.src : element.data; if (src && src != 'about:blank' && !CoreUrlUtils.isLocalFileUrl(src) && !CoreNetwork.isOnline()) { @@ -91,7 +89,7 @@ export class CoreIframeUtilsProvider { // Reload the frame. if ('src' in element) { // eslint-disable-next-line no-self-assign - element.src = element.src; // eslint-disable-line deprecation/deprecation + element.src = element.src; } else { // eslint-disable-next-line no-self-assign @@ -135,7 +133,6 @@ export class CoreIframeUtilsProvider { const canHandleLink = await CoreContentLinksHelper.canHandleLink(src, undefined, username); if (!canHandleLink) { - // @todo The not connected icon isn't seen due to the div's height. Also, it's quite big. div.innerHTML = (isSubframe ? '' : '
') + '

' + Translate.instant('core.networkerroriframemsg') + '

'; @@ -232,21 +229,18 @@ export class CoreIframeUtilsProvider { * @returns Window and Document. */ getContentWindowAndDocument(element: CoreFrameElement): { window: Window | null; document: Document | null } { - // @todo Drop frame tag support to avoid deprecation. - // eslint-disable-next-line deprecation/deprecation const src = 'src' in element ? element.src : element.data; if (src !== 'about:blank' && !CoreUrlUtils.isLocalFileUrl(src)) { // No permissions to access the iframe. return { window: null, document: null }; } - // eslint-disable-next-line deprecation/deprecation let contentWindow: Window | null = 'contentWindow' in element ? element.contentWindow : null; let contentDocument: Document | null = null; try { - contentDocument = 'contentDocument' in element && element.contentDocument // eslint-disable-line deprecation/deprecation - ? element.contentDocument // eslint-disable-line deprecation/deprecation + contentDocument = 'contentDocument' in element && element.contentDocument + ? element.contentDocument : contentWindow && contentWindow.document; } catch { // Ignore errors. @@ -425,9 +419,8 @@ export class CoreIframeUtilsProvider { const scheme = CoreUrlUtils.getUrlScheme(url); if (!scheme) { // It's a relative URL, use the frame src to create the full URL. - // @todo Drop frame tag support to avoid deprecation. const src = element - ? ('src' in element ? element.src : element.data) // eslint-disable-line deprecation/deprecation + ? ('src' in element ? element.src : element.data) : null; if (src) { const dirAndFile = CoreFile.getFileAndDirectoryFromPath(src); diff --git a/src/core/services/utils/utils.ts b/src/core/services/utils/utils.ts index 84cbf839cd0..b9710aaca74 100644 --- a/src/core/services/utils/utils.ts +++ b/src/core/services/utils/utils.ts @@ -1059,7 +1059,7 @@ export class CoreUtilsProvider { /** * Open a URL using InAppBrowser. - * Do not use for files, refer to {@link openFile}. + * Do not use for files, refer to {@link CoreUtilsProvider.openFile}. * * @param url The URL to open. * @param options Override default options passed to InAppBrowser. @@ -1176,7 +1176,7 @@ export class CoreUtilsProvider { /** * Open a URL using a browser. - * Do not use for files, refer to {@link openFile}. + * Do not use for files, refer to {@link CoreUtilsProvider.openFile}. * * @param url The URL to open. * @param options Options. diff --git a/src/core/services/ws.ts b/src/core/services/ws.ts index 0c299c56c33..8e7d7ae0ce1 100644 --- a/src/core/services/ws.ts +++ b/src/core/services/ws.ts @@ -260,7 +260,7 @@ export class CoreWSProvider { // Download the file in the tmp file. await transfer.download(url, fileEntry.toURL(), true, { headers: { - 'User-Agent': navigator.userAgent, // eslint-disable-line @typescript-eslint/naming-convention + 'User-Agent': navigator.userAgent, }, }); @@ -995,7 +995,7 @@ export class CoreWSProvider { }; options.chunkedMode = false; options.headers = { - 'User-Agent': navigator.userAgent, // eslint-disable-line @typescript-eslint/naming-convention + 'User-Agent': navigator.userAgent, }; options['Connection'] = 'close';