diff --git a/src/app/components/wait/wait-demo.component.ts b/src/app/components/wait/wait-demo.component.ts index 545099506..c4519ac67 100644 --- a/src/app/components/wait/wait-demo.component.ts +++ b/src/app/components/wait/wait-demo.component.ts @@ -9,9 +9,10 @@ import { templateUrl: './wait-demo.component.html' }) export class SkyWaitDemoComponent { - public isWaiting = false; + constructor(private waitSvc: SkyWaitService) { } + public showPageWait(isBlocking: boolean) { if (isBlocking) { this.waitSvc.beginBlockingPageWait(); @@ -25,6 +26,4 @@ export class SkyWaitDemoComponent { }, 2000); } } - - constructor(private waitSvc: SkyWaitService) { } } diff --git a/src/modules/colorpicker/colorpicker-component.spec.ts b/src/modules/colorpicker/colorpicker-component.spec.ts index 4fabdbcad..0a2db4bea 100644 --- a/src/modules/colorpicker/colorpicker-component.spec.ts +++ b/src/modules/colorpicker/colorpicker-component.spec.ts @@ -117,7 +117,7 @@ describe('Colorpicker Component', () => { fixture.whenStable(); let inputElement: NodeListOf = element.querySelectorAll('.rgba-text > div:last-child > input'); - let input = { + let input: any = { 'hex': inputElement[0], 'red': inputElement[1], 'green': inputElement[2], @@ -125,7 +125,7 @@ describe('Colorpicker Component', () => { 'alpha': inputElement[4] }; input[name].value = value; - let params = { + let params: any = { 'bubbles': false, 'cancelable': false }; diff --git a/src/modules/colorpicker/colorpicker.component.ts b/src/modules/colorpicker/colorpicker.component.ts index 765821128..585320d15 100644 --- a/src/modules/colorpicker/colorpicker.component.ts +++ b/src/modules/colorpicker/colorpicker.component.ts @@ -32,10 +32,10 @@ let componentIdIndex = 0; }) export class SkyColorpickerComponent implements OnInit { - @Output() public selectedColorChanged: EventEmitter = - new EventEmitter(); + new EventEmitter(); + public idIndex: number; public skyColorpickerHexId: string; public skyColorpickerRedId: string; @@ -56,12 +56,26 @@ export class SkyColorpickerComponent implements OnInit { public selectedColor: SkyColorpickerOutput; public slider: SliderPosition; public initialColor: string; + @ViewChild('closeColorPicker') private closeColorPicker: ElementRef; + private outputColor: string; private hsva: SkyColorpickerHsva; private sliderDimMax: SliderDimension; + constructor(private service: SkyColorpickerService) { + componentIdIndex++; + + this.idIndex = componentIdIndex; + this.skyColorpickerRedId = 'sky-colorpicker-red-' + this.idIndex; + this.skyColorpickerHexId = 'sky-colorpicker-hex-' + this.idIndex; + this.skyColorpickerRedId = 'sky-colorpicker-red-' + this.idIndex; + this.skyColorpickerGreenId = 'sky-colorpicker-green-' + this.idIndex; + this.skyColorpickerBlueId = 'sky-colorpicker-blue-' + this.idIndex; + this.skyColorpickerAlphaId = 'sky-colorpicker-alpha-' + this.idIndex; + } + @HostListener('click', ['$event']) public onClick(event: any) { let element: HTMLButtonElement = event.target; @@ -87,19 +101,6 @@ export class SkyColorpickerComponent implements OnInit { } } - constructor( - private service: SkyColorpickerService - ) { - componentIdIndex++; - this.idIndex = componentIdIndex; - this.skyColorpickerRedId = 'sky-colorpicker-red-' + this.idIndex; - this.skyColorpickerHexId = 'sky-colorpicker-hex-' + this.idIndex; - this.skyColorpickerRedId = 'sky-colorpicker-red-' + this.idIndex; - this.skyColorpickerGreenId = 'sky-colorpicker-green-' + this.idIndex; - this.skyColorpickerBlueId = 'sky-colorpicker-blue-' + this.idIndex; - this.skyColorpickerAlphaId = 'sky-colorpicker-alpha-' + this.idIndex; - } - public setDialog( instance: any, elementRef: ElementRef, diff --git a/src/modules/fileattachments/file-item.component.ts b/src/modules/fileattachments/file-item.component.ts index f555bf0b0..9b9c730ea 100644 --- a/src/modules/fileattachments/file-item.component.ts +++ b/src/modules/fileattachments/file-item.component.ts @@ -23,7 +23,6 @@ import { }) export class SkyFileItemComponent implements DoCheck { - @Input() public fileItem: SkyFileItem | SkyFileLink; @@ -31,9 +30,12 @@ export class SkyFileItemComponent implements DoCheck { public deleteFile = new EventEmitter(); private otherCls: string; - private differ: KeyValueDiffer; + public constructor(private differs: KeyValueDiffers) { + this.differ = this.differs.find({}).create(undefined); + } + public ngDoCheck() { let changes = this.differ.diff(this.fileItem); @@ -102,10 +104,6 @@ export class SkyFileItemComponent implements DoCheck { } } - public constructor(private differs: KeyValueDiffers) { - this.differ = this.differs.find({}).create(undefined); - } - public itemDelete() { this.deleteFile.emit(this.fileItem); } diff --git a/src/modules/grid/grid-column.component.ts b/src/modules/grid/grid-column.component.ts index 5e3355ec0..959e6566c 100644 --- a/src/modules/grid/grid-column.component.ts +++ b/src/modules/grid/grid-column.component.ts @@ -32,13 +32,13 @@ export class SkyGridColumnComponent { @Input() public isSortable: boolean = true; - /* tslint:disable */ + /* tslint:disable:no-input-rename */ @Input('search') - private searchFunction: (value: any, searchText: string) => boolean = this.search; + public searchFunction: (value: any, searchText: string) => boolean = this.search; @Input('template') - private templateInput: TemplateRef; - /* tslint:enable */ + public templateInput: TemplateRef; + /* tslint:enable:no-input-rename */ @ContentChildren(TemplateRef) private templates: QueryList>; diff --git a/src/modules/list-filters/list-filter-inline.model.ts b/src/modules/list-filters/list-filter-inline.model.ts index 7d341c293..49dc533a3 100644 --- a/src/modules/list-filters/list-filter-inline.model.ts +++ b/src/modules/list-filters/list-filter-inline.model.ts @@ -9,18 +9,10 @@ export class SkyListFilterInlineModel { public name: string; public value: any; public defaultValue: any; - public filterFunction: (item: ListItemModel, filter: any) => boolean; - public onChange: EventEmitter = new EventEmitter(); - public template: TemplateRef; - public changed(value: any) { - this.value = value; - this.onChange.emit(value); - } - constructor(data?: any) { if (data) { this.name = data.name; @@ -30,4 +22,9 @@ export class SkyListFilterInlineModel { this.defaultValue = data.defaultValue; } } + + public changed(value: any) { + this.value = value; + this.onChange.emit(value); + } } diff --git a/src/modules/list-secondary-actions/list-secondary-actions.spec.ts b/src/modules/list-secondary-actions/list-secondary-actions.spec.ts index 97609a767..77906f89b 100644 --- a/src/modules/list-secondary-actions/list-secondary-actions.spec.ts +++ b/src/modules/list-secondary-actions/list-secondary-actions.spec.ts @@ -61,40 +61,35 @@ describe('List Secondary Actions Component', () => { // run detectChanges once more then begin tests state.skip(1).take(1).subscribe(() => fixture.detectChanges()); } - it('should show secondary actions when specified', async(() => { - initializeToolbar(); - fixture.detectChanges(); - fixture.whenStable().then(() => { - fixture.detectChanges(); - - /* tslint:disable */ - let query = - '.sky-list-toolbar-container .sky-toolbar-item .sky-list-secondary-actions .sky-dropdown .sky-dropdown-menu sky-list-secondary-action'; - /* tslint:enable */ - expect(nativeElement.querySelector(query)).not.toBeNull(); - }); - })); - - it('should hide secondary actions when no child actions available', fakeAsync(() => { - component.showOption = false; - initializeToolbar(); - fixture.detectChanges(); - tick(); + it('should show secondary actions when specified', async(() => { + initializeToolbar(); + fixture.detectChanges(); + fixture.whenStable().then(() => { fixture.detectChanges(); - /* tslint:disable */ + + /* tslint:disable:max-line-length */ let query = - '.sky-list-toolbar-container .sky-toolbar-item .sky-list-secondary-actions'; - /* tslint:enable */ + '.sky-list-toolbar-container .sky-toolbar-item .sky-list-secondary-actions .sky-dropdown .sky-dropdown-menu sky-list-secondary-action'; + /* tslint:enable:max-line-length */ + expect(nativeElement.querySelector(query)).not.toBeNull(); + }); + })); - expect(component.secondaryActions.dropdownHidden.valueOf()).toBe(true); + it('should hide secondary actions when no child actions available', fakeAsync(() => { + component.showOption = false; + initializeToolbar(); + fixture.detectChanges(); + tick(); + fixture.detectChanges(); - component.showOption = true; - fixture.detectChanges(); - tick(); - expect(component.secondaryActions.dropdownHidden.valueOf()).toBe(false); + expect(component.secondaryActions.dropdownHidden.valueOf()).toBe(true); - })); + component.showOption = true; + fixture.detectChanges(); + tick(); - }); + expect(component.secondaryActions.dropdownHidden.valueOf()).toBe(false); + })); + }); }); diff --git a/src/modules/list-view-checklist/list-view-checklist.component.spec.ts b/src/modules/list-view-checklist/list-view-checklist.component.spec.ts index 2a320316a..3f8c6a152 100644 --- a/src/modules/list-view-checklist/list-view-checklist.component.spec.ts +++ b/src/modules/list-view-checklist/list-view-checklist.component.spec.ts @@ -478,7 +478,7 @@ describe('List View Checklist Component', () => { expect(clearAllEl).toBeNull(); let toolbarSectionsEl = nativeElement.querySelectorAll('sky-toolbar-section'); - expect(toolbarSectionsEl.item(1).attributes['hidden']).not.toBeUndefined(); + expect((toolbarSectionsEl.item(1) as any).attributes['hidden']).not.toBeUndefined(); })); diff --git a/src/modules/list/list-view.component.ts b/src/modules/list/list-view.component.ts index 740651bd2..e48c14153 100644 --- a/src/modules/list/list-view.component.ts +++ b/src/modules/list/list-view.component.ts @@ -3,16 +3,13 @@ import { } from '@angular/core'; import { ListState } from './state'; - import { SkyListComponent } from '../list/list.component'; -import { - BehaviorSubject -} from 'rxjs/BehaviorSubject'; + import { Observable } from 'rxjs/Observable'; -let moment = require('moment'); +const moment = require('moment'); export abstract class ListViewComponent implements OnDestroy { public active: Observable; @@ -23,9 +20,6 @@ export abstract class ListViewComponent implements OnDestroy { protected subscriptions: Array = []; protected hasToolbar: Observable; - /* tslint:disable */ - private initialized: BehaviorSubject = new BehaviorSubject(false); - /* tslint:enable */ private viewId: string = moment().toDate().getTime().toString(); constructor(state: ListState, defaultName: string) { diff --git a/src/modules/list/list.component.spec.ts b/src/modules/list/list.component.spec.ts index 77a307333..5610415a6 100644 --- a/src/modules/list/list.component.spec.ts +++ b/src/modules/list/list.component.spec.ts @@ -612,7 +612,7 @@ describe('List Component', () => { describe('models and state', () => { it('should handle no data passed to constructor', () => { - let item = new ListFilterModel(); + new ListFilterModel(); }); }); }); @@ -820,8 +820,7 @@ describe('List Component', () => { fixture: any, dataProvider: SkyListInMemoryDataProvider, nativeElement: HTMLElement, - element: DebugElement, - bs: BehaviorSubject; + element: DebugElement; beforeEach(async(() => { dispatcher = new ListStateDispatcher(); @@ -882,8 +881,7 @@ describe('List Component', () => { component: ListTestComponent, fixture: any, nativeElement: HTMLElement, - element: DebugElement, - bs: BehaviorSubject; + element: DebugElement; beforeEach(async(() => { dispatcher = new ListStateDispatcher(); diff --git a/src/modules/modal/modal-host.service.ts b/src/modules/modal/modal-host.service.ts index fb9788f13..6bac581a5 100644 --- a/src/modules/modal/modal-host.service.ts +++ b/src/modules/modal/modal-host.service.ts @@ -1,9 +1,7 @@ import { - EventEmitter, - Injectable + EventEmitter } from '@angular/core'; -@Injectable() export class SkyModalHostService { public static get openModalCount(): number { return SkyModalHostService.modalHosts.length; @@ -31,7 +29,7 @@ export class SkyModalHostService { public close = new EventEmitter(); public openHelp = new EventEmitter(); - public constructor(private fullPage: boolean) { + constructor(private fullPage: boolean) { SkyModalHostService.modalHosts.push(this); } diff --git a/src/modules/modal/modal.component.ts b/src/modules/modal/modal.component.ts index 482c93cb7..33045e1d0 100644 --- a/src/modules/modal/modal.component.ts +++ b/src/modules/modal/modal.component.ts @@ -42,7 +42,6 @@ let skyModalUniqueIdentifier: number = 0; }) export class SkyModalComponent implements AfterViewInit { public modalState = 'in'; - public modalContentId: string = 'sky-modal-content-id-' + skyModalUniqueIdentifier.toString(); public modalHeaderId: string = 'sky-modal-header-id-' + skyModalUniqueIdentifier.toString(); @@ -87,6 +86,14 @@ export class SkyModalComponent implements AfterViewInit { return this.config.helpKey; } + constructor( + private hostService: SkyModalHostService, + private config: SkyModalConfiguration, + private elRef: ElementRef, + private windowRef: SkyWindowRefService, + private componentAdapter: SkyModalComponentAdapterService + ) { } + @HostListener('document:keydown', ['$event']) public onDocumentKeyDown(event: KeyboardEvent) { /* istanbul ignore else */ @@ -131,13 +138,6 @@ export class SkyModalComponent implements AfterViewInit { } } - constructor( - private hostService: SkyModalHostService, - private config: SkyModalConfiguration, - private elRef: ElementRef, - private windowRef: SkyWindowRefService, - private componentAdapter: SkyModalComponentAdapterService) { } - public ngAfterViewInit() { skyModalUniqueIdentifier++; this.componentAdapter.handleWindowChange(this.elRef); diff --git a/src/modules/tiles/tile-dashboard/tile-dashboard.service.spec.ts b/src/modules/tiles/tile-dashboard/tile-dashboard.service.spec.ts index 119ce42f2..bceb3a985 100644 --- a/src/modules/tiles/tile-dashboard/tile-dashboard.service.spec.ts +++ b/src/modules/tiles/tile-dashboard/tile-dashboard.service.spec.ts @@ -200,11 +200,12 @@ describe('Tile dashboard service', () => { } ); - /* tslint:disable-next-line:no-unused-variable */ - let testDashboardService = new SkyTileDashboardService( - mockDragulaService, - mockMediaQueryService - ); + (function () { + return new SkyTileDashboardService( + mockDragulaService, + mockMediaQueryService + ); + }()); expect(setOptionsSpy).toHaveBeenCalled(); }); diff --git a/src/modules/tiles/tile/tile.component.ts b/src/modules/tiles/tile/tile.component.ts index b3a78f644..38a572a98 100644 --- a/src/modules/tiles/tile/tile.component.ts +++ b/src/modules/tiles/tile/tile.component.ts @@ -67,9 +67,15 @@ export class SkyTileComponent implements AfterViewInit { } private _isCollapsed = false; - private viewInitialized = false; + constructor( + public elementRef: ElementRef, + @Optional() private dashboardService: SkyTileDashboardService + ) { + this.isInDashboardColumn = !!dashboardService; + } + public settingsButtonClicked() { this.settingsClick.emit(undefined); } @@ -78,13 +84,6 @@ export class SkyTileComponent implements AfterViewInit { return this.settingsClick.observers.length > 0; } - constructor( - public elementRef: ElementRef, - @Optional() private dashboardService: SkyTileDashboardService - ) { - this.isInDashboardColumn = !!dashboardService; - } - public titleClick() { this.isCollapsed = !this.isCollapsed; } diff --git a/tsconfig.json b/tsconfig.json index 088faf160..3bfb80d41 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -1,36 +1,10 @@ { + "extends": "./node_modules/@blackbaud/skyux-builder/tsconfig", "compilerOptions": { - "target": "es5", - "module": "commonjs", - "moduleResolution": "node", - "emitDecoratorMetadata": true, - "experimentalDecorators": true, - "allowSyntheticDefaultImports": true, - "sourceMap": true, - "noEmitHelpers": true, - "noImplicitAny": true, - "suppressImplicitAnyIndexErrors": true, - "lib": [ - "dom", - "es6" - ], - "types": [ - "jasmine", - "node" - ], - "baseUrl": ".", - "paths": { - "@angular/*": ["./node_modules/@angular/*"], - "sky-pages-spa/src/*": ["./src/*"], - "sky-pages-internal/*": ["./node_modules/@blackbaud/skyux-builder/*"] - } + "module": "commonjs" }, "exclude": [ "node_modules", - "dist", "skyux-spa-visual-tests" - ], - "compileOnSave": false, - "buildOnSave": false, - "atom": { "rewriteTsconfig": false } + ] } diff --git a/tslint.json b/tslint.json index b972c6f5a..141cb48e9 100644 --- a/tslint.json +++ b/tslint.json @@ -1,148 +1,3 @@ { - "rulesDirectory": [ - "node_modules/codelyzer" - ], - "rules": { - "member-access": true, - "member-ordering": [ - true, - "public-before-private", - "static-before-instance", - "variables-before-functions" - ], - "no-any": false, - "no-inferrable-types": false, - "no-internal-module": true, - "no-reference": true, - "no-var-requires": false, - "typedef": [false], - "typedef-whitespace": [ - true, - { - "call-signature": "nospace", - "index-signature": "nospace", - "parameter": "nospace", - "property-declaration": "nospace", - "variable-declaration": "nospace" - }, - { - "call-signature": "space", - "index-signature": "space", - "parameter": "space", - "property-declaration": "space", - "variable-declaration": "space" - } - ], - - "ban": false, - "curly": true, - "forin": true, - "label-position": true, - "no-arg": true, - "no-bitwise": true, - "no-conditional-assignment": true, - "no-console": [ - true, - "debug", - "info", - "time", - "timeEnd", - "trace" - ], - "no-construct": true, - "no-debugger": true, - "no-duplicate-variable": true, - "no-empty": false, - "no-eval": true, - "no-null-keyword": true, - "no-shadowed-variable": true, - "no-string-literal": false, - "no-switch-case-fall-through": true, - "no-unused-expression": true, - "no-unused-variable": true, - "no-use-before-declare": true, - "no-var-keyword": true, - "radix": true, - "switch-default": true, - "triple-equals": [ - true, - "allow-null-check" - ], - - "eofline": true, - "indent": [ - true, - "spaces" - ], - "max-line-length": [ - true, - 100 - ], - "no-require-imports": false, - "no-trailing-whitespace": true, - "object-literal-sort-keys": false, - "trailing-comma": [ - true, - { - "multiline": "never", - "singleline": "never" - } - ], - - "align": [false], - "class-name": true, - "comment-format": [ - true, - "check-space" - ], - "interface-name": [ - true, "never-prefix" - ], - "jsdoc-format": true, - "no-consecutive-blank-lines": true, - "no-parameter-properties": false, - "one-line": [ - true, - "check-open-brace", - "check-catch", - "check-else", - "check-finally", - "check-whitespace" - ], - "quotemark": [ - true, - "single", - "avoid-escape" - ], - "semicolon": [true, "always"], - "variable-name": [ - true, - "check-format", - "allow-leading-underscore", - "ban-keywords" - ], - "whitespace": [ - true, - "check-branch", - "check-decl", - "check-operator", - "check-separator", - "check-type" - ], - - "directive-selector": [true, ["attribute"], "sky", "camelCase"], - "component-selector": [true, ["element"], "sky", "kebab-case"], - "use-input-property-decorator": true, - "use-output-property-decorator": true, - "use-host-property-decorator": true, - "no-attribute-parameter-decorator": true, - "no-input-rename": true, - "no-output-rename": true, - "no-forward-ref": true, - "use-life-cycle-interface": true, - "use-pipe-transform-interface": true, - "pipe-naming": [true, "camelCase", "sky"], - "component-class-suffix": true, - "directive-class-suffix": true - } + "extends": "@blackbaud/skyux-builder/tslint" }