Skip to content

Commit d42e37b

Browse files
committed
Enable TypeScript checks for unused locals and parameters.
1 parent 4c8f33c commit d42e37b

28 files changed

+99
-153
lines changed

Diff for: nativescript-angular/animation-driver.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ export class NativeScriptAnimationDriver implements AnimationDriver {
1616
return (<View>element).style._getValue(getPropertyByCssName(prop));
1717
}
1818

19-
animate(element: any, startingStyles: AnimationStyles, keyframes: AnimationKeyframe[], duration: number, delay: number, easing: string): AnimationPlayer {
19+
animate(element: any, _startingStyles: AnimationStyles, keyframes: AnimationKeyframe[], duration: number, delay: number, easing: string): AnimationPlayer {
2020
return new NativeScriptAnimationPlayer(element, keyframes, duration, delay, easing);
2121
}
2222
}

Diff for: nativescript-angular/animation-player.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ export class NativeScriptAnimationPlayer implements AnimationPlayer {
9898
this._onStart();
9999
this.animation.play(this.target)
100100
.then(() => { this._onFinish(); })
101-
.catch((e) => { });
101+
.catch((_e) => { });
102102
}
103103
}
104104

@@ -126,7 +126,7 @@ export class NativeScriptAnimationPlayer implements AnimationPlayer {
126126
this._onFinish();
127127
}
128128

129-
setPosition(p: any): void {
129+
setPosition(_p: any): void {
130130
throw new Error("AnimationPlayer.setPosition method is not supported!");
131131
}
132132

Diff for: nativescript-angular/collection-facade.ts

-63
Original file line numberDiff line numberDiff line change
@@ -131,66 +131,3 @@ function _flattenArray(source: any[], target: any[]): any[] {
131131
}
132132
return target;
133133
}
134-
135-
export class StringMapWrapper {
136-
static create(): {[k: /*any*/ string]: any} {
137-
// Note: We are not using Object.create(null) here due to
138-
// performance!
139-
// http://jsperf.com/ng2-object-create-null
140-
return {};
141-
}
142-
static contains(map: {[key: string]: any}, key: string): boolean {
143-
return map.hasOwnProperty(key);
144-
}
145-
static get<V>(map: {[key: string]: V}, key: string): V {
146-
return map.hasOwnProperty(key) ? map[key] : undefined;
147-
}
148-
static set<V>(map: {[key: string]: V}, key: string, value: V) { map[key] = value; }
149-
150-
static keys(map: {[key: string]: any}): string[] { return Object.keys(map); }
151-
static values<T>(map: {[key: string]: T}): T[] {
152-
return Object.keys(map).map((k: string): T => map[k]);
153-
}
154-
static isEmpty(map: {[key: string]: any}): boolean {
155-
for (var prop in map) {
156-
return false;
157-
}
158-
return true;
159-
}
160-
static delete (map: {[key: string]: any}, key: string) { delete map[key]; }
161-
static forEach<K, V>(map: {[key: string]: V}, callback: (v: V, K: string) => void) {
162-
for (let k of Object.keys(map)) {
163-
callback(map[k], k);
164-
}
165-
}
166-
167-
static merge<V>(m1: {[key: string]: V}, m2: {[key: string]: V}): {[key: string]: V} {
168-
var m: {[key: string]: V} = {};
169-
170-
for (let k of Object.keys(m1)) {
171-
m[k] = m1[k];
172-
}
173-
174-
for (let k of Object.keys(m2)) {
175-
m[k] = m2[k];
176-
}
177-
178-
return m;
179-
}
180-
181-
static equals<V>(m1: {[key: string]: V}, m2: {[key: string]: V}): boolean {
182-
var k1 = Object.keys(m1);
183-
var k2 = Object.keys(m2);
184-
if (k1.length != k2.length) {
185-
return false;
186-
}
187-
var key: any /** TODO #???? */;
188-
for (var i = 0; i < k1.length; i++) {
189-
key = k1[i];
190-
if (m1[key] !== m2[key]) {
191-
return false;
192-
}
193-
}
194-
return true;
195-
}
196-
}

Diff for: nativescript-angular/common/detached-loader.ts

-6
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,6 @@ import {
44
} from '@angular/core';
55
import * as trace from "trace";
66

7-
type AnyComponentRef = ComponentRef<any>;
8-
interface PendingLoadEntry {
9-
componentType: Type<any>;
10-
resolveCallback: (AnyComponentRef) => void;
11-
}
12-
137
export const CATEGORY = "detached-loader";
148
function log(message: string) {
159
trace.write(message, CATEGORY);

Diff for: nativescript-angular/directives/action-bar.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import { registerElement, ViewClassMeta, NgView } from '../element-registry';
77

88
var actionBarMeta: ViewClassMeta = {
99
skipAddToDom: true,
10-
insertChild: (parent: NgView, child: NgView, atIndex: number) => {
10+
insertChild: (parent: NgView, child: NgView, _atIndex: number) => {
1111
const bar = <ActionBar>(<any>parent);
1212
const childView = <any>child;
1313

Diff for: nativescript-angular/directives/dialogs.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ export class ModalDialogService {
3939
const resolver: ComponentFactoryResolver = viewContainerRef.injector.get(ComponentFactoryResolver);
4040
const pageFactory: PageFactory = viewContainerRef.injector.get(PAGE_FACTORY);
4141

42-
return new Promise((resolve, reject) => {
42+
return new Promise((resolve) => {
4343
setTimeout(() => ModalDialogService.showDialog(type, options, resolve, viewContainerRef, resolver, parentPage, pageFactory), 10);
4444
});
4545
}

Diff for: nativescript-angular/directives/list-view-comp.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -79,13 +79,13 @@ export class ListViewComponent implements DoCheck, OnDestroy, AfterContentInit {
7979
needDiffer = false;
8080
}
8181
if (needDiffer && !this._differ && isListLikeIterable(value)) {
82-
this._differ = this._iterableDiffers.find(this._items).create(this._cdr, (index, item) => { return item; });
82+
this._differ = this._iterableDiffers.find(this._items).create(this._cdr, (_index, item) => { return item; });
8383
}
8484

8585
this.listView.items = this._items;
8686
}
8787

88-
constructor(private _elementRef: ElementRef,
88+
constructor(_elementRef: ElementRef,
8989
private _iterableDiffers: IterableDiffers,
9090
private _cdr: ChangeDetectorRef) {
9191
this.listView = _elementRef.nativeElement;

Diff for: nativescript-angular/directives/tab-view.ts

+5-5
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
import {ElementRef, Directive, Input, TemplateRef, ViewContainerRef} from "@angular/core";
2-
import {TabView, TabViewItem} from "ui/tab-view";
1+
import { ElementRef, Directive, Input, TemplateRef, ViewContainerRef } from "@angular/core";
2+
import { TabView, TabViewItem } from "ui/tab-view";
33
import * as utils from '../common/utils';
4-
import {rendererLog, rendererError} from "../trace";
5-
import {isBlank} from "../lang-facade";
4+
import { rendererLog } from "../trace";
5+
import { isBlank } from "../lang-facade";
66

77
@Directive({
88
selector: 'TabView',
@@ -24,7 +24,7 @@ export class TabViewDirective {
2424
}
2525
}
2626

27-
constructor(private element: ElementRef) {
27+
constructor(element: ElementRef) {
2828
this.tabView = element.nativeElement;
2929
}
3030

Diff for: nativescript-angular/dom-adapter.ts

+9-9
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
import { ElementSchemaRegistry } from '@angular/compiler';
2-
import { Sanitizer, SchemaMetadata } from '@angular/core';
2+
import { SchemaMetadata } from '@angular/core';
33
import { Parse5DomAdapter } from "./parse5_adapter";
44
import { setRootDomAdapter } from './private_import_platform-browser';
5-
import { rendererLog, rendererError } from "./trace";
5+
import { rendererLog } from "./trace";
66
import { print } from "./lang-facade";
77

88
export enum SecurityContext {
@@ -15,11 +15,11 @@ export enum SecurityContext {
1515
}
1616

1717
export class NativeScriptElementSchemaRegistry extends ElementSchemaRegistry {
18-
hasProperty(tagName: string, propName: string): boolean {
18+
hasProperty(_tagName: string, _propName: string): boolean {
1919
return true;
2020
}
2121

22-
hasElement(tagName: string, schemaMetas: SchemaMetadata[]): boolean {
22+
hasElement(_tagName: string, _schemaMetas: SchemaMetadata[]): boolean {
2323
return true;
2424
}
2525

@@ -32,15 +32,15 @@ export class NativeScriptElementSchemaRegistry extends ElementSchemaRegistry {
3232
return 'ng-component';
3333
}
3434

35-
securityContext(tagName: string, propName: string): any {
35+
securityContext(_tagName: string, _propName: string): any {
3636
return SecurityContext.NONE;
3737
}
3838

39-
validateProperty(name: string): { error: boolean, msg?: string } {
39+
validateProperty(_name: string): { error: boolean, msg?: string } {
4040
return { error: false };
4141
}
4242

43-
validateAttribute(name: string): { error: boolean, msg?: string } {
43+
validateAttribute(_name: string): { error: boolean, msg?: string } {
4444
return { error: false };
4545
}
4646

@@ -52,7 +52,7 @@ export class NativeScriptElementSchemaRegistry extends ElementSchemaRegistry {
5252
return propName;
5353
}
5454

55-
normalizeAnimationStyleValue(camelCaseProp: string, userProvidedProp: string, val: string | number):
55+
normalizeAnimationStyleValue(_camelCaseProp: string, _userProvidedProp: string, val: string | number):
5656
{ error: string, value: string } {
5757
return { error: null, value: val.toString() };
5858
}
@@ -64,7 +64,7 @@ export class NativeScriptDomAdapter extends Parse5DomAdapter {
6464
setRootDomAdapter(new NativeScriptDomAdapter());
6565
}
6666

67-
hasProperty(element, name: string) {
67+
hasProperty(_element: any, _name: string) {
6868
//TODO: actually check if the property exists.
6969
return true;
7070
}

Diff for: nativescript-angular/http/ns-http.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
import {Injectable} from '@angular/core';
2-
import {Http, XHRBackend, ConnectionBackend, RequestOptions, RequestOptionsArgs, ResponseOptions, ResponseType, Response, XSRFStrategy} from '@angular/http';
2+
import {Http, ConnectionBackend, RequestOptionsArgs, ResponseOptions, ResponseType, Response} from '@angular/http';
33
import {Observable} from 'rxjs/Observable';
44
import 'rxjs/add/observable/fromPromise';
55
import {NSFileSystem} from '../file-system/ns-file-system';
66

77
export class NSXSRFStrategy {
8-
public configureRequest(req: any) {
8+
public configureRequest(_req: any) {
99
// noop
1010
}
1111
}

Diff for: nativescript-angular/parse5_adapter.ts

+20-20
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ export class Parse5DomAdapter extends DomAdapter {
4747
setRootDomAdapter(new Parse5DomAdapter());
4848
}
4949

50-
hasProperty(element: any, name: string): boolean {
50+
hasProperty(_element: any, name: string): boolean {
5151
return _HTMLElementPropertyList.indexOf(name) > -1;
5252
}
5353
// TODO(tbosch): don't even call this method when we run the tests on server side
@@ -75,7 +75,7 @@ export class Parse5DomAdapter extends DomAdapter {
7575

7676
get attrToPropMap() { return _attrToPropMap; }
7777

78-
query(selector: any) { throw _notImplemented('query'); }
78+
query(_selector: any) { throw _notImplemented('query'); }
7979
querySelector(el: any, selector: string): any { return this.querySelectorAll(el, selector)[0]; }
8080
querySelectorAll(el: any, selector: string): any[] {
8181
const res: any[] = [];
@@ -121,7 +121,7 @@ export class Parse5DomAdapter extends DomAdapter {
121121
cssSelector.addClassName(classList[i]);
122122
}
123123

124-
matcher.match(cssSelector, function(selector: any, cb: any) { result = true; });
124+
matcher.match(cssSelector, function(_selector: any, _cb: any) { result = true; });
125125
}
126126
return result;
127127
}
@@ -171,15 +171,15 @@ export class Parse5DomAdapter extends DomAdapter {
171171
getInnerHTML(el: any): string {
172172
return parse5.serialize(this.templateAwareRoot(el), {treeAdapter});
173173
}
174-
getTemplateContent(el: any): Node { return null; }
174+
getTemplateContent(_el: any): Node { return null; }
175175
getOuterHTML(el: any): string {
176176
const fragment = treeAdapter.createDocumentFragment();
177177
this.appendChild(fragment, el);
178178
return parse5.serialize(fragment, {treeAdapter});
179179
}
180180
nodeName(node: any): string { return node.tagName; }
181181
nodeValue(node: any): string { return node.nodeValue; }
182-
type(node: any): string { throw _notImplemented('type'); }
182+
type(_node: any): string { throw _notImplemented('type'); }
183183
content(node: any): string { return node.childNodes[0]; }
184184
firstChild(el: any): Node { return el.firstChild; }
185185
nextSibling(el: any): Node { return el.nextSibling; }
@@ -313,7 +313,7 @@ export class Parse5DomAdapter extends DomAdapter {
313313
}
314314
getShadowRoot(el: any): Element { return el.shadowRoot; }
315315
getHost(el: any): string { return el.host; }
316-
getDistributedNodes(el: any): Node[] { throw _notImplemented('getDistributedNodes'); }
316+
getDistributedNodes(_el: any): Node[] { throw _notImplemented('getDistributedNodes'); }
317317
clone(node: Node): Node {
318318
const _recursive = (node: any) => {
319319
const nodeClone = Object.create(Object.getPrototypeOf(node));
@@ -358,7 +358,7 @@ export class Parse5DomAdapter extends DomAdapter {
358358
getElementsByClassName(element: any, name: string): HTMLElement[] {
359359
return this.querySelectorAll(element, '.' + name);
360360
}
361-
getElementsByTagName(element: any, name: string): HTMLElement[] {
361+
getElementsByTagName(_element: any, _name: string): HTMLElement[] {
362362
throw _notImplemented('getElementsByTagName');
363363
}
364364
classList(element: any): string[] {
@@ -442,13 +442,13 @@ export class Parse5DomAdapter extends DomAdapter {
442442
hasAttribute(element: any, attribute: string): boolean {
443443
return element.attribs && element.attribs.hasOwnProperty(attribute);
444444
}
445-
hasAttributeNS(element: any, ns: string, attribute: string): boolean { throw 'not implemented'; }
445+
hasAttributeNS(_element: any, _ns: string, _attribute: string): boolean { throw 'not implemented'; }
446446
getAttribute(element: any, attribute: string): string {
447447
return element.attribs && element.attribs.hasOwnProperty(attribute) ?
448448
element.attribs[attribute] :
449449
null;
450450
}
451-
getAttributeNS(element: any, ns: string, attribute: string): string { throw 'not implemented'; }
451+
getAttributeNS(_element: any, _ns: string, _attribute: string): string { throw 'not implemented'; }
452452
setAttribute(element: any, attribute: string, value: string) {
453453
if (attribute) {
454454
element.attribs[attribute] = value;
@@ -457,15 +457,15 @@ export class Parse5DomAdapter extends DomAdapter {
457457
}
458458
}
459459
}
460-
setAttributeNS(element: any, ns: string, attribute: string, value: string) {
460+
setAttributeNS(_element: any, _ns: string, _attribute: string, _value: string) {
461461
throw 'not implemented';
462462
}
463463
removeAttribute(element: any, attribute: string) {
464464
if (attribute) {
465465
delete element.attribs[attribute];
466466
}
467467
}
468-
removeAttributeNS(element: any, ns: string, name: string) { throw 'not implemented'; }
468+
removeAttributeNS(_element: any, _ns: string, _name: string) { throw 'not implemented'; }
469469
templateAwareRoot(el: any): any {
470470
return this.isTemplateElement(el) ? treeAdapter.getTemplateContent(el) : el;
471471
}
@@ -482,7 +482,7 @@ export class Parse5DomAdapter extends DomAdapter {
482482
return newDoc;
483483
}
484484
defaultDoc(): Document { return defDoc = defDoc || this.createHtmlDocument(); }
485-
getBoundingClientRect(el: any): any { return {left: 0, top: 0, width: 0, height: 0}; }
485+
getBoundingClientRect(_el: any): any { return {left: 0, top: 0, width: 0, height: 0}; }
486486
getTitle(): string { return this.defaultDoc().title || ''; }
487487
setTitle(newTitle: string) { this.defaultDoc().title = newTitle; }
488488
isTemplateElement(el: any): boolean {
@@ -556,7 +556,7 @@ export class Parse5DomAdapter extends DomAdapter {
556556
getLocation(): Location { throw 'not implemented'; }
557557
getUserAgent(): string { return 'Fake user agent'; }
558558
getData(el: any, name: string): string { return this.getAttribute(el, 'data-' + name); }
559-
getComputedStyle(el: any): any { throw 'not implemented'; }
559+
getComputedStyle(_el: any): any { throw 'not implemented'; }
560560
setData(el: any, name: string, value: string) { this.setAttribute(el, 'data-' + name, value); }
561561
// TODO(tbosch): move this into a separate environment class once we have it
562562
setGlobalVar(path: string, value: any) { setValueOnPath(global, path, value); }
@@ -566,15 +566,15 @@ export class Parse5DomAdapter extends DomAdapter {
566566
getTransitionEnd(): string { return 'transitionend'; }
567567
supportsAnimation(): boolean { return true; }
568568

569-
replaceChild(el: any, newNode: any, oldNode: any) { throw new Error('not implemented'); }
570-
parse(templateHtml: string) { throw new Error('not implemented'); }
571-
invoke(el: Element, methodName: string, args: any[]): any { throw new Error('not implemented'); }
572-
getEventKey(event: any): string { throw new Error('not implemented'); }
569+
replaceChild(_el: any, _newNode: any, _oldNode: any) { throw new Error('not implemented'); }
570+
parse(_templateHtml: string) { throw new Error('not implemented'); }
571+
invoke(_el: Element, _methodName: string, _args: any[]): any { throw new Error('not implemented'); }
572+
getEventKey(_event: any): string { throw new Error('not implemented'); }
573573

574574
supportsCookies(): boolean { return false; }
575-
getCookie(name: string): string { throw new Error('not implemented'); }
576-
setCookie(name: string, value: string) { throw new Error('not implemented'); }
577-
animate(element: any, keyframes: any[], options: any): any { throw new Error('not implemented'); }
575+
getCookie(_name: string): string { throw new Error('not implemented'); }
576+
setCookie(_name: string, _value: string) { throw new Error('not implemented'); }
577+
animate(_element: any, _keyframes: any[], _options: any): any { throw new Error('not implemented'); }
578578
}
579579

580580
// TODO: build a proper list, this one is all the keys of a HTMLInputElement

0 commit comments

Comments
 (0)