fix(compiler): generated code should pass noUnusedLocals check

Closes #14797
This commit is contained in:
Tobias Bosch
2017-03-13 11:32:07 -07:00
committed by Chuck Jazdzewski
parent 06fc42bc44
commit 50ab06e29d
11 changed files with 60 additions and 34 deletions

View File

@ -6,7 +6,6 @@
* found in the LICENSE file at https://angular.io/license
*/
import {NgFor, NgIf} from '@angular/common';
import {Component, Inject, LOCALE_ID, TRANSLATIONS_FORMAT} from '@angular/core';

View File

@ -6,7 +6,6 @@
* found in the LICENSE file at https://angular.io/license
*/
import {platformBrowser} from '@angular/platform-browser';
import {BasicComp} from './basic';
import {MainModuleNgFactory} from './module.ngfactory';

View File

@ -6,8 +6,7 @@
* found in the LICENSE file at https://angular.io/license
*/
import {LowerCasePipe, NgIf} from '@angular/common';
import {ANALYZE_FOR_ENTRY_COMPONENTS, Component, ComponentFactoryResolver, Directive, Inject, Injectable, InjectionToken, Input, ModuleWithProviders, NgModule, Pipe} from '@angular/core';
import {ANALYZE_FOR_ENTRY_COMPONENTS, Component, Directive, Injectable, InjectionToken, Input, NgModule, Pipe} from '@angular/core';
@Injectable()
export class SomeService {

View File

@ -6,7 +6,6 @@
* found in the LICENSE file at https://angular.io/license
*/
import {NgFor} from '@angular/common';
import {Component, Directive, QueryList, ViewChild, ViewChildren} from '@angular/core';
@Component({selector: 'comp-for-child-query', template: 'child'})

View File

@ -7,7 +7,7 @@
*/
import './init';
import {DebugElement, QueryList} from '@angular/core';
import {QueryList} from '@angular/core';
import {By} from '@angular/platform-browser';
import {CompForChildQuery, CompWithChildQuery} from '../src/queries';
import {createComponent} from './util';
@ -16,7 +16,7 @@ describe('child queries', () => {
it('should support compiling child queries', () => {
const childQueryCompFixture = createComponent(CompWithChildQuery);
const debugElement = childQueryCompFixture.debugElement;
const compWithChildren = debugElement.query(By.directive(CompWithChildQuery));
debugElement.query(By.directive(CompWithChildQuery));
expect(childQueryCompFixture.componentInstance.child).toBeDefined();
expect(childQueryCompFixture.componentInstance.child instanceof CompForChildQuery).toBe(true);
@ -25,7 +25,7 @@ describe('child queries', () => {
it('should support compiling children queries', () => {
const childQueryCompFixture = createComponent(CompWithChildQuery);
const debugElement = childQueryCompFixture.debugElement;
const compWithChildren = debugElement.query(By.directive(CompWithChildQuery));
debugElement.query(By.directive(CompWithChildQuery));
childQueryCompFixture.detectChanges();

View File

@ -15,7 +15,7 @@ import * as path from 'path';
import * as ts from 'typescript';
import * as assert from 'assert';
import {tsc} from '@angular/tsc-wrapped/src/tsc';
import {AngularCompilerOptions, CodeGenerator, CompilerHostContext, NodeCompilerHostContext, __NGTOOLS_PRIVATE_API_2} from '@angular/compiler-cli';
import {NodeCompilerHostContext, __NGTOOLS_PRIVATE_API_2} from '@angular/compiler-cli';
const glob = require('glob');

View File

@ -6,7 +6,7 @@
* found in the LICENSE file at https://angular.io/license
*/
import {NgModuleFactory, NgModuleRef} from '@angular/core';
import {NgModuleRef} from '@angular/core';
import {ComponentFixture} from '@angular/core/testing';
import {platformServer} from '@angular/platform-server';

View File

@ -16,7 +16,8 @@
"lib": ["es6", "dom"],
"baseUrl": ".",
// Prevent scanning up the directory tree for types
"typeRoots": ["node_modules/@types"]
"typeRoots": ["node_modules/@types"],
"noUnusedLocals": true
},
"files": [