MOBIE-3947 lint: Fix some linting

main
Pau Ferrer Ocaña 2023-11-24 12:28:25 +01:00
parent 08f8208186
commit a0cd868179
13 changed files with 13 additions and 27 deletions

View File

@ -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<string, unknown>) => void;
_setLocale: () => void; // eslint-disable-line @typescript-eslint/naming-convention
_setLocale: () => void;
typeset: (container: HTMLElement) => void;
};
};

View File

@ -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.

View File

@ -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.
*/

View File

@ -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',

View File

@ -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;

View File

@ -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<void>; // Emit when resizing the textarea.
constructor(protected element: ElementRef) {

View File

@ -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;

View File

@ -59,7 +59,6 @@ import { CoreUtils } from '@services/utils/utils';
template: '<core-loading [hideUntil]="loaded"><ng-container #dynamicComponent></ng-container></core-loading>',
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 cant or wont 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<string, SimpleChange>): Promise<void> {
// 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();
}

View File

@ -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 {

View File

@ -80,7 +80,6 @@ export class CoreViewerImageComponent implements OnInit {
this.title = this.title || Translate.instant('core.imageviewer');
}
/**
* Close modal.
*/

View File

@ -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 ? '' : '<div class="core-iframe-network-error"></div>') +
'<p>' + Translate.instant('core.networkerroriframemsg') + '</p>';
@ -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);

View File

@ -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.

View File

@ -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';