Enable 'only-arrow-functions' lint rule (#19717)
This commit is contained in:
parent
ae87cd2fa9
commit
cd9dbe694f
56
Gulpfile.ts
56
Gulpfile.ts
|
@ -123,15 +123,13 @@ const es2015LibrarySources = [
|
|||
"es2015.symbol.wellknown.d.ts"
|
||||
];
|
||||
|
||||
const es2015LibrarySourceMap = es2015LibrarySources.map(function(source) {
|
||||
return { target: "lib." + source, sources: ["header.d.ts", source] };
|
||||
});
|
||||
const es2015LibrarySourceMap = es2015LibrarySources.map(source =>
|
||||
({ target: "lib." + source, sources: ["header.d.ts", source] }));
|
||||
|
||||
const es2016LibrarySource = ["es2016.array.include.d.ts"];
|
||||
|
||||
const es2016LibrarySourceMap = es2016LibrarySource.map(function(source) {
|
||||
return { target: "lib." + source, sources: ["header.d.ts", source] };
|
||||
});
|
||||
const es2016LibrarySourceMap = es2016LibrarySource.map(source =>
|
||||
({ target: "lib." + source, sources: ["header.d.ts", source] }));
|
||||
|
||||
const es2017LibrarySource = [
|
||||
"es2017.object.d.ts",
|
||||
|
@ -140,17 +138,15 @@ const es2017LibrarySource = [
|
|||
"es2017.intl.d.ts",
|
||||
];
|
||||
|
||||
const es2017LibrarySourceMap = es2017LibrarySource.map(function(source) {
|
||||
return { target: "lib." + source, sources: ["header.d.ts", source] };
|
||||
});
|
||||
const es2017LibrarySourceMap = es2017LibrarySource.map(source =>
|
||||
({ target: "lib." + source, sources: ["header.d.ts", source] }));
|
||||
|
||||
const esnextLibrarySource = [
|
||||
"esnext.asynciterable.d.ts"
|
||||
];
|
||||
|
||||
const esnextLibrarySourceMap = esnextLibrarySource.map(function (source) {
|
||||
return { target: "lib." + source, sources: ["header.d.ts", source] };
|
||||
});
|
||||
const esnextLibrarySourceMap = esnextLibrarySource.map(source =>
|
||||
({ target: "lib." + source, sources: ["header.d.ts", source] }));
|
||||
|
||||
const hostsLibrarySources = ["dom.generated.d.ts", "webworker.importscripts.d.ts", "scripthost.d.ts"];
|
||||
|
||||
|
@ -176,9 +172,8 @@ const librarySourceMap = [
|
|||
{ target: "lib.esnext.full.d.ts", sources: ["header.d.ts", "esnext.d.ts"].concat(hostsLibrarySources, "dom.iterable.d.ts") },
|
||||
].concat(es2015LibrarySourceMap, es2016LibrarySourceMap, es2017LibrarySourceMap, esnextLibrarySourceMap);
|
||||
|
||||
const libraryTargets = librarySourceMap.map(function(f) {
|
||||
return path.join(builtLocalDirectory, f.target);
|
||||
});
|
||||
const libraryTargets = librarySourceMap.map(f =>
|
||||
path.join(builtLocalDirectory, f.target));
|
||||
|
||||
/**
|
||||
* .lcg file is what localization team uses to know what messages to localize.
|
||||
|
@ -193,22 +188,19 @@ const generatedLCGFile = path.join(builtLocalDirectory, "enu", "diagnosticMessag
|
|||
* 2. 'src\compiler\diagnosticMessages.generated.json' => 'built\local\ENU\diagnosticMessages.generated.json.lcg'
|
||||
* generate the lcg file (source of messages to localize) from the diagnosticMessages.generated.json
|
||||
*/
|
||||
const localizationTargets = ["cs", "de", "es", "fr", "it", "ja", "ko", "pl", "pt-BR", "ru", "tr", "zh-CN", "zh-TW"].map(function (f) {
|
||||
return path.join(builtLocalDirectory, f, "diagnosticMessages.generated.json");
|
||||
}).concat(generatedLCGFile);
|
||||
const localizationTargets = ["cs", "de", "es", "fr", "it", "ja", "ko", "pl", "pt-BR", "ru", "tr", "zh-CN", "zh-TW"]
|
||||
.map(f => path.join(builtLocalDirectory, f, "diagnosticMessages.generated.json"))
|
||||
.concat(generatedLCGFile);
|
||||
|
||||
for (const i in libraryTargets) {
|
||||
const entry = librarySourceMap[i];
|
||||
const target = libraryTargets[i];
|
||||
const sources = [copyright].concat(entry.sources.map(function(s) {
|
||||
return path.join(libraryDirectory, s);
|
||||
}));
|
||||
gulp.task(target, /*help*/ false, [], function() {
|
||||
return gulp.src(sources)
|
||||
const sources = [copyright].concat(entry.sources.map(s => path.join(libraryDirectory, s)));
|
||||
gulp.task(target, /*help*/ false, [], () =>
|
||||
gulp.src(sources)
|
||||
.pipe(newer(target))
|
||||
.pipe(concat(target, { newLine: "\n\n" }))
|
||||
.pipe(gulp.dest("."));
|
||||
});
|
||||
.pipe(gulp.dest(".")));
|
||||
}
|
||||
|
||||
const configureNightlyJs = path.join(scriptsDirectory, "configureNightly.js");
|
||||
|
@ -575,9 +567,7 @@ gulp.task(specMd, /*help*/ false, [word2mdJs], (done) => {
|
|||
const specMDFullPath = path.resolve(specMd);
|
||||
const cmd = "cscript //nologo " + word2mdJs + " \"" + specWordFullPath + "\" " + "\"" + specMDFullPath + "\"";
|
||||
console.log(cmd);
|
||||
cp.exec(cmd, function() {
|
||||
done();
|
||||
});
|
||||
cp.exec(cmd, done);
|
||||
});
|
||||
|
||||
gulp.task("generate-spec", "Generates a Markdown version of the Language Specification", [specMd]);
|
||||
|
@ -714,17 +704,13 @@ function runConsoleTests(defaultReporter: string, runInParallel: boolean, done:
|
|||
}
|
||||
args.push(run);
|
||||
setNodeEnvToDevelopment();
|
||||
exec(mocha, args, lintThenFinish, function(e, status) {
|
||||
finish(e, status);
|
||||
});
|
||||
exec(mocha, args, lintThenFinish, finish);
|
||||
|
||||
}
|
||||
else {
|
||||
// run task to load all tests and partition them between workers
|
||||
setNodeEnvToDevelopment();
|
||||
exec(host, [run], lintThenFinish, function(e, status) {
|
||||
finish(e, status);
|
||||
});
|
||||
exec(host, [run], lintThenFinish, finish);
|
||||
}
|
||||
});
|
||||
|
||||
|
@ -1082,7 +1068,7 @@ function sendNextFile(files: {path: string}[], child: cp.ChildProcess, callback:
|
|||
function spawnLintWorker(files: {path: string}[], callback: (failures: number) => void) {
|
||||
const child = cp.fork("./scripts/parallel-lint");
|
||||
let failures = 0;
|
||||
child.on("message", function(data) {
|
||||
child.on("message", data => {
|
||||
switch (data.kind) {
|
||||
case "result":
|
||||
if (data.failures > 0) {
|
||||
|
|
|
@ -124,7 +124,7 @@ namespace ts {
|
|||
getEnvironmentVariable?(name: string): string;
|
||||
};
|
||||
|
||||
export let sys: System = (function() {
|
||||
export let sys: System = (() => {
|
||||
function getNodeSystem(): System {
|
||||
const _fs = require("fs");
|
||||
const _path = require("path");
|
||||
|
@ -594,7 +594,7 @@ namespace ts {
|
|||
if (sys) {
|
||||
// patch writefile to create folder before writing the file
|
||||
const originalWriteFile = sys.writeFile;
|
||||
sys.writeFile = function(path, data, writeBom) {
|
||||
sys.writeFile = (path, data, writeBom) => {
|
||||
const directoryPath = getDirectoryPath(normalizeSlashes(path));
|
||||
if (directoryPath && !sys.directoryExists(directoryPath)) {
|
||||
recursiveCreateDirectory(directoryPath, sys);
|
||||
|
|
|
@ -757,6 +757,7 @@ namespace Harness.LanguageService {
|
|||
create(info: ts.server.PluginCreateInfo) {
|
||||
const proxy = makeDefaultProxy(info);
|
||||
const langSvc: any = info.languageService;
|
||||
// tslint:disable-next-line only-arrow-functions
|
||||
proxy.getQuickInfoAtPosition = function () {
|
||||
const parts = langSvc.getQuickInfoAtPosition.apply(langSvc, arguments);
|
||||
if (parts.displayParts.length > 0) {
|
||||
|
@ -789,7 +790,7 @@ namespace Harness.LanguageService {
|
|||
module: () => ({
|
||||
create(info: ts.server.PluginCreateInfo) {
|
||||
const proxy = makeDefaultProxy(info);
|
||||
proxy.getSemanticDiagnostics = function (filename: string) {
|
||||
proxy.getSemanticDiagnostics = filename => {
|
||||
const prev = info.languageService.getSemanticDiagnostics(filename);
|
||||
const sourceFile: ts.SourceFile = info.languageService.getSourceFile(filename);
|
||||
prev.push({
|
||||
|
@ -815,11 +816,12 @@ namespace Harness.LanguageService {
|
|||
};
|
||||
}
|
||||
|
||||
function makeDefaultProxy(info: ts.server.PluginCreateInfo) {
|
||||
function makeDefaultProxy(info: ts.server.PluginCreateInfo): ts.LanguageService {
|
||||
// tslint:disable-next-line:no-null-keyword
|
||||
const proxy = Object.create(/*prototype*/ null);
|
||||
const langSvc: any = info.languageService;
|
||||
for (const k of Object.keys(langSvc)) {
|
||||
// tslint:disable-next-line only-arrow-functions
|
||||
proxy[k] = function () {
|
||||
return langSvc[k].apply(langSvc, arguments);
|
||||
};
|
||||
|
|
|
@ -366,6 +366,7 @@ namespace Playback {
|
|||
|
||||
function recordReplay<T extends Function>(original: T, underlying: any) {
|
||||
function createWrapper(record: T, replay: T): T {
|
||||
// tslint:disable-next-line only-arrow-functions
|
||||
return <any>(function () {
|
||||
if (replayLog !== undefined) {
|
||||
return replay.apply(undefined, arguments);
|
||||
|
|
|
@ -6,7 +6,7 @@ interface ClassificationEntry {
|
|||
position?: number;
|
||||
}
|
||||
|
||||
describe("Colorization", function () {
|
||||
describe("Colorization", () => {
|
||||
// Use the shim adapter to ensure test coverage of the shim layer for the classifier
|
||||
const languageServiceAdapter = new Harness.LanguageService.ShimLanguageServiceAdapter(/*preprocessToResolve*/ false);
|
||||
const classifier = languageServiceAdapter.getClassifier();
|
||||
|
@ -55,8 +55,8 @@ describe("Colorization", function () {
|
|||
}
|
||||
}
|
||||
|
||||
describe("test getClassifications", function () {
|
||||
it("Returns correct token classes", function () {
|
||||
describe("test getClassifications", () => {
|
||||
it("Returns correct token classes", () => {
|
||||
testLexicalClassification("var x: string = \"foo\"; //Hello",
|
||||
ts.EndOfLineState.None,
|
||||
keyword("var"),
|
||||
|
@ -70,7 +70,7 @@ describe("Colorization", function () {
|
|||
punctuation(";"));
|
||||
});
|
||||
|
||||
it("correctly classifies a comment after a divide operator", function () {
|
||||
it("correctly classifies a comment after a divide operator", () => {
|
||||
testLexicalClassification("1 / 2 // comment",
|
||||
ts.EndOfLineState.None,
|
||||
numberLiteral("1"),
|
||||
|
@ -80,7 +80,7 @@ describe("Colorization", function () {
|
|||
comment("// comment"));
|
||||
});
|
||||
|
||||
it("correctly classifies a literal after a divide operator", function () {
|
||||
it("correctly classifies a literal after a divide operator", () => {
|
||||
testLexicalClassification("1 / 2, 3 / 4",
|
||||
ts.EndOfLineState.None,
|
||||
numberLiteral("1"),
|
||||
|
@ -92,131 +92,131 @@ describe("Colorization", function () {
|
|||
operator(","));
|
||||
});
|
||||
|
||||
it("correctly classifies a multi-line string with one backslash", function () {
|
||||
it("correctly classifies a multi-line string with one backslash", () => {
|
||||
testLexicalClassification("'line1\\",
|
||||
ts.EndOfLineState.None,
|
||||
stringLiteral("'line1\\"),
|
||||
finalEndOfLineState(ts.EndOfLineState.InSingleQuoteStringLiteral));
|
||||
});
|
||||
|
||||
it("correctly classifies a multi-line string with three backslashes", function () {
|
||||
it("correctly classifies a multi-line string with three backslashes", () => {
|
||||
testLexicalClassification("'line1\\\\\\",
|
||||
ts.EndOfLineState.None,
|
||||
stringLiteral("'line1\\\\\\"),
|
||||
finalEndOfLineState(ts.EndOfLineState.InSingleQuoteStringLiteral));
|
||||
});
|
||||
|
||||
it("correctly classifies an unterminated single-line string with no backslashes", function () {
|
||||
it("correctly classifies an unterminated single-line string with no backslashes", () => {
|
||||
testLexicalClassification("'line1",
|
||||
ts.EndOfLineState.None,
|
||||
stringLiteral("'line1"),
|
||||
finalEndOfLineState(ts.EndOfLineState.None));
|
||||
});
|
||||
|
||||
it("correctly classifies an unterminated single-line string with two backslashes", function () {
|
||||
it("correctly classifies an unterminated single-line string with two backslashes", () => {
|
||||
testLexicalClassification("'line1\\\\",
|
||||
ts.EndOfLineState.None,
|
||||
stringLiteral("'line1\\\\"),
|
||||
finalEndOfLineState(ts.EndOfLineState.None));
|
||||
});
|
||||
|
||||
it("correctly classifies an unterminated single-line string with four backslashes", function () {
|
||||
it("correctly classifies an unterminated single-line string with four backslashes", () => {
|
||||
testLexicalClassification("'line1\\\\\\\\",
|
||||
ts.EndOfLineState.None,
|
||||
stringLiteral("'line1\\\\\\\\"),
|
||||
finalEndOfLineState(ts.EndOfLineState.None));
|
||||
});
|
||||
|
||||
it("correctly classifies the continuing line of a multi-line string ending in one backslash", function () {
|
||||
it("correctly classifies the continuing line of a multi-line string ending in one backslash", () => {
|
||||
testLexicalClassification("\\",
|
||||
ts.EndOfLineState.InDoubleQuoteStringLiteral,
|
||||
stringLiteral("\\"),
|
||||
finalEndOfLineState(ts.EndOfLineState.InDoubleQuoteStringLiteral));
|
||||
});
|
||||
|
||||
it("correctly classifies the continuing line of a multi-line string ending in three backslashes", function () {
|
||||
it("correctly classifies the continuing line of a multi-line string ending in three backslashes", () => {
|
||||
testLexicalClassification("\\",
|
||||
ts.EndOfLineState.InDoubleQuoteStringLiteral,
|
||||
stringLiteral("\\"),
|
||||
finalEndOfLineState(ts.EndOfLineState.InDoubleQuoteStringLiteral));
|
||||
});
|
||||
|
||||
it("correctly classifies the last line of an unterminated multi-line string ending in no backslashes", function () {
|
||||
it("correctly classifies the last line of an unterminated multi-line string ending in no backslashes", () => {
|
||||
testLexicalClassification(" ",
|
||||
ts.EndOfLineState.InDoubleQuoteStringLiteral,
|
||||
stringLiteral(" "),
|
||||
finalEndOfLineState(ts.EndOfLineState.None));
|
||||
});
|
||||
|
||||
it("correctly classifies the last line of an unterminated multi-line string ending in two backslashes", function () {
|
||||
it("correctly classifies the last line of an unterminated multi-line string ending in two backslashes", () => {
|
||||
testLexicalClassification("\\\\",
|
||||
ts.EndOfLineState.InDoubleQuoteStringLiteral,
|
||||
stringLiteral("\\\\"),
|
||||
finalEndOfLineState(ts.EndOfLineState.None));
|
||||
});
|
||||
|
||||
it("correctly classifies the last line of an unterminated multi-line string ending in four backslashes", function () {
|
||||
it("correctly classifies the last line of an unterminated multi-line string ending in four backslashes", () => {
|
||||
testLexicalClassification("\\\\\\\\",
|
||||
ts.EndOfLineState.InDoubleQuoteStringLiteral,
|
||||
stringLiteral("\\\\\\\\"),
|
||||
finalEndOfLineState(ts.EndOfLineState.None));
|
||||
});
|
||||
|
||||
it("correctly classifies the last line of a multi-line string", function () {
|
||||
it("correctly classifies the last line of a multi-line string", () => {
|
||||
testLexicalClassification("'",
|
||||
ts.EndOfLineState.InSingleQuoteStringLiteral,
|
||||
stringLiteral("'"),
|
||||
finalEndOfLineState(ts.EndOfLineState.None));
|
||||
});
|
||||
|
||||
it("correctly classifies an unterminated multiline comment", function () {
|
||||
it("correctly classifies an unterminated multiline comment", () => {
|
||||
testLexicalClassification("/*",
|
||||
ts.EndOfLineState.None,
|
||||
comment("/*"),
|
||||
finalEndOfLineState(ts.EndOfLineState.InMultiLineCommentTrivia));
|
||||
});
|
||||
|
||||
it("correctly classifies the termination of a multiline comment", function () {
|
||||
it("correctly classifies the termination of a multiline comment", () => {
|
||||
testLexicalClassification(" */ ",
|
||||
ts.EndOfLineState.InMultiLineCommentTrivia,
|
||||
comment(" */"),
|
||||
finalEndOfLineState(ts.EndOfLineState.None));
|
||||
});
|
||||
|
||||
it("correctly classifies the continuation of a multiline comment", function () {
|
||||
it("correctly classifies the continuation of a multiline comment", () => {
|
||||
testLexicalClassification("LOREM IPSUM DOLOR ",
|
||||
ts.EndOfLineState.InMultiLineCommentTrivia,
|
||||
comment("LOREM IPSUM DOLOR "),
|
||||
finalEndOfLineState(ts.EndOfLineState.InMultiLineCommentTrivia));
|
||||
});
|
||||
|
||||
it("correctly classifies an unterminated multiline comment on a line ending in '/*/'", function () {
|
||||
it("correctly classifies an unterminated multiline comment on a line ending in '/*/'", () => {
|
||||
testLexicalClassification(" /*/",
|
||||
ts.EndOfLineState.None,
|
||||
comment("/*/"),
|
||||
finalEndOfLineState(ts.EndOfLineState.InMultiLineCommentTrivia));
|
||||
});
|
||||
|
||||
it("correctly classifies an unterminated multiline comment with trailing space", function () {
|
||||
it("correctly classifies an unterminated multiline comment with trailing space", () => {
|
||||
testLexicalClassification("/* ",
|
||||
ts.EndOfLineState.None,
|
||||
comment("/* "),
|
||||
finalEndOfLineState(ts.EndOfLineState.InMultiLineCommentTrivia));
|
||||
});
|
||||
|
||||
it("correctly classifies a keyword after a dot", function () {
|
||||
it("correctly classifies a keyword after a dot", () => {
|
||||
testLexicalClassification("a.var",
|
||||
ts.EndOfLineState.None,
|
||||
identifier("var"));
|
||||
});
|
||||
|
||||
it("correctly classifies a string literal after a dot", function () {
|
||||
it("correctly classifies a string literal after a dot", () => {
|
||||
testLexicalClassification("a.\"var\"",
|
||||
ts.EndOfLineState.None,
|
||||
stringLiteral("\"var\""));
|
||||
});
|
||||
|
||||
it("correctly classifies a keyword after a dot separated by comment trivia", function () {
|
||||
it("correctly classifies a keyword after a dot separated by comment trivia", () => {
|
||||
testLexicalClassification("a./*hello world*/ var",
|
||||
ts.EndOfLineState.None,
|
||||
identifier("a"),
|
||||
|
@ -225,21 +225,21 @@ describe("Colorization", function () {
|
|||
identifier("var"));
|
||||
});
|
||||
|
||||
it("classifies a property access with whitespace around the dot", function () {
|
||||
it("classifies a property access with whitespace around the dot", () => {
|
||||
testLexicalClassification(" x .\tfoo ()",
|
||||
ts.EndOfLineState.None,
|
||||
identifier("x"),
|
||||
identifier("foo"));
|
||||
});
|
||||
|
||||
it("classifies a keyword after a dot on previous line", function () {
|
||||
it("classifies a keyword after a dot on previous line", () => {
|
||||
testLexicalClassification("var",
|
||||
ts.EndOfLineState.None,
|
||||
keyword("var"),
|
||||
finalEndOfLineState(ts.EndOfLineState.None));
|
||||
});
|
||||
|
||||
it("classifies multiple keywords properly", function () {
|
||||
it("classifies multiple keywords properly", () => {
|
||||
testLexicalClassification("public static",
|
||||
ts.EndOfLineState.None,
|
||||
keyword("public"),
|
||||
|
@ -353,7 +353,7 @@ describe("Colorization", function () {
|
|||
}
|
||||
});
|
||||
|
||||
it("classifies partially written generics correctly.", function () {
|
||||
it("classifies partially written generics correctly.", () => {
|
||||
testLexicalClassification("Foo<number",
|
||||
ts.EndOfLineState.None,
|
||||
identifier("Foo"),
|
||||
|
@ -466,7 +466,7 @@ class D { }\r\n\
|
|||
finalEndOfLineState(ts.EndOfLineState.None));
|
||||
});
|
||||
|
||||
it("'of' keyword", function () {
|
||||
it("'of' keyword", () => {
|
||||
testLexicalClassification("for (var of of of) { }",
|
||||
ts.EndOfLineState.None,
|
||||
keyword("for"),
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/// <reference path="..\..\..\services\patternMatcher.ts" />
|
||||
|
||||
describe("PatternMatcher", function () {
|
||||
describe("BreakIntoCharacterSpans", function () {
|
||||
describe("PatternMatcher", () => {
|
||||
describe("BreakIntoCharacterSpans", () => {
|
||||
it("EmptyIdentifier", () => {
|
||||
verifyBreakIntoCharacterSpans("");
|
||||
});
|
||||
|
@ -55,7 +55,7 @@ describe("PatternMatcher", function () {
|
|||
});
|
||||
});
|
||||
|
||||
describe("BreakIntoWordSpans", function () {
|
||||
describe("BreakIntoWordSpans", () => {
|
||||
it("VarbatimIdentifier", () => {
|
||||
verifyBreakIntoWordSpans("@int:", "int");
|
||||
});
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/// <reference path="..\..\harnessLanguageService.ts" />
|
||||
|
||||
describe("PreProcessFile:", function () {
|
||||
describe("PreProcessFile:", () => {
|
||||
function test(sourceText: string, readImportFile: boolean, detectJavaScriptImports: boolean, expectedPreProcess: ts.PreProcessedFileInfo): void {
|
||||
const resultPreProcess = ts.preProcessFile(sourceText, readImportFile, detectJavaScriptImports);
|
||||
|
||||
|
@ -31,8 +31,8 @@ describe("PreProcessFile:", function () {
|
|||
}
|
||||
}
|
||||
|
||||
describe("Test preProcessFiles,", function () {
|
||||
it("Correctly return referenced files from triple slash", function () {
|
||||
describe("Test preProcessFiles,", () => {
|
||||
it("Correctly return referenced files from triple slash", () => {
|
||||
test("///<reference path = \"refFile1.ts\" />" + "\n" + "///<reference path =\"refFile2.ts\"/>" + "\n" + "///<reference path=\"refFile3.ts\" />" + "\n" + "///<reference path= \"..\\refFile4d.ts\" />",
|
||||
/*readImportFile*/ true,
|
||||
/*detectJavaScriptImports*/ false,
|
||||
|
@ -46,7 +46,7 @@ describe("PreProcessFile:", function () {
|
|||
});
|
||||
}),
|
||||
|
||||
it("Do not return reference path because of invalid triple-slash syntax", function () {
|
||||
it("Do not return reference path because of invalid triple-slash syntax", () => {
|
||||
test("///<reference path\"refFile1.ts\" />" + "\n" + "///<reference path =\"refFile2.ts\">" + "\n" + "///<referencepath=\"refFile3.ts\" />" + "\n" + "///<reference pat= \"refFile4d.ts\" />",
|
||||
/*readImportFile*/ true,
|
||||
/*detectJavaScriptImports*/ false,
|
||||
|
@ -59,7 +59,7 @@ describe("PreProcessFile:", function () {
|
|||
});
|
||||
}),
|
||||
|
||||
it("Correctly return imported files", function () {
|
||||
it("Correctly return imported files", () => {
|
||||
test("import i1 = require(\"r1.ts\"); import i2 =require(\"r2.ts\"); import i3= require(\"r3.ts\"); import i4=require(\"r4.ts\"); import i5 = require (\"r5.ts\");",
|
||||
/*readImportFile*/ true,
|
||||
/*detectJavaScriptImports*/ false,
|
||||
|
@ -73,7 +73,7 @@ describe("PreProcessFile:", function () {
|
|||
});
|
||||
}),
|
||||
|
||||
it("Do not return imported files if readImportFiles argument is false", function () {
|
||||
it("Do not return imported files if readImportFiles argument is false", () => {
|
||||
test("import i1 = require(\"r1.ts\"); import i2 =require(\"r2.ts\"); import i3= require(\"r3.ts\"); import i4=require(\"r4.ts\"); import i5 = require (\"r5.ts\");",
|
||||
/*readImportFile*/ false,
|
||||
/*detectJavaScriptImports*/ false,
|
||||
|
@ -86,7 +86,7 @@ describe("PreProcessFile:", function () {
|
|||
});
|
||||
}),
|
||||
|
||||
it("Do not return import path because of invalid import syntax", function () {
|
||||
it("Do not return import path because of invalid import syntax", () => {
|
||||
test("import i1 require(\"r1.ts\"); import = require(\"r2.ts\") import i3= require(\"r3.ts\"); import i5",
|
||||
/*readImportFile*/ true,
|
||||
/*detectJavaScriptImports*/ false,
|
||||
|
@ -99,7 +99,7 @@ describe("PreProcessFile:", function () {
|
|||
});
|
||||
}),
|
||||
|
||||
it("Correctly return referenced files and import files", function () {
|
||||
it("Correctly return referenced files and import files", () => {
|
||||
test("///<reference path=\"refFile1.ts\" />" + "\n" + "///<reference path =\"refFile2.ts\"/>" + "\n" + "import i1 = require(\"r1.ts\"); import i2 =require(\"r2.ts\");",
|
||||
/*readImportFile*/ true,
|
||||
/*detectJavaScriptImports*/ false,
|
||||
|
@ -112,7 +112,7 @@ describe("PreProcessFile:", function () {
|
|||
});
|
||||
}),
|
||||
|
||||
it("Correctly return referenced files and import files even with some invalid syntax", function () {
|
||||
it("Correctly return referenced files and import files even with some invalid syntax", () => {
|
||||
test("///<reference path=\"refFile1.ts\" />" + "\n" + "///<reference path \"refFile2.ts\"/>" + "\n" + "import i1 = require(\"r1.ts\"); import = require(\"r2.ts\"); import i2 = require(\"r3.ts\");",
|
||||
/*readImportFile*/ true,
|
||||
/*detectJavaScriptImports*/ false,
|
||||
|
@ -125,7 +125,7 @@ describe("PreProcessFile:", function () {
|
|||
});
|
||||
});
|
||||
|
||||
it("Correctly return ES6 imports", function () {
|
||||
it("Correctly return ES6 imports", () => {
|
||||
test("import * as ns from \"m1\";" + "\n" +
|
||||
"import def, * as ns from \"m2\";" + "\n" +
|
||||
"import def from \"m3\";" + "\n" +
|
||||
|
@ -152,7 +152,7 @@ describe("PreProcessFile:", function () {
|
|||
});
|
||||
});
|
||||
|
||||
it("Correctly return ES6 exports", function () {
|
||||
it("Correctly return ES6 exports", () => {
|
||||
test("export * from \"m1\";" + "\n" +
|
||||
"export {a} from \"m2\";" + "\n" +
|
||||
"export {a as A} from \"m3\";" + "\n" +
|
||||
|
@ -192,7 +192,7 @@ describe("PreProcessFile:", function () {
|
|||
});
|
||||
});
|
||||
|
||||
it("Correctly handles export import declarations", function () {
|
||||
it("Correctly handles export import declarations", () => {
|
||||
test("export import a = require(\"m1\");",
|
||||
/*readImportFile*/ true,
|
||||
/*detectJavaScriptImports*/ false,
|
||||
|
@ -206,7 +206,7 @@ describe("PreProcessFile:", function () {
|
|||
isLibFile: false
|
||||
});
|
||||
});
|
||||
it("Correctly handles export require calls in JavaScript files", function () {
|
||||
it("Correctly handles export require calls in JavaScript files", () => {
|
||||
test(`
|
||||
export import a = require("m1");
|
||||
var x = require('m2');
|
||||
|
@ -228,7 +228,7 @@ describe("PreProcessFile:", function () {
|
|||
isLibFile: false
|
||||
});
|
||||
});
|
||||
it("Correctly handles dependency lists in define([deplist]) calls in JavaScript files", function () {
|
||||
it("Correctly handles dependency lists in define([deplist]) calls in JavaScript files", () => {
|
||||
test(`
|
||||
define(["mod1", "mod2"], (m1, m2) => {
|
||||
});
|
||||
|
@ -246,7 +246,7 @@ describe("PreProcessFile:", function () {
|
|||
isLibFile: false
|
||||
});
|
||||
});
|
||||
it("Correctly handles dependency lists in define(modName, [deplist]) calls in JavaScript files", function () {
|
||||
it("Correctly handles dependency lists in define(modName, [deplist]) calls in JavaScript files", () => {
|
||||
test(`
|
||||
define("mod", ["mod1", "mod2"], (m1, m2) => {
|
||||
});
|
||||
|
|
|
@ -816,7 +816,7 @@ namespace ts.server {
|
|||
if (useWatchGuard) {
|
||||
const currentDrive = extractWatchDirectoryCacheKey(sys.resolvePath(sys.getCurrentDirectory()), /*currentDriveKey*/ undefined);
|
||||
const statusCache = createMap<boolean>();
|
||||
sys.watchDirectory = function (path: string, callback: DirectoryWatcherCallback, recursive?: boolean): FileWatcher {
|
||||
sys.watchDirectory = (path, callback, recursive) => {
|
||||
const cacheKey = extractWatchDirectoryCacheKey(path, currentDrive);
|
||||
let status = cacheKey && statusCache.get(cacheKey);
|
||||
if (status === undefined) {
|
||||
|
@ -953,7 +953,7 @@ namespace ts.server {
|
|||
};
|
||||
|
||||
const ioSession = new IOSession(options);
|
||||
process.on("uncaughtException", function (err: Error) {
|
||||
process.on("uncaughtException", err => {
|
||||
ioSession.logError(err, "unknown");
|
||||
});
|
||||
// See https://github.com/Microsoft/TypeScript/issues/11348
|
||||
|
|
|
@ -96,7 +96,6 @@
|
|||
"no-unnecessary-initializer": false,
|
||||
"no-var-requires": false,
|
||||
"object-literal-key-quotes": false,
|
||||
"only-arrow-functions": false,
|
||||
"ordered-imports": false,
|
||||
"prefer-conditional-expression": false,
|
||||
"prefer-for-of": false,
|
||||
|
|
Loading…
Reference in a new issue