Skip to content

Commit

Permalink
build: enable no-unused-variable lint rule (#5184)
Browse files Browse the repository at this point in the history
* 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.
  • Loading branch information
devversion authored and mmalerba committed Jul 7, 2017
1 parent eedf36c commit 589dc05
Show file tree
Hide file tree
Showing 42 changed files with 83 additions and 127 deletions.
1 change: 0 additions & 1 deletion e2e/components/checkbox-e2e.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ describe('checkbox', () => {
it('should be checked when clicked, and unchecked when clicked again', async () => {
let checkboxEl = element(by.id('test-checkbox'));
let inputEl = element(by.css('input[id=input-test-checkbox]'));
let checked: string;

screenshot('start');
checkboxEl.click();
Expand Down
1 change: 0 additions & 1 deletion e2e/components/icon-e2e.spec.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import {browser, by, element} from 'protractor';
import {screenshot} from '../screenshot';


describe('icon', () => {
Expand Down
2 changes: 1 addition & 1 deletion e2e/components/menu-e2e.spec.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import {Key, protractor, browser, by, element, ElementFinder} from 'protractor';
import {Key, protractor, browser, by, element} from 'protractor';
import {screenshot} from '../screenshot';
import {
expectToExist,
Expand Down
1 change: 0 additions & 1 deletion src/cdk/a11y/activedescendant-key-manager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
* found in the LICENSE file at https://angular.io/license
*/

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

/**
Expand Down
2 changes: 1 addition & 1 deletion src/cdk/bidi/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
import {NgModule} from '@angular/core';
import {DOCUMENT} from '@angular/platform-browser';
import {Dir} from './dir';
import {DIR_DOCUMENT, Directionality, DIRECTIONALITY_PROVIDER} from './directionality';
import {DIR_DOCUMENT, Directionality} from './directionality';

export {
Directionality,
Expand Down
12 changes: 4 additions & 8 deletions src/cdk/table/cell.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,10 +51,8 @@ export class CdkColumnDef {
},
})
export class CdkHeaderCell {
constructor(private columnDef: CdkColumnDef,
private elementRef: ElementRef,
private renderer: Renderer2) {
this.renderer.addClass(elementRef.nativeElement, `cdk-column-${columnDef.name}`);
constructor(columnDef: CdkColumnDef, elementRef: ElementRef, renderer: Renderer2) {
renderer.addClass(elementRef.nativeElement, `cdk-column-${columnDef.name}`);
}
}

Expand All @@ -67,9 +65,7 @@ export class CdkHeaderCell {
},
})
export class CdkCell {
constructor(private columnDef: CdkColumnDef,
private elementRef: ElementRef,
private renderer: Renderer2) {
this.renderer.addClass(elementRef.nativeElement, `cdk-column-${columnDef.name}`);
constructor(columnDef: CdkColumnDef, elementRef: ElementRef, renderer: Renderer2) {
renderer.addClass(elementRef.nativeElement, `cdk-column-${columnDef.name}`);
}
}
3 changes: 3 additions & 0 deletions src/demo-app/overlay/overlay-demo.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@ import {
OverlayState,
OverlayOrigin,
ComponentPortal,
// This import is only used to define a generic type. The current TypeScript version incorrectly
// considers such imports as unused (https://github.com/Microsoft/TypeScript/issues/14953)
// tslint:disable-next-line:no-unused-variable
Portal,
TemplatePortalDirective,
} from '@angular/material';
Expand Down
2 changes: 1 addition & 1 deletion src/lib/autocomplete/autocomplete.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ import {Observable} from 'rxjs/Observable';
import {Subject} from 'rxjs/Subject';
import {createKeyboardEvent, dispatchFakeEvent, typeInElement} from '@angular/cdk/testing';
import {ScrollDispatcher} from '../core/overlay/scroll/scroll-dispatcher';
import {RxChain, map, startWith, filter} from '../core/rxjs/index';
import {RxChain, map, startWith} from '../core/rxjs/index';


describe('MdAutocomplete', () => {
Expand Down
4 changes: 2 additions & 2 deletions src/lib/chips/chip-list.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,9 @@ import {

import {MdChip} from './chip';
import {FocusKeyManager} from '../core/a11y/focus-key-manager';
import {SPACE, LEFT_ARROW, RIGHT_ARROW, TAB} from '../core/keyboard/keycodes';
import {coerceBooleanProperty} from '@angular/cdk';
import {SPACE, LEFT_ARROW, RIGHT_ARROW} from '../core/keyboard/keycodes';
import {Subscription} from 'rxjs/Subscription';
import {coerceBooleanProperty} from '@angular/cdk';

/**
* A material design chips component (named ChipList for it's similarity to the List component).
Expand Down
1 change: 0 additions & 1 deletion src/lib/core/a11y/activedescendant-key-manager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
* found in the LICENSE file at https://angular.io/license
*/

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

/**
Expand Down
1 change: 0 additions & 1 deletion src/lib/core/bidi/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
* found in the LICENSE file at https://angular.io/license
*/


export {
Directionality,
DIRECTIONALITY_PROVIDER,
Expand Down
9 changes: 1 addition & 8 deletions src/lib/core/datetime/native-date-adapter.spec.ts
Original file line number Diff line number Diff line change
@@ -1,16 +1,9 @@
import {NativeDateAdapter} from './native-date-adapter';
import {Platform} from '../platform/index';

import {DEC, FEB, JAN, MAR} from '../testing/month-constants';

const SUPPORTS_INTL = typeof Intl != 'undefined';


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


describe('NativeDateAdapter', () => {
let adapter;
let platform;
Expand Down
2 changes: 1 addition & 1 deletion src/lib/core/error/error-options.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
*/

import {InjectionToken} from '@angular/core';
import {FormControl, FormGroupDirective, Form, NgForm} from '@angular/forms';
import {FormControl, FormGroupDirective, NgForm} from '@angular/forms';

/** Injection token that can be used to specify the global error options. */
export const MD_ERROR_GLOBAL_OPTIONS = new InjectionToken<ErrorOptions>('md-error-global-options');
Expand Down
2 changes: 1 addition & 1 deletion src/lib/core/option/optgroup.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
* found in the LICENSE file at https://angular.io/license
*/

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

// Boilerplate for applying mixins to MdOptgroup.
Expand Down
1 change: 0 additions & 1 deletion src/lib/core/option/option.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ import {
EventEmitter,
Input,
Output,
NgModule,
ViewEncapsulation,
Inject,
Optional,
Expand Down
4 changes: 3 additions & 1 deletion src/lib/core/overlay/overlay-directives.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,13 @@ import {TemplatePortal} from '../portal/portal';
import {OverlayState} from './overlay-state';
import {
ConnectionPositionPair,
// This import is only used to define a generic type. The current TypeScript version incorrectly
// considers such imports as unused (https://github.com/Microsoft/TypeScript/issues/14953)
// tslint:disable-next-line:no-unused-variable
ConnectedOverlayPositionChange
} from './position/connected-position';
import {ConnectedPositionStrategy} from './position/connected-position-strategy';
import {Directionality, Direction} from '../bidi/index';
import {Scrollable} from './scroll/scrollable';
import {ScrollStrategy} from './scroll/scroll-strategy';
import {coerceBooleanProperty} from '@angular/cdk';
import {ESCAPE} from '../keyboard/keycodes';
Expand Down
3 changes: 0 additions & 3 deletions src/lib/core/overlay/overlay.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,7 @@ import {
OverlayContainer,
Overlay,
PositionStrategy,
ViewportRuler,
ScrollStrategy,
ScrollDispatcher,
} from './index';


Expand Down Expand Up @@ -336,7 +334,6 @@ describe('Overlay', () => {
overlayRef.attach(componentPortal);
viewContainerFixture.detectChanges();

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

overlayRef.backdropClick().subscribe(undefined, undefined, completeHandler);
Expand Down
1 change: 0 additions & 1 deletion src/lib/core/overlay/scroll/scroll-strategy-options.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
*/

import {Injectable} from '@angular/core';
import {ScrollStrategy} from './scroll-strategy';
import {CloseScrollStrategy} from './close-scroll-strategy';
import {NoopScrollStrategy} from './noop-scroll-strategy';
import {BlockScrollStrategy} from './block-scroll-strategy';
Expand Down
14 changes: 14 additions & 0 deletions src/lib/core/testing/month-constants.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
/**
* @license
* Copyright Google Inc. All Rights Reserved.
*
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.io/license
*/

/**
* When constructing a Date, the month is zero-based. This can be confusing, since people are
* used to seeing them one-based. So we create these aliases to make writing the tests easier.
*/
export const JAN = 0, FEB = 1, MAR = 2, APR = 3, MAY = 4, JUN = 5, JUL = 6, AUG = 7, SEP = 8,
OCT = 9, NOV = 10, DEC = 11;
8 changes: 1 addition & 7 deletions src/lib/datepicker/calendar.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,7 @@ import {MdDatepickerIntl} from './datepicker-intl';
import {MdNativeDateModule} from '../core/datetime/index';
import {NoConflictStyleCompatibilityMode} from '../core';
import {MdButtonModule} from '../button/index';


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

import {AUG, DEC, FEB, JAN, JUL, NOV, MAR, MAY, JUN, SEP} from '../core/testing/month-constants';

describe('MdCalendar', () => {
beforeEach(async(() => {
Expand Down
8 changes: 1 addition & 7 deletions src/lib/datepicker/datepicker.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,7 @@ import {MdInputModule} from '../input/index';
import {MdNativeDateModule, DateAdapter, NativeDateAdapter} from '../core/datetime/index';
import {ESCAPE} from '../core';
import {dispatchFakeEvent, dispatchMouseEvent, dispatchKeyboardEvent} from '@angular/cdk/testing';


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

import {DEC, JAN} from '../core/testing/month-constants';

describe('MdDatepicker', () => {
describe('with MdNativeDateModule', () => {
Expand Down
1 change: 0 additions & 1 deletion src/lib/datepicker/datepicker.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@ import {MdDialogRef} from '../dialog/dialog-ref';
import {PositionStrategy} from '../core/overlay/position/position-strategy';
import {MdDatepickerInput} from './datepicker-input';
import {Subscription} from 'rxjs/Subscription';
import {MdDialogConfig} from '../dialog/dialog-config';
import {DateAdapter} from '../core/datetime/index';
import {createMissingDateImplError} from './datepicker-errors';
import {ESCAPE} from '../core/keyboard/keycodes';
Expand Down
8 changes: 1 addition & 7 deletions src/lib/datepicker/month-view.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,7 @@ import {By} from '@angular/platform-browser';
import {MdMonthView} from './month-view';
import {MdCalendarBody} from './calendar-body';
import {MdNativeDateModule, DateAdapter, NativeDateAdapter} from '../core/datetime/index';


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

import {JAN, MAR} from '../core/testing/month-constants';

describe('MdMonthView', () => {
beforeEach(async(() => {
Expand Down
8 changes: 1 addition & 7 deletions src/lib/datepicker/year-view.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,7 @@ import {By} from '@angular/platform-browser';
import {MdYearView} from './year-view';
import {MdCalendarBody} from './calendar-body';
import {MdNativeDateModule, DateAdapter, NativeDateAdapter} from '../core/datetime/index';


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

import {FEB, JAN, MAR} from '../core/testing/month-constants';

describe('MdYearView', () => {
beforeEach(async(() => {
Expand Down
1 change: 0 additions & 1 deletion src/lib/dialog/dialog-container.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ import {
ViewChild,
ViewEncapsulation,
NgZone,
OnDestroy,
ElementRef,
EventEmitter,
Inject,
Expand Down
2 changes: 0 additions & 2 deletions src/lib/dialog/dialog-injector.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,6 @@
*/

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

/** Custom injector type specifically for instantiating components with a dialog. */
export class DialogInjector implements Injector {
Expand Down
2 changes: 1 addition & 1 deletion src/lib/dialog/dialog.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -319,7 +319,7 @@ describe('MdDialog', () => {
});

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

viewContainerFixture.detectChanges();

Expand Down
2 changes: 1 addition & 1 deletion src/lib/expansion/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
* found in the LICENSE file at https://angular.io/license
*/

import {NgModule, ModuleWithProviders} from '@angular/core';
import {NgModule} from '@angular/core';
import {CommonModule} from '@angular/common';
import {CompatibilityModule, UNIQUE_SELECTION_DISPATCHER_PROVIDER} from '../core';
import {
Expand Down
1 change: 0 additions & 1 deletion src/lib/paginator/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
import {NgModule} from '@angular/core';
import {CommonModule} from '@angular/common';
import {FormsModule} from '@angular/forms';
import {MdCommonModule, OverlayModule} from '../core';
import {MdButtonModule} from '../button/index';
import {MdSelectModule} from '../select/index';
import {MdPaginator} from './paginator';
Expand Down
9 changes: 0 additions & 9 deletions src/lib/paginator/paginator.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -248,15 +248,6 @@ class MdPaginatorApp {
}
}

@Component({
template: `
<md-paginator [length]="100"></md-paginator>
`,
})
class MdPaginatorWithoutPageSizeOrOptionsApp {
@ViewChild(MdPaginator) mdPaginator: MdPaginator;
}

@Component({
template: `
<md-paginator [pageSizeOptions]="[10, 20, 30]"></md-paginator>
Expand Down
2 changes: 1 addition & 1 deletion src/lib/sidenav/sidenav.spec.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import {fakeAsync, async, tick, ComponentFixture, TestBed} from '@angular/core/testing';
import {Component, ElementRef, ViewChild} from '@angular/core';
import {By} from '@angular/platform-browser';
import {MdSidenav, MdSidenavModule, MdSidenavToggleResult, MdSidenavContainer} from './index';
import {MdSidenav, MdSidenavModule, MdSidenavContainer} from './index';
import {A11yModule} from '../core/a11y/index';
import {PlatformModule} from '../core/platform/index';
import {ESCAPE} from '../core/keyboard/keycodes';
Expand Down
1 change: 0 additions & 1 deletion src/lib/snack-bar/snack-bar-container.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ import {
import {
BasePortalHost,
ComponentPortal,
TemplatePortal,
PortalHostDirective,
} from '../core';
import {MdSnackBarConfig} from './snack-bar-config';
Expand Down
1 change: 0 additions & 1 deletion src/lib/tabs/tab-header.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@ import {
import {MdTabLabelWrapper} from './tab-label-wrapper';
import {MdInkBar} from './ink-bar';
import {Subscription} from 'rxjs/Subscription';
import {applyCssTransform} from '../core/style/apply-transform';
import {auditTime, startWith} from '../core/rxjs/index';
import {of as observableOf} from 'rxjs/observable/of';
import {merge} from 'rxjs/observable/merge';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import {Component, ElementRef, ViewChild} from '@angular/core';
import {DataSource} from '@angular/cdk';
import {MdSort} from '@angular/material';
import {BehaviorSubject} from 'rxjs/BehaviorSubject';
import {Observable} from 'rxjs/Observable';
import 'rxjs/add/operator/startWith';
Expand Down
28 changes: 0 additions & 28 deletions src/tsconfig.json

This file was deleted.

Loading

0 comments on commit 589dc05

Please sign in to comment.