MOBILE-2340 core: Fix linter errors

main
Pau Ferrer Ocaña 2018-03-15 15:24:22 +01:00
parent 6cdb32d30d
commit 66ee81609c
19 changed files with 26 additions and 50 deletions

View File

@ -14,7 +14,7 @@
import { Injectable } from '@angular/core'; import { Injectable } from '@angular/core';
import { AddonMessagesProvider } from './messages'; 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 { CoreCronHandler } from '@providers/cron';
import { CoreSitesProvider } from '@providers/sites'; import { CoreSitesProvider } from '@providers/sites';
import { CoreEventsProvider } from '@providers/events'; import { CoreEventsProvider } from '@providers/events';

View File

@ -17,15 +17,12 @@ import { CoreDomUtilsProvider } from '@providers/utils/dom';
import { CoreCourseProvider } from '@core/course/providers/course'; import { CoreCourseProvider } from '@core/course/providers/course';
import { CoreCourseHelperProvider } from '@core/course/providers/helper'; import { CoreCourseHelperProvider } from '@core/course/providers/helper';
import { AddonModResourceProvider } from './resource'; import { AddonModResourceProvider } from './resource';
import { TranslateService } from '@ngx-translate/core';
import { CoreSitesProvider } from '@providers/sites'; import { CoreSitesProvider } from '@providers/sites';
import { CoreUtilsProvider } from '@providers/utils/utils';
import { CoreFilepoolProvider } from '@providers/filepool'; import { CoreFilepoolProvider } from '@providers/filepool';
import { CoreFileProvider } from '@providers/file'; import { CoreFileProvider } from '@providers/file';
import { CoreAppProvider } from '@providers/app'; import { CoreAppProvider } from '@providers/app';
import { CoreMimetypeUtilsProvider } from '@providers/utils/mimetype'; import { CoreMimetypeUtilsProvider } from '@providers/utils/mimetype';
import { CoreTextUtilsProvider } from '@providers/utils/text'; import { CoreTextUtilsProvider } from '@providers/utils/text';
import { CoreConstants } from '@core/constants';
/** /**
* Service that provides helper functions for resources. * Service that provides helper functions for resources.
@ -43,8 +40,7 @@ export class AddonModResourceHelperProvider {
private resourceProvider: AddonModResourceProvider, private courseHelper: CoreCourseHelperProvider, private resourceProvider: AddonModResourceProvider, private courseHelper: CoreCourseHelperProvider,
private textUtils: CoreTextUtilsProvider, private mimetypeUtils: CoreMimetypeUtilsProvider, private textUtils: CoreTextUtilsProvider, private mimetypeUtils: CoreMimetypeUtilsProvider,
private fileProvider: CoreFileProvider, private appProvider: CoreAppProvider, private fileProvider: CoreFileProvider, private appProvider: CoreAppProvider,
private filepoolProvider: CoreFilepoolProvider, private utils: CoreUtilsProvider, private filepoolProvider: CoreFilepoolProvider, private sitesProvider: CoreSitesProvider) {
private sitesProvider: CoreSitesProvider, private translate: TranslateService) {
} }
/** /**

View File

@ -25,9 +25,9 @@ import { CoreUtilsProvider } from '@providers/utils/utils';
}) })
export class AddonUserProfileFieldCheckboxComponent implements OnInit { export class AddonUserProfileFieldCheckboxComponent implements OnInit {
@Input() field: any; // The profile field to be rendered. @Input() field: any; // The profile field to be rendered.
@Input() edit?: false; // True if editing the field. Defaults to false. @Input() edit = false; // True if editing the field. Defaults to false.
@Input() disabled?: false; // True if disabled. Defaults to false. @Input() disabled = false; // True if disabled. Defaults to false.
@Input() form?: FormGroup; // Form where to add the form control. @Input() form: FormGroup; // Form where to add the form control.
constructor(private fb: FormBuilder, protected utils: CoreUtilsProvider) { } constructor(private fb: FormBuilder, protected utils: CoreUtilsProvider) { }

View File

@ -26,8 +26,8 @@ import { CoreUtilsProvider } from '@providers/utils/utils';
}) })
export class AddonUserProfileFieldDatetimeComponent implements OnInit { export class AddonUserProfileFieldDatetimeComponent implements OnInit {
@Input() field: any; // The profile field to be rendered. @Input() field: any; // The profile field to be rendered.
@Input() edit? = false; // True if editing the field. Defaults to false. @Input() edit = false; // True if editing the field. Defaults to false.
@Input() disabled? = false; // True if disabled. Defaults to false. @Input() disabled = false; // True if disabled. Defaults to false.
@Input() form?: FormGroup; // Form where to add the form control. @Input() form?: FormGroup; // Form where to add the form control.
constructor(private fb: FormBuilder, private timeUtils: CoreTimeUtilsProvider, protected utils: CoreUtilsProvider) { } constructor(private fb: FormBuilder, private timeUtils: CoreTimeUtilsProvider, protected utils: CoreUtilsProvider) { }

View File

@ -24,8 +24,8 @@ import { FormGroup, FormBuilder, Validators } from '@angular/forms';
}) })
export class AddonUserProfileFieldMenuComponent implements OnInit { export class AddonUserProfileFieldMenuComponent implements OnInit {
@Input() field: any; // The profile field to be rendered. @Input() field: any; // The profile field to be rendered.
@Input() edit? = false; // True if editing the field. Defaults to false. @Input() edit = false; // True if editing the field. Defaults to false.
@Input() disabled? = false; // True if disabled. Defaults to false. @Input() disabled = false; // True if disabled. Defaults to false.
@Input() form?: FormGroup; // Form where to add the form control. @Input() form?: FormGroup; // Form where to add the form control.
constructor(private fb: FormBuilder) { } constructor(private fb: FormBuilder) { }

View File

@ -25,8 +25,8 @@ import { CoreUtilsProvider } from '@providers/utils/utils';
}) })
export class AddonUserProfileFieldTextComponent implements OnInit { export class AddonUserProfileFieldTextComponent implements OnInit {
@Input() field: any; // The profile field to be rendered. @Input() field: any; // The profile field to be rendered.
@Input() edit? = false; // True if editing the field. Defaults to false. @Input() edit = false; // True if editing the field. Defaults to false.
@Input() disabled? = false; // True if disabled. Defaults to false. @Input() disabled = false; // True if disabled. Defaults to false.
@Input() form?: FormGroup; // Form where to add the form control. @Input() form?: FormGroup; // Form where to add the form control.
constructor(private fb: FormBuilder, protected utils: CoreUtilsProvider) { } constructor(private fb: FormBuilder, protected utils: CoreUtilsProvider) { }

View File

@ -24,8 +24,8 @@ import { FormGroup, Validators, FormControl } from '@angular/forms';
}) })
export class AddonUserProfileFieldTextareaComponent implements OnInit { export class AddonUserProfileFieldTextareaComponent implements OnInit {
@Input() field: any; // The profile field to be rendered. @Input() field: any; // The profile field to be rendered.
@Input() edit? = false; // True if editing the field. Defaults to false. @Input() edit = false; // True if editing the field. Defaults to false.
@Input() disabled? = false; // True if disabled. Defaults to false. @Input() disabled = false; // True if disabled. Defaults to false.
@Input() form?: FormGroup; // Form where to add the form control. @Input() form?: FormGroup; // Form where to add the form control.
control: FormControl; control: FormControl;

View File

@ -32,7 +32,7 @@ import { Component, Input, OnChanges, OnDestroy, Output, EventEmitter, SimpleCha
}) })
export class CoreChronoComponent implements OnChanges, OnDestroy { 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() 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() endTime?: number; // Number of milliseconds to stop the chrono.
@Input() reset?: boolean; // Set it to true to reset the chrono. @Input() reset?: boolean; // Set it to true to reset the chrono.
@Output() onEnd?: EventEmitter<void>; // Will emit an event when the endTime is reached. @Output() onEnd?: EventEmitter<void>; // Will emit an event when the endTime is reached.

View File

@ -40,7 +40,7 @@ export class CoreRichTextEditorComponent {
// Based on: https://github.com/judgewest2000/Ionic3RichText/ // Based on: https://github.com/judgewest2000/Ionic3RichText/
// @todo: Resize, images, anchor button, fullscreen... // @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. @Input() control: FormControl; // Form control.
@Output() contentChanged: EventEmitter<string>; @Output() contentChanged: EventEmitter<string>;

View File

@ -33,12 +33,12 @@ import { CoreUtilsProvider } from '@providers/utils/utils';
export class CoreSearchBoxComponent implements OnInit { export class CoreSearchBoxComponent implements OnInit {
@Input() searchLabel?: string; // Label to be used on action button. @Input() searchLabel?: string; // Label to be used on action button.
@Input() placeholder?: string; // Placeholder text for search text input. @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() spellcheck?: string | boolean = true; // Enables/disable Spellchecker on search text input.
@Input() autoFocus?: string | boolean; // Enables/disable Autofocus when entering view. @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() lengthCheck = 3; // Check value length before submit. If 0, any string will be submitted.
@Input() showClear? = true; // Show/hide clear button. @Input() showClear = true; // Show/hide clear button.
@Input() disabled? = false; // Disables the input text. @Input() disabled = false; // Disables the input text.
@Output() onSubmit: EventEmitter<string>; // Send data when submitting the search form. @Output() onSubmit: EventEmitter<string>; // Send data when submitting the search form.
@Output() onClear?: EventEmitter<void>; // Send event when clearing the search form. @Output() onClear?: EventEmitter<void>; // Send event when clearing the search form.

View File

@ -46,8 +46,8 @@ export class CoreTabComponent implements OnInit, OnDestroy {
@Input() icon?: string; // The tab icon. @Input() icon?: string; // The tab icon.
@Input() badge?: string; // A badge to add in the tab. @Input() badge?: string; // A badge to add in the tab.
@Input() badgeStyle?: string; // The badge color. @Input() badgeStyle?: string; // The badge color.
@Input() enabled? = true; // Whether the tab is enabled. @Input() enabled = true; // Whether the tab is enabled.
@Input() show? = true; // Whether the tab should be shown. @Input() show = true; // Whether the tab should be shown.
@Input() id?: string; // An ID to identify the tab. @Input() id?: string; // An ID to identify the tab.
@Output() ionSelect: EventEmitter<CoreTabComponent> = new EventEmitter<CoreTabComponent>(); @Output() ionSelect: EventEmitter<CoreTabComponent> = new EventEmitter<CoreTabComponent>();

View File

@ -242,15 +242,11 @@ export class CoreTabsComponent implements OnInit, AfterViewInit, OnChanges {
protected sortTabs(): void { protected sortTabs(): void {
if (this.originalTabsContainer) { if (this.originalTabsContainer) {
const newTabs = []; const newTabs = [];
let newSelected;
this.tabs.forEach((tab, index) => { this.tabs.forEach((tab, index) => {
const originalIndex = Array.prototype.indexOf.call(this.originalTabsContainer.children, tab.element); const originalIndex = Array.prototype.indexOf.call(this.originalTabsContainer.children, tab.element);
if (originalIndex != -1) { if (originalIndex != -1) {
newTabs[originalIndex] = tab; newTabs[originalIndex] = tab;
if (this.selected == index) {
newSelected = originalIndex;
}
} }
}); });

View File

@ -238,7 +238,6 @@ export class FileTransferObjectMock extends FileTransferObject {
const basicAuthHeader = this.getBasicAuthHeader(url); const basicAuthHeader = this.getBasicAuthHeader(url);
let fileKey = null, let fileKey = null,
fileName = null, fileName = null,
mimeType = null,
params = null, params = null,
headers = null, headers = null,
httpMethod = null; httpMethod = null;
@ -254,7 +253,6 @@ export class FileTransferObjectMock extends FileTransferObject {
if (options) { if (options) {
fileKey = options.fileKey; fileKey = options.fileKey;
fileName = options.fileName; fileName = options.fileName;
mimeType = options.mimeType;
headers = options.headers; headers = options.headers;
httpMethod = options.httpMethod || 'POST'; httpMethod = options.httpMethod || 'POST';

View File

@ -14,7 +14,6 @@
import { Component, OnDestroy, ViewChild } from '@angular/core'; import { Component, OnDestroy, ViewChild } from '@angular/core';
import { IonicPage, NavController, NavParams, Tabs } from 'ionic-angular'; import { IonicPage, NavController, NavParams, Tabs } from 'ionic-angular';
import { CoreEventsProvider } from '@providers/events';
import { CoreSitesProvider } from '@providers/sites'; import { CoreSitesProvider } from '@providers/sites';
import { CoreMainMenuProvider } from '../../providers/mainmenu'; import { CoreMainMenuProvider } from '../../providers/mainmenu';
import { CoreMainMenuDelegate, CoreMainMenuHandlerData } from '../../providers/delegate'; import { CoreMainMenuDelegate, CoreMainMenuHandlerData } from '../../providers/delegate';
@ -66,7 +65,7 @@ export class CoreMainMenuPage implements OnDestroy {
protected redirectPageLoaded = false; protected redirectPageLoaded = false;
constructor(private menuDelegate: CoreMainMenuDelegate, private sitesProvider: CoreSitesProvider, navParams: NavParams, constructor(private menuDelegate: CoreMainMenuDelegate, private sitesProvider: CoreSitesProvider, navParams: NavParams,
private navCtrl: NavController, private eventsProvider: CoreEventsProvider) { private navCtrl: NavController) {
this.redirectPage = navParams.get('redirectPage'); this.redirectPage = navParams.get('redirectPage');
this.redirectParams = navParams.get('redirectParams'); this.redirectParams = navParams.get('redirectParams');
} }

View File

@ -43,7 +43,7 @@ export class CoreMainMenuMorePage implements OnDestroy {
constructor(private menuDelegate: CoreMainMenuDelegate, private sitesProvider: CoreSitesProvider, constructor(private menuDelegate: CoreMainMenuDelegate, private sitesProvider: CoreSitesProvider,
private navCtrl: NavController, private mainMenuProvider: CoreMainMenuProvider, private navCtrl: NavController, private mainMenuProvider: CoreMainMenuProvider,
private eventsProvider: CoreEventsProvider) { eventsProvider: CoreEventsProvider) {
this.langObserver = eventsProvider.on(CoreEventsProvider.LANGUAGE_CHANGED, this.loadSiteInfo.bind(this)); this.langObserver = eventsProvider.on(CoreEventsProvider.LANGUAGE_CHANGED, this.loadSiteInfo.bind(this));
this.updateSiteObserver = eventsProvider.on(CoreEventsProvider.SITE_UPDATED, this.loadSiteInfo.bind(this), this.updateSiteObserver = eventsProvider.on(CoreEventsProvider.SITE_UPDATED, this.loadSiteInfo.bind(this),

View File

@ -30,7 +30,7 @@ import { CoreConfigConstants } from '../configconstants';
export class CoreLinkDirective implements OnInit { export class CoreLinkDirective implements OnInit {
@Input() capture?: boolean | string; // If the link needs to be captured by the app. @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() 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. // "yes" -> Always auto-login.
// "no" -> Never auto-login. // "no" -> Never auto-login.
// "check" -> Auto-login only if it points to the current site. Default value. // "check" -> Auto-login only if it points to the current site. Default value.

View File

@ -21,7 +21,6 @@ import { CoreLoggerProvider } from './logger';
import { CoreSitesFactoryProvider } from './sites-factory'; import { CoreSitesFactoryProvider } from './sites-factory';
import { CoreTextUtilsProvider } from './utils/text'; import { CoreTextUtilsProvider } from './utils/text';
import { CoreUrlUtilsProvider } from './utils/url'; import { CoreUrlUtilsProvider } from './utils/url';
import { CoreUtilsProvider } from './utils/utils';
import { CoreConstants } from '@core/constants'; import { CoreConstants } from '@core/constants';
import { CoreConfigConstants } from '../configconstants'; import { CoreConfigConstants } from '../configconstants';
import { CoreSite } from '@classes/site'; 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. protected siteTablesSchemas = []; // Schemas for site tables. Other providers can add schemas in here.
constructor(logger: CoreLoggerProvider, private http: HttpClient, private sitesFactory: CoreSitesFactoryProvider, constructor(logger: CoreLoggerProvider, private http: HttpClient, private sitesFactory: CoreSitesFactoryProvider,
private appProvider: CoreAppProvider, private utils: CoreUtilsProvider, private translate: TranslateService, private appProvider: CoreAppProvider, private translate: TranslateService, private urlUtils: CoreUrlUtilsProvider,
private eventsProvider: CoreEventsProvider, private urlUtils: CoreUrlUtilsProvider, private eventsProvider: CoreEventsProvider, private textUtils: CoreTextUtilsProvider) {
private textUtils: CoreTextUtilsProvider) {
this.logger = logger.getInstance('CoreSitesProvider'); this.logger = logger.getInstance('CoreSitesProvider');
this.appDB = appProvider.getDB(); this.appDB = appProvider.getDB();

View File

@ -14,7 +14,6 @@
import { Injectable } from '@angular/core'; import { Injectable } from '@angular/core';
import { Platform } from 'ionic-angular'; import { Platform } from 'ionic-angular';
import { Observable } from 'rxjs';
import { InAppBrowser, InAppBrowserObject } from '@ionic-native/in-app-browser'; import { InAppBrowser, InAppBrowserObject } from '@ionic-native/in-app-browser';
import { Clipboard } from '@ionic-native/clipboard'; import { Clipboard } from '@ionic-native/clipboard';
import { CoreAppProvider } from '../app'; import { CoreAppProvider } from '../app';
@ -699,15 +698,6 @@ export class CoreUtilsProvider {
options.location = 'no'; 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); this.iabInstance = this.iab.create(url, '_blank', options);
if (this.appProvider.isDesktop() || this.appProvider.isMobile()) { if (this.appProvider.isDesktop() || this.appProvider.isMobile()) {

View File

@ -58,7 +58,6 @@
"no-unused-variable": true, "no-unused-variable": true,
"no-var-keyword": true, "no-var-keyword": true,
"switch-default": true, "switch-default": true,
"typeof-compare": true,
"use-isnan": true, "use-isnan": true,
"eofline": true, "eofline": true,
"indent": [true, "spaces", 4], "indent": [true, "spaces", 4],