Skip to content

Commit 53091cf

Browse files
committed
chore(tslint): Updated linting rules, fixed linting issues
1 parent 85051b9 commit 53091cf

11 files changed

+295
-134
lines changed

src/animation-presets/fade.animation-preset.spec.ts

Lines changed: 32 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import { NotifierConfig } from '../models/notifier-config.model';
12
import { NotifierAnimationPresetKeyframes } from '../models/notifier-animation.model';
23
import { fade } from './../animation-presets/fade.animation-preset';
34

@@ -12,7 +13,7 @@ export function main(): void {
1213

1314
it( 'should return animation keyframes', () => {
1415

15-
const testNotification: any = new MockNotification( {} );
16+
const testNotification: MockNotification = new MockNotification( <NotifierConfig> {} );
1617
const expectedKeyframes: NotifierAnimationPresetKeyframes = {
1718
from: {
1819
opacity: '0'
@@ -21,7 +22,9 @@ export function main(): void {
2122
opacity: '1'
2223
}
2324
};
24-
const keyframes: NotifierAnimationPresetKeyframes = fade.show( testNotification );
25+
// tslint:disable no-any
26+
const keyframes: NotifierAnimationPresetKeyframes = fade.show( <any> testNotification );
27+
// tslint:enable no-any
2528

2629
expect( keyframes ).toEqual( expectedKeyframes );
2730

@@ -33,7 +36,7 @@ export function main(): void {
3336

3437
it( 'should return animation keyframes', () => {
3538

36-
const testNotification: any = new MockNotification( {} );
39+
const testNotification: MockNotification = new MockNotification( <NotifierConfig> {} );
3740
const expectedKeyframes: NotifierAnimationPresetKeyframes = {
3841
from: {
3942
opacity: '1'
@@ -42,7 +45,9 @@ export function main(): void {
4245
opacity: '0'
4346
}
4447
};
45-
const keyframes: NotifierAnimationPresetKeyframes = fade.hide( testNotification );
48+
// tslint:disable no-any
49+
const keyframes: NotifierAnimationPresetKeyframes = fade.hide( <any> testNotification );
50+
// tslint:enable no-any
4651

4752
expect( keyframes ).toEqual( expectedKeyframes );
4853

@@ -54,6 +59,21 @@ export function main(): void {
5459

5560
}
5661

62+
/**
63+
* Mock Notification Height
64+
*/
65+
const mockNotificationHeight: number = 40;
66+
67+
/**
68+
* Mock Notification Shift
69+
*/
70+
const mockNotificationShift: number = 80;
71+
72+
/**
73+
* Mock Notification Width
74+
*/
75+
const mockNotificationWidth: number = 300;
76+
5777
/**
5878
* Mock notification, providing static values except the global configuration
5979
*/
@@ -62,7 +82,7 @@ class MockNotification {
6282
/**
6383
* Configuration
6484
*/
65-
public config: any;
85+
public config: NotifierConfig;
6686

6787
/**
6888
* Notification ID
@@ -79,22 +99,24 @@ class MockNotification {
7999
*/
80100
public message: string = 'Lorem ipsum dolor sit amet.';
81101

102+
// tslint:disable no-any
82103
/**
83104
* Notification component
84105
*/
85106
public component: any = {
86107
getConfig: () => this.config,
87-
getHeight: () => 40,
88-
getShift: () => 80,
89-
getWidth: () => 300
108+
getHeight: () => mockNotificationHeight,
109+
getShift: () => mockNotificationShift,
110+
getWidth: () => mockNotificationWidth
90111
};
112+
// tslint:enable no-any
91113

92114
/**
93115
* Constructor
94116
*
95-
* @param {any} config Configuration
117+
* @param {NotifierConfig} config Configuration
96118
*/
97-
public constructor( config: any ) {
119+
public constructor( config: NotifierConfig ) {
98120
this.config = config;
99121
}
100122

src/animation-presets/slide.animation-preset.spec.ts

Lines changed: 55 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ export function main(): void {
2525
}
2626
}
2727
} );
28-
const testNotification: any = new MockNotification( testConfig );
28+
const testNotification: MockNotification = new MockNotification( testConfig );
2929
const expectedKeyframes: NotifierAnimationPresetKeyframes = {
3030
from: {
3131
transform: `translate3d( calc( -100% - ${ testConfig.position.horizontal.distance }px - 10px ), 0, 0 )`
@@ -34,7 +34,9 @@ export function main(): void {
3434
transform: 'translate3d( 0, 0, 0 )'
3535
}
3636
};
37-
const keyframes: NotifierAnimationPresetKeyframes = slide.show( testNotification );
37+
// tslint:disable no-any
38+
const keyframes: NotifierAnimationPresetKeyframes = slide.show( <any> testNotification );
39+
// tslint:enable no-any
3840

3941
expect( keyframes ).toEqual( expectedKeyframes );
4042

@@ -54,7 +56,7 @@ export function main(): void {
5456
}
5557
}
5658
} );
57-
const testNotification: any = new MockNotification( testConfig );
59+
const testNotification: MockNotification = new MockNotification( testConfig );
5860
const expectedKeyframes: NotifierAnimationPresetKeyframes = {
5961
from: {
6062
transform: `translate3d( calc( 100% + ${ testConfig.position.horizontal.distance }px + 10px ), 0, 0 )`
@@ -63,7 +65,9 @@ export function main(): void {
6365
transform: 'translate3d( 0, 0, 0 )'
6466
}
6567
};
66-
const keyframes: NotifierAnimationPresetKeyframes = slide.show( testNotification );
68+
// tslint:disable no-any
69+
const keyframes: NotifierAnimationPresetKeyframes = slide.show( <any> testNotification );
70+
// tslint:enable no-any
6771

6872
expect( keyframes ).toEqual( expectedKeyframes );
6973

@@ -83,7 +87,7 @@ export function main(): void {
8387
}
8488
}
8589
} );
86-
const testNotification: any = new MockNotification( testConfig );
90+
const testNotification: MockNotification = new MockNotification( testConfig );
8791
const expectedKeyframes: NotifierAnimationPresetKeyframes = {
8892
from: {
8993
transform: `translate3d( -50%, calc( -100% - ${ testConfig.position.horizontal.distance }px - 10px ), 0 )`
@@ -92,7 +96,9 @@ export function main(): void {
9296
transform: 'translate3d( -50%, 0, 0 )'
9397
}
9498
};
95-
const keyframes: NotifierAnimationPresetKeyframes = slide.show( testNotification );
99+
// tslint:disable no-any
100+
const keyframes: NotifierAnimationPresetKeyframes = slide.show( <any> testNotification );
101+
// tslint:enable no-any
96102

97103
expect( keyframes ).toEqual( expectedKeyframes );
98104

@@ -112,7 +118,7 @@ export function main(): void {
112118
}
113119
}
114120
} );
115-
const testNotification: any = new MockNotification( testConfig );
121+
const testNotification: MockNotification = new MockNotification( testConfig );
116122
const expectedKeyframes: NotifierAnimationPresetKeyframes = {
117123
from: {
118124
transform: `translate3d( -50%, calc( 100% + ${ testConfig.position.horizontal.distance }px + 10px ), 0 )`
@@ -121,7 +127,9 @@ export function main(): void {
121127
transform: 'translate3d( -50%, 0, 0 )'
122128
}
123129
};
124-
const keyframes: NotifierAnimationPresetKeyframes = slide.show( testNotification );
130+
// tslint:disable no-any
131+
const keyframes: NotifierAnimationPresetKeyframes = slide.show( <any> testNotification );
132+
// tslint:enable no-any
125133

126134
expect( keyframes ).toEqual( expectedKeyframes );
127135

@@ -144,7 +152,7 @@ export function main(): void {
144152
}
145153
}
146154
} );
147-
const testNotification: any = new MockNotification( testConfig );
155+
const testNotification: MockNotification = new MockNotification( testConfig );
148156
const expectedKeyframes: NotifierAnimationPresetKeyframes = {
149157
from: {
150158
transform: `translate3d( 0, ${ testNotification.component.getShift() }px, 0 )`
@@ -155,7 +163,9 @@ export function main(): void {
155163
/* tslint:enable max-line-length */
156164
}
157165
};
158-
const keyframes: NotifierAnimationPresetKeyframes = slide.hide( testNotification );
166+
// tslint:disable no-any
167+
const keyframes: NotifierAnimationPresetKeyframes = slide.hide( <any> testNotification );
168+
// tslint:enable no-any
159169

160170
expect( keyframes ).toEqual( expectedKeyframes );
161171

@@ -174,7 +184,7 @@ export function main(): void {
174184
}
175185
}
176186
} );
177-
const testNotification: any = new MockNotification( testConfig );
187+
const testNotification: MockNotification = new MockNotification( testConfig );
178188
const expectedKeyframes: NotifierAnimationPresetKeyframes = {
179189
from: {
180190
transform: `translate3d( 0, ${ testNotification.component.getShift() }px, 0 )`
@@ -185,7 +195,9 @@ export function main(): void {
185195
/* tslint:enable max-line-length */
186196
}
187197
};
188-
const keyframes: NotifierAnimationPresetKeyframes = slide.hide( testNotification );
198+
// tslint:disable no-any
199+
const keyframes: NotifierAnimationPresetKeyframes = slide.hide( <any> testNotification );
200+
// tslint:enable no-any
189201

190202
expect( keyframes ).toEqual( expectedKeyframes );
191203

@@ -204,7 +216,7 @@ export function main(): void {
204216
}
205217
}
206218
} );
207-
const testNotification: any = new MockNotification( testConfig );
219+
const testNotification: MockNotification = new MockNotification( testConfig );
208220
const expectedKeyframes: NotifierAnimationPresetKeyframes = {
209221
from: {
210222
transform: `translate3d( -50%, ${ testNotification.component.getShift() }px, 0 )`
@@ -213,7 +225,9 @@ export function main(): void {
213225
transform: `translate3d( -50%, calc( -100% - ${ testConfig.position.horizontal.distance }px - 10px ), 0 )`
214226
}
215227
};
216-
const keyframes: NotifierAnimationPresetKeyframes = slide.hide( testNotification );
228+
// tslint:disable no-any
229+
const keyframes: NotifierAnimationPresetKeyframes = slide.hide( <any> testNotification );
230+
// tslint:enable no-any
217231

218232
expect( keyframes ).toEqual( expectedKeyframes );
219233

@@ -232,7 +246,7 @@ export function main(): void {
232246
}
233247
}
234248
} );
235-
const testNotification: any = new MockNotification( testConfig );
249+
const testNotification: MockNotification = new MockNotification( testConfig );
236250
const expectedKeyframes: NotifierAnimationPresetKeyframes = {
237251
from: {
238252
transform: `translate3d( -50%, ${ testNotification.component.getShift() }px, 0 )`
@@ -241,7 +255,9 @@ export function main(): void {
241255
transform: `translate3d( -50%, calc( 100% + ${ testConfig.position.horizontal.distance }px + 10px ), 0 )`
242256
}
243257
};
244-
const keyframes: NotifierAnimationPresetKeyframes = slide.hide( testNotification );
258+
// tslint:disable no-any
259+
const keyframes: NotifierAnimationPresetKeyframes = slide.hide( <any> testNotification );
260+
// tslint:enable no-any
245261

246262
expect( keyframes ).toEqual( expectedKeyframes );
247263

@@ -253,6 +269,21 @@ export function main(): void {
253269

254270
}
255271

272+
/**
273+
* Mock Notification Height
274+
*/
275+
const mockNotificationHeight: number = 40;
276+
277+
/**
278+
* Mock Notification Shift
279+
*/
280+
const mockNotificationShift: number = 80;
281+
282+
/**
283+
* Mock Notification Width
284+
*/
285+
const mockNotificationWidth: number = 300;
286+
256287
/**
257288
* Mock notification, providing static values except the global configuration
258289
*/
@@ -261,7 +292,7 @@ class MockNotification {
261292
/**
262293
* Configuration
263294
*/
264-
public config: any;
295+
public config: NotifierConfig;
265296

266297
/**
267298
* Notification ID
@@ -278,22 +309,24 @@ class MockNotification {
278309
*/
279310
public message: string = 'Lorem ipsum dolor sit amet.';
280311

312+
// tslint:disable no-any
281313
/**
282314
* Notification component
283315
*/
284316
public component: any = {
285317
getConfig: () => this.config,
286-
getHeight: () => 40,
287-
getShift: () => 80,
288-
getWidth: () => 300
318+
getHeight: () => mockNotificationHeight,
319+
getShift: () => mockNotificationShift,
320+
getWidth: () => mockNotificationWidth
289321
};
322+
// tslint:enable no-any
290323

291324
/**
292325
* Constructor
293326
*
294-
* @param {any} config Configuration
327+
* @param {NotifierConfig} config Configuration
295328
*/
296-
public constructor( config: any ) {
329+
public constructor( config: NotifierConfig ) {
297330
this.config = config;
298331
}
299332

0 commit comments

Comments
 (0)