MOBIE-3947 lint: Fix some linting
parent
08f8208186
commit
a0cd868179
|
@ -411,7 +411,7 @@ type MathJaxWindow = Window & {
|
||||||
_configured: boolean; // eslint-disable-line @typescript-eslint/naming-convention
|
_configured: boolean; // eslint-disable-line @typescript-eslint/naming-convention
|
||||||
// Add the configuration to the head and set the lang.
|
// Add the configuration to the head and set the lang.
|
||||||
configure: (params: Record<string, unknown>) => void;
|
configure: (params: Record<string, unknown>) => void;
|
||||||
_setLocale: () => void; // eslint-disable-line @typescript-eslint/naming-convention
|
_setLocale: () => void;
|
||||||
typeset: (container: HTMLElement) => void;
|
typeset: (container: HTMLElement) => void;
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
|
@ -81,7 +81,6 @@ const ERROR_STRINGS = {
|
||||||
/**
|
/**
|
||||||
* SCORM data model implementation for version 1.2.
|
* SCORM data model implementation for version 1.2.
|
||||||
*/
|
*/
|
||||||
/* eslint-disable @typescript-eslint/naming-convention */
|
|
||||||
export class AddonModScormDataModel12 {
|
export class AddonModScormDataModel12 {
|
||||||
|
|
||||||
protected currentUserData: AddonModScormUserDataMap = {}; // Current user data.
|
protected currentUserData: AddonModScormUserDataMap = {}; // Current user data.
|
||||||
|
|
|
@ -211,7 +211,7 @@ export class CoreAuthenticatedSite extends CoreUnauthenticatedSite {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Check if current user is Admin.
|
* 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.
|
* @returns Whether the user is Admin.
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -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,
|
* 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.".
|
* if no component is supplied then the template will show the message "Cannot render the data.".
|
||||||
*/
|
*/
|
||||||
/* eslint-disable @angular-eslint/no-conflicting-lifecycle */
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'core-dynamic-component',
|
selector: 'core-dynamic-component',
|
||||||
templateUrl: 'core-dynamic-component.html',
|
templateUrl: 'core-dynamic-component.html',
|
||||||
|
|
|
@ -35,7 +35,6 @@ import { Translate } from '@singletons';
|
||||||
})
|
})
|
||||||
export class CoreMarkRequiredComponent implements OnInit, AfterViewInit {
|
export class CoreMarkRequiredComponent implements OnInit, AfterViewInit {
|
||||||
|
|
||||||
// eslint-disable-next-line @angular-eslint/no-input-rename
|
|
||||||
@Input('core-mark-required') coreMarkRequired: boolean | string = true;
|
@Input('core-mark-required') coreMarkRequired: boolean | string = true;
|
||||||
|
|
||||||
protected element: HTMLElement;
|
protected element: HTMLElement;
|
||||||
|
|
|
@ -28,7 +28,7 @@ export class CoreAutoRowsDirective implements AfterViewInit, OnChanges {
|
||||||
|
|
||||||
protected height = 0;
|
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.
|
@Output() onResize: EventEmitter<void>; // Emit when resizing the textarea.
|
||||||
|
|
||||||
constructor(protected element: ElementRef) {
|
constructor(protected element: ElementRef) {
|
||||||
|
|
|
@ -35,7 +35,6 @@ const SWIPE_FRICTION = 0.6;
|
||||||
})
|
})
|
||||||
export class CoreSwipeNavigationDirective implements AfterViewInit, OnDestroy {
|
export class CoreSwipeNavigationDirective implements AfterViewInit, OnDestroy {
|
||||||
|
|
||||||
// eslint-disable-next-line @angular-eslint/no-input-rename
|
|
||||||
@Input('core-swipe-navigation') manager?: CoreSwipeNavigationItemsManager;
|
@Input('core-swipe-navigation') manager?: CoreSwipeNavigationItemsManager;
|
||||||
|
|
||||||
protected element: HTMLElement;
|
protected element: HTMLElement;
|
||||||
|
|
|
@ -59,7 +59,6 @@ import { CoreUtils } from '@services/utils/utils';
|
||||||
template: '<core-loading [hideUntil]="loaded"><ng-container #dynamicComponent></ng-container></core-loading>',
|
template: '<core-loading [hideUntil]="loaded"><ng-container #dynamicComponent></ng-container></core-loading>',
|
||||||
styles: [':host { display: contents; }'],
|
styles: [':host { display: contents; }'],
|
||||||
})
|
})
|
||||||
// eslint-disable-next-line @angular-eslint/no-conflicting-lifecycle
|
|
||||||
export class CoreCompileHtmlComponent implements OnChanges, OnDestroy, DoCheck {
|
export class CoreCompileHtmlComponent implements OnChanges, OnDestroy, DoCheck {
|
||||||
|
|
||||||
@Input() text!: string; // The HTML text to display.
|
@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).
|
* 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 {
|
ngDoCheck(): void {
|
||||||
if (!this.componentInstance || this.creatingComponent) {
|
if (!this.componentInstance || this.creatingComponent) {
|
||||||
return;
|
return;
|
||||||
|
@ -115,7 +113,6 @@ export class CoreCompileHtmlComponent implements OnChanges, OnDestroy, DoCheck {
|
||||||
/**
|
/**
|
||||||
* Detect changes on input properties.
|
* Detect changes on input properties.
|
||||||
*/
|
*/
|
||||||
// eslint-disable-next-line @angular-eslint/no-conflicting-lifecycle
|
|
||||||
async ngOnChanges(changes: Record<string, SimpleChange>): Promise<void> {
|
async ngOnChanges(changes: Record<string, SimpleChange>): Promise<void> {
|
||||||
// Only compile if text/javascript has changed or the forceCompile flag has been set to true.
|
// Only compile if text/javascript has changed or the forceCompile flag has been set to true.
|
||||||
if (this.text !== undefined && (changes.text || changes.javascript ||
|
if (this.text !== undefined && (changes.text || changes.javascript ||
|
||||||
|
@ -153,7 +150,6 @@ export class CoreCompileHtmlComponent implements OnChanges, OnDestroy, DoCheck {
|
||||||
/**
|
/**
|
||||||
* Component destroyed.
|
* Component destroyed.
|
||||||
*/
|
*/
|
||||||
// eslint-disable-next-line @angular-eslint/no-conflicting-lifecycle
|
|
||||||
ngOnDestroy(): void {
|
ngOnDestroy(): void {
|
||||||
this.componentRef?.destroy();
|
this.componentRef?.destroy();
|
||||||
}
|
}
|
||||||
|
|
|
@ -46,6 +46,7 @@ export class ClipboardMock extends Clipboard {
|
||||||
this.copyTextarea.select();
|
this.copyTextarea.select();
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
// eslint-disable-next-line deprecation/deprecation
|
||||||
if (document.execCommand('copy')) {
|
if (document.execCommand('copy')) {
|
||||||
resolve();
|
resolve();
|
||||||
} else {
|
} else {
|
||||||
|
@ -71,6 +72,7 @@ export class ClipboardMock extends Clipboard {
|
||||||
this.copyTextarea.select();
|
this.copyTextarea.select();
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
// eslint-disable-next-line deprecation/deprecation
|
||||||
if (document.execCommand('paste')) {
|
if (document.execCommand('paste')) {
|
||||||
resolve(this.copyTextarea.innerHTML);
|
resolve(this.copyTextarea.innerHTML);
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -80,7 +80,6 @@ export class CoreViewerImageComponent implements OnInit {
|
||||||
this.title = this.title || Translate.instant('core.imageviewer');
|
this.title = this.title || Translate.instant('core.imageviewer');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Close modal.
|
* Close modal.
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -62,8 +62,6 @@ export class CoreIframeUtilsProvider {
|
||||||
* @returns True if frame is online and the app is offline, false otherwise.
|
* @returns True if frame is online and the app is offline, false otherwise.
|
||||||
*/
|
*/
|
||||||
checkOnlineFrameInOffline(element: CoreFrameElement, isSubframe?: boolean): boolean {
|
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;
|
const src = 'src' in element ? element.src : element.data;
|
||||||
|
|
||||||
if (src && src != 'about:blank' && !CoreUrlUtils.isLocalFileUrl(src) && !CoreNetwork.isOnline()) {
|
if (src && src != 'about:blank' && !CoreUrlUtils.isLocalFileUrl(src) && !CoreNetwork.isOnline()) {
|
||||||
|
@ -91,7 +89,7 @@ export class CoreIframeUtilsProvider {
|
||||||
// Reload the frame.
|
// Reload the frame.
|
||||||
if ('src' in element) {
|
if ('src' in element) {
|
||||||
// eslint-disable-next-line no-self-assign
|
// eslint-disable-next-line no-self-assign
|
||||||
element.src = element.src; // eslint-disable-line deprecation/deprecation
|
element.src = element.src;
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
// eslint-disable-next-line no-self-assign
|
// eslint-disable-next-line no-self-assign
|
||||||
|
@ -135,7 +133,6 @@ export class CoreIframeUtilsProvider {
|
||||||
const canHandleLink = await CoreContentLinksHelper.canHandleLink(src, undefined, username);
|
const canHandleLink = await CoreContentLinksHelper.canHandleLink(src, undefined, username);
|
||||||
|
|
||||||
if (!canHandleLink) {
|
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>') +
|
div.innerHTML = (isSubframe ? '' : '<div class="core-iframe-network-error"></div>') +
|
||||||
'<p>' + Translate.instant('core.networkerroriframemsg') + '</p>';
|
'<p>' + Translate.instant('core.networkerroriframemsg') + '</p>';
|
||||||
|
|
||||||
|
@ -232,21 +229,18 @@ export class CoreIframeUtilsProvider {
|
||||||
* @returns Window and Document.
|
* @returns Window and Document.
|
||||||
*/
|
*/
|
||||||
getContentWindowAndDocument(element: CoreFrameElement): { window: Window | null; document: Document | null } {
|
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;
|
const src = 'src' in element ? element.src : element.data;
|
||||||
if (src !== 'about:blank' && !CoreUrlUtils.isLocalFileUrl(src)) {
|
if (src !== 'about:blank' && !CoreUrlUtils.isLocalFileUrl(src)) {
|
||||||
// No permissions to access the iframe.
|
// No permissions to access the iframe.
|
||||||
return { window: null, document: null };
|
return { window: null, document: null };
|
||||||
}
|
}
|
||||||
|
|
||||||
// eslint-disable-next-line deprecation/deprecation
|
|
||||||
let contentWindow: Window | null = 'contentWindow' in element ? element.contentWindow : null;
|
let contentWindow: Window | null = 'contentWindow' in element ? element.contentWindow : null;
|
||||||
let contentDocument: Document | null = null;
|
let contentDocument: Document | null = null;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
contentDocument = 'contentDocument' in element && element.contentDocument // eslint-disable-line deprecation/deprecation
|
contentDocument = 'contentDocument' in element && element.contentDocument
|
||||||
? element.contentDocument // eslint-disable-line deprecation/deprecation
|
? element.contentDocument
|
||||||
: contentWindow && contentWindow.document;
|
: contentWindow && contentWindow.document;
|
||||||
} catch {
|
} catch {
|
||||||
// Ignore errors.
|
// Ignore errors.
|
||||||
|
@ -425,9 +419,8 @@ export class CoreIframeUtilsProvider {
|
||||||
const scheme = CoreUrlUtils.getUrlScheme(url);
|
const scheme = CoreUrlUtils.getUrlScheme(url);
|
||||||
if (!scheme) {
|
if (!scheme) {
|
||||||
// It's a relative URL, use the frame src to create the full URL.
|
// 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
|
const src = element
|
||||||
? ('src' in element ? element.src : element.data) // eslint-disable-line deprecation/deprecation
|
? ('src' in element ? element.src : element.data)
|
||||||
: null;
|
: null;
|
||||||
if (src) {
|
if (src) {
|
||||||
const dirAndFile = CoreFile.getFileAndDirectoryFromPath(src);
|
const dirAndFile = CoreFile.getFileAndDirectoryFromPath(src);
|
||||||
|
|
|
@ -1059,7 +1059,7 @@ export class CoreUtilsProvider {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Open a URL using InAppBrowser.
|
* 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 url The URL to open.
|
||||||
* @param options Override default options passed to InAppBrowser.
|
* @param options Override default options passed to InAppBrowser.
|
||||||
|
@ -1176,7 +1176,7 @@ export class CoreUtilsProvider {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Open a URL using a browser.
|
* 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 url The URL to open.
|
||||||
* @param options Options.
|
* @param options Options.
|
||||||
|
|
|
@ -260,7 +260,7 @@ export class CoreWSProvider {
|
||||||
// Download the file in the tmp file.
|
// Download the file in the tmp file.
|
||||||
await transfer.download(url, fileEntry.toURL(), true, {
|
await transfer.download(url, fileEntry.toURL(), true, {
|
||||||
headers: {
|
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.chunkedMode = false;
|
||||||
options.headers = {
|
options.headers = {
|
||||||
'User-Agent': navigator.userAgent, // eslint-disable-line @typescript-eslint/naming-convention
|
'User-Agent': navigator.userAgent,
|
||||||
};
|
};
|
||||||
options['Connection'] = 'close';
|
options['Connection'] = 'close';
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue