mirror of
https://github.com/microsoft/TypeScript.git
synced 2025-11-18 17:21:48 +00:00
boolean-trivia lint rule: Enforce space between comment and argument
This commit is contained in:
@@ -3787,11 +3787,11 @@ namespace FourSlashInterface {
|
||||
}
|
||||
|
||||
public printCurrentFileStateWithWhitespace() {
|
||||
this.state.printCurrentFileState(/*makeWhitespaceVisible*/true);
|
||||
this.state.printCurrentFileState(/*makeWhitespaceVisible*/ true);
|
||||
}
|
||||
|
||||
public printCurrentFileStateWithoutCaret() {
|
||||
this.state.printCurrentFileState(/*makeWhitespaceVisible*/false, /*makeCaretVisible*/false);
|
||||
this.state.printCurrentFileState(/*makeWhitespaceVisible*/ false, /*makeCaretVisible*/ false);
|
||||
}
|
||||
|
||||
public printCurrentQuickInfo() {
|
||||
|
||||
@@ -210,7 +210,7 @@ namespace Harness.LanguageService {
|
||||
}
|
||||
readDirectory(path: string, extensions?: string[], exclude?: string[], include?: string[]): string[] {
|
||||
return ts.matchFiles(path, extensions, exclude, include,
|
||||
/*useCaseSensitiveFileNames*/false,
|
||||
/*useCaseSensitiveFileNames*/ false,
|
||||
this.getCurrentDirectory(),
|
||||
(p) => this.virtualFileSystem.getAccessibleFileSystemEntries(p));
|
||||
}
|
||||
|
||||
@@ -65,7 +65,7 @@ namespace ts {
|
||||
};
|
||||
|
||||
const projectService = new server.ProjectService(serverHost, logger, { isCancellationRequested: () => false }, /*useOneInferredProject*/ false, /*typingsInstaller*/ undefined);
|
||||
const rootScriptInfo = projectService.getOrCreateScriptInfo(rootFile, /* openedByClient */true, /*containingProject*/ undefined);
|
||||
const rootScriptInfo = projectService.getOrCreateScriptInfo(rootFile, /*openedByClient*/ true, /*containingProject*/ undefined);
|
||||
const project = projectService.createInferredProjectWithRootFileIfNecessary(rootScriptInfo);
|
||||
project.setCompilerOptions({ module: ts.ModuleKind.AMD } );
|
||||
return {
|
||||
|
||||
@@ -144,14 +144,14 @@ namespace ts {
|
||||
|
||||
const resolution = nodeModuleNameResolver("b", containingFile.name, {}, createModuleResolutionHost(hasDirectoryExists, containingFile, packageJson, moduleFile, indexFile));
|
||||
|
||||
checkResolvedModule(resolution.resolvedModule, createResolvedModule(indexPath, /*isExternalLibraryImport*/true));
|
||||
checkResolvedModule(resolution.resolvedModule, createResolvedModule(indexPath, /*isExternalLibraryImport*/ true));
|
||||
}
|
||||
}
|
||||
|
||||
it("module name as directory - handle invalid 'typings'", () => {
|
||||
testTypingsIgnored(["a", "b"]);
|
||||
testTypingsIgnored({ "a": "b" });
|
||||
testTypingsIgnored(/*typings*/true);
|
||||
testTypingsIgnored(/*typings*/ true);
|
||||
testTypingsIgnored(/*typings*/ null); // tslint:disable-line no-null-keyword
|
||||
testTypingsIgnored(/*typings*/ undefined);
|
||||
});
|
||||
@@ -530,7 +530,7 @@ import b = require("./moduleB");
|
||||
check("m1", main, m1);
|
||||
check("m2", main, m2);
|
||||
check("m3", main, m3Typings);
|
||||
check("m4", main, m4, /*isExternalLibraryImport*/true);
|
||||
check("m4", main, m4, /*isExternalLibraryImport*/ true);
|
||||
|
||||
function check(name: string, caller: File, expected: File, isExternalLibraryImport = false) {
|
||||
const result = resolveModuleName(name, caller.name, options, host);
|
||||
|
||||
@@ -34,7 +34,7 @@ describe("PreProcessFile:", function () {
|
||||
describe("Test preProcessFiles,", function () {
|
||||
it("Correctly return referenced files from triple slash", function () {
|
||||
test("///<reference path = \"refFile1.ts\" />" + "\n" + "///<reference path =\"refFile2.ts\"/>" + "\n" + "///<reference path=\"refFile3.ts\" />" + "\n" + "///<reference path= \"..\\refFile4d.ts\" />",
|
||||
/*readImportFile*/true,
|
||||
/*readImportFile*/ true,
|
||||
/*detectJavaScriptImports*/ false,
|
||||
{
|
||||
referencedFiles: [{ fileName: "refFile1.ts", pos: 0, end: 37 }, { fileName: "refFile2.ts", pos: 38, end: 73 },
|
||||
@@ -48,7 +48,7 @@ describe("PreProcessFile:", function () {
|
||||
|
||||
it("Do not return reference path because of invalid triple-slash syntax", function () {
|
||||
test("///<reference path\"refFile1.ts\" />" + "\n" + "///<reference path =\"refFile2.ts\">" + "\n" + "///<referencepath=\"refFile3.ts\" />" + "\n" + "///<reference pat= \"refFile4d.ts\" />",
|
||||
/*readImportFile*/true,
|
||||
/*readImportFile*/ true,
|
||||
/*detectJavaScriptImports*/ false,
|
||||
{
|
||||
referencedFiles: <ts.FileReference[]>[],
|
||||
@@ -61,7 +61,7 @@ describe("PreProcessFile:", function () {
|
||||
|
||||
it("Correctly return imported files", function () {
|
||||
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,
|
||||
/*readImportFile*/ true,
|
||||
/*detectJavaScriptImports*/ false,
|
||||
{
|
||||
referencedFiles: <ts.FileReference[]>[],
|
||||
@@ -88,7 +88,7 @@ describe("PreProcessFile:", function () {
|
||||
|
||||
it("Do not return import path because of invalid import syntax", function () {
|
||||
test("import i1 require(\"r1.ts\"); import = require(\"r2.ts\") import i3= require(\"r3.ts\"); import i5",
|
||||
/*readImportFile*/true,
|
||||
/*readImportFile*/ true,
|
||||
/*detectJavaScriptImports*/ false,
|
||||
{
|
||||
referencedFiles: <ts.FileReference[]>[],
|
||||
@@ -101,7 +101,7 @@ describe("PreProcessFile:", function () {
|
||||
|
||||
it("Correctly return referenced files and import files", function () {
|
||||
test("///<reference path=\"refFile1.ts\" />" + "\n" + "///<reference path =\"refFile2.ts\"/>" + "\n" + "import i1 = require(\"r1.ts\"); import i2 =require(\"r2.ts\");",
|
||||
/*readImportFile*/true,
|
||||
/*readImportFile*/ true,
|
||||
/*detectJavaScriptImports*/ false,
|
||||
{
|
||||
referencedFiles: [{ fileName: "refFile1.ts", pos: 0, end: 35 }, { fileName: "refFile2.ts", pos: 36, end: 71 }],
|
||||
@@ -114,7 +114,7 @@ describe("PreProcessFile:", function () {
|
||||
|
||||
it("Correctly return referenced files and import files even with some invalid syntax", function () {
|
||||
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,
|
||||
/*readImportFile*/ true,
|
||||
/*detectJavaScriptImports*/ false,
|
||||
{
|
||||
referencedFiles: [{ fileName: "refFile1.ts", pos: 0, end: 35 }],
|
||||
@@ -133,7 +133,7 @@ describe("PreProcessFile:", function () {
|
||||
"import {a as A} from \"m5\";" + "\n" +
|
||||
"import {a as A, b, c as C} from \"m6\";" + "\n" +
|
||||
"import def , {a, b, c as C} from \"m7\";" + "\n",
|
||||
/*readImportFile*/true,
|
||||
/*readImportFile*/ true,
|
||||
/*detectJavaScriptImports*/ false,
|
||||
{
|
||||
referencedFiles: [],
|
||||
@@ -157,7 +157,7 @@ describe("PreProcessFile:", function () {
|
||||
"export {a} from \"m2\";" + "\n" +
|
||||
"export {a as A} from \"m3\";" + "\n" +
|
||||
"export {a as A, b, c as C} from \"m4\";" + "\n",
|
||||
/*readImportFile*/true,
|
||||
/*readImportFile*/ true,
|
||||
/*detectJavaScriptImports*/ false,
|
||||
{
|
||||
referencedFiles: [],
|
||||
@@ -194,7 +194,7 @@ describe("PreProcessFile:", function () {
|
||||
|
||||
it("Correctly handles export import declarations", function () {
|
||||
test("export import a = require(\"m1\");",
|
||||
/*readImportFile*/true,
|
||||
/*readImportFile*/ true,
|
||||
/*detectJavaScriptImports*/ false,
|
||||
{
|
||||
referencedFiles: [],
|
||||
@@ -213,7 +213,7 @@ describe("PreProcessFile:", function () {
|
||||
foo(require('m3'));
|
||||
var z = { f: require('m4') }
|
||||
`,
|
||||
/*readImportFile*/true,
|
||||
/*readImportFile*/ true,
|
||||
/*detectJavaScriptImports*/ true,
|
||||
{
|
||||
referencedFiles: [],
|
||||
@@ -233,7 +233,7 @@ describe("PreProcessFile:", function () {
|
||||
define(["mod1", "mod2"], (m1, m2) => {
|
||||
});
|
||||
`,
|
||||
/*readImportFile*/true,
|
||||
/*readImportFile*/ true,
|
||||
/*detectJavaScriptImports*/ true,
|
||||
{
|
||||
referencedFiles: [],
|
||||
@@ -251,7 +251,7 @@ describe("PreProcessFile:", function () {
|
||||
define("mod", ["mod1", "mod2"], (m1, m2) => {
|
||||
});
|
||||
`,
|
||||
/*readImportFile*/true,
|
||||
/*readImportFile*/ true,
|
||||
/*detectJavaScriptImports*/ true,
|
||||
{
|
||||
referencedFiles: [],
|
||||
|
||||
@@ -1795,9 +1795,9 @@ namespace ts.projectSystem {
|
||||
|
||||
// Open HTML file
|
||||
projectService.applyChangesInOpenFiles(
|
||||
/*openFiles*/[{ fileName: file2.path, hasMixedContent: true, scriptKind: ScriptKind.JS, content: `var hello = "hello";` }],
|
||||
/*changedFiles*/undefined,
|
||||
/*closedFiles*/undefined);
|
||||
/*openFiles*/ [{ fileName: file2.path, hasMixedContent: true, scriptKind: ScriptKind.JS, content: `var hello = "hello";` }],
|
||||
/*changedFiles*/ undefined,
|
||||
/*closedFiles*/ undefined);
|
||||
|
||||
// Now HTML file is included in the project
|
||||
checkNumberOfProjects(projectService, { configuredProjects: 1 });
|
||||
@@ -1810,9 +1810,9 @@ namespace ts.projectSystem {
|
||||
|
||||
// Close HTML file
|
||||
projectService.applyChangesInOpenFiles(
|
||||
/*openFiles*/undefined,
|
||||
/*changedFiles*/undefined,
|
||||
/*closedFiles*/[file2.path]);
|
||||
/*openFiles*/ undefined,
|
||||
/*changedFiles*/ undefined,
|
||||
/*closedFiles*/ [file2.path]);
|
||||
|
||||
// HTML file is still included in project
|
||||
checkNumberOfProjects(projectService, { configuredProjects: 1 });
|
||||
@@ -2270,12 +2270,12 @@ namespace ts.projectSystem {
|
||||
projectService.openClientFile(f1.path, "let x = 1;\nlet y = 2;");
|
||||
|
||||
projectService.checkNumberOfProjects({ externalProjects: 1 });
|
||||
projectService.externalProjects[0].getLanguageService(/*ensureSynchronized*/false).getNavigationBarItems(f1.path);
|
||||
projectService.externalProjects[0].getLanguageService(/*ensureSynchronized*/ false).getNavigationBarItems(f1.path);
|
||||
projectService.closeClientFile(f1.path);
|
||||
|
||||
projectService.openClientFile(f1.path);
|
||||
projectService.checkNumberOfProjects({ externalProjects: 1 });
|
||||
const navbar = projectService.externalProjects[0].getLanguageService(/*ensureSynchronized*/false).getNavigationBarItems(f1.path);
|
||||
const navbar = projectService.externalProjects[0].getLanguageService(/*ensureSynchronized*/ false).getNavigationBarItems(f1.path);
|
||||
assert.equal(navbar[0].spans[0].length, f1.content.length);
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user