enable prefer-const rule for tslint, fix issues (#4409)

* enable prefer-const rule for tslint, fix issues

* Update content-node-selector.component.spec.ts

* Update content-node-selector.component.spec.ts

* fix const

* fix lint issues

* update tests

* update tests

* update tests

* fix code

* fix page class
This commit is contained in:
Denys Vuika
2019-03-25 12:19:33 +00:00
committed by Eugenio Romano
parent 26c5982a1a
commit a7a48e8b2b
581 changed files with 5435 additions and 5402 deletions

View File

@@ -24,10 +24,10 @@ export interface FileInfo {
export class FileUtils {
static flatten(folder: any): Promise<FileInfo[]> {
let reader = folder.createReader();
let files: FileInfo[] = [];
const reader = folder.createReader();
const files: FileInfo[] = [];
return new Promise((resolve) => {
let iterations = [];
const iterations = [];
(function traverse() {
reader.readEntries((entries) => {
if (!entries.length) {
@@ -60,7 +60,7 @@ export class FileUtils {
}
static toFileArray(fileList: FileList): File[] {
let result = [];
const result = [];
if (fileList && fileList.length > 0) {
for (let i = 0; i < fileList.length; i++) {

View File

@@ -89,7 +89,7 @@ export class MomentDateAdapter extends DateAdapter<Moment> {
}
clone(date: Moment): Moment {
let locale = this.locale || 'en';
const locale = this.locale || 'en';
return date.clone().locale(locale);
}
@@ -98,12 +98,12 @@ export class MomentDateAdapter extends DateAdapter<Moment> {
}
today(): Moment {
let locale = this.locale || 'en';
const locale = this.locale || 'en';
return moment().locale(locale);
}
parse(value: any, parseFormat: any): Moment {
let locale = this.locale || 'en';
const locale = this.locale || 'en';
if (value && typeof value === 'string') {
let m = moment(value, parseFormat, locale, true);
@@ -207,8 +207,8 @@ export class MomentDateAdapter extends DateAdapter<Moment> {
}
fromIso8601(iso8601String: string): Moment | null {
let locale = this.locale || 'en';
let d = moment(iso8601String, moment.ISO_8601).locale(locale);
const locale = this.locale || 'en';
const d = moment(iso8601String, moment.ISO_8601).locale(locale);
return this.isValid(d) ? d : null;
}

View File

@@ -20,19 +20,19 @@ import { ObjectUtils } from './object-utils';
describe('ObjectUtils', () => {
it('should get top level property value', () => {
let obj = {
const obj = {
id: 1
};
expect(ObjectUtils.getValue(obj, 'id')).toBe(1);
});
it('should not get top level property value', () => {
let obj = {};
const obj = {};
expect(ObjectUtils.getValue(obj, 'missing')).toBeUndefined();
});
it('should get nested property value', () => {
let obj = {
const obj = {
name: {
firstName: 'John',
lastName: 'Doe'
@@ -43,7 +43,7 @@ describe('ObjectUtils', () => {
});
it('should not get nested property value', () => {
let obj = {};
const obj = {};
expect(ObjectUtils.getValue(obj, 'some.missing.property')).toBeUndefined();
});

View File

@@ -28,12 +28,12 @@ export class ObjectUtils {
return undefined;
}
let keys = key.split('.');
const keys = key.split('.');
key = '';
do {
key += keys.shift();
let value = target[key];
const value = target[key];
if (value !== undefined && (typeof value === 'object' || !keys.length)) {
target = value;
key = '';
@@ -48,7 +48,7 @@ export class ObjectUtils {
}
static merge(...objects): any {
let result = {};
const result = {};
objects.forEach((source) => {
Object.keys(source).forEach((prop) => {