Use eslint-plugin-simple-import-sort (#52090)

This commit is contained in:
Jake Bailey
2023-02-02 14:36:21 -08:00
committed by GitHub
parent 0d251ba9bc
commit 2a8436c529
145 changed files with 527 additions and 487 deletions
+11 -6
View File
@@ -11,7 +11,7 @@
"es6": true
},
"plugins": [
"@typescript-eslint", "no-null", "import", "eslint-plugin-local"
"@typescript-eslint", "no-null", "import", "eslint-plugin-local", "simple-import-sort"
],
"ignorePatterns": [
"**/node_modules/**",
@@ -25,11 +25,8 @@
"/coverage/**"
],
"rules": {
"sort-imports": ["error", {
"ignoreCase": true,
"ignoreDeclarationSort": true,
"allowSeparatedGroups": true
}],
"simple-import-sort/imports": "error",
"simple-import-sort/exports": "error",
"@typescript-eslint/adjacent-overload-signatures": "error",
"@typescript-eslint/array-type": "error",
@@ -180,6 +177,14 @@
{ "name": "exports" }
]
}
},
{
// These files contain imports in a specific order that are generally unsafe to modify.
"files": ["**/_namespaces/**"],
"rules": {
"simple-import-sort/imports": "off",
"simple-import-sort/exports": "off"
}
}
]
}
+8
View File
@@ -13,6 +13,14 @@
// ".git-blame-ignore-revs"
// ]
// Match eslint-plugin-simple-import-sort in organize/auto-imports.
"typescript.unstable": {
"organizeImportsCollation": "unicode",
"organizeImportsCaseFirst": "upper",
"organizeImportsIgnoreCase": false,
"organizeImportsNumericCollation": true
},
// These options search the repo recursively and slow down
// the build task menu. We define our own in tasks.json.
"typescript.tsc.autoDetect": "off",
+14 -13
View File
@@ -1,21 +1,22 @@
// @ts-check
import path from "path";
import fs from "fs";
import del from "del";
import { task } from "hereby";
import _glob from "glob";
import util from "util";
import { CancelToken } from "@esfx/canceltoken";
import chalk from "chalk";
import chokidar from "chokidar";
import del from "del";
import esbuild from "esbuild";
import { EventEmitter } from "events";
import fs from "fs";
import fsExtra from "fs-extra";
import { Debouncer, Deferred, exec, getDiffTool, getDirSize, memoize, needsUpdate, readJson } from "./scripts/build/utils.mjs";
import { localBaseline, localRwcBaseline, refBaseline, refRwcBaseline, runConsoleTests } from "./scripts/build/tests.mjs";
import { buildProject, cleanProject, watchProject } from "./scripts/build/projects.mjs";
import _glob from "glob";
import { task } from "hereby";
import path from "path";
import util from "util";
import { localizationDirectories } from "./scripts/build/localization.mjs";
import cmdLineOptions from "./scripts/build/options.mjs";
import esbuild from "esbuild";
import chokidar from "chokidar";
import { EventEmitter } from "events";
import { CancelToken } from "@esfx/canceltoken";
import { buildProject, cleanProject, watchProject } from "./scripts/build/projects.mjs";
import { localBaseline, localRwcBaseline, refBaseline, refRwcBaseline, runConsoleTests } from "./scripts/build/tests.mjs";
import { Debouncer, Deferred, exec, getDiffTool, getDirSize, memoize, needsUpdate, readJson } from "./scripts/build/utils.mjs";
const glob = util.promisify(_glob);
+17
View File
@@ -40,6 +40,7 @@
"eslint-plugin-import": "^2.26.0",
"eslint-plugin-local": "^1.0.0",
"eslint-plugin-no-null": "^1.0.2",
"eslint-plugin-simple-import-sort": "^10.0.0",
"fast-xml-parser": "^4.0.11",
"fs-extra": "^9.1.0",
"glob": "latest",
@@ -2000,6 +2001,15 @@
"eslint": ">=3.0.0"
}
},
"node_modules/eslint-plugin-simple-import-sort": {
"version": "10.0.0",
"resolved": "https://registry.npmjs.org/eslint-plugin-simple-import-sort/-/eslint-plugin-simple-import-sort-10.0.0.tgz",
"integrity": "sha512-AeTvO9UCMSNzIHRkg8S6c3RPy5YEwKWSQPx3DYghLedo2ZQxowPFLGDN1AZ2evfg6r6mjBSZSLxLFsWSu3acsw==",
"dev": true,
"peerDependencies": {
"eslint": ">=5.0.0"
}
},
"node_modules/eslint-scope": {
"version": "5.1.1",
"resolved": "https://registry.npmjs.org/eslint-scope/-/eslint-scope-5.1.1.tgz",
@@ -5935,6 +5945,13 @@
"dev": true,
"requires": {}
},
"eslint-plugin-simple-import-sort": {
"version": "10.0.0",
"resolved": "https://registry.npmjs.org/eslint-plugin-simple-import-sort/-/eslint-plugin-simple-import-sort-10.0.0.tgz",
"integrity": "sha512-AeTvO9UCMSNzIHRkg8S6c3RPy5YEwKWSQPx3DYghLedo2ZQxowPFLGDN1AZ2evfg6r6mjBSZSLxLFsWSu3acsw==",
"dev": true,
"requires": {}
},
"eslint-scope": {
"version": "5.1.1",
"resolved": "https://registry.npmjs.org/eslint-scope/-/eslint-scope-5.1.1.tgz",
+1
View File
@@ -66,6 +66,7 @@
"eslint-plugin-import": "^2.26.0",
"eslint-plugin-local": "^1.0.0",
"eslint-plugin-no-null": "^1.0.2",
"eslint-plugin-simple-import-sort": "^10.0.0",
"fast-xml-parser": "^4.0.11",
"fs-extra": "^9.1.0",
"glob": "latest",
+1 -1
View File
@@ -1,6 +1,6 @@
import chalk from "chalk";
import { join } from "path";
import { readFileSync } from "fs";
import { join } from "path";
let playwright;
try {
+1 -1
View File
@@ -1,5 +1,5 @@
import { dirname, join, resolve } from "path";
import { existsSync } from "fs";
import { dirname, join, resolve } from "path";
import url from "url";
const __filename = url.fileURLToPath(new URL(import.meta.url));
+2 -1
View File
@@ -1,7 +1,8 @@
import { Debouncer, exec } from "./utils.mjs";
import { resolve } from "path";
import { findUpRoot } from "./findUpDir.mjs";
import cmdLineOptions from "./options.mjs";
import { Debouncer, exec } from "./utils.mjs";
class ProjectQueue {
/**
+4 -3
View File
@@ -1,12 +1,13 @@
import { CancelError } from "@esfx/canceltoken";
import chalk from "chalk";
import del from "del";
import fs from "fs";
import os from "os";
import path from "path";
import chalk from "chalk";
import { findUpFile, findUpRoot } from "./findUpDir.mjs";
import cmdLineOptions from "./options.mjs";
import { exec } from "./utils.mjs";
import { findUpFile, findUpRoot } from "./findUpDir.mjs";
import { CancelError } from "@esfx/canceltoken";
const mochaJs = path.resolve(findUpRoot(), "node_modules", "mocha", "bin", "_mocha");
export const localBaseline = "tests/baselines/local/";
+7 -7
View File
@@ -1,13 +1,13 @@
/* eslint-disable no-restricted-globals */
import fs from "fs";
import path from "path";
import chalk from "chalk";
import which from "which";
import { spawn } from "child_process";
import assert from "assert";
import JSONC from "jsonc-parser";
import { CancelError } from "@esfx/canceltoken";
import assert from "assert";
import chalk from "chalk";
import { spawn } from "child_process";
import fs from "fs";
import JSONC from "jsonc-parser";
import path from "path";
import which from "which";
/**
* Executes the provided command once with the supplied arguments.
+1 -1
View File
@@ -1,6 +1,6 @@
import { normalize, relative } from "path";
import assert from "assert";
import { readFileSync, writeFileSync } from "fs";
import { normalize, relative } from "path";
import url from "url";
const __filename = url.fileURLToPath(new URL(import.meta.url));
+6 -5
View File
@@ -5,12 +5,13 @@
* bundle as namespaces again, even though the project is modules.
*/
import fs from "fs";
import path from "path";
import minimist from "minimist";
import url from "url";
import ts from "../lib/typescript.js";
import assert, { fail } from "assert";
import fs from "fs";
import minimist from "minimist";
import path from "path";
import url from "url";
import ts from "../lib/typescript.js";
const __filename = url.fileURLToPath(new URL(import.meta.url));
const __dirname = path.dirname(__filename);
+1 -1
View File
@@ -1,9 +1,9 @@
// This file requires a modern version of node 14+, and grep to be available.
// node scripts/find-unused-diagnostic-messages.mjs
import { execSync } from "child_process";
import { readFileSync } from "fs";
import { EOL } from "os";
import { execSync } from "child_process";
const diags = readFileSync("src/compiler/diagnosticInformationMap.generated.ts", "utf8");
const startOfDiags = diags.split("export const Diagnostics")[1];
@@ -1,6 +1,6 @@
import { XMLParser } from "fast-xml-parser";
import fs from "fs";
import path from "path";
import { XMLParser } from "fast-xml-parser";
/** @typedef {{
LCX: {
+3 -3
View File
@@ -1,7 +1,7 @@
import * as fs from "fs";
import * as path from "path";
import * as os from "os";
import * as childProcess from "child_process";
import * as fs from "fs";
import * as os from "os";
import * as path from "path";
import url from "url";
const __filename = url.fileURLToPath(new URL(import.meta.url));
+1
View File
@@ -1,6 +1,7 @@
import fs from "fs";
import path from "path";
import url from "url";
import { findUpRoot } from "./build/findUpDir.mjs";
const __filename = url.fileURLToPath(new URL(import.meta.url));
+2 -1
View File
@@ -1,9 +1,10 @@
import { Octokit } from "@octokit/rest";
import { runSequence } from "./run-sequence.mjs";
import fs from "fs";
import path from "path";
import url from "url";
import { runSequence } from "./run-sequence.mjs";
const __filename = url.fileURLToPath(new URL(import.meta.url));
const __dirname = path.dirname(__filename);
+1
View File
@@ -1,4 +1,5 @@
import { Octokit } from "@octokit/rest";
import { runSequence } from "./run-sequence.mjs";
const userName = process.env.GH_USERNAME || "typescript-bot";
+3 -3
View File
@@ -1,8 +1,8 @@
import { Octokit } from "@octokit/rest";
import fs from "fs";
import ado from "azure-devops-node-api";
import fetch from "node-fetch";
import assert from "assert";
import ado from "azure-devops-node-api";
import fs from "fs";
import fetch from "node-fetch";
async function main() {
+1 -1
View File
@@ -1,5 +1,5 @@
import path from "path";
import fs from "fs";
import path from "path";
/** @typedef {{
category: string;
+5 -4
View File
@@ -1,8 +1,9 @@
import fs from "fs-extra";
import path from "path";
import glob from "glob";
import url from "url";
import del from "del";
import fs from "fs-extra";
import glob from "glob";
import path from "path";
import url from "url";
import { localizationDirectories } from "./build/localization.mjs";
const __filename = url.fileURLToPath(new URL(import.meta.url));
+1
View File
@@ -1,4 +1,5 @@
import { Octokit } from "@octokit/rest";
import { runSequence } from "./run-sequence.mjs";
// The first is used by bot-based kickoffs, the second by automatic triggers
+1 -1
View File
@@ -1062,8 +1062,8 @@ import {
WithStatement,
YieldExpression,
} from "./_namespaces/ts";
import * as performance from "./_namespaces/ts.performance";
import * as moduleSpecifiers from "./_namespaces/ts.moduleSpecifiers";
import * as performance from "./_namespaces/ts.performance";
const ambientModuleSymbolRegex = /^".+"$/;
const anon = "(anonymous)" as __String & string;
+1 -1
View File
@@ -103,8 +103,8 @@ import {
tryExtractTSExtension,
tryGetExtensionFromPath,
tryParsePatterns,
version,
Version,
version,
versionMajorMinor,
VersionRange,
} from "./_namespaces/ts";
+1 -1
View File
@@ -55,6 +55,7 @@ import {
transformECMAScriptModule,
Transformer,
TransformerFactory,
transformES5,
transformES2015,
transformES2016,
transformES2017,
@@ -62,7 +63,6 @@ import {
transformES2019,
transformES2020,
transformES2021,
transformES5,
transformESDecorators,
transformESNext,
transformGenerators,
+1 -1
View File
@@ -199,8 +199,8 @@ import {
HasExpressionInitializer,
hasExtension,
HasFlowNode,
hasInitializer,
HasInitializer,
hasInitializer,
HasJSDoc,
hasJSDocNodes,
HasModifiers,
+1 -1
View File
@@ -3,8 +3,8 @@ import {
DeprecationOptions,
formatStringFromArgs,
noop,
version,
Version,
version,
} from "./_namespaces/ts";
export let enableDeprecationWarnings = true;
+2 -2
View File
@@ -1,3 +1,4 @@
import * as performance from "../compiler/_namespaces/ts.performance";
import * as ts from "./_namespaces/ts";
import {
arrayFrom,
@@ -19,8 +20,8 @@ import {
createDiagnosticReporter,
createGetCanonicalFileName,
createIncrementalCompilerHost,
createProgram,
CreateProgram,
createProgram,
CreateProgramOptions,
createSolutionBuilder,
createSolutionBuilderHost,
@@ -87,7 +88,6 @@ import {
WatchCompilerHost,
WatchOptions,
} from "./_namespaces/ts";
import * as performance from "../compiler/_namespaces/ts.performance";
interface Statistic {
name: string;
+5 -5
View File
@@ -1,10 +1,10 @@
import * as ts from "./_namespaces/ts";
import * as fakes from "./_namespaces/fakes";
import * as vpath from "./_namespaces/vpath";
import * as documents from "./_namespaces/documents";
import * as vfs from "./_namespaces/vfs";
import * as collections from "./_namespaces/collections";
import * as documents from "./_namespaces/documents";
import * as fakes from "./_namespaces/fakes";
import * as Harness from "./_namespaces/Harness";
import * as ts from "./_namespaces/ts";
import * as vfs from "./_namespaces/vfs";
import * as vpath from "./_namespaces/vpath";
/**
* Test harness compiler functionality.
+5 -5
View File
@@ -1,9 +1,9 @@
import * as vpath from "./_namespaces/vpath";
import * as vfs from "./_namespaces/vfs";
import * as ts from "./_namespaces/ts";
import * as Harness from "./_namespaces/Harness";
import * as fakes from "./_namespaces/fakes";
import * as compiler from "./_namespaces/compiler";
import * as fakes from "./_namespaces/fakes";
import * as Harness from "./_namespaces/Harness";
import * as ts from "./_namespaces/ts";
import * as vfs from "./_namespaces/vfs";
import * as vpath from "./_namespaces/vpath";
declare let Symbol: SymbolConstructor;
+5 -5
View File
@@ -1,10 +1,10 @@
import * as ts from "./_namespaces/ts";
import * as vfs from "./_namespaces/vfs";
import * as Utils from "./_namespaces/Utils";
import * as vpath from "./_namespaces/vpath";
import * as documents from "./_namespaces/documents";
import * as collections from "./_namespaces/collections";
import * as documents from "./_namespaces/documents";
import * as Harness from "./_namespaces/Harness";
import * as ts from "./_namespaces/ts";
import * as Utils from "./_namespaces/Utils";
import * as vfs from "./_namespaces/vfs";
import * as vpath from "./_namespaces/vpath";
/**
* Fake implementations of various compiler dependencies.
+3 -3
View File
@@ -1,10 +1,10 @@
import * as fakes from "./_namespaces/fakes";
import * as FourSlashInterface from "./_namespaces/FourSlashInterface";
import * as Harness from "./_namespaces/Harness";
import * as vfs from "./_namespaces/vfs";
import * as ts from "./_namespaces/ts";
import * as fakes from "./_namespaces/fakes";
import * as vpath from "./_namespaces/vpath";
import * as Utils from "./_namespaces/Utils";
import * as vfs from "./_namespaces/vfs";
import * as vpath from "./_namespaces/vpath";
import ArrayOrSingle = FourSlashInterface.ArrayOrSingle;
+4 -4
View File
@@ -1,7 +1,3 @@
import * as ts from "./_namespaces/ts";
import * as Utils from "./_namespaces/Utils";
import * as vpath from "./_namespaces/vpath";
import * as vfs from "./_namespaces/vfs";
import * as compiler from "./_namespaces/compiler";
import * as documents from "./_namespaces/documents";
import * as fakes from "./_namespaces/fakes";
@@ -10,6 +6,10 @@ import {
TypeWriterResult,
TypeWriterWalker,
} from "./_namespaces/Harness";
import * as ts from "./_namespaces/ts";
import * as Utils from "./_namespaces/Utils";
import * as vfs from "./_namespaces/vfs";
import * as vpath from "./_namespaces/vpath";
export interface IO {
newLine(): string;
+4 -4
View File
@@ -1,14 +1,14 @@
import * as ts from "./_namespaces/ts";
import * as fakes from "./_namespaces/fakes";
import * as vfs from "./_namespaces/vfs";
import * as collections from "./_namespaces/collections";
import * as vpath from "./_namespaces/vpath";
import * as fakes from "./_namespaces/fakes";
import {
Compiler,
mockHash,
virtualFileSystemRoot,
} from "./_namespaces/Harness";
import * as ts from "./_namespaces/ts";
import { getNewLineCharacter } from "./_namespaces/ts";
import * as vfs from "./_namespaces/vfs";
import * as vpath from "./_namespaces/vpath";
export function makeDefaultProxy(info: ts.server.PluginCreateInfo): ts.LanguageService {
const proxy = Object.create(/*prototype*/ null); // eslint-disable-line no-null/no-null
+1 -1
View File
@@ -1,5 +1,5 @@
import * as ts from "./_namespaces/ts";
import * as Harness from "./_namespaces/Harness";
import * as ts from "./_namespaces/ts";
export function encodeString(s: string): string {
return ts.sys.bufferFrom!(s).toString("utf8");
+1 -1
View File
@@ -1,9 +1,9 @@
import * as ts from "./_namespaces/ts";
import {
FileBasedTest,
IO,
userSpecifiedRoot,
} from "./_namespaces/Harness";
import * as ts from "./_namespaces/ts";
export type TestRunnerKind = CompilerTestKind | FourslashTestKind | "project" | "rwc" | "test262" | "user" | "dt" | "docker";
export type CompilerTestKind = "conformance" | "compiler";
+2 -2
View File
@@ -1,7 +1,7 @@
import * as ts from "./_namespaces/ts";
import * as documents from "./_namespaces/documents";
import * as Utils from "./_namespaces/Utils";
import { Compiler } from "./_namespaces/Harness";
import * as ts from "./_namespaces/ts";
import * as Utils from "./_namespaces/Utils";
interface SourceMapSpanWithDecodeErrors {
sourceMapSpan: ts.Mapping;
+2 -2
View File
@@ -1,8 +1,8 @@
import * as collections from "./_namespaces/collections";
import * as ts from "./_namespaces/ts";
import * as vpath from "./_namespaces/vpath";
import * as documents from "./_namespaces/documents";
import * as Harness from "./_namespaces/Harness";
import * as ts from "./_namespaces/ts";
import * as vpath from "./_namespaces/vpath";
/**
* Posix-style path to the TypeScript compiler build outputs (including tsc.js, lib.d.ts, etc.)
+9 -9
View File
@@ -1,12 +1,3 @@
import {
ActionInvalidate,
ActionPackageInstalled,
ActionSet,
EventBeginInstallTypes,
EventEndInstallTypes,
EventInitializationFailed,
EventTypesRegistry,
} from "./_namespaces/ts.server";
import {
CompilerOptions,
DirectoryWatcherCallback,
@@ -19,6 +10,15 @@ import {
TypeAcquisition,
WatchOptions,
} from "./_namespaces/ts";
import {
ActionInvalidate,
ActionPackageInstalled,
ActionSet,
EventBeginInstallTypes,
EventEndInstallTypes,
EventInitializationFailed,
EventTypesRegistry,
} from "./_namespaces/ts.server";
export interface TypingInstallerResponse {
readonly kind: ActionSet | ActionInvalidate | EventTypesRegistry | ActionPackageInstalled | EventBeginInstallTypes | EventEndInstallTypes | EventInitializationFailed;
+1 -1
View File
@@ -1,5 +1,5 @@
import * as ts from "./_namespaces/ts";
import * as Harness from "./_namespaces/Harness";
import * as ts from "./_namespaces/ts";
interface FileInformation {
contents?: string;
+47 -47
View File
@@ -1,50 +1,3 @@
import {
ActionInvalidate,
ActionSet,
asNormalizedPath,
AutoImportProviderProject,
BeginEnablePluginResult,
BeginInstallTypes,
ConfiguredProject,
countEachFileTypes,
createPackageJsonCache,
emptyArray,
EndInstallTypes,
Errors,
ExternalProject,
getBaseConfigFileName,
hasNoTypeScriptSource,
InferredProject,
InvalidateCachedTypings,
isConfiguredProject,
isDynamicFileName,
isInferredProject,
isInferredProjectName,
ITypingsInstaller,
Logger,
LogLevel,
makeAutoImportProviderProjectName,
makeAuxiliaryProjectName,
makeInferredProjectName,
Msg,
NormalizedPath,
normalizedPathToPath,
nullTypingsInstaller,
PackageInstalledResponse,
PackageJsonCache,
Project,
ProjectFilesWithTSDiagnostics,
ProjectKind,
ProjectOptions,
ScriptInfo,
ScriptInfoVersion,
ServerHost,
Session,
SetTypings,
ThrottledOperations,
toNormalizedPath,
TypingsCache,
} from "./_namespaces/ts.server";
import {
addToSeen,
arrayFrom,
@@ -177,6 +130,53 @@ import {
WatchType,
WildcardDirectoryWatcher,
} from "./_namespaces/ts";
import {
ActionInvalidate,
ActionSet,
asNormalizedPath,
AutoImportProviderProject,
BeginEnablePluginResult,
BeginInstallTypes,
ConfiguredProject,
countEachFileTypes,
createPackageJsonCache,
emptyArray,
EndInstallTypes,
Errors,
ExternalProject,
getBaseConfigFileName,
hasNoTypeScriptSource,
InferredProject,
InvalidateCachedTypings,
isConfiguredProject,
isDynamicFileName,
isInferredProject,
isInferredProjectName,
ITypingsInstaller,
Logger,
LogLevel,
makeAutoImportProviderProjectName,
makeAuxiliaryProjectName,
makeInferredProjectName,
Msg,
NormalizedPath,
normalizedPathToPath,
nullTypingsInstaller,
PackageInstalledResponse,
PackageJsonCache,
Project,
ProjectFilesWithTSDiagnostics,
ProjectKind,
ProjectOptions,
ScriptInfo,
ScriptInfoVersion,
ServerHost,
Session,
SetTypings,
ThrottledOperations,
toNormalizedPath,
TypingsCache,
} from "./_namespaces/ts.server";
import * as protocol from "./protocol";
export const maxProgramSizeForNonTsFiles = 20 * 1024 * 1024;
+22 -22
View File
@@ -1,26 +1,4 @@
import * as ts from "./_namespaces/ts";
import {
asNormalizedPath,
createModuleSpecifierCache,
emptyArray,
Errors,
FileStats,
forEachResolvedProjectReferenceProject,
LogLevel,
ModuleImportResult,
Msg,
NormalizedPath,
projectContainsInfoDirectly,
ProjectOptions,
ProjectReferenceProjectLoadKind,
ProjectService,
ScriptInfo,
ServerHost,
Session,
toNormalizedPath,
TypingsCache,
updateProjectIfDirty,
} from "./_namespaces/ts.server";
import {
addRange,
append,
@@ -147,6 +125,28 @@ import {
WatchOptions,
WatchType,
} from "./_namespaces/ts";
import {
asNormalizedPath,
createModuleSpecifierCache,
emptyArray,
Errors,
FileStats,
forEachResolvedProjectReferenceProject,
LogLevel,
ModuleImportResult,
Msg,
NormalizedPath,
projectContainsInfoDirectly,
ProjectOptions,
ProjectReferenceProjectLoadKind,
ProjectService,
ScriptInfo,
ServerHost,
Session,
toNormalizedPath,
TypingsCache,
updateProjectIfDirty,
} from "./_namespaces/ts.server";
import * as protocol from "./protocol";
export enum ProjectKind {
+16 -16
View File
@@ -1,19 +1,3 @@
import {
AbsolutePositionAndLineText,
ConfiguredProject,
Errors,
ExternalProject,
InferredProject,
isConfiguredProject,
isExternalProject,
isInferredProject,
maxFileSize,
NormalizedPath,
Project,
ProjectKind,
ScriptVersionCache,
ServerHost,
} from "./_namespaces/ts.server";
import {
assign,
clear,
@@ -51,6 +35,22 @@ import {
TextSpan,
unorderedRemoveItem,
} from "./_namespaces/ts";
import {
AbsolutePositionAndLineText,
ConfiguredProject,
Errors,
ExternalProject,
InferredProject,
isConfiguredProject,
isExternalProject,
isInferredProject,
maxFileSize,
NormalizedPath,
Project,
ProjectKind,
ScriptVersionCache,
ServerHost,
} from "./_namespaces/ts.server";
import * as protocol from "./protocol";
export interface ScriptInfoVersion {
@@ -1,12 +1,12 @@
import {
createCodeFixActionWithoutFixAll,
registerCodeFix,
} from "../_namespaces/ts.codefix";
import {
Diagnostics,
factory,
textChanges,
} from "../_namespaces/ts";
import {
createCodeFixActionWithoutFixAll,
registerCodeFix,
} from "../_namespaces/ts.codefix";
registerCodeFix({
errorCodes: [
+5 -5
View File
@@ -1,8 +1,3 @@
import {
createCodeFixActionWithoutFixAll,
moduleSpecifierToValidIdentifier,
registerCodeFix,
} from "../_namespaces/ts.codefix";
import {
__String,
arrayFrom,
@@ -81,6 +76,11 @@ import {
TypeChecker,
VariableStatement,
} from "../_namespaces/ts";
import {
createCodeFixActionWithoutFixAll,
moduleSpecifierToValidIdentifier,
registerCodeFix,
} from "../_namespaces/ts.codefix";
registerCodeFix({
errorCodes: [Diagnostics.File_is_a_CommonJS_module_it_may_be_converted_to_an_ES_module.code],
@@ -1,9 +1,3 @@
import {
createCodeFixActionWithoutFixAll,
registerCodeFix,
setJsonCompilerOptionValue,
setJsonCompilerOptionValues,
} from "../_namespaces/ts.codefix";
import {
CodeFixAction,
Diagnostics,
@@ -16,6 +10,12 @@ import {
ScriptTarget,
textChanges,
} from "../_namespaces/ts";
import {
createCodeFixActionWithoutFixAll,
registerCodeFix,
setJsonCompilerOptionValue,
setJsonCompilerOptionValues,
} from "../_namespaces/ts.codefix";
registerCodeFix({
errorCodes: [
+1 -1
View File
@@ -64,8 +64,8 @@ import {
mapEntries,
NewExpression,
Node,
nodeSeenTracker,
NodeSeenTracker,
nodeSeenTracker,
ObjectFlags,
ParameterDeclaration,
PrefixUnaryExpression,
+1 -1
View File
@@ -1,4 +1,3 @@
import { TextRangeWithKind } from "../_namespaces/ts.formatting";
import {
Debug,
findChildOfKind,
@@ -7,6 +6,7 @@ import {
SourceFileLike,
SyntaxKind,
} from "../_namespaces/ts";
import { TextRangeWithKind } from "../_namespaces/ts.formatting";
/** @internal */
export const enum FormattingRequestKind {
+1 -1
View File
@@ -1,8 +1,8 @@
import { FormattingContext } from "../_namespaces/ts.formatting";
import {
emptyArray,
SyntaxKind,
} from "../_namespaces/ts";
import { FormattingContext } from "../_namespaces/ts.formatting";
/** @internal */
export interface Rule {
+11 -11
View File
@@ -1,14 +1,3 @@
import {
anyContext,
ContextPredicate,
FormattingContext,
FormattingRequestKind,
Rule,
RuleAction,
RuleFlags,
TextRangeWithKind,
TokenRange,
} from "../_namespaces/ts.formatting";
import {
BinaryExpression,
contains,
@@ -32,6 +21,17 @@ import {
typeKeywords,
YieldExpression,
} from "../_namespaces/ts";
import {
anyContext,
ContextPredicate,
FormattingContext,
FormattingRequestKind,
Rule,
RuleAction,
RuleFlags,
TextRangeWithKind,
TokenRange,
} from "../_namespaces/ts.formatting";
/** @internal */
export interface RuleSpec {
+3 -3
View File
@@ -1,6 +1,4 @@
import * as ts from "./_namespaces/ts";
import * as NavigateTo from "./_namespaces/ts.NavigateTo";
import * as NavigationBar from "./_namespaces/ts.NavigationBar";
import {
__String,
ApplicableRefactorInfo,
@@ -182,8 +180,8 @@ import {
isTextWhiteSpaceLike,
isThisTypeParameter,
isTransientSymbol,
JsDoc,
JSDoc,
JsDoc,
JSDocContainer,
JSDocTagInfo,
JsonSourceFile,
@@ -318,6 +316,8 @@ import {
UserPreferences,
VariableDeclaration,
} from "./_namespaces/ts";
import * as NavigateTo from "./_namespaces/ts.NavigateTo";
import * as NavigationBar from "./_namespaces/ts.NavigationBar";
/** The version of the language service API */
export const servicesVersion = "0.8";
+3 -3
View File
@@ -1,7 +1,4 @@
import * as vpath from "./_namespaces/vpath";
import * as ts from "./_namespaces/ts";
import * as compiler from "./_namespaces/compiler";
import * as Utils from "./_namespaces/Utils";
import {
Baseline,
Compiler,
@@ -14,6 +11,9 @@ import {
TestCaseParser,
TestRunnerKind,
} from "./_namespaces/Harness";
import * as ts from "./_namespaces/ts";
import * as Utils from "./_namespaces/Utils";
import * as vpath from "./_namespaces/vpath";
export const enum CompilerTestType {
Conformance,
+1 -1
View File
@@ -2,7 +2,6 @@ import * as del from "del";
import * as fs from "fs";
import * as path from "path";
import * as ts from "./_namespaces/ts";
import {
Baseline,
IO,
@@ -10,6 +9,7 @@ import {
RunnerBase,
TestRunnerKind,
} from "./_namespaces/Harness";
import * as ts from "./_namespaces/ts";
interface ExecResult {
stdout: Buffer;
+1 -1
View File
@@ -1,10 +1,10 @@
import * as FourSlash from "./_namespaces/FourSlash";
import * as ts from "./_namespaces/ts";
import {
IO,
RunnerBase,
TestRunnerKind,
} from "./_namespaces/Harness";
import * as ts from "./_namespaces/ts";
export class FourSlashRunner extends RunnerBase {
protected basePath: string;
+2 -2
View File
@@ -1,5 +1,3 @@
import * as Utils from "../_namespaces/Utils";
import * as ts from "../_namespaces/ts";
import {
configOption,
globalTimeout,
@@ -24,6 +22,8 @@ import {
TaskTimeout,
TestInfo,
} from "../_namespaces/Harness.Parallel";
import * as ts from "../_namespaces/ts";
import * as Utils from "../_namespaces/Utils";
export function start() {
const Mocha = require("mocha") as typeof import("mocha");
+1 -1
View File
@@ -1,5 +1,5 @@
import * as ts from "../_namespaces/ts";
import { TestRunnerKind } from "../_namespaces/Harness";
import * as ts from "../_namespaces/ts";
export interface RunnerTask {
runner: TestRunnerKind;
+6 -6
View File
@@ -1,3 +1,9 @@
import {
createRunner,
globalTimeout,
RunnerBase,
runUnitTests,
} from "../_namespaces/Harness";
import {
ErrorInfo,
ParallelClientMessage,
@@ -9,12 +15,6 @@ import {
TestInfo,
UnitTestTask,
} from "../_namespaces/Harness.Parallel";
import {
createRunner,
globalTimeout,
RunnerBase,
runUnitTests,
} from "../_namespaces/Harness";
export function start() {
function hookUncaughtExceptions() {
+3 -3
View File
@@ -1,10 +1,10 @@
import * as ts from "./_namespaces/ts";
import * as documents from "./_namespaces/documents";
import * as Harness from "./_namespaces/Harness";
import * as fakes from "./_namespaces/fakes";
import * as Harness from "./_namespaces/Harness";
import * as ts from "./_namespaces/ts";
import * as Utils from "./_namespaces/Utils";
import * as vfs from "./_namespaces/vfs";
import * as vpath from "./_namespaces/vpath";
import * as Utils from "./_namespaces/Utils";
// Test case is json of below type in tests/cases/project/
interface ProjectRunnerTestCase {
+4 -4
View File
@@ -1,8 +1,4 @@
import * as vpath from "./_namespaces/vpath";
import * as ts from "./_namespaces/ts";
import * as FourSlash from "./_namespaces/FourSlash";
import * as project from "./_namespaces/project";
import * as RWC from "./_namespaces/RWC";
import {
CompilerBaselineRunner,
CompilerTestType,
@@ -20,6 +16,10 @@ import {
TestRunnerKind,
UserCodeRunner,
} from "./_namespaces/Harness";
import * as project from "./_namespaces/project";
import * as RWC from "./_namespaces/RWC";
import * as ts from "./_namespaces/ts";
import * as vpath from "./_namespaces/vpath";
/* eslint-disable prefer-const */
export let runners: RunnerBase[] = [];
+2 -2
View File
@@ -1,6 +1,6 @@
import * as Playback from "./_namespaces/Playback";
import * as Harness from "./_namespaces/Harness";
import * as compiler from "./_namespaces/compiler";
import * as Harness from "./_namespaces/Harness";
import * as Playback from "./_namespaces/Playback";
import * as ts from "./_namespaces/ts";
import * as vpath from "./_namespaces/vpath";
+2 -2
View File
@@ -1,6 +1,4 @@
import * as ts from "./_namespaces/ts";
import * as compiler from "./_namespaces/compiler";
import * as Utils from "./_namespaces/Utils";
import {
Baseline,
Compiler,
@@ -9,6 +7,8 @@ import {
TestCaseParser,
TestRunnerKind,
} from "./_namespaces/Harness";
import * as ts from "./_namespaces/ts";
import * as Utils from "./_namespaces/Utils";
// In harness baselines, null is different than undefined. See `generateActual` in `harness.ts`.
export class Test262BaselineRunner extends RunnerBase {
@@ -1,5 +1,5 @@
import * as ts from "../../_namespaces/ts";
import * as Harness from "../../_namespaces/Harness";
import * as ts from "../../_namespaces/ts";
describe("unittests:: config:: commandLineParsing:: parseCommandLine", () => {
function assertParseResult(subScenario: string, commandLine: string[], workerDiagnostic?: () => ts.ParseCommandLineWorkerDiagnostics) {
@@ -1,6 +1,6 @@
import * as fakes from "../../_namespaces/fakes";
import * as ts from "../../_namespaces/ts";
import * as vfs from "../../_namespaces/vfs";
import * as fakes from "../../_namespaces/fakes";
function createFileSystem(ignoreCase: boolean, cwd: string, root: string) {
return new vfs.FileSystem(ignoreCase, {
@@ -1,5 +1,5 @@
import * as ts from "../../_namespaces/ts";
import * as fakes from "../../_namespaces/fakes";
import * as ts from "../../_namespaces/ts";
import * as vfs from "../../_namespaces/vfs";
describe("unittests:: config:: convertCompilerOptionsFromJson", () => {
@@ -1,5 +1,5 @@
import * as ts from "../../_namespaces/ts";
import * as fakes from "../../_namespaces/fakes";
import * as ts from "../../_namespaces/ts";
import * as vfs from "../../_namespaces/vfs";
interface ExpectedResult { typeAcquisition: ts.TypeAcquisition; errors: ts.Diagnostic[]; }
@@ -1,5 +1,5 @@
import * as ts from "../../_namespaces/ts";
import * as Harness from "../../_namespaces/Harness";
import * as ts from "../../_namespaces/ts";
describe("unittests:: config:: initTSConfig", () => {
function initTSConfigCorrectly(name: string, commandLinesArgs: string[]) {
@@ -1,5 +1,5 @@
import * as ts from "../../_namespaces/ts";
import * as fakes from "../../_namespaces/fakes";
import * as ts from "../../_namespaces/ts";
import * as vfs from "../../_namespaces/vfs";
const caseInsensitiveBasePath = "c:/dev/";
@@ -1,5 +1,5 @@
import * as ts from "../../_namespaces/ts";
import * as fakes from "../../_namespaces/fakes";
import * as ts from "../../_namespaces/ts";
import * as vfs from "../../_namespaces/vfs";
import { libFile } from "../virtualFileSystemWithWatch";
@@ -1,5 +1,5 @@
import * as ts from "../../_namespaces/ts";
import * as Harness from "../../_namespaces/Harness";
import * as ts from "../../_namespaces/ts";
describe("unittests:: config:: showConfig", () => {
function showTSConfigCorrectly(name: string, commandLinesArgs: string[], configJson?: object) {
@@ -1,6 +1,6 @@
import * as fakes from "../../_namespaces/fakes";
import * as ts from "../../_namespaces/ts";
import * as vfs from "../../_namespaces/vfs";
import * as fakes from "../../_namespaces/fakes";
describe("unittests:: config:: tsconfigParsing:: parseConfigFileTextToJson", () => {
function assertParseResult(jsonText: string, expectedConfigObject: { config?: any; error?: ts.Diagnostic[] }) {
@@ -1,7 +1,7 @@
import * as ts from "../../_namespaces/ts";
import * as vfs from "../../_namespaces/vfs";
import * as fakes from "../../_namespaces/fakes";
import * as Harness from "../../_namespaces/Harness";
import * as ts from "../../_namespaces/ts";
import * as vfs from "../../_namespaces/vfs";
describe("unittests:: config:: tsconfigParsingWatchOptions:: parseConfigFileTextToJson", () => {
function createParseConfigHost(additionalFiles?: vfs.FileSet) {
+1 -1
View File
@@ -1,5 +1,5 @@
import * as ts from "../_namespaces/ts";
import * as Harness from "../_namespaces/Harness";
import * as ts from "../_namespaces/ts";
describe("unittests:: customTransforms", () => {
function emitsCorrectly(name: string, sources: { file: string, text: string }[], customTransformers: ts.CustomTransformers, options: ts.CompilerOptions = {}) {
+1 -1
View File
@@ -1,5 +1,5 @@
import * as ts from "../_namespaces/ts";
import { deprecate } from "../../deprecatedCompat/deprecate";
import * as ts from "../_namespaces/ts";
describe("unittests:: debugDeprecation", () => {
let loggingHost: ts.LoggingHost | undefined;
@@ -1,5 +1,5 @@
import * as ts from "../../_namespaces/ts";
import * as evaluator from "../../_namespaces/evaluator";
import * as ts from "../../_namespaces/ts";
describe("unittests:: evaluation:: autoAccessors", () => {
const editions = [
+1 -1
View File
@@ -1,5 +1,5 @@
import * as ts from "../_namespaces/ts";
import * as Harness from "../_namespaces/Harness";
import * as ts from "../_namespaces/ts";
import * as Utils from "../_namespaces/Utils";
describe("unittests:: JSDocParsing", () => {
@@ -1,5 +1,5 @@
import * as ts from "../_namespaces/ts";
import * as Harness from "../_namespaces/Harness";
import * as ts from "../_namespaces/ts";
describe("unittests:: jsonParserRecovery", () => {
function parsesToValidSourceFileWithErrors(name: string, text: string) {
+1 -1
View File
@@ -1,5 +1,5 @@
import * as ts from "../_namespaces/ts";
import * as Harness from "../_namespaces/Harness";
import * as ts from "../_namespaces/ts";
interface File {
name: string;
+2 -2
View File
@@ -1,6 +1,6 @@
import * as ts from "../_namespaces/ts";
import * as Harness from "../_namespaces/Harness";
import * as fakes from "../_namespaces/fakes";
import * as Harness from "../_namespaces/Harness";
import * as ts from "../_namespaces/ts";
import * as vfs from "../_namespaces/vfs";
describe("unittests:: PrinterAPI", () => {
+2 -2
View File
@@ -1,8 +1,8 @@
import * as ts from "../_namespaces/ts";
import * as documents from "../_namespaces/documents";
import * as fakes from "../_namespaces/fakes";
import * as vfs from "../_namespaces/vfs";
import * as Harness from "../_namespaces/Harness";
import * as ts from "../_namespaces/ts";
import * as vfs from "../_namespaces/vfs";
function verifyMissingFilePaths(missingPaths: readonly ts.Path[], expected: readonly string[]) {
assert.isDefined(missingPaths);
+4 -4
View File
@@ -1,9 +1,9 @@
import * as Harness from "../_namespaces/Harness";
import * as vfs from "../_namespaces/vfs";
import * as fakes from "../_namespaces/fakes";
import * as ts from "../_namespaces/ts";
import * as compiler from "../_namespaces/compiler";
import * as documents from "../_namespaces/documents";
import * as fakes from "../_namespaces/fakes";
import * as Harness from "../_namespaces/Harness";
import * as ts from "../_namespaces/ts";
import * as vfs from "../_namespaces/vfs";
describe("unittests:: Public APIs", () => {
function verifyApi(fileName: string) {
@@ -1,5 +1,5 @@
import * as ts from "../_namespaces/ts";
import * as Harness from "../_namespaces/Harness";
import * as ts from "../_namespaces/ts";
import * as Utils from "../_namespaces/Utils";
import {
createTestCompilerHost,
@@ -1,5 +1,5 @@
import * as ts from "../../_namespaces/ts";
import * as Harness from "../../_namespaces/Harness";
import * as ts from "../../_namespaces/ts";
describe("unittests:: services:: cancellableLanguageServiceOperations", () => {
const file = `
@@ -1,5 +1,5 @@
import * as ts from "../../_namespaces/ts";
import * as Harness from "../../_namespaces/Harness";
import * as ts from "../../_namespaces/ts";
// lots of tests use quoted code
/* eslint-disable no-template-curly-in-string */
@@ -1,10 +1,10 @@
import * as ts from "../../_namespaces/ts";
import * as Harness from "../../_namespaces/Harness";
import * as ts from "../../_namespaces/ts";
import { createProjectService } from "../tsserver/helpers";
import {
createServerHost,
File,
} from "../virtualFileSystemWithWatch";
import { createProjectService } from "../tsserver/helpers";
import {
extractTest,
newLineCharacter,
@@ -1,10 +1,10 @@
import * as ts from "../../../_namespaces/ts";
import * as Harness from "../../../_namespaces/Harness";
import * as ts from "../../../_namespaces/ts";
import { createProjectService } from "../../tsserver/helpers";
import {
createServerHost,
libFile,
} from "../../virtualFileSystemWithWatch";
import { createProjectService } from "../../tsserver/helpers";
interface Range {
pos: number;
@@ -1,5 +1,5 @@
import * as ts from "../../../_namespaces/ts";
import * as Harness from "../../../_namespaces/Harness";
import * as ts from "../../../_namespaces/ts";
describe("unittests:: services:: extract:: Symbol Walker", () => {
function test(description: string, source: string, verifier: (file: ts.SourceFile, checker: ts.TypeChecker) => void) {
@@ -1,5 +1,5 @@
import * as ts from "../../_namespaces/ts";
import * as Harness from "../../_namespaces/Harness";
import * as ts from "../../_namespaces/ts";
describe("unittests:: services:: hostNewLineSupport", () => {
function testLSWithFiles(settings: ts.CompilerOptions, files: Harness.Compiler.TestFile[]) {
@@ -1,10 +1,10 @@
import * as ts from "../../_namespaces/ts";
import * as Harness from "../../_namespaces/Harness";
import * as ts from "../../_namespaces/ts";
import { createProjectService } from "../tsserver/helpers";
import {
createServerHost,
File,
} from "../virtualFileSystemWithWatch";
import { createProjectService } from "../tsserver/helpers";
import { newLineCharacter } from "./extract/helpers";
describe("unittests:: services:: organizeImports", () => {
@@ -1,5 +1,5 @@
import * as ts from "../../_namespaces/ts";
import * as Harness from "../../_namespaces/Harness";
import * as ts from "../../_namespaces/ts";
import { notImplementedHost } from "./extract/helpers";
// Some tests have trailing whitespace
@@ -1,5 +1,5 @@
import * as ts from "../../_namespaces/ts";
import * as Harness from "../../_namespaces/Harness";
import * as ts from "../../_namespaces/ts";
describe("unittests:: services:: Transpile", () => {
+4 -4
View File
@@ -1,10 +1,10 @@
import * as ts from "../_namespaces/ts";
import * as Harness from "../_namespaces/Harness";
import * as evaluator from "../_namespaces/evaluator";
import * as vfs from "../_namespaces/vfs";
import * as documents from "../_namespaces/documents";
import * as evaluator from "../_namespaces/evaluator";
import * as fakes from "../_namespaces/fakes";
import * as Harness from "../_namespaces/Harness";
import * as ts from "../_namespaces/ts";
import { NewLineKind, ScriptTarget, transpileModule } from "../_namespaces/ts";
import * as vfs from "../_namespaces/vfs";
describe("unittests:: TransformAPI", () => {
function replaceUndefinedWithVoid0(context: ts.TransformationContext) {
@@ -1,3 +1,4 @@
import { dedent } from "../../_namespaces/Utils";
import {
appendText,
loadProjectFromDisk,
@@ -6,7 +7,6 @@ import {
replaceText,
verifyTsc,
} from "../tsc/helpers";
import { dedent } from "../../_namespaces/Utils";
describe("unittests:: tsbuild:: configFileErrors:: when tsconfig extends the missing file", () => {
verifyTsc({
@@ -1,5 +1,5 @@
import * as vfs from "../../_namespaces/vfs";
import * as Utils from "../../_namespaces/Utils";
import * as vfs from "../../_namespaces/vfs";
import {
loadProjectFromFiles,
verifyTsc,
@@ -1,5 +1,5 @@
import * as ts from "../../_namespaces/ts";
import * as fakes from "../../_namespaces/fakes";
import * as ts from "../../_namespaces/ts";
import * as vfs from "../../_namespaces/vfs";
describe("unittests:: tsbuild - graph-ordering", () => {
@@ -1,15 +1,15 @@
import * as ts from "../../_namespaces/ts";
import * as Utils from "../../_namespaces/Utils";
import {
createWatchedSystem,
libFile,
} from "../virtualFileSystemWithWatch";
import {
loadProjectFromFiles,
noChangeOnlyRuns,
verifyTsc,
} from "../tsc/helpers";
import { verifyTscWatch } from "../tscWatch/helpers";
import {
createWatchedSystem,
libFile,
} from "../virtualFileSystemWithWatch";
describe("unittests:: tsbuild:: moduleResolution:: handles the modules and options from referenced project correctly", () => {
function sys(optionsToExtend?: ts.CompilerOptions) {
@@ -1,10 +1,10 @@
import { libFile } from "../virtualFileSystemWithWatch";
import * as Utils from "../../_namespaces/Utils";
import {
loadProjectFromFiles,
symbolLibContent,
verifyTsc,
} from "../tsc/helpers";
import { libFile } from "../virtualFileSystemWithWatch";
// https://github.com/microsoft/TypeScript/issues/31696
describe("unittests:: tsbuild:: moduleSpecifiers:: synthesized module specifiers to referenced projects resolve correctly", () => {
@@ -1,9 +1,9 @@
import * as vfs from "../../_namespaces/vfs";
import {
loadProjectFromDisk,
noChangeRun,
verifyTsc,
} from "../tsc/helpers";
import * as vfs from "../../_namespaces/vfs";
describe("unittests:: tsbuild - with noEmitOnError", () => {
let projFs: vfs.FileSystem;
+1 -1
View File
@@ -1,6 +1,6 @@
import * as fakes from "../../_namespaces/fakes";
import * as ts from "../../_namespaces/ts";
import * as vfs from "../../_namespaces/vfs";
import * as fakes from "../../_namespaces/fakes";
import {
addRest,
addShebang,
@@ -1,5 +1,5 @@
import * as ts from "../../_namespaces/ts";
import * as fakes from "../../_namespaces/fakes";
import * as ts from "../../_namespaces/ts";
import {
loadProjectFromFiles,
noChangeRun,
@@ -1,5 +1,5 @@
import * as ts from "../../_namespaces/ts";
import * as fakes from "../../_namespaces/fakes";
import * as ts from "../../_namespaces/ts";
import * as vfs from "../../_namespaces/vfs";
import {
baselinePrograms,

Some files were not shown because too many files have changed in this diff Show More