build: enable TSLint on the packages folder
This commit is contained in:

committed by
Alex Rickabaugh

parent
e64b54b67b
commit
9479a106bb
@ -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(`
|
||||
|
Reference in New Issue
Block a user