diff --git a/src/addon/messages/providers/mainmenu-handler.ts b/src/addon/messages/providers/mainmenu-handler.ts index 33f22fbb7..a30ac88a4 100644 --- a/src/addon/messages/providers/mainmenu-handler.ts +++ b/src/addon/messages/providers/mainmenu-handler.ts @@ -14,7 +14,7 @@ import { Injectable } from '@angular/core'; import { AddonMessagesProvider } from './messages'; -import { CoreMainMenuDelegate, CoreMainMenuHandler, CoreMainMenuHandlerToDisplay } from '@core/mainmenu/providers/delegate'; +import { CoreMainMenuHandler, CoreMainMenuHandlerToDisplay } from '@core/mainmenu/providers/delegate'; import { CoreCronHandler } from '@providers/cron'; import { CoreSitesProvider } from '@providers/sites'; import { CoreEventsProvider } from '@providers/events'; diff --git a/src/addon/mod/resource/providers/helper.ts b/src/addon/mod/resource/providers/helper.ts index a9077b3d5..3eb43e727 100644 --- a/src/addon/mod/resource/providers/helper.ts +++ b/src/addon/mod/resource/providers/helper.ts @@ -17,15 +17,12 @@ import { CoreDomUtilsProvider } from '@providers/utils/dom'; import { CoreCourseProvider } from '@core/course/providers/course'; import { CoreCourseHelperProvider } from '@core/course/providers/helper'; import { AddonModResourceProvider } from './resource'; -import { TranslateService } from '@ngx-translate/core'; import { CoreSitesProvider } from '@providers/sites'; -import { CoreUtilsProvider } from '@providers/utils/utils'; import { CoreFilepoolProvider } from '@providers/filepool'; import { CoreFileProvider } from '@providers/file'; import { CoreAppProvider } from '@providers/app'; import { CoreMimetypeUtilsProvider } from '@providers/utils/mimetype'; import { CoreTextUtilsProvider } from '@providers/utils/text'; -import { CoreConstants } from '@core/constants'; /** * Service that provides helper functions for resources. @@ -43,8 +40,7 @@ export class AddonModResourceHelperProvider { private resourceProvider: AddonModResourceProvider, private courseHelper: CoreCourseHelperProvider, private textUtils: CoreTextUtilsProvider, private mimetypeUtils: CoreMimetypeUtilsProvider, private fileProvider: CoreFileProvider, private appProvider: CoreAppProvider, - private filepoolProvider: CoreFilepoolProvider, private utils: CoreUtilsProvider, - private sitesProvider: CoreSitesProvider, private translate: TranslateService) { + private filepoolProvider: CoreFilepoolProvider, private sitesProvider: CoreSitesProvider) { } /** diff --git a/src/addon/userprofilefield/checkbox/component/checkbox.ts b/src/addon/userprofilefield/checkbox/component/checkbox.ts index 998187701..de4a3392e 100644 --- a/src/addon/userprofilefield/checkbox/component/checkbox.ts +++ b/src/addon/userprofilefield/checkbox/component/checkbox.ts @@ -25,9 +25,9 @@ import { CoreUtilsProvider } from '@providers/utils/utils'; }) export class AddonUserProfileFieldCheckboxComponent implements OnInit { @Input() field: any; // The profile field to be rendered. - @Input() edit?: false; // True if editing the field. Defaults to false. - @Input() disabled?: false; // True if disabled. Defaults to false. - @Input() form?: FormGroup; // Form where to add the form control. + @Input() edit = false; // True if editing the field. Defaults to false. + @Input() disabled = false; // True if disabled. Defaults to false. + @Input() form: FormGroup; // Form where to add the form control. constructor(private fb: FormBuilder, protected utils: CoreUtilsProvider) { } diff --git a/src/addon/userprofilefield/datetime/component/datetime.ts b/src/addon/userprofilefield/datetime/component/datetime.ts index 1d43eaf80..cf72c309b 100644 --- a/src/addon/userprofilefield/datetime/component/datetime.ts +++ b/src/addon/userprofilefield/datetime/component/datetime.ts @@ -26,8 +26,8 @@ import { CoreUtilsProvider } from '@providers/utils/utils'; }) export class AddonUserProfileFieldDatetimeComponent implements OnInit { @Input() field: any; // The profile field to be rendered. - @Input() edit? = false; // True if editing the field. Defaults to false. - @Input() disabled? = false; // True if disabled. Defaults to false. + @Input() edit = false; // True if editing the field. Defaults to false. + @Input() disabled = false; // True if disabled. Defaults to false. @Input() form?: FormGroup; // Form where to add the form control. constructor(private fb: FormBuilder, private timeUtils: CoreTimeUtilsProvider, protected utils: CoreUtilsProvider) { } diff --git a/src/addon/userprofilefield/menu/component/menu.ts b/src/addon/userprofilefield/menu/component/menu.ts index b9e74c51a..338d40a33 100644 --- a/src/addon/userprofilefield/menu/component/menu.ts +++ b/src/addon/userprofilefield/menu/component/menu.ts @@ -24,8 +24,8 @@ import { FormGroup, FormBuilder, Validators } from '@angular/forms'; }) export class AddonUserProfileFieldMenuComponent implements OnInit { @Input() field: any; // The profile field to be rendered. - @Input() edit? = false; // True if editing the field. Defaults to false. - @Input() disabled? = false; // True if disabled. Defaults to false. + @Input() edit = false; // True if editing the field. Defaults to false. + @Input() disabled = false; // True if disabled. Defaults to false. @Input() form?: FormGroup; // Form where to add the form control. constructor(private fb: FormBuilder) { } diff --git a/src/addon/userprofilefield/text/component/text.ts b/src/addon/userprofilefield/text/component/text.ts index 84f1f44c1..c8ebd6b21 100644 --- a/src/addon/userprofilefield/text/component/text.ts +++ b/src/addon/userprofilefield/text/component/text.ts @@ -25,8 +25,8 @@ import { CoreUtilsProvider } from '@providers/utils/utils'; }) export class AddonUserProfileFieldTextComponent implements OnInit { @Input() field: any; // The profile field to be rendered. - @Input() edit? = false; // True if editing the field. Defaults to false. - @Input() disabled? = false; // True if disabled. Defaults to false. + @Input() edit = false; // True if editing the field. Defaults to false. + @Input() disabled = false; // True if disabled. Defaults to false. @Input() form?: FormGroup; // Form where to add the form control. constructor(private fb: FormBuilder, protected utils: CoreUtilsProvider) { } diff --git a/src/addon/userprofilefield/textarea/component/textarea.ts b/src/addon/userprofilefield/textarea/component/textarea.ts index efd1dae99..61b24b458 100644 --- a/src/addon/userprofilefield/textarea/component/textarea.ts +++ b/src/addon/userprofilefield/textarea/component/textarea.ts @@ -24,8 +24,8 @@ import { FormGroup, Validators, FormControl } from '@angular/forms'; }) export class AddonUserProfileFieldTextareaComponent implements OnInit { @Input() field: any; // The profile field to be rendered. - @Input() edit? = false; // True if editing the field. Defaults to false. - @Input() disabled? = false; // True if disabled. Defaults to false. + @Input() edit = false; // True if editing the field. Defaults to false. + @Input() disabled = false; // True if disabled. Defaults to false. @Input() form?: FormGroup; // Form where to add the form control. control: FormControl; diff --git a/src/components/chrono/chrono.ts b/src/components/chrono/chrono.ts index 885d62565..ca8757a41 100644 --- a/src/components/chrono/chrono.ts +++ b/src/components/chrono/chrono.ts @@ -32,7 +32,7 @@ import { Component, Input, OnChanges, OnDestroy, Output, EventEmitter, SimpleCha }) export class CoreChronoComponent implements OnChanges, OnDestroy { @Input() running: boolean; // Set it to true to start the chrono. Set it to false to stop it. - @Input() startTime? = 0; // Number of milliseconds to put in the chrono before starting. + @Input() startTime = 0; // Number of milliseconds to put in the chrono before starting. @Input() endTime?: number; // Number of milliseconds to stop the chrono. @Input() reset?: boolean; // Set it to true to reset the chrono. @Output() onEnd?: EventEmitter; // Will emit an event when the endTime is reached. diff --git a/src/components/rich-text-editor/rich-text-editor.ts b/src/components/rich-text-editor/rich-text-editor.ts index bf0e9c0ec..97a6a6530 100644 --- a/src/components/rich-text-editor/rich-text-editor.ts +++ b/src/components/rich-text-editor/rich-text-editor.ts @@ -40,7 +40,7 @@ export class CoreRichTextEditorComponent { // Based on: https://github.com/judgewest2000/Ionic3RichText/ // @todo: Resize, images, anchor button, fullscreen... - @Input() placeholder? = ''; // Placeholder to set in textarea. + @Input() placeholder = ''; // Placeholder to set in textarea. @Input() control: FormControl; // Form control. @Output() contentChanged: EventEmitter; diff --git a/src/components/search-box/search-box.ts b/src/components/search-box/search-box.ts index 2c5110b65..dabae223c 100644 --- a/src/components/search-box/search-box.ts +++ b/src/components/search-box/search-box.ts @@ -33,12 +33,12 @@ import { CoreUtilsProvider } from '@providers/utils/utils'; export class CoreSearchBoxComponent implements OnInit { @Input() searchLabel?: string; // Label to be used on action button. @Input() placeholder?: string; // Placeholder text for search text input. - @Input() autocorrect? = 'on'; // Enables/disable Autocorrection on search text input. + @Input() autocorrect = 'on'; // Enables/disable Autocorrection on search text input. @Input() spellcheck?: string | boolean = true; // Enables/disable Spellchecker on search text input. @Input() autoFocus?: string | boolean; // Enables/disable Autofocus when entering view. - @Input() lengthCheck? = 3; // Check value length before submit. If 0, any string will be submitted. - @Input() showClear? = true; // Show/hide clear button. - @Input() disabled? = false; // Disables the input text. + @Input() lengthCheck = 3; // Check value length before submit. If 0, any string will be submitted. + @Input() showClear = true; // Show/hide clear button. + @Input() disabled = false; // Disables the input text. @Output() onSubmit: EventEmitter; // Send data when submitting the search form. @Output() onClear?: EventEmitter; // Send event when clearing the search form. diff --git a/src/components/tabs/tab.ts b/src/components/tabs/tab.ts index 95102e758..fe5ef6fc3 100644 --- a/src/components/tabs/tab.ts +++ b/src/components/tabs/tab.ts @@ -46,8 +46,8 @@ export class CoreTabComponent implements OnInit, OnDestroy { @Input() icon?: string; // The tab icon. @Input() badge?: string; // A badge to add in the tab. @Input() badgeStyle?: string; // The badge color. - @Input() enabled? = true; // Whether the tab is enabled. - @Input() show? = true; // Whether the tab should be shown. + @Input() enabled = true; // Whether the tab is enabled. + @Input() show = true; // Whether the tab should be shown. @Input() id?: string; // An ID to identify the tab. @Output() ionSelect: EventEmitter = new EventEmitter(); diff --git a/src/components/tabs/tabs.ts b/src/components/tabs/tabs.ts index 9c9cee453..0734f63eb 100644 --- a/src/components/tabs/tabs.ts +++ b/src/components/tabs/tabs.ts @@ -242,15 +242,11 @@ export class CoreTabsComponent implements OnInit, AfterViewInit, OnChanges { protected sortTabs(): void { if (this.originalTabsContainer) { const newTabs = []; - let newSelected; this.tabs.forEach((tab, index) => { const originalIndex = Array.prototype.indexOf.call(this.originalTabsContainer.children, tab.element); if (originalIndex != -1) { newTabs[originalIndex] = tab; - if (this.selected == index) { - newSelected = originalIndex; - } } }); diff --git a/src/core/emulator/providers/file-transfer.ts b/src/core/emulator/providers/file-transfer.ts index 7adff60e3..f6a5db400 100644 --- a/src/core/emulator/providers/file-transfer.ts +++ b/src/core/emulator/providers/file-transfer.ts @@ -238,7 +238,6 @@ export class FileTransferObjectMock extends FileTransferObject { const basicAuthHeader = this.getBasicAuthHeader(url); let fileKey = null, fileName = null, - mimeType = null, params = null, headers = null, httpMethod = null; @@ -254,7 +253,6 @@ export class FileTransferObjectMock extends FileTransferObject { if (options) { fileKey = options.fileKey; fileName = options.fileName; - mimeType = options.mimeType; headers = options.headers; httpMethod = options.httpMethod || 'POST'; diff --git a/src/core/mainmenu/pages/menu/menu.ts b/src/core/mainmenu/pages/menu/menu.ts index 19476a899..dd5872b6c 100644 --- a/src/core/mainmenu/pages/menu/menu.ts +++ b/src/core/mainmenu/pages/menu/menu.ts @@ -14,7 +14,6 @@ import { Component, OnDestroy, ViewChild } from '@angular/core'; import { IonicPage, NavController, NavParams, Tabs } from 'ionic-angular'; -import { CoreEventsProvider } from '@providers/events'; import { CoreSitesProvider } from '@providers/sites'; import { CoreMainMenuProvider } from '../../providers/mainmenu'; import { CoreMainMenuDelegate, CoreMainMenuHandlerData } from '../../providers/delegate'; @@ -66,7 +65,7 @@ export class CoreMainMenuPage implements OnDestroy { protected redirectPageLoaded = false; constructor(private menuDelegate: CoreMainMenuDelegate, private sitesProvider: CoreSitesProvider, navParams: NavParams, - private navCtrl: NavController, private eventsProvider: CoreEventsProvider) { + private navCtrl: NavController) { this.redirectPage = navParams.get('redirectPage'); this.redirectParams = navParams.get('redirectParams'); } diff --git a/src/core/mainmenu/pages/more/more.ts b/src/core/mainmenu/pages/more/more.ts index 8f36a3101..ce0e1ccfe 100644 --- a/src/core/mainmenu/pages/more/more.ts +++ b/src/core/mainmenu/pages/more/more.ts @@ -43,7 +43,7 @@ export class CoreMainMenuMorePage implements OnDestroy { constructor(private menuDelegate: CoreMainMenuDelegate, private sitesProvider: CoreSitesProvider, private navCtrl: NavController, private mainMenuProvider: CoreMainMenuProvider, - private eventsProvider: CoreEventsProvider) { + eventsProvider: CoreEventsProvider) { this.langObserver = eventsProvider.on(CoreEventsProvider.LANGUAGE_CHANGED, this.loadSiteInfo.bind(this)); this.updateSiteObserver = eventsProvider.on(CoreEventsProvider.SITE_UPDATED, this.loadSiteInfo.bind(this), diff --git a/src/directives/link.ts b/src/directives/link.ts index 75c50b186..7165f82f7 100644 --- a/src/directives/link.ts +++ b/src/directives/link.ts @@ -30,7 +30,7 @@ import { CoreConfigConstants } from '../configconstants'; export class CoreLinkDirective implements OnInit { @Input() capture?: boolean | string; // If the link needs to be captured by the app. @Input() inApp?: boolean | string; // True to open in embedded browser, false to open in system browser. - @Input() autoLogin?= 'check'; // If the link should be open with auto-login. Accepts the following values: + @Input() autoLogin = 'check'; // If the link should be open with auto-login. Accepts the following values: // "yes" -> Always auto-login. // "no" -> Never auto-login. // "check" -> Auto-login only if it points to the current site. Default value. diff --git a/src/providers/sites.ts b/src/providers/sites.ts index 4b34327a9..53154c12a 100644 --- a/src/providers/sites.ts +++ b/src/providers/sites.ts @@ -21,7 +21,6 @@ import { CoreLoggerProvider } from './logger'; import { CoreSitesFactoryProvider } from './sites-factory'; import { CoreTextUtilsProvider } from './utils/text'; import { CoreUrlUtilsProvider } from './utils/url'; -import { CoreUtilsProvider } from './utils/utils'; import { CoreConstants } from '@core/constants'; import { CoreConfigConstants } from '../configconstants'; import { CoreSite } from '@classes/site'; @@ -211,9 +210,8 @@ export class CoreSitesProvider { protected siteTablesSchemas = []; // Schemas for site tables. Other providers can add schemas in here. constructor(logger: CoreLoggerProvider, private http: HttpClient, private sitesFactory: CoreSitesFactoryProvider, - private appProvider: CoreAppProvider, private utils: CoreUtilsProvider, private translate: TranslateService, - private eventsProvider: CoreEventsProvider, private urlUtils: CoreUrlUtilsProvider, - private textUtils: CoreTextUtilsProvider) { + private appProvider: CoreAppProvider, private translate: TranslateService, private urlUtils: CoreUrlUtilsProvider, + private eventsProvider: CoreEventsProvider, private textUtils: CoreTextUtilsProvider) { this.logger = logger.getInstance('CoreSitesProvider'); this.appDB = appProvider.getDB(); diff --git a/src/providers/utils/utils.ts b/src/providers/utils/utils.ts index 40044549d..2c485ed85 100644 --- a/src/providers/utils/utils.ts +++ b/src/providers/utils/utils.ts @@ -14,7 +14,6 @@ import { Injectable } from '@angular/core'; import { Platform } from 'ionic-angular'; -import { Observable } from 'rxjs'; import { InAppBrowser, InAppBrowserObject } from '@ionic-native/in-app-browser'; import { Clipboard } from '@ionic-native/clipboard'; import { CoreAppProvider } from '../app'; @@ -699,15 +698,6 @@ export class CoreUtilsProvider { options.location = 'no'; } - // Convert the options to a string. - const optionsArray = []; - let optionsString; - - for (const name in options) { - optionsArray.push(`${name}=${options[name]}`); - } - optionsString = optionsArray.join(','); - this.iabInstance = this.iab.create(url, '_blank', options); if (this.appProvider.isDesktop() || this.appProvider.isMobile()) { diff --git a/tslint.json b/tslint.json index 54d006b00..e553d9a05 100644 --- a/tslint.json +++ b/tslint.json @@ -58,7 +58,6 @@ "no-unused-variable": true, "no-var-keyword": true, "switch-default": true, - "typeof-compare": true, "use-isnan": true, "eofline": true, "indent": [true, "spaces", 4],