Skip to content

Commit

Permalink
MOBIE-3947 lint: Fix some linting
Browse files Browse the repository at this point in the history
  • Loading branch information
crazyserver committed Nov 24, 2023
1 parent 681175b commit 62bf563
Show file tree
Hide file tree
Showing 13 changed files with 13 additions and 27 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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;
};
};
Expand Down
1 change: 0 additions & 1 deletion src/addons/mod/scorm/classes/data-model-12.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
2 changes: 1 addition & 1 deletion src/core/classes/sites/authenticated-site.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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.
*/
Expand Down
1 change: 0 additions & 1 deletion src/core/components/dynamic-component/dynamic-component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand Down
1 change: 0 additions & 1 deletion src/core/components/mark-required/mark-required.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion src/core/directives/auto-rows.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
1 change: 0 additions & 1 deletion src/core/directives/swipe-navigation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -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;
Expand All @@ -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 ||
Expand Down Expand Up @@ -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();
}
Expand Down
2 changes: 2 additions & 0 deletions src/core/features/emulator/services/clipboard.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand All @@ -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 {
Expand Down
1 change: 0 additions & 1 deletion src/core/features/viewer/components/image/image.ts
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,6 @@ export class CoreViewerImageComponent implements OnInit {
this.title = this.title || Translate.instant('core.imageviewer');
}


/**
* Close modal.
*/
Expand Down
15 changes: 4 additions & 11 deletions src/core/services/utils/iframe.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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()) {
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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>';

Expand Down Expand Up @@ -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.
Expand Down Expand Up @@ -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);
Expand Down
4 changes: 2 additions & 2 deletions src/core/services/utils/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -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.
Expand Down
4 changes: 2 additions & 2 deletions src/core/services/ws.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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,
},
});

Expand Down Expand Up @@ -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';

Expand Down

0 comments on commit 62bf563

Please sign in to comment.