Skip to content

Commit b2720ad

Browse files
committed
Lint
1 parent a4eb156 commit b2720ad

1 file changed

Lines changed: 28 additions & 23 deletions

File tree

src/compiler/tsbuild.ts

Lines changed: 28 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
namespace ts {
2-
const MinimumDate = new Date(-8640000000000000);
3-
const MaximumDate = new Date(8640000000000000);
2+
const minimumDate = new Date(-8640000000000000);
3+
const maximumDate = new Date(8640000000000000);
44

55
/**
66
* A BuildContext tracks what's going on during the course of a build.
@@ -133,15 +133,16 @@ namespace ts {
133133
* A FileMap maintains a normalized-key to value relationship
134134
*/
135135
function createFileMap<T>(): FileMap<T> {
136-
const lookup: { [key: string]: T } = Object.create(null);
136+
// tslint:disable-next-line:no-null-keyword
137+
const lookup: { [key: string]: T } = Object.create(/*prototype*/ null);
137138

138139
return {
139140
setValue,
140141
getValue,
141142
getValueOrUndefined,
142143
getValueOrDefault,
143144
tryGetValue
144-
}
145+
};
145146

146147
function setValue(fileName: string, value: T) {
147148
lookup[normalizePath(fileName)] = value;
@@ -151,7 +152,8 @@ namespace ts {
151152
const f = normalizePath(fileName);
152153
if (f in lookup) {
153154
return lookup[f];
154-
} else {
155+
}
156+
else {
155157
throw new Error(`No value corresponding to ${fileName} exists in this map`);
156158
}
157159
}
@@ -160,7 +162,8 @@ namespace ts {
160162
const f = normalizePath(fileName);
161163
if (f in lookup) {
162164
return lookup[f];
163-
} else {
165+
}
166+
else {
164167
return undefined;
165168
}
166169
}
@@ -169,7 +172,8 @@ namespace ts {
169172
const f = normalizePath(fileName);
170173
if (f in lookup) {
171174
return lookup[f];
172-
} else {
175+
}
176+
else {
173177
return defaultValue;
174178
}
175179
}
@@ -178,26 +182,27 @@ namespace ts {
178182
const f = normalizePath(fileName);
179183
if (f in lookup) {
180184
return [true as true, lookup[f]];
181-
} else {
185+
}
186+
else {
182187
return [false as false, undefined];
183188
}
184189
}
185190
}
186191

187-
function getOutputDeclarationFileName(inputFileName: string, configFile: ts.ParsedCommandLine) {
188-
const relativePath = getRelativePathFromDirectory(rootDirOfOptions(configFile.options, configFile.options.configFilePath), inputFileName, true);
192+
function getOutputDeclarationFileName(inputFileName: string, configFile: ParsedCommandLine) {
193+
const relativePath = getRelativePathFromDirectory(rootDirOfOptions(configFile.options, configFile.options.configFilePath), inputFileName, /*ignoreCase*/ true);
189194
const outputPath = resolvePath(configFile.options.declarationDir || configFile.options.outDir || getDirectoryPath(configFile.options.configFilePath), relativePath);
190195
return changeExtension(outputPath, ".d.ts");
191196
}
192197

193-
function getOutputJavaScriptFileName(inputFileName: string, configFile: ts.ParsedCommandLine) {
198+
function getOutputJavaScriptFileName(inputFileName: string, configFile: ParsedCommandLine) {
194199
// TODO handle JSX: Preserve
195-
const relativePath = getRelativePathFromDirectory(rootDirOfOptions(configFile.options, configFile.options.configFilePath), inputFileName, true);
200+
const relativePath = getRelativePathFromDirectory(rootDirOfOptions(configFile.options, configFile.options.configFilePath), inputFileName, /*ignoreCase*/ true);
196201
const outputPath = resolvePath(configFile.options.outDir || getDirectoryPath(configFile.options.configFilePath), relativePath);
197202
return changeExtension(outputPath, (fileExtensionIs(inputFileName, ".tsx") && configFile.options.jsx === JsxEmit.Preserve) ? ".jsx" : ".js");
198203
}
199204

200-
function getOutputFileNames(inputFileName: string, configFile: ts.ParsedCommandLine): ReadonlyArray<string> {
205+
function getOutputFileNames(inputFileName: string, configFile: ParsedCommandLine): ReadonlyArray<string> {
201206
if (configFile.options.outFile) {
202207
return emptyArray;
203208
}
@@ -213,7 +218,7 @@ namespace ts {
213218
return outputs;
214219
}
215220

216-
function getOutFileOutputs(project: ts.ParsedCommandLine): ReadonlyArray<string> {
221+
function getOutFileOutputs(project: ParsedCommandLine): ReadonlyArray<string> {
217222
Debug.assert(!!project.options.outFile, "outFile must be set");
218223
const outputs: string[] = [];
219224
outputs.push(project.options.outFile);
@@ -226,7 +231,7 @@ namespace ts {
226231
return outputs;
227232
}
228233

229-
function rootDirOfOptions(opts: ts.CompilerOptions, configFileName: string) {
234+
function rootDirOfOptions(opts: CompilerOptions, configFileName: string) {
230235
return opts.rootDir || path.dirname(configFileName);
231236
}
232237

@@ -245,7 +250,7 @@ namespace ts {
245250

246251
return {
247252
parseConfigFile
248-
}
253+
};
249254
}
250255

251256
function newer(date1: Date, date2: Date): Date {
@@ -270,8 +275,8 @@ namespace ts {
270275
}
271276

272277
function getUpToDateStatusWorker(project: ParsedCommandLine, context: BuildContext): UpToDateStatus {
273-
let newestInputFileName: string = '???';
274-
let newestInputFileTime = MinimumDate;
278+
let newestInputFileName: string = undefined!;
279+
let newestInputFileTime = minimumDate;
275280
// Get timestamps of input files
276281
for (const inputFile of project.fileNames) {
277282
if (!host.fileExists(inputFile)) {
@@ -301,10 +306,10 @@ namespace ts {
301306
}
302307

303308
// Now see if all outputs are newer than the newest input
304-
let oldestOutputFileName: string = "n/a";
305-
let oldestOutputFileTime: Date = MinimumDate;
306-
let newestOutputFileTime: Date = MaximumDate;
307-
let newestDeclarationFileContentChangedTime: Date = MinimumDate;
309+
let oldestOutputFileName: string = undefined!;
310+
let oldestOutputFileTime: Date = minimumDate;
311+
let newestOutputFileTime: Date = maximumDate;
312+
let newestDeclarationFileContentChangedTime: Date = minimumDate;
308313
for (const output of outputs) {
309314
// Output is missing
310315
if (!host.fileExists(output)) {
@@ -356,7 +361,7 @@ namespace ts {
356361
return {
357362
type: UpToDateStatusType.UpstreamOutOfDate,
358363
upstreamProjectName: ref.path
359-
}
364+
};
360365
}
361366

362367
// If the upstream project's newest file is older than our oldest output, we

0 commit comments

Comments
 (0)