Skip to content

Commit

Permalink
chore(project): Linting
Browse files Browse the repository at this point in the history
Add tslint-ionic-rules and lint project according to ionic's standard
  • Loading branch information
stonelasley committed Aug 2, 2017
1 parent 6c435c6 commit b638634
Show file tree
Hide file tree
Showing 39 changed files with 569 additions and 564 deletions.
3 changes: 3 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
"license": "MIT",
"scripts": {
"test": "karma start",
"lint": "tslint ./src/**/*.ts",
"build": "tsc -d",
"version": "git add .",
"postversion": "git push && git push --tags && npm publish",
Expand All @@ -26,6 +27,8 @@
"rimraf": "^2.6.1",
"rxjs": "5.1.1",
"semantic-release": "^6.3.6",
"tslint": "^5.5.0",
"tslint-ionic-rules": "0.0.11",
"typescript": "^2.0.9"
}
}
12 changes: 6 additions & 6 deletions src/angular/action-sheet-controller.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import { ActionSheetMock } from './action-sheet';
import {ActionSheetMock} from './action-sheet';

export class ActionSheetControllerMock {
public static instance(actionSheet?: ActionSheetMock): any {
public static instance(actionSheet?: ActionSheetMock): any {

let instance = jasmine.createSpyObj('ActionSheetController', ['create']);
instance.create.and.returnValue(actionSheet || ActionSheetMock.instance());
let instance = jasmine.createSpyObj('ActionSheetController', ['create']);
instance.create.and.returnValue(actionSheet || ActionSheetMock.instance());

return instance;
}
return instance;
}
}
10 changes: 5 additions & 5 deletions src/angular/action-sheet.spec.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { ActionSheetMock } from './action-sheet';
import {ActionSheetMock} from './action-sheet';
describe('ActionSheetMock', () => {
it('should initialize', () => {
expect(ActionSheetMock.instance).toBeDefined()
});
});
it('should initialize', () => {
expect(ActionSheetMock.instance).toBeDefined();
});
});
12 changes: 6 additions & 6 deletions src/angular/action-sheet.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
export class ActionSheetMock {
public static instance(): any {
let instance = jasmine.createSpyObj('ActionSheet', ['present', 'dismiss']);
instance.present.and.returnValue(Promise.resolve());
instance.dismiss.and.returnValue(Promise.resolve());
public static instance(): any {
let instance = jasmine.createSpyObj('ActionSheet', ['present', 'dismiss']);
instance.present.and.returnValue(Promise.resolve());
instance.dismiss.and.returnValue(Promise.resolve());

return instance;
}
return instance;
}
}
12 changes: 6 additions & 6 deletions src/angular/alert-controller.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import { AlertMock } from './alert';
import {AlertMock} from './alert';

export class AlertControllerMock {
public static instance(alertMock?: AlertMock): any {
public static instance(alertMock?: AlertMock): any {

let instance = jasmine.createSpyObj('AlertController', ['create']);
instance.create.and.returnValue(alertMock || AlertMock.instance());
let instance = jasmine.createSpyObj('AlertController', ['create']);
instance.create.and.returnValue(alertMock || AlertMock.instance());

return instance;
}
return instance;
}
}
12 changes: 6 additions & 6 deletions src/angular/alert.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
export class AlertMock {
public static instance(): any {
let instance = jasmine.createSpyObj('Alert', ['present', 'dismiss']);
instance.present.and.returnValue(Promise.resolve());
instance.dismiss.and.returnValue(Promise.resolve());
public static instance(): any {
let instance = jasmine.createSpyObj('Alert', ['present', 'dismiss']);
instance.present.and.returnValue(Promise.resolve());
instance.dismiss.and.returnValue(Promise.resolve());

return instance;
}
return instance;
}
}
52 changes: 26 additions & 26 deletions src/angular/app.ts
Original file line number Diff line number Diff line change
@@ -1,31 +1,31 @@
import { Observable } from 'rxjs';
import { NavControllerMock } from "./nav-controller";
import {Observable} from 'rxjs';
import {NavControllerMock} from './nav-controller';

export class AppMock {
public static instance(navCtrl?: NavControllerMock, viewObservable?: Observable<any>): any {
public static instance(navCtrl?: NavControllerMock, viewObservable?: Observable<any>): any {

let instance = jasmine.createSpyObj('App', [
'getActiveNav',
'getRootNav',
'isScrolling',
'setTitle',
'viewDidEnter',
'viewDidLeave',
'viewDidLoad',
'viewWillEnter',
'viewWillLeave',
'viewWillUnload'
]);
let instance = jasmine.createSpyObj('App', [
'getActiveNav',
'getRootNav',
'isScrolling',
'setTitle',
'viewDidEnter',
'viewDidLeave',
'viewDidLoad',
'viewWillEnter',
'viewWillLeave',
'viewWillUnload'
]);

instance.getRootNav.and.returnValue(navCtrl || NavControllerMock.instance());
instance.isScrolling.and.returnValue(false);
instance.viewDidEnter.and.returnValue(viewObservable || Observable.of(undefined));
instance.viewDidLoad.and.returnValue(viewObservable || Observable.of(undefined));
instance.viewDidLeave.and.returnValue(viewObservable || Observable.of(undefined));
instance.viewWillEnter.and.returnValue(viewObservable || Observable.of(undefined));
instance.viewWillUnload.and.returnValue(viewObservable || Observable.of(undefined));
instance.viewWillLeave.and.returnValue(viewObservable || Observable.of(undefined));
instance.getRootNav.and.returnValue(navCtrl || NavControllerMock.instance());
instance.isScrolling.and.returnValue(false);
instance.viewDidEnter.and.returnValue(viewObservable || Observable.of(undefined));
instance.viewDidLoad.and.returnValue(viewObservable || Observable.of(undefined));
instance.viewDidLeave.and.returnValue(viewObservable || Observable.of(undefined));
instance.viewWillEnter.and.returnValue(viewObservable || Observable.of(undefined));
instance.viewWillUnload.and.returnValue(viewObservable || Observable.of(undefined));
instance.viewWillLeave.and.returnValue(viewObservable || Observable.of(undefined));

return instance;
}
}
return instance;
}
}
36 changes: 18 additions & 18 deletions src/angular/config.ts
Original file line number Diff line number Diff line change
@@ -1,21 +1,21 @@
export class ConfigMock {
public static instance(): any {
let instance = jasmine.createSpyObj('Config', [
'get',
'getBoolean',
'getNumber',
'set',
'settings',
'setModeConfig',
'getModeConfig',
'setTransition',
'getTransition'
]);
public static instance(): any {
let instance = jasmine.createSpyObj('Config', [
'get',
'getBoolean',
'getNumber',
'set',
'settings',
'setModeConfig',
'getModeConfig',
'setTransition',
'getTransition'
]);

instance.get.and.returnValue('');
instance.getBoolean.and.returnValue(true);
instance.getNumber.and.returnValue(0);
instance.get.and.returnValue('');
instance.getBoolean.and.returnValue(true);
instance.getNumber.and.returnValue(0);

return instance;
}
}
return instance;
}
}
38 changes: 19 additions & 19 deletions src/angular/content.ts
Original file line number Diff line number Diff line change
@@ -1,24 +1,24 @@
export class ContentMock {
public static instance(): any {
let instance = jasmine.createSpyObj('Content', ['addImg', 'getContentDimensions', 'getFixedElement', 'resize', 'scrollTo', 'scrollToBottom', 'scrollToTop']);
instance['contentBottom'] = 10;
instance['contentHeight'] = 10;
instance['contentTop'] = 10;
instance['directionX'] = 'left';
instance['directionY'] = 'up';
instance['isScrolling'] = false;
instance['scrollHeight'] = 10;
instance['scrollLeft'] = 10;
instance['scrollTop'] = 10;
instance['scrollWidth'] = 10;
public static instance(): any {
let instance = jasmine.createSpyObj('Content', ['addImg', 'getContentDimensions', 'getFixedElement', 'resize', 'scrollTo', 'scrollToBottom', 'scrollToTop']);
instance['contentBottom'] = 10;
instance['contentHeight'] = 10;
instance['contentTop'] = 10;
instance['directionX'] = 'left';
instance['directionY'] = 'up';
instance['isScrolling'] = false;
instance['scrollHeight'] = 10;
instance['scrollLeft'] = 10;
instance['scrollTop'] = 10;
instance['scrollWidth'] = 10;

let dimensions = {};
instance.getContentDimensions.and.returnValue(dimensions);
instance.scrollTo.and.returnValue(Promise.resolve());
instance.scrollToBottom.and.returnValue(Promise.resolve());
instance.scrollToTop.and.returnValue(Promise.resolve());
let dimensions = {};
instance.getContentDimensions.and.returnValue(dimensions);
instance.scrollTo.and.returnValue(Promise.resolve());
instance.scrollToBottom.and.returnValue(Promise.resolve());
instance.scrollToTop.and.returnValue(Promise.resolve());


return instance;
}
return instance;
}
}
8 changes: 4 additions & 4 deletions src/angular/events.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
export class EventsMock {
public static instance(): any {
return jasmine.createSpyObj('events', ['subscribe', 'publish', 'unsubscribe']);
}
}
public static instance(): any {
return jasmine.createSpyObj('events', ['subscribe', 'publish', 'unsubscribe']);
}
}
26 changes: 13 additions & 13 deletions src/angular/form.ts
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
export class FormMock {
public static instance(): any {
let instance = jasmine.createSpyObj('Form', [
'register',
'nextId',
'deregister',
'setAsFocused',
'unsetAsFocused',
'tabFocus'
]);
public static instance(): any {
let instance = jasmine.createSpyObj('Form', [
'register',
'nextId',
'deregister',
'setAsFocused',
'unsetAsFocused',
'tabFocus'
]);

instance.nextId.and.returnValue(0);
instance.nextId.and.returnValue(0);

return instance;
}
}
return instance;
}
}
24 changes: 12 additions & 12 deletions src/angular/haptic.ts
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
export class HapticMock {
public static instance(): any {
let instance = jasmine.createSpyObj('Haptic', ['available',
'gestureSelectionChanged',
'gestureSelectionEnd',
'gestureSelectionStart',
'impact',
'notification',
'selection'
]);
instance.available.and.returnValue(true);
public static instance(): any {
let instance = jasmine.createSpyObj('Haptic', ['available',
'gestureSelectionChanged',
'gestureSelectionEnd',
'gestureSelectionStart',
'impact',
'notification',
'selection'
]);
instance.available.and.returnValue(true);

return instance;
}
return instance;
}
}
Loading

0 comments on commit b638634

Please sign in to comment.