build: enable TSLint on the packages folder
This commit is contained in:
parent
e64b54b67b
commit
9479a106bb
|
@ -201,7 +201,7 @@ export class AnimationAstBuilderVisitor implements AnimationDslVisitor {
|
|||
} else {
|
||||
styles.push(styleTuple as ɵStyleData);
|
||||
}
|
||||
})
|
||||
});
|
||||
} else {
|
||||
styles.push(metadata.styles);
|
||||
}
|
||||
|
|
|
@ -29,8 +29,8 @@ export class AnimationEngine {
|
|||
this._transitionEngine = new TransitionAnimationEngine(driver, normalizer);
|
||||
this._timelineEngine = new TimelineAnimationEngine(driver, normalizer);
|
||||
|
||||
this._transitionEngine.onRemovalComplete =
|
||||
(element: any, context: any) => { this.onRemovalComplete(element, context); }
|
||||
this._transitionEngine.onRemovalComplete = (element: any, context: any) =>
|
||||
this.onRemovalComplete(element, context);
|
||||
}
|
||||
|
||||
registerTrigger(
|
||||
|
|
|
@ -490,6 +490,7 @@ export class TransitionAnimationEngine {
|
|||
// this method is designed to be overridden by the code that uses this engine
|
||||
public onRemovalComplete = (element: any, context: any) => {};
|
||||
|
||||
/** @internal */
|
||||
_onRemovalComplete(element: any, context: any) { this.onRemovalComplete(element, context); }
|
||||
|
||||
constructor(public driver: AnimationDriver, private _normalizer: AnimationStyleNormalizer) {}
|
||||
|
|
|
@ -427,17 +427,17 @@ export function main() {
|
|||
|
||||
it('should throw an error when an input variable is not provided when invoked and is not a default value',
|
||||
() => {
|
||||
expect(() => {invokeAnimationSequence(rootElement, [style({color: '{{ color }}'})])})
|
||||
expect(() => invokeAnimationSequence(rootElement, [style({color: '{{ color }}'})]))
|
||||
.toThrowError(/Please provide a value for the animation param color/);
|
||||
|
||||
expect(
|
||||
() => {invokeAnimationSequence(
|
||||
() => invokeAnimationSequence(
|
||||
rootElement,
|
||||
[
|
||||
style({color: '{{ start }}'}),
|
||||
animate('{{ time }}', style({color: '{{ end }}'})),
|
||||
],
|
||||
buildParams({start: 'blue', end: 'red'}))})
|
||||
buildParams({start: 'blue', end: 'red'})))
|
||||
.toThrowError(/Please provide a value for the animation param time/);
|
||||
});
|
||||
});
|
||||
|
|
|
@ -182,7 +182,7 @@ export function main() {
|
|||
const trans = buildTransition(result, element, false, true) !;
|
||||
expect(trans.timelines[0].keyframes).toEqual([
|
||||
{offset: 0, color: 'red'}, {offset: 1, color: 'green'}
|
||||
])
|
||||
]);
|
||||
});
|
||||
|
||||
it('should match `1` and `0` state styles on a `true <=> false` boolean transition given boolean values',
|
||||
|
@ -195,7 +195,7 @@ export function main() {
|
|||
const trans = buildTransition(result, element, false, true) !;
|
||||
expect(trans.timelines[0].keyframes).toEqual([
|
||||
{offset: 0, color: 'orange'}, {offset: 1, color: 'blue'}
|
||||
])
|
||||
]);
|
||||
});
|
||||
|
||||
describe('aliases', () => {
|
||||
|
|
|
@ -15,8 +15,11 @@ import {HttpParams} from './params';
|
|||
* All values are optional and will override default values if provided.
|
||||
*/
|
||||
interface HttpRequestInit {
|
||||
headers?: HttpHeaders, reportProgress?: boolean, params?: HttpParams,
|
||||
responseType?: 'arraybuffer'|'blob'|'json'|'text', withCredentials?: boolean,
|
||||
headers?: HttpHeaders;
|
||||
reportProgress?: boolean;
|
||||
params?: HttpParams;
|
||||
responseType?: 'arraybuffer'|'blob'|'json'|'text';
|
||||
withCredentials?: boolean;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -120,7 +120,10 @@ export interface HttpUserEvent<T> { type: HttpEventType.User; }
|
|||
*
|
||||
* @experimental
|
||||
*/
|
||||
export interface HttpJsonParseError { error: Error, text: string, }
|
||||
export interface HttpJsonParseError {
|
||||
error: Error;
|
||||
text: string;
|
||||
}
|
||||
|
||||
/**
|
||||
* Union type for all possible events on the response stream.
|
||||
|
@ -233,7 +236,7 @@ export class HttpHeaderResponse extends HttpResponseBase {
|
|||
status: update.status !== undefined ? update.status : this.status,
|
||||
statusText: update.statusText || this.statusText,
|
||||
url: update.url || this.url || undefined,
|
||||
})
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -268,27 +268,26 @@ export class HttpXhrBackend implements HttpBackend {
|
|||
|
||||
// The upload progress event handler, which is only registered if
|
||||
// progress events are enabled.
|
||||
const onUpProgress =
|
||||
(event: ProgressEvent) => {
|
||||
// Upload progress events are simpler. Begin building the progress
|
||||
// event.
|
||||
let progress: HttpUploadProgressEvent = {
|
||||
type: HttpEventType.UploadProgress,
|
||||
loaded: event.loaded,
|
||||
};
|
||||
const onUpProgress = (event: ProgressEvent) => {
|
||||
// Upload progress events are simpler. Begin building the progress
|
||||
// event.
|
||||
let progress: HttpUploadProgressEvent = {
|
||||
type: HttpEventType.UploadProgress,
|
||||
loaded: event.loaded,
|
||||
};
|
||||
|
||||
// If the total number of bytes being uploaded is available, include
|
||||
// it.
|
||||
if (event.lengthComputable) {
|
||||
progress.total = event.total;
|
||||
}
|
||||
// If the total number of bytes being uploaded is available, include
|
||||
// it.
|
||||
if (event.lengthComputable) {
|
||||
progress.total = event.total;
|
||||
}
|
||||
|
||||
// Send the event.
|
||||
observer.next(progress);
|
||||
}
|
||||
// Send the event.
|
||||
observer.next(progress);
|
||||
};
|
||||
|
||||
// By default, register for load and error events.
|
||||
xhr.addEventListener('load', onLoad);
|
||||
// By default, register for load and error events.
|
||||
xhr.addEventListener('load', onLoad);
|
||||
xhr.addEventListener('error', onError);
|
||||
|
||||
// Progress events are only enabled if requested.
|
||||
|
|
|
@ -56,11 +56,11 @@ export function main() {
|
|||
});
|
||||
describe('throws an error', () => {
|
||||
it('when request method is not JSONP',
|
||||
() => {expect(() => backend.handle(SAMPLE_REQ.clone<never>({method: 'GET'})))
|
||||
.toThrowError(JSONP_ERR_WRONG_METHOD)});
|
||||
() => expect(() => backend.handle(SAMPLE_REQ.clone<never>({method: 'GET'})))
|
||||
.toThrowError(JSONP_ERR_WRONG_METHOD));
|
||||
it('when response type is not json',
|
||||
() => {expect(() => backend.handle(SAMPLE_REQ.clone<never>({responseType: 'text'})))
|
||||
.toThrowError(JSONP_ERR_WRONG_RESPONSE_TYPE)});
|
||||
() => expect(() => backend.handle(SAMPLE_REQ.clone<never>({responseType: 'text'})))
|
||||
.toThrowError(JSONP_ERR_WRONG_RESPONSE_TYPE));
|
||||
it('when callback is never called', (done: DoneFn) => {
|
||||
backend.handle(SAMPLE_REQ).subscribe(undefined, (err: HttpErrorResponse) => {
|
||||
expect(err.status).toBe(0);
|
||||
|
@ -69,7 +69,7 @@ export function main() {
|
|||
done();
|
||||
});
|
||||
document.mockLoad();
|
||||
})
|
||||
});
|
||||
});
|
||||
});
|
||||
}
|
||||
|
|
|
@ -13,7 +13,7 @@ export function main() {
|
|||
describe('initialization', () => {
|
||||
it('should be empty at construction', () => {
|
||||
const body = new HttpParams();
|
||||
expect(body.toString()).toEqual('')
|
||||
expect(body.toString()).toEqual('');
|
||||
});
|
||||
|
||||
it('should parse an existing url', () => {
|
||||
|
|
|
@ -271,7 +271,7 @@ export function main() {
|
|||
done();
|
||||
});
|
||||
factory.mock.mockFlush(200, 'OK', 'Test');
|
||||
})
|
||||
});
|
||||
});
|
||||
describe('corrects for quirks', () => {
|
||||
it('by normalizing 1223 status to 204', (done: DoneFn) => {
|
||||
|
|
|
@ -64,7 +64,7 @@ export function main() {
|
|||
});
|
||||
describe('HttpXsrfCookieExtractor', () => {
|
||||
let document: {[key: string]: string};
|
||||
let extractor: HttpXsrfCookieExtractor
|
||||
let extractor: HttpXsrfCookieExtractor;
|
||||
beforeEach(() => {
|
||||
document = {
|
||||
cookie: 'XSRF-TOKEN=test',
|
||||
|
|
|
@ -126,7 +126,7 @@ export class HttpClientTestingBackend implements HttpBackend, HttpTestingControl
|
|||
const requests = open.map(testReq => {
|
||||
const url = testReq.request.urlWithParams.split('?')[0];
|
||||
const method = testReq.request.method;
|
||||
return `${method} ${url}`
|
||||
return `${method} ${url}`;
|
||||
})
|
||||
.join(', ');
|
||||
throw new Error(`Expected no open requests, found ${open.length}: ${requests}`);
|
||||
|
|
|
@ -96,7 +96,7 @@ export class CodeGenerator {
|
|||
}
|
||||
}
|
||||
if (!transContent) {
|
||||
missingTranslation = MissingTranslationStrategy.Ignore
|
||||
missingTranslation = MissingTranslationStrategy.Ignore;
|
||||
}
|
||||
const {compiler: aotCompiler} = compiler.createAotCompiler(ngCompilerHost, {
|
||||
translations: transContent,
|
||||
|
|
|
@ -203,11 +203,9 @@ class TypeCheckingHost implements ts.CompilerHost {
|
|||
}
|
||||
|
||||
writeFile: ts.WriteFileCallback =
|
||||
() => { throw new Error('Unexpected write in diagnostic program'); }
|
||||
() => { throw new Error('Unexpected write in diagnostic program'); };
|
||||
|
||||
getCurrentDirectory(): string {
|
||||
return this.host.getCurrentDirectory();
|
||||
}
|
||||
getCurrentDirectory(): string { return this.host.getCurrentDirectory(); }
|
||||
|
||||
getDirectories(path: string): string[] { return this.host.getDirectories(path); }
|
||||
|
||||
|
|
|
@ -136,12 +136,11 @@ export function performCompilation(
|
|||
|
||||
const rootFileNames = files.map(f => path.normalize(f));
|
||||
|
||||
const addGeneratedFileName =
|
||||
(fileName: string) => {
|
||||
if (fileName.startsWith(basePath) && TS_EXT.exec(fileName)) {
|
||||
rootFileNames.push(fileName);
|
||||
}
|
||||
}
|
||||
const addGeneratedFileName = (fileName: string) => {
|
||||
if (fileName.startsWith(basePath) && TS_EXT.exec(fileName)) {
|
||||
rootFileNames.push(fileName);
|
||||
}
|
||||
};
|
||||
|
||||
if (ngOptions.flatModuleOutFile && !ngOptions.skipMetadataEmit) {
|
||||
const {host: bundleHost, indexName, errors} =
|
||||
|
|
|
@ -63,7 +63,7 @@ function transformSourceFile(
|
|||
const result = ts.visitEachChild(node, visitNode, context);
|
||||
|
||||
if (declarations.length) {
|
||||
inserts.push({priorTo: result, declarations})
|
||||
inserts.push({priorTo: result, declarations});
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
@ -113,7 +113,7 @@ export function getExpressionLoweringTransformFactory(requestsMap: RequestsMap):
|
|||
return (context: ts.TransformationContext) => (sourceFile: ts.SourceFile): ts.SourceFile => {
|
||||
const requests = requestsMap.getRequests(sourceFile);
|
||||
if (requests && requests.size) {
|
||||
return transformSourceFile(sourceFile, requests, context)
|
||||
return transformSourceFile(sourceFile, requests, context);
|
||||
}
|
||||
return sourceFile;
|
||||
};
|
||||
|
@ -155,12 +155,11 @@ export class LowerMetadataCache implements RequestsMap {
|
|||
let identNumber = 0;
|
||||
const freshIdent = () => '\u0275' + identNumber++;
|
||||
const requests = new Map<number, LoweringRequest>();
|
||||
const replaceNode =
|
||||
(node: ts.Node) => {
|
||||
const name = freshIdent();
|
||||
requests.set(node.pos, {name, kind: node.kind, location: node.pos, end: node.end});
|
||||
return {__symbolic: 'reference', name};
|
||||
}
|
||||
const replaceNode = (node: ts.Node) => {
|
||||
const name = freshIdent();
|
||||
requests.set(node.pos, {name, kind: node.kind, location: node.pos, end: node.end});
|
||||
return {__symbolic: 'reference', name};
|
||||
};
|
||||
|
||||
const substituteExpression = (value: MetadataValue, node: ts.Node): MetadataValue => {
|
||||
if (node.kind === ts.SyntaxKind.ArrowFunction ||
|
||||
|
|
|
@ -9,8 +9,7 @@
|
|||
import * as path from 'path';
|
||||
import * as ts from 'typescript';
|
||||
|
||||
import {ModuleFilenameResolver} from './api';
|
||||
import {CompilerOptions} from './api';
|
||||
import {CompilerOptions, ModuleFilenameResolver} from './api';
|
||||
|
||||
const EXT = /(\.ts|\.d\.ts|\.js|\.jsx|\.tsx)$/;
|
||||
const DTS = /\.d\.ts$/;
|
||||
|
|
|
@ -32,7 +32,7 @@ export class TypeScriptNodeEmitter {
|
|||
}
|
||||
statements[0] = ts.setSyntheticLeadingComments(
|
||||
statements[0],
|
||||
[{kind: ts.SyntaxKind.MultiLineCommentTrivia, text: preamble, pos: -1, end: -1}])
|
||||
[{kind: ts.SyntaxKind.MultiLineCommentTrivia, text: preamble, pos: -1, end: -1}]);
|
||||
}
|
||||
return [newSourceFile, converter.getNodeMap()];
|
||||
}
|
||||
|
@ -279,7 +279,7 @@ class _NodeEmitterVisitor implements StatementVisitor, ExpressionVisitor {
|
|||
return this.record(
|
||||
expr, ts.createCall(
|
||||
expr.fn.visitExpression(this, null), /* typeArguments */ undefined,
|
||||
expr.args.map(arg => arg.visitExpression(this, null))))
|
||||
expr.args.map(arg => arg.visitExpression(this, null))));
|
||||
}
|
||||
|
||||
visitInstantiateExpr(expr: InstantiateExpr): RecordedNode<ts.NewExpression> {
|
||||
|
|
|
@ -15,8 +15,7 @@ import * as ts from 'typescript';
|
|||
import {CompilerHost as AotCompilerHost, CompilerHostContext} from '../compiler_host';
|
||||
import {TypeChecker} from '../diagnostics/check_types';
|
||||
|
||||
import {CompilerHost, CompilerOptions, DiagnosticCategory} from './api';
|
||||
import {Diagnostic, EmitFlags, Program} from './api';
|
||||
import {CompilerHost, CompilerOptions, Diagnostic, DiagnosticCategory, EmitFlags, Program} from './api';
|
||||
import {LowerMetadataCache, getExpressionLoweringTransformFactory} from './lower_expressions';
|
||||
import {getAngularEmitterTransformFactory} from './node_emitter_transform';
|
||||
|
||||
|
@ -144,7 +143,7 @@ class AngularCompilerProgram implements Program {
|
|||
}
|
||||
|
||||
private get structuralDiagnostics(): Diagnostic[] {
|
||||
return this.analyzedModules && this._structuralDiagnostics
|
||||
return this.analyzedModules && this._structuralDiagnostics;
|
||||
}
|
||||
|
||||
private get stubs(): GeneratedFile[] {
|
||||
|
@ -171,7 +170,7 @@ class AngularCompilerProgram implements Program {
|
|||
}
|
||||
|
||||
private get generatedFiles(): GeneratedFile[] {
|
||||
return this._generatedFiles || (this._generatedFiles = this.generateFiles())
|
||||
return this._generatedFiles || (this._generatedFiles = this.generateFiles());
|
||||
}
|
||||
|
||||
private get typeChecker(): TypeChecker {
|
||||
|
@ -343,7 +342,7 @@ function createProgramWithStubsHost(
|
|||
generatedFiles: GeneratedFile[], originalProgram: ts.Program,
|
||||
originalHost: ts.CompilerHost): ts.CompilerHost {
|
||||
interface FileData {
|
||||
g: GeneratedFile
|
||||
g: GeneratedFile;
|
||||
s?: ts.SourceFile;
|
||||
}
|
||||
return new class implements ts.CompilerHost {
|
||||
|
|
|
@ -110,12 +110,14 @@ const summaryResolver = new AotSummaryResolver(
|
|||
staticSymbolCache);
|
||||
|
||||
export class DiagnosticContext {
|
||||
// tslint:disable
|
||||
_analyzedModules: NgAnalyzedModules;
|
||||
_staticSymbolResolver: StaticSymbolResolver|undefined;
|
||||
_reflector: StaticReflector|undefined;
|
||||
_errors: {e: any, path?: string}[] = [];
|
||||
_resolver: CompileMetadataResolver|undefined;
|
||||
_refletor: StaticReflector;
|
||||
// tslint:enable
|
||||
|
||||
constructor(
|
||||
public service: ts.LanguageService, public program: ts.Program,
|
||||
|
|
|
@ -45,7 +45,7 @@ describe('symbol query', () => {
|
|||
options.basePath = '/quickstart';
|
||||
const aotHost = new CompilerHost(program, options, host, {verboseInvalidExpression: true});
|
||||
context = new DiagnosticContext(service, program, checker, aotHost);
|
||||
query = getSymbolQuery(program, checker, sourceFile, emptyPipes)
|
||||
query = getSymbolQuery(program, checker, sourceFile, emptyPipes);
|
||||
});
|
||||
|
||||
it('should be able to get undefined for an unknown symbol', () => {
|
||||
|
|
|
@ -437,12 +437,11 @@ describe('ngc command-line', () => {
|
|||
throw new Error(`Expected ${fileName} to be emitted (outDir: ${outDir})`);
|
||||
}
|
||||
};
|
||||
const shouldNotExist =
|
||||
(fileName: string) => {
|
||||
if (fs.existsSync(path.resolve(outDir, fileName))) {
|
||||
throw new Error(`Did not expect ${fileName} to be emitted (outDir: ${outDir})`);
|
||||
}
|
||||
}
|
||||
const shouldNotExist = (fileName: string) => {
|
||||
if (fs.existsSync(path.resolve(outDir, fileName))) {
|
||||
throw new Error(`Did not expect ${fileName} to be emitted (outDir: ${outDir})`);
|
||||
}
|
||||
};
|
||||
|
||||
it('should be able to generate a flat module library', () => {
|
||||
writeConfig(`
|
||||
|
|
|
@ -14,5 +14,5 @@ export interface AotCompilerOptions {
|
|||
translations?: string;
|
||||
missingTranslation?: MissingTranslationStrategy;
|
||||
enableLegacyTemplate?: boolean;
|
||||
enableSummariesForJit?: boolean
|
||||
enableSummariesForJit?: boolean;
|
||||
}
|
||||
|
|
|
@ -621,7 +621,7 @@ export class StaticReflector implements CompileReflector {
|
|||
}
|
||||
return simplifyInContext(context, value, depth, references + 1);
|
||||
}
|
||||
return simplify(value)
|
||||
return simplify(value);
|
||||
});
|
||||
}
|
||||
return IGNORE;
|
||||
|
|
|
@ -142,7 +142,7 @@ export function findNode(nodes: Node[], position: number): HtmlAstPath {
|
|||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
visitAll(visitor, nodes);
|
||||
|
||||
|
|
|
@ -228,7 +228,7 @@ export class ReadVarExpr extends Expression {
|
|||
|
||||
set(value: Expression): WriteVarExpr {
|
||||
if (!this.name) {
|
||||
throw new Error(`Built in variable ${this.builtin} can not be assigned to.`)
|
||||
throw new Error(`Built in variable ${this.builtin} can not be assigned to.`);
|
||||
}
|
||||
return new WriteVarExpr(this.name, value, null, this.sourceSpan);
|
||||
}
|
||||
|
|
|
@ -28,7 +28,7 @@ describe('compiler (unbundled Angular)', () => {
|
|||
|
||||
describe('aot source mapping', () => {
|
||||
const componentPath = '/app/app.component.ts';
|
||||
const ngComponentPath = 'ng:///app/app.component.ts'
|
||||
const ngComponentPath = 'ng:///app/app.component.ts';
|
||||
|
||||
let rootDir: MockDirectory;
|
||||
let appDir: MockDirectory;
|
||||
|
|
|
@ -490,7 +490,7 @@ export function main() {
|
|||
.toEqual(
|
||||
'<span someAttr="ok">foo</span><div>{count, plural, =0 {<p title="foo"></p>}}</div>');
|
||||
});
|
||||
})
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
|
|
|
@ -31,5 +31,5 @@ export function main() {
|
|||
expect(Object.keys(args).length).toBe(20);
|
||||
});
|
||||
});
|
||||
})
|
||||
});
|
||||
}
|
|
@ -6,23 +6,21 @@
|
|||
* found in the LICENSE file at https://angular.io/license
|
||||
*/
|
||||
|
||||
import {ParseError, ParseErrorLevel, ParseLocation, ParseSourceFile, ParseSourceSpan} from '../src/parse_util'
|
||||
import {ParseError, ParseErrorLevel, ParseLocation, ParseSourceFile, ParseSourceSpan} from '../src/parse_util';
|
||||
|
||||
export function main() {
|
||||
describe(
|
||||
'ParseError',
|
||||
() => {
|
||||
it('should reflect the level in the message', () => {
|
||||
const file = new ParseSourceFile(`foo\nbar\nfoo`, 'url');
|
||||
const start = new ParseLocation(file, 4, 1, 0);
|
||||
const end = new ParseLocation(file, 6, 1, 2);
|
||||
const span = new ParseSourceSpan(start, end);
|
||||
describe('ParseError', () => {
|
||||
it('should reflect the level in the message', () => {
|
||||
const file = new ParseSourceFile(`foo\nbar\nfoo`, 'url');
|
||||
const start = new ParseLocation(file, 4, 1, 0);
|
||||
const end = new ParseLocation(file, 6, 1, 2);
|
||||
const span = new ParseSourceSpan(start, end);
|
||||
|
||||
const fatal = new ParseError(span, 'fatal', ParseErrorLevel.ERROR);
|
||||
expect(fatal.toString()).toEqual('fatal ("foo\n[ERROR ->]bar\nfoo"): url@1:0');
|
||||
const fatal = new ParseError(span, 'fatal', ParseErrorLevel.ERROR);
|
||||
expect(fatal.toString()).toEqual('fatal ("foo\n[ERROR ->]bar\nfoo"): url@1:0');
|
||||
|
||||
const warning = new ParseError(span, 'warning', ParseErrorLevel.WARNING);
|
||||
expect(warning.toString()).toEqual('warning ("foo\n[WARNING ->]bar\nfoo"): url@1:0');
|
||||
});
|
||||
});
|
||||
const warning = new ParseError(span, 'warning', ParseErrorLevel.WARNING);
|
||||
expect(warning.toString()).toEqual('warning ("foo\n[WARNING ->]bar\nfoo"): url@1:0');
|
||||
});
|
||||
});
|
||||
}
|
|
@ -45,11 +45,10 @@ export class ApplicationInitStatus {
|
|||
|
||||
const asyncInitPromises: Promise<any>[] = [];
|
||||
|
||||
const complete =
|
||||
() => {
|
||||
this._done = true;
|
||||
this.resolve();
|
||||
}
|
||||
const complete = () => {
|
||||
this._done = true;
|
||||
this.resolve();
|
||||
};
|
||||
|
||||
if (this.appInits) {
|
||||
for (let i = 0; i < this.appInits.length; i++) {
|
||||
|
|
|
@ -52,11 +52,9 @@ export class DefaultIterableDiffer<V> implements IterableDiffer<V>, IterableChan
|
|||
// Keeps track of records where custom track by is the same, but item identity has changed
|
||||
private _identityChangesHead: IterableChangeRecord_<V>|null = null;
|
||||
private _identityChangesTail: IterableChangeRecord_<V>|null = null;
|
||||
private _trackByFn: TrackByFunction<V>
|
||||
private _trackByFn: TrackByFunction<V>;
|
||||
|
||||
constructor(trackByFn?: TrackByFunction<V>) {
|
||||
this._trackByFn = trackByFn || trackByIdentity;
|
||||
}
|
||||
constructor(trackByFn?: TrackByFunction<V>) { this._trackByFn = trackByFn || trackByIdentity; }
|
||||
|
||||
get collection() { return this._collection; }
|
||||
|
||||
|
|
|
@ -466,7 +466,8 @@ export function createNgModuleRef(
|
|||
class NgModuleRef_ implements NgModuleData, InternalNgModuleRef<any> {
|
||||
private _destroyListeners: (() => void)[] = [];
|
||||
private _destroyed: boolean = false;
|
||||
public _providers: any[];
|
||||
/** @internal */
|
||||
_providers: any[];
|
||||
|
||||
constructor(
|
||||
private _moduleType: Type<any>, public _parent: Injector,
|
||||
|
|
|
@ -1882,7 +1882,7 @@ export function main() {
|
|||
class Cmp {
|
||||
exp: string;
|
||||
log: any[] = [];
|
||||
callback = (event: any) => { this.log.push(`${event.phaseName} => ${event.toState}`); }
|
||||
callback = (event: any) => this.log.push(`${event.phaseName} => ${event.toState}`);
|
||||
}
|
||||
|
||||
TestBed.configureTestingModule({
|
||||
|
|
|
@ -35,7 +35,7 @@ export function main() {
|
|||
return () => {
|
||||
const initStatus = injector.get(ApplicationInitStatus);
|
||||
initStatus.donePromise.then(() => { expect(completerResolver).toBe(true); });
|
||||
}
|
||||
};
|
||||
};
|
||||
promise = new Promise((res) => { resolve = res; });
|
||||
TestBed.configureTestingModule({
|
||||
|
|
|
@ -1353,7 +1353,7 @@ export function main() {
|
|||
tpl: TemplateRef<any>;
|
||||
|
||||
@Input()
|
||||
outerTpl: TemplateRef<any>
|
||||
outerTpl: TemplateRef<any>;
|
||||
|
||||
constructor(public cdRef: ChangeDetectorRef) {}
|
||||
log(id: string) { log.push(`inner-${id}`); }
|
||||
|
|
|
@ -83,14 +83,17 @@ export class DefaultValueAccessor implements ControlValueAccessor {
|
|||
this._renderer.setProperty(this._elementRef.nativeElement, 'disabled', isDisabled);
|
||||
}
|
||||
|
||||
/** @internal */
|
||||
_handleInput(value: any): void {
|
||||
if (!this._compositionMode || (this._compositionMode && !this._composing)) {
|
||||
this.onChange(value);
|
||||
}
|
||||
}
|
||||
|
||||
/** @internal */
|
||||
_compositionStart(): void { this._composing = true; }
|
||||
|
||||
/** @internal */
|
||||
_compositionEnd(value: any): void {
|
||||
this._composing = false;
|
||||
this._compositionMode && this.onChange(value);
|
||||
|
|
|
@ -41,7 +41,7 @@ export function main() {
|
|||
return e;
|
||||
}
|
||||
|
||||
function otherObservableValidator() { return of ({'other': true}) }
|
||||
function otherObservableValidator() { return of ({'other': true}); }
|
||||
|
||||
describe('FormGroup', () => {
|
||||
describe('value', () => {
|
||||
|
|
|
@ -1116,7 +1116,7 @@ export function main() {
|
|||
|
||||
tick(100);
|
||||
expect(resultArr.length)
|
||||
.toEqual(2, `Expected original observable to be canceled on the next value change.`)
|
||||
.toEqual(2, `Expected original observable to be canceled on the next value change.`);
|
||||
}));
|
||||
|
||||
|
||||
|
|
|
@ -1,3 +1,11 @@
|
|||
/**
|
||||
* @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
|
||||
*/
|
||||
|
||||
import {Component, Directive, EventEmitter, Input, Output, Type} from '@angular/core';
|
||||
import {ComponentFixture, TestBed, async, fakeAsync, tick} from '@angular/core/testing';
|
||||
import {AbstractControl, ControlValueAccessor, FormControl, FormGroup, FormsModule, NG_VALIDATORS, NG_VALUE_ACCESSOR, NgControl, NgForm, ReactiveFormsModule, Validators} from '@angular/forms';
|
||||
|
|
|
@ -123,7 +123,7 @@ export function main() {
|
|||
// depending on the browser, we might ge an exception
|
||||
}
|
||||
try {
|
||||
sanitizeHtml(defaultDoc, '<form><input name="nextSibling" /></form>')
|
||||
sanitizeHtml(defaultDoc, '<form><input name="nextSibling" /></form>');
|
||||
} catch (e) {
|
||||
// depending on the browser, we might ge an exception
|
||||
}
|
||||
|
|
|
@ -444,8 +444,11 @@ function match(segmentGroup: UrlSegmentGroup, route: Route, segments: UrlSegment
|
|||
|
||||
if (!res) {
|
||||
return {
|
||||
matched: false, consumedSegments: <any[]>[], lastChild: 0, positionalParamSegments: {},
|
||||
}
|
||||
matched: false,
|
||||
consumedSegments: <any[]>[],
|
||||
lastChild: 0,
|
||||
positionalParamSegments: {},
|
||||
};
|
||||
}
|
||||
|
||||
return {
|
||||
|
|
|
@ -1128,7 +1128,7 @@ class ActivateRoutes {
|
|||
const children: {[outletName: string]: any} = nodeChildrenAsMap(route);
|
||||
const contexts = route.value.component ? context.children : parentContexts;
|
||||
|
||||
forEach(children, (v: any, k: string) => {this.deactivateRouteAndItsChildren(v, contexts)});
|
||||
forEach(children, (v: any, k: string) => this.deactivateRouteAndItsChildren(v, contexts));
|
||||
|
||||
if (context.outlet) {
|
||||
// Destroy the component
|
||||
|
|
|
@ -64,7 +64,7 @@ export function forEach<K, V>(map: {[key: string]: V}, callback: (v: V, k: strin
|
|||
export function waitForMap<A, B>(
|
||||
obj: {[k: string]: A}, fn: (k: string, a: A) => Observable<B>): Observable<{[k: string]: B}> {
|
||||
if (Object.keys(obj).length === 0) {
|
||||
return of ({})
|
||||
return of ({});
|
||||
}
|
||||
|
||||
const waitHead: Observable<B>[] = [];
|
||||
|
|
|
@ -1070,7 +1070,7 @@ describe('Integration', () => {
|
|||
return map.call(of (null), () => {
|
||||
log.push('resolver2');
|
||||
observer.next(null);
|
||||
observer.complete()
|
||||
observer.complete();
|
||||
});
|
||||
}
|
||||
},
|
||||
|
|
|
@ -259,9 +259,9 @@ describe('Evaluator', () => {
|
|||
const expr = findVar(source, 'a');
|
||||
expect(evaluator.evaluateNode(expr !.initializer !)).toEqual([
|
||||
{provide: 'someValue', useFactory: {__symbolic: 'reference', name: lambdaTemp}}
|
||||
])
|
||||
]);
|
||||
});
|
||||
})
|
||||
});
|
||||
});
|
||||
|
||||
function sourceFileOf(text: string): ts.SourceFile {
|
||||
|
|
|
@ -1,3 +1,11 @@
|
|||
/**
|
||||
* @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
|
||||
*/
|
||||
|
||||
import * as fs from 'fs';
|
||||
import * as ts from 'typescript';
|
||||
|
||||
|
@ -70,7 +78,7 @@ export class MockNode implements ts.Node {
|
|||
public kind: ts.SyntaxKind = ts.SyntaxKind.Identifier, public flags: ts.NodeFlags = 0,
|
||||
public pos: number = 0, public end: number = 0) {}
|
||||
getSourceFile(): ts.SourceFile { return null as any as ts.SourceFile; }
|
||||
getChildCount(sourceFile?: ts.SourceFile): number { return 0 }
|
||||
getChildCount(sourceFile?: ts.SourceFile): number { return 0; }
|
||||
getChildAt(index: number, sourceFile?: ts.SourceFile): ts.Node { return null as any as ts.Node; }
|
||||
getChildren(sourceFile?: ts.SourceFile): ts.Node[] { return []; }
|
||||
getStart(sourceFile?: ts.SourceFile): number { return 0; }
|
||||
|
@ -90,12 +98,14 @@ export class MockNode implements ts.Node {
|
|||
|
||||
export class MockIdentifier extends MockNode implements ts.Identifier {
|
||||
public text: string;
|
||||
// tslint:disable
|
||||
public _primaryExpressionBrand: any;
|
||||
public _memberExpressionBrand: any;
|
||||
public _leftHandSideExpressionBrand: any;
|
||||
public _incrementExpressionBrand: any;
|
||||
public _unaryExpressionBrand: any;
|
||||
public _expressionBrand: any;
|
||||
// tslint:enable
|
||||
|
||||
constructor(
|
||||
public name: string, public kind: ts.SyntaxKind.Identifier = ts.SyntaxKind.Identifier,
|
||||
|
@ -106,6 +116,7 @@ export class MockIdentifier extends MockNode implements ts.Identifier {
|
|||
}
|
||||
|
||||
export class MockVariableDeclaration extends MockNode implements ts.VariableDeclaration {
|
||||
// tslint:disable-next-line
|
||||
public _declarationBrand: any;
|
||||
|
||||
constructor(
|
||||
|
@ -130,7 +141,7 @@ export class MockSymbol implements ts.Symbol {
|
|||
getDeclarations(): ts.Declaration[] { return [this.node]; }
|
||||
getDocumentationComment(): ts.SymbolDisplayPart[] { return []; }
|
||||
// TODO(vicb): removed in TS 2.2
|
||||
getJsDocTags(): any[]{return []};
|
||||
getJsDocTags(): any[] { return []; }
|
||||
|
||||
static of (name: string): MockSymbol { return new MockSymbol(name); }
|
||||
}
|
||||
|
@ -139,6 +150,7 @@ export function expectNoDiagnostics(diagnostics: ts.Diagnostic[]) {
|
|||
for (const diagnostic of diagnostics) {
|
||||
const message = ts.flattenDiagnosticMessageText(diagnostic.messageText, '\n');
|
||||
const {line, character} = diagnostic.file.getLineAndCharacterOfPosition(diagnostic.start);
|
||||
// tslint:disable-next-line:no-console
|
||||
console.log(`${diagnostic.file.fileName} (${line + 1},${character + 1}): ${message}`);
|
||||
}
|
||||
expect(diagnostics.length).toBe(0);
|
||||
|
@ -159,7 +171,7 @@ export function allChildren<T>(node: ts.Node, cb: (node: ts.Node) => T): T {
|
|||
return result;
|
||||
}
|
||||
return allChildren(child, cb);
|
||||
})
|
||||
});
|
||||
}
|
||||
|
||||
export function findClass(sourceFile: ts.SourceFile, name: string): ts.ClassDeclaration|undefined {
|
||||
|
|
|
@ -9,6 +9,7 @@ module.exports = (gulp) => () => {
|
|||
// todo(vicb): add .js files when supported
|
||||
// see https://github.com/palantir/tslint/pull/1515
|
||||
'./modules/**/*.ts',
|
||||
'./packages/**/*.ts',
|
||||
'./tools/**/*.ts',
|
||||
'./*.ts',
|
||||
|
||||
|
|
|
@ -144,9 +144,6 @@ export declare class DefaultValueAccessor implements ControlValueAccessor {
|
|||
onChange: (_: any) => void;
|
||||
onTouched: () => void;
|
||||
constructor(_renderer: Renderer2, _elementRef: ElementRef, _compositionMode: boolean);
|
||||
_compositionEnd(value: any): void;
|
||||
_compositionStart(): void;
|
||||
_handleInput(value: any): void;
|
||||
registerOnChange(fn: (_: any) => void): void;
|
||||
registerOnTouched(fn: () => void): void;
|
||||
setDisabledState(isDisabled: boolean): void;
|
||||
|
|
Loading…
Reference in New Issue