Skip to content

Commit 4cedfe4

Browse files
authored
Update dprint, don't force multiline imports for imports of single name (microsoft#58038)
1 parent 66f5be9 commit 4cedfe4

File tree

205 files changed

+388
-1156
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

205 files changed

+388
-1156
lines changed

.dprint.jsonc

+4-4
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
"arrowFunction.useParentheses": "preferNone",
2020
"conditionalExpression.linePerExpression": false, // Keep our "match/case"-ish conditionals.
2121
"functionExpression.spaceAfterFunctionKeyword": true,
22-
"importDeclaration.forceMultiLine": true,
22+
"importDeclaration.forceMultiLine": "whenMultiple",
2323
"constructorType.spaceAfterNewKeyword": true,
2424
"constructSignature.spaceAfterNewKeyword": true,
2525

@@ -57,8 +57,8 @@
5757
],
5858
// Note: if adding new languages, make sure settings.template.json is updated too.
5959
"plugins": [
60-
"https://plugins.dprint.dev/typescript-0.88.9.wasm",
61-
"https://plugins.dprint.dev/json-0.19.1.wasm",
62-
"https://plugins.dprint.dev/prettier-0.35.0.json@0df49c4d878bb1051af2fa1d1f69ba6400f4b78633f49baa1f38954a6fd32b40"
60+
"https://plugins.dprint.dev/typescript-0.90.0.wasm",
61+
"https://plugins.dprint.dev/json-0.19.2.wasm",
62+
"https://plugins.dprint.dev/prettier-0.39.0.json@896b70f29ef8213c1b0ba81a93cee9c2d4f39ac2194040313cd433906db7bc7c"
6363
]
6464
}

Herebyfile.mjs

+5-15
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,16 @@
11
// @ts-check
2-
import {
3-
CancelToken,
4-
} from "@esfx/canceltoken";
2+
import { CancelToken } from "@esfx/canceltoken";
53
import assert from "assert";
64
import chalk from "chalk";
75
import chokidar from "chokidar";
86
import esbuild from "esbuild";
9-
import {
10-
EventEmitter,
11-
} from "events";
7+
import { EventEmitter } from "events";
128
import fs from "fs";
13-
import {
14-
glob,
15-
} from "glob";
16-
import {
17-
task,
18-
} from "hereby";
9+
import { glob } from "glob";
10+
import { task } from "hereby";
1911
import path from "path";
2012

21-
import {
22-
localizationDirectories,
23-
} from "./scripts/build/localization.mjs";
13+
import { localizationDirectories } from "./scripts/build/localization.mjs";
2414
import cmdLineOptions from "./scripts/build/options.mjs";
2515
import {
2616
buildProject,

scripts/browserIntegrationTest.mjs

+2-6
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,6 @@
11
import chalk from "chalk";
2-
import {
3-
readFileSync,
4-
} from "fs";
5-
import {
6-
join,
7-
} from "path";
2+
import { readFileSync } from "fs";
3+
import { join } from "path";
84
import playwright from "playwright";
95

106
// Turning this on will leave the Chromium browser open, giving you the

scripts/build/findUpDir.mjs

+1-3
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
1-
import {
2-
existsSync,
3-
} from "fs";
1+
import { existsSync } from "fs";
42
import {
53
dirname,
64
join,

scripts/build/projects.mjs

+2-6
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,6 @@
1-
import {
2-
resolve,
3-
} from "path";
1+
import { resolve } from "path";
42

5-
import {
6-
findUpRoot,
7-
} from "./findUpDir.mjs";
3+
import { findUpRoot } from "./findUpDir.mjs";
84
import cmdLineOptions from "./options.mjs";
95
import {
106
Debouncer,

scripts/build/tests.mjs

+1-3
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
1-
import {
2-
CancelError,
3-
} from "@esfx/canceltoken";
1+
import { CancelError } from "@esfx/canceltoken";
42
import chalk from "chalk";
53
import fs from "fs";
64
import os from "os";

scripts/build/utils.mjs

+2-6
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,7 @@
1-
import {
2-
CancelError,
3-
} from "@esfx/canceltoken";
1+
import { CancelError } from "@esfx/canceltoken";
42
import assert from "assert";
53
import chalk from "chalk";
6-
import {
7-
spawn,
8-
} from "child_process";
4+
import { spawn } from "child_process";
95
import fs from "fs";
106
import JSONC from "jsonc-parser";
117
import which from "which";

scripts/checkModuleFormat.mjs

+2-6
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,9 @@
1-
import {
2-
createRequire,
3-
} from "module";
1+
import { createRequire } from "module";
42
import {
53
__importDefault,
64
__importStar,
75
} from "tslib";
8-
import {
9-
pathToFileURL,
10-
} from "url";
6+
import { pathToFileURL } from "url";
117

128
// This script tests that TypeScript's CJS API is structured
139
// as expected. It calls "require" as though it were in CWD,

scripts/configurePrerelease.mjs

+1-3
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
import assert from "assert";
2-
import {
3-
execFileSync,
4-
} from "child_process";
2+
import { execFileSync } from "child_process";
53
import {
64
readFileSync,
75
writeFileSync,

scripts/dtsBundler.mjs

+1-3
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,7 @@
55
* bundle as namespaces again, even though the project is modules.
66
*/
77

8-
import assert, {
9-
fail,
10-
} from "assert";
8+
import assert, { fail } from "assert";
119
import cp from "child_process";
1210
import fs from "fs";
1311
import minimist from "minimist";

scripts/errorCheck.mjs

+1-3
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
import fs from "fs";
22
import fsPromises from "fs/promises";
3-
import {
4-
glob,
5-
} from "glob";
3+
import { glob } from "glob";
64

75
async function checkErrorBaselines() {
86
const data = await fsPromises.readFile("src/compiler/diagnosticMessages.json", "utf-8");

scripts/find-unused-diganostic-messages.mjs

+3-9
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,9 @@
11
// This file requires a modern version of node 14+, and grep to be available.
22

33
// node scripts/find-unused-diagnostic-messages.mjs
4-
import {
5-
execSync,
6-
} from "child_process";
7-
import {
8-
readFileSync,
9-
} from "fs";
10-
import {
11-
EOL,
12-
} from "os";
4+
import { execSync } from "child_process";
5+
import { readFileSync } from "fs";
6+
import { EOL } from "os";
137

148
const diags = readFileSync("src/compiler/diagnosticInformationMap.generated.ts", "utf8");
159
const startOfDiags = diags.split("export const Diagnostics")[1];

scripts/generateLocalizedDiagnosticMessages.mjs

+1-3
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
1-
import {
2-
XMLParser,
3-
} from "fast-xml-parser";
1+
import { XMLParser } from "fast-xml-parser";
42
import fs from "fs";
53
import path from "path";
64

scripts/link-hooks.mjs

+1-3
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,7 @@ import fs from "fs";
22
import path from "path";
33
import url from "url";
44

5-
import {
6-
findUpRoot,
7-
} from "./build/findUpDir.mjs";
5+
import { findUpRoot } from "./build/findUpDir.mjs";
86

97
const __filename = url.fileURLToPath(new URL(import.meta.url));
108
const __dirname = path.dirname(__filename);

scripts/post-vsts-artifact-comment.mjs

+1-3
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
1-
import {
2-
Octokit,
3-
} from "@octokit/rest";
1+
import { Octokit } from "@octokit/rest";
42
import assert from "assert";
53
import ado from "azure-devops-node-api";
64
import fetch from "node-fetch";

scripts/produceLKG.mjs

+2-6
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,9 @@
11
import fs from "fs";
2-
import {
3-
glob,
4-
} from "glob";
2+
import { glob } from "glob";
53
import path from "path";
64
import url from "url";
75

8-
import {
9-
localizationDirectories,
10-
} from "./build/localization.mjs";
6+
import { localizationDirectories } from "./build/localization.mjs";
117

128
const __filename = url.fileURLToPath(new URL(import.meta.url));
139
const __dirname = path.dirname(__filename);

src/compiler/performanceCore.ts

+1-3
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
1-
import {
2-
isNodeLikeSystem,
3-
} from "./_namespaces/ts";
1+
import { isNodeLikeSystem } from "./_namespaces/ts";
42

53
// The following definitions provide the minimum compatible support for the Web Performance User Timings API
64
// between browsers and NodeJS:

src/deprecatedCompat/5.0/identifierProperties.ts

+1-3
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,7 @@ import {
55
identifierToKeywordKind,
66
NodeFlags,
77
} from "../_namespaces/ts";
8-
import {
9-
deprecate,
10-
} from "../deprecate";
8+
import { deprecate } from "../deprecate";
119

1210
declare module "../../compiler/types" {
1311
export interface Identifier {

src/deprecatedCompat/deprecations.ts

+1-3
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,7 @@ import {
33
UnionToIntersection,
44
Version,
55
} from "./_namespaces/ts";
6-
import {
7-
deprecate,
8-
} from "./deprecate";
6+
import { deprecate } from "./deprecate";
97

108
/** @internal */
119
export interface DeprecationOptions {

src/harness/client.ts

+1-3
Original file line numberDiff line numberDiff line change
@@ -74,9 +74,7 @@ import {
7474
TodoCommentDescriptor,
7575
UserPreferences,
7676
} from "./_namespaces/ts";
77-
import {
78-
protocol,
79-
} from "./_namespaces/ts.server";
77+
import { protocol } from "./_namespaces/ts.server";
8078

8179
export interface SessionClientHost extends LanguageServiceHost {
8280
writeMessage(message: string): void;

src/harness/findUpDir.ts

+1-3
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
1-
import {
2-
existsSync,
3-
} from "fs";
1+
import { existsSync } from "fs";
42
import {
53
dirname,
64
join,

src/harness/fourslashImpl.ts

+1-3
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,7 @@ import * as ts from "./_namespaces/ts";
55
import * as Utils from "./_namespaces/Utils";
66
import * as vfs from "./_namespaces/vfs";
77
import * as vpath from "./_namespaces/vpath";
8-
import {
9-
LoggerWithInMemoryLogs,
10-
} from "./tsserverLogger";
8+
import { LoggerWithInMemoryLogs } from "./tsserverLogger";
119

1210
import ArrayOrSingle = FourSlashInterface.ArrayOrSingle;
1311

src/harness/harnessLanguageService.ts

+4-12
Original file line numberDiff line numberDiff line change
@@ -6,25 +6,17 @@ import {
66
virtualFileSystemRoot,
77
} from "./_namespaces/Harness";
88
import * as ts from "./_namespaces/ts";
9-
import {
10-
getNewLineCharacter,
11-
} from "./_namespaces/ts";
9+
import { getNewLineCharacter } from "./_namespaces/ts";
1210
import * as vfs from "./_namespaces/vfs";
1311
import * as vpath from "./_namespaces/vpath";
14-
import {
15-
incrementalVerifier,
16-
} from "./incrementalUtils";
17-
import {
18-
patchServiceForStateBaseline,
19-
} from "./projectServiceStateLogger";
12+
import { incrementalVerifier } from "./incrementalUtils";
13+
import { patchServiceForStateBaseline } from "./projectServiceStateLogger";
2014
import {
2115
createLoggerWithInMemoryLogs,
2216
HarnessLSCouldNotResolveModule,
2317
LoggerWithInMemoryLogs,
2418
} from "./tsserverLogger";
25-
import {
26-
createWatchUtils,
27-
} from "./watchUtils";
19+
import { createWatchUtils } from "./watchUtils";
2820

2921
export function makeDefaultProxy(info: ts.server.PluginCreateInfo): ts.LanguageService {
3022
const proxy = Object.create(/*o*/ null); // eslint-disable-line no-null/no-null

src/harness/projectServiceStateLogger.ts

+1-3
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,7 @@ import {
2323
SourceMapFileWatcher,
2424
TextStorage,
2525
} from "./_namespaces/ts.server";
26-
import {
27-
LoggerWithInMemoryLogs,
28-
} from "./tsserverLogger";
26+
import { LoggerWithInMemoryLogs } from "./tsserverLogger";
2927

3028
interface ProjectData {
3129
projectStateVersion: Project["projectStateVersion"];

src/harness/sourceMapRecorder.ts

+1-3
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
import * as documents from "./_namespaces/documents";
2-
import {
3-
Compiler,
4-
} from "./_namespaces/Harness";
2+
import { Compiler } from "./_namespaces/Harness";
53
import * as ts from "./_namespaces/ts";
64
import * as Utils from "./_namespaces/Utils";
75

src/harness/tsserverLogger.ts

+1-3
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
import * as ts from "./_namespaces/ts";
2-
import {
3-
Compiler,
4-
} from "./harnessIO";
2+
import { Compiler } from "./harnessIO";
53

64
export const HarnessLSCouldNotResolveModule = "HarnessLanguageService:: Could not resolve module";
75

src/jsTyping/jsTyping.ts

+1-3
Original file line numberDiff line numberDiff line change
@@ -30,9 +30,7 @@ import {
3030
Version,
3131
versionMajorMinor,
3232
} from "./_namespaces/ts";
33-
import {
34-
stringifyIndented,
35-
} from "./_namespaces/ts.server";
33+
import { stringifyIndented } from "./_namespaces/ts.server";
3634

3735
export interface TypingResolutionHost {
3836
directoryExists(path: string): boolean;

src/jsTyping/shared.ts

+1-3
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
1-
import {
2-
sys,
3-
} from "./_namespaces/ts";
1+
import { sys } from "./_namespaces/ts";
42

53
export type ActionSet = "action::set";
64
export type ActionInvalidate = "action::invalidate";

src/server/packageJsonCache.ts

+1-3
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,7 @@ import {
99
Ternary,
1010
tryFileExists,
1111
} from "./_namespaces/ts";
12-
import {
13-
ProjectService,
14-
} from "./_namespaces/ts.server";
12+
import { ProjectService } from "./_namespaces/ts.server";
1513

1614
/** @internal */
1715
export interface PackageJsonCache {

src/server/scriptVersionCache.ts

+1-3
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,7 @@ import {
99
TextSpan,
1010
unchangedTextChangeRange,
1111
} from "./_namespaces/ts";
12-
import {
13-
emptyArray,
14-
} from "./_namespaces/ts.server";
12+
import { emptyArray } from "./_namespaces/ts.server";
1513
import * as protocol from "./protocol";
1614

1715
const lineCollectionCapacity = 4;

src/services/codefixes/helpers.ts

+1-3
Original file line numberDiff line numberDiff line change
@@ -111,9 +111,7 @@ import {
111111
visitNode,
112112
visitNodes,
113113
} from "../_namespaces/ts";
114-
import {
115-
ImportAdder,
116-
} from "../_namespaces/ts.codefix";
114+
import { ImportAdder } from "../_namespaces/ts.codefix";
117115

118116
/**
119117
* Finds members of the resolved type that are missing in the class pointed to by class decl

src/services/completions.ts

+1-3
Original file line numberDiff line numberDiff line change
@@ -389,9 +389,7 @@ import {
389389
VariableDeclaration,
390390
walkUpParenthesizedExpressions,
391391
} from "./_namespaces/ts";
392-
import {
393-
StringCompletions,
394-
} from "./_namespaces/ts.Completions";
392+
import { StringCompletions } from "./_namespaces/ts.Completions";
395393

396394
// Exported only for tests
397395
/** @internal */

0 commit comments

Comments
 (0)