Skip to content

Commit 589dc05

Browse files
devversionmmalerba
authored andcommitted
build: enable no-unused-variable lint rule (#5184)
* Now TSLint starts reporting unused variables again (Rule has been un-deprecated and now uses the type checker * In favor of linting the whole project the tsconfig file inside of `src/` needs to live in the project root.
1 parent eedf36c commit 589dc05

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

42 files changed

+83
-127
lines changed

e2e/components/checkbox-e2e.spec.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@ describe('checkbox', () => {
1010
it('should be checked when clicked, and unchecked when clicked again', async () => {
1111
let checkboxEl = element(by.id('test-checkbox'));
1212
let inputEl = element(by.css('input[id=input-test-checkbox]'));
13-
let checked: string;
1413

1514
screenshot('start');
1615
checkboxEl.click();

e2e/components/icon-e2e.spec.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
import {browser, by, element} from 'protractor';
2-
import {screenshot} from '../screenshot';
32

43

54
describe('icon', () => {

e2e/components/menu-e2e.spec.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import {Key, protractor, browser, by, element, ElementFinder} from 'protractor';
1+
import {Key, protractor, browser, by, element} from 'protractor';
22
import {screenshot} from '../screenshot';
33
import {
44
expectToExist,

src/cdk/a11y/activedescendant-key-manager.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66
* found in the LICENSE file at https://angular.io/license
77
*/
88

9-
import {QueryList} from '@angular/core';
109
import {ListKeyManager, CanDisable} from './list-key-manager';
1110

1211
/**

src/cdk/bidi/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
import {NgModule} from '@angular/core';
1010
import {DOCUMENT} from '@angular/platform-browser';
1111
import {Dir} from './dir';
12-
import {DIR_DOCUMENT, Directionality, DIRECTIONALITY_PROVIDER} from './directionality';
12+
import {DIR_DOCUMENT, Directionality} from './directionality';
1313

1414
export {
1515
Directionality,

src/cdk/table/cell.ts

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -51,10 +51,8 @@ export class CdkColumnDef {
5151
},
5252
})
5353
export class CdkHeaderCell {
54-
constructor(private columnDef: CdkColumnDef,
55-
private elementRef: ElementRef,
56-
private renderer: Renderer2) {
57-
this.renderer.addClass(elementRef.nativeElement, `cdk-column-${columnDef.name}`);
54+
constructor(columnDef: CdkColumnDef, elementRef: ElementRef, renderer: Renderer2) {
55+
renderer.addClass(elementRef.nativeElement, `cdk-column-${columnDef.name}`);
5856
}
5957
}
6058

@@ -67,9 +65,7 @@ export class CdkHeaderCell {
6765
},
6866
})
6967
export class CdkCell {
70-
constructor(private columnDef: CdkColumnDef,
71-
private elementRef: ElementRef,
72-
private renderer: Renderer2) {
73-
this.renderer.addClass(elementRef.nativeElement, `cdk-column-${columnDef.name}`);
68+
constructor(columnDef: CdkColumnDef, elementRef: ElementRef, renderer: Renderer2) {
69+
renderer.addClass(elementRef.nativeElement, `cdk-column-${columnDef.name}`);
7470
}
7571
}

src/demo-app/overlay/overlay-demo.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,9 @@ import {
1111
OverlayState,
1212
OverlayOrigin,
1313
ComponentPortal,
14+
// This import is only used to define a generic type. The current TypeScript version incorrectly
15+
// considers such imports as unused (https://github.com/Microsoft/TypeScript/issues/14953)
16+
// tslint:disable-next-line:no-unused-variable
1417
Portal,
1518
TemplatePortalDirective,
1619
} from '@angular/material';

src/lib/autocomplete/autocomplete.spec.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ import {Observable} from 'rxjs/Observable';
2828
import {Subject} from 'rxjs/Subject';
2929
import {createKeyboardEvent, dispatchFakeEvent, typeInElement} from '@angular/cdk/testing';
3030
import {ScrollDispatcher} from '../core/overlay/scroll/scroll-dispatcher';
31-
import {RxChain, map, startWith, filter} from '../core/rxjs/index';
31+
import {RxChain, map, startWith} from '../core/rxjs/index';
3232

3333

3434
describe('MdAutocomplete', () => {

src/lib/chips/chip-list.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,9 @@ import {
1919

2020
import {MdChip} from './chip';
2121
import {FocusKeyManager} from '../core/a11y/focus-key-manager';
22-
import {SPACE, LEFT_ARROW, RIGHT_ARROW, TAB} from '../core/keyboard/keycodes';
23-
import {coerceBooleanProperty} from '@angular/cdk';
22+
import {SPACE, LEFT_ARROW, RIGHT_ARROW} from '../core/keyboard/keycodes';
2423
import {Subscription} from 'rxjs/Subscription';
24+
import {coerceBooleanProperty} from '@angular/cdk';
2525

2626
/**
2727
* A material design chips component (named ChipList for it's similarity to the List component).

src/lib/core/a11y/activedescendant-key-manager.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66
* found in the LICENSE file at https://angular.io/license
77
*/
88

9-
import {QueryList} from '@angular/core';
109
import {ListKeyManager, CanDisable} from './list-key-manager';
1110

1211
/**

src/lib/core/bidi/index.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66
* found in the LICENSE file at https://angular.io/license
77
*/
88

9-
109
export {
1110
Directionality,
1211
DIRECTIONALITY_PROVIDER,

src/lib/core/datetime/native-date-adapter.spec.ts

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,9 @@
11
import {NativeDateAdapter} from './native-date-adapter';
22
import {Platform} from '../platform/index';
3-
3+
import {DEC, FEB, JAN, MAR} from '../testing/month-constants';
44

55
const SUPPORTS_INTL = typeof Intl != 'undefined';
66

7-
8-
// When constructing a Date, the month is zero-based. This can be confusing, since people are
9-
// used to seeing them one-based. So we create these aliases to make reading the tests easier.
10-
const JAN = 0, FEB = 1, MAR = 2, APR = 3, MAY = 4, JUN = 5, JUL = 6, AUG = 7, SEP = 8, OCT = 9,
11-
NOV = 10, DEC = 11;
12-
13-
147
describe('NativeDateAdapter', () => {
158
let adapter;
169
let platform;

src/lib/core/error/error-options.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
*/
88

99
import {InjectionToken} from '@angular/core';
10-
import {FormControl, FormGroupDirective, Form, NgForm} from '@angular/forms';
10+
import {FormControl, FormGroupDirective, NgForm} from '@angular/forms';
1111

1212
/** Injection token that can be used to specify the global error options. */
1313
export const MD_ERROR_GLOBAL_OPTIONS = new InjectionToken<ErrorOptions>('md-error-global-options');

src/lib/core/option/optgroup.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
* found in the LICENSE file at https://angular.io/license
77
*/
88

9-
import {Component, ViewEncapsulation, ContentChildren, QueryList, Input} from '@angular/core';
9+
import {Component, ViewEncapsulation, Input} from '@angular/core';
1010
import {mixinDisabled, CanDisable} from '../common-behaviors/disabled';
1111

1212
// Boilerplate for applying mixins to MdOptgroup.

src/lib/core/option/option.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@ import {
1212
EventEmitter,
1313
Input,
1414
Output,
15-
NgModule,
1615
ViewEncapsulation,
1716
Inject,
1817
Optional,

src/lib/core/overlay/overlay-directives.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,11 +26,13 @@ import {TemplatePortal} from '../portal/portal';
2626
import {OverlayState} from './overlay-state';
2727
import {
2828
ConnectionPositionPair,
29+
// This import is only used to define a generic type. The current TypeScript version incorrectly
30+
// considers such imports as unused (https://github.com/Microsoft/TypeScript/issues/14953)
31+
// tslint:disable-next-line:no-unused-variable
2932
ConnectedOverlayPositionChange
3033
} from './position/connected-position';
3134
import {ConnectedPositionStrategy} from './position/connected-position-strategy';
3235
import {Directionality, Direction} from '../bidi/index';
33-
import {Scrollable} from './scroll/scrollable';
3436
import {ScrollStrategy} from './scroll/scroll-strategy';
3537
import {coerceBooleanProperty} from '@angular/cdk';
3638
import {ESCAPE} from '../keyboard/keycodes';

src/lib/core/overlay/overlay.spec.ts

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,7 @@ import {
99
OverlayContainer,
1010
Overlay,
1111
PositionStrategy,
12-
ViewportRuler,
1312
ScrollStrategy,
14-
ScrollDispatcher,
1513
} from './index';
1614

1715

@@ -336,7 +334,6 @@ describe('Overlay', () => {
336334
overlayRef.attach(componentPortal);
337335
viewContainerFixture.detectChanges();
338336

339-
let backdrop = overlayContainerElement.querySelector('.cdk-overlay-backdrop') as HTMLElement;
340337
let completeHandler = jasmine.createSpy('backdrop complete handler');
341338

342339
overlayRef.backdropClick().subscribe(undefined, undefined, completeHandler);

src/lib/core/overlay/scroll/scroll-strategy-options.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77
*/
88

99
import {Injectable} from '@angular/core';
10-
import {ScrollStrategy} from './scroll-strategy';
1110
import {CloseScrollStrategy} from './close-scroll-strategy';
1211
import {NoopScrollStrategy} from './noop-scroll-strategy';
1312
import {BlockScrollStrategy} from './block-scroll-strategy';
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
/**
2+
* @license
3+
* Copyright Google Inc. All Rights Reserved.
4+
*
5+
* Use of this source code is governed by an MIT-style license that can be
6+
* found in the LICENSE file at https://angular.io/license
7+
*/
8+
9+
/**
10+
* When constructing a Date, the month is zero-based. This can be confusing, since people are
11+
* used to seeing them one-based. So we create these aliases to make writing the tests easier.
12+
*/
13+
export const JAN = 0, FEB = 1, MAR = 2, APR = 3, MAY = 4, JUN = 5, JUL = 6, AUG = 7, SEP = 8,
14+
OCT = 9, NOV = 10, DEC = 11;

src/lib/datepicker/calendar.spec.ts

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -21,13 +21,7 @@ import {MdDatepickerIntl} from './datepicker-intl';
2121
import {MdNativeDateModule} from '../core/datetime/index';
2222
import {NoConflictStyleCompatibilityMode} from '../core';
2323
import {MdButtonModule} from '../button/index';
24-
25-
26-
// When constructing a Date, the month is zero-based. This can be confusing, since people are
27-
// used to seeing them one-based. So we create these aliases to make reading the tests easier.
28-
const JAN = 0, FEB = 1, MAR = 2, APR = 3, MAY = 4, JUN = 5, JUL = 6, AUG = 7, SEP = 8, OCT = 9,
29-
NOV = 10, DEC = 11;
30-
24+
import {AUG, DEC, FEB, JAN, JUL, NOV, MAR, MAY, JUN, SEP} from '../core/testing/month-constants';
3125

3226
describe('MdCalendar', () => {
3327
beforeEach(async(() => {

src/lib/datepicker/datepicker.spec.ts

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -10,13 +10,7 @@ import {MdInputModule} from '../input/index';
1010
import {MdNativeDateModule, DateAdapter, NativeDateAdapter} from '../core/datetime/index';
1111
import {ESCAPE} from '../core';
1212
import {dispatchFakeEvent, dispatchMouseEvent, dispatchKeyboardEvent} from '@angular/cdk/testing';
13-
14-
15-
// When constructing a Date, the month is zero-based. This can be confusing, since people are
16-
// used to seeing them one-based. So we create these aliases to make reading the tests easier.
17-
const JAN = 0, FEB = 1, MAR = 2, APR = 3, MAY = 4, JUN = 5, JUL = 6, AUG = 7, SEP = 8, OCT = 9,
18-
NOV = 10, DEC = 11;
19-
13+
import {DEC, JAN} from '../core/testing/month-constants';
2014

2115
describe('MdDatepicker', () => {
2216
describe('with MdNativeDateModule', () => {

src/lib/datepicker/datepicker.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,6 @@ import {MdDialogRef} from '../dialog/dialog-ref';
3333
import {PositionStrategy} from '../core/overlay/position/position-strategy';
3434
import {MdDatepickerInput} from './datepicker-input';
3535
import {Subscription} from 'rxjs/Subscription';
36-
import {MdDialogConfig} from '../dialog/dialog-config';
3736
import {DateAdapter} from '../core/datetime/index';
3837
import {createMissingDateImplError} from './datepicker-errors';
3938
import {ESCAPE} from '../core/keyboard/keycodes';

src/lib/datepicker/month-view.spec.ts

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,7 @@ import {By} from '@angular/platform-browser';
44
import {MdMonthView} from './month-view';
55
import {MdCalendarBody} from './calendar-body';
66
import {MdNativeDateModule, DateAdapter, NativeDateAdapter} from '../core/datetime/index';
7-
8-
9-
// When constructing a Date, the month is zero-based. This can be confusing, since people are
10-
// used to seeing them one-based. So we create these aliases to make reading the tests easier.
11-
const JAN = 0, FEB = 1, MAR = 2, APR = 3, MAY = 4, JUN = 5, JUL = 6, AUG = 7, SEP = 8, OCT = 9,
12-
NOV = 10, DEC = 11;
13-
7+
import {JAN, MAR} from '../core/testing/month-constants';
148

159
describe('MdMonthView', () => {
1610
beforeEach(async(() => {

src/lib/datepicker/year-view.spec.ts

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,7 @@ import {By} from '@angular/platform-browser';
44
import {MdYearView} from './year-view';
55
import {MdCalendarBody} from './calendar-body';
66
import {MdNativeDateModule, DateAdapter, NativeDateAdapter} from '../core/datetime/index';
7-
8-
9-
// When constructing a Date, the month is zero-based. This can be confusing, since people are
10-
// used to seeing them one-based. So we create these aliases to make reading the tests easier.
11-
const JAN = 0, FEB = 1, MAR = 2, APR = 3, MAY = 4, JUN = 5, JUL = 6, AUG = 7, SEP = 8, OCT = 9,
12-
NOV = 10, DEC = 11;
13-
7+
import {FEB, JAN, MAR} from '../core/testing/month-constants';
148

159
describe('MdYearView', () => {
1610
beforeEach(async(() => {

src/lib/dialog/dialog-container.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@ import {
1212
ViewChild,
1313
ViewEncapsulation,
1414
NgZone,
15-
OnDestroy,
1615
ElementRef,
1716
EventEmitter,
1817
Inject,

src/lib/dialog/dialog-injector.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,6 @@
77
*/
88

99
import {Injector} from '@angular/core';
10-
import {MdDialogRef} from './dialog-ref';
11-
import {MdDialogContainer} from './dialog-container';
1210

1311
/** Custom injector type specifically for instantiating components with a dialog. */
1412
export class DialogInjector implements Injector {

src/lib/dialog/dialog.spec.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -319,7 +319,7 @@ describe('MdDialog', () => {
319319
});
320320

321321
it('should allow setting the layout direction', () => {
322-
let dialogRef = dialog.open(PizzaMsg, { direction: 'rtl' });
322+
dialog.open(PizzaMsg, { direction: 'rtl' });
323323

324324
viewContainerFixture.detectChanges();
325325

src/lib/expansion/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
* found in the LICENSE file at https://angular.io/license
77
*/
88

9-
import {NgModule, ModuleWithProviders} from '@angular/core';
9+
import {NgModule} from '@angular/core';
1010
import {CommonModule} from '@angular/common';
1111
import {CompatibilityModule, UNIQUE_SELECTION_DISPATCHER_PROVIDER} from '../core';
1212
import {

src/lib/paginator/index.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@
99
import {NgModule} from '@angular/core';
1010
import {CommonModule} from '@angular/common';
1111
import {FormsModule} from '@angular/forms';
12-
import {MdCommonModule, OverlayModule} from '../core';
1312
import {MdButtonModule} from '../button/index';
1413
import {MdSelectModule} from '../select/index';
1514
import {MdPaginator} from './paginator';

src/lib/paginator/paginator.spec.ts

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -248,15 +248,6 @@ class MdPaginatorApp {
248248
}
249249
}
250250

251-
@Component({
252-
template: `
253-
<md-paginator [length]="100"></md-paginator>
254-
`,
255-
})
256-
class MdPaginatorWithoutPageSizeOrOptionsApp {
257-
@ViewChild(MdPaginator) mdPaginator: MdPaginator;
258-
}
259-
260251
@Component({
261252
template: `
262253
<md-paginator [pageSizeOptions]="[10, 20, 30]"></md-paginator>

src/lib/sidenav/sidenav.spec.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import {fakeAsync, async, tick, ComponentFixture, TestBed} from '@angular/core/testing';
22
import {Component, ElementRef, ViewChild} from '@angular/core';
33
import {By} from '@angular/platform-browser';
4-
import {MdSidenav, MdSidenavModule, MdSidenavToggleResult, MdSidenavContainer} from './index';
4+
import {MdSidenav, MdSidenavModule, MdSidenavContainer} from './index';
55
import {A11yModule} from '../core/a11y/index';
66
import {PlatformModule} from '../core/platform/index';
77
import {ESCAPE} from '../core/keyboard/keycodes';

src/lib/snack-bar/snack-bar-container.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,6 @@ import {
2727
import {
2828
BasePortalHost,
2929
ComponentPortal,
30-
TemplatePortal,
3130
PortalHostDirective,
3231
} from '../core';
3332
import {MdSnackBarConfig} from './snack-bar-config';

src/lib/tabs/tab-header.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,6 @@ import {
3434
import {MdTabLabelWrapper} from './tab-label-wrapper';
3535
import {MdInkBar} from './ink-bar';
3636
import {Subscription} from 'rxjs/Subscription';
37-
import {applyCssTransform} from '../core/style/apply-transform';
3837
import {auditTime, startWith} from '../core/rxjs/index';
3938
import {of as observableOf} from 'rxjs/observable/of';
4039
import {merge} from 'rxjs/observable/merge';

src/material-examples/table-filtering/table-filtering-example.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
import {Component, ElementRef, ViewChild} from '@angular/core';
22
import {DataSource} from '@angular/cdk';
3-
import {MdSort} from '@angular/material';
43
import {BehaviorSubject} from 'rxjs/BehaviorSubject';
54
import {Observable} from 'rxjs/Observable';
65
import 'rxjs/add/operator/startWith';

src/tsconfig.json

Lines changed: 0 additions & 28 deletions
This file was deleted.

0 commit comments

Comments
 (0)