Skip to content

Update dprint, don't force multiline imports for imports of single name #58038

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Apr 2, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions .dprint.jsonc
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
"arrowFunction.useParentheses": "preferNone",
"conditionalExpression.linePerExpression": false, // Keep our "match/case"-ish conditionals.
"functionExpression.spaceAfterFunctionKeyword": true,
"importDeclaration.forceMultiLine": true,
"importDeclaration.forceMultiLine": "whenMultiple",
"constructorType.spaceAfterNewKeyword": true,
"constructSignature.spaceAfterNewKeyword": true,

Expand Down Expand Up @@ -57,8 +57,8 @@
],
// Note: if adding new languages, make sure settings.template.json is updated too.
"plugins": [
"https://plugins.dprint.dev/typescript-0.88.9.wasm",
"https://plugins.dprint.dev/json-0.19.1.wasm",
"https://plugins.dprint.dev/prettier-0.35.0.json@0df49c4d878bb1051af2fa1d1f69ba6400f4b78633f49baa1f38954a6fd32b40"
"https://plugins.dprint.dev/typescript-0.90.0.wasm",
"https://plugins.dprint.dev/json-0.19.2.wasm",
"https://plugins.dprint.dev/prettier-0.39.0.json@896b70f29ef8213c1b0ba81a93cee9c2d4f39ac2194040313cd433906db7bc7c"
]
}
20 changes: 5 additions & 15 deletions Herebyfile.mjs
Original file line number Diff line number Diff line change
@@ -1,26 +1,16 @@
// @ts-check
import {
CancelToken,
} from "@esfx/canceltoken";
import { CancelToken } from "@esfx/canceltoken";
import assert from "assert";
import chalk from "chalk";
import chokidar from "chokidar";
import esbuild from "esbuild";
import {
EventEmitter,
} from "events";
import { EventEmitter } from "events";
import fs from "fs";
import {
glob,
} from "glob";
import {
task,
} from "hereby";
import { glob } from "glob";
import { task } from "hereby";
import path from "path";

import {
localizationDirectories,
} from "./scripts/build/localization.mjs";
import { localizationDirectories } from "./scripts/build/localization.mjs";
import cmdLineOptions from "./scripts/build/options.mjs";
import {
buildProject,
Expand Down
8 changes: 2 additions & 6 deletions scripts/browserIntegrationTest.mjs
Original file line number Diff line number Diff line change
@@ -1,10 +1,6 @@
import chalk from "chalk";
import {
readFileSync,
} from "fs";
import {
join,
} from "path";
import { readFileSync } from "fs";
import { join } from "path";
import playwright from "playwright";

// Turning this on will leave the Chromium browser open, giving you the
Expand Down
4 changes: 1 addition & 3 deletions scripts/build/findUpDir.mjs
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
import {
existsSync,
} from "fs";
import { existsSync } from "fs";
import {
dirname,
join,
Expand Down
8 changes: 2 additions & 6 deletions scripts/build/projects.mjs
Original file line number Diff line number Diff line change
@@ -1,10 +1,6 @@
import {
resolve,
} from "path";
import { resolve } from "path";

import {
findUpRoot,
} from "./findUpDir.mjs";
import { findUpRoot } from "./findUpDir.mjs";
import cmdLineOptions from "./options.mjs";
import {
Debouncer,
Expand Down
4 changes: 1 addition & 3 deletions scripts/build/tests.mjs
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
import {
CancelError,
} from "@esfx/canceltoken";
import { CancelError } from "@esfx/canceltoken";
import chalk from "chalk";
import fs from "fs";
import os from "os";
Expand Down
8 changes: 2 additions & 6 deletions scripts/build/utils.mjs
Original file line number Diff line number Diff line change
@@ -1,11 +1,7 @@
import {
CancelError,
} from "@esfx/canceltoken";
import { CancelError } from "@esfx/canceltoken";
import assert from "assert";
import chalk from "chalk";
import {
spawn,
} from "child_process";
import { spawn } from "child_process";
import fs from "fs";
import JSONC from "jsonc-parser";
import which from "which";
Expand Down
8 changes: 2 additions & 6 deletions scripts/checkModuleFormat.mjs
Original file line number Diff line number Diff line change
@@ -1,13 +1,9 @@
import {
createRequire,
} from "module";
import { createRequire } from "module";
import {
__importDefault,
__importStar,
} from "tslib";
import {
pathToFileURL,
} from "url";
import { pathToFileURL } from "url";

// This script tests that TypeScript's CJS API is structured
// as expected. It calls "require" as though it were in CWD,
Expand Down
4 changes: 1 addition & 3 deletions scripts/configurePrerelease.mjs
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
import assert from "assert";
import {
execFileSync,
} from "child_process";
import { execFileSync } from "child_process";
import {
readFileSync,
writeFileSync,
Expand Down
4 changes: 1 addition & 3 deletions scripts/dtsBundler.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,7 @@
* bundle as namespaces again, even though the project is modules.
*/

import assert, {
fail,
} from "assert";
import assert, { fail } from "assert";
import cp from "child_process";
import fs from "fs";
import minimist from "minimist";
Expand Down
4 changes: 1 addition & 3 deletions scripts/errorCheck.mjs
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
import fs from "fs";
import fsPromises from "fs/promises";
import {
glob,
} from "glob";
import { glob } from "glob";

async function checkErrorBaselines() {
const data = await fsPromises.readFile("src/compiler/diagnosticMessages.json", "utf-8");
Expand Down
12 changes: 3 additions & 9 deletions scripts/find-unused-diganostic-messages.mjs
Original file line number Diff line number Diff line change
@@ -1,15 +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";
import { readFileSync } from "fs";
import { EOL } from "os";

const diags = readFileSync("src/compiler/diagnosticInformationMap.generated.ts", "utf8");
const startOfDiags = diags.split("export const Diagnostics")[1];
Expand Down
4 changes: 1 addition & 3 deletions scripts/generateLocalizedDiagnosticMessages.mjs
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
import {
XMLParser,
} from "fast-xml-parser";
import { XMLParser } from "fast-xml-parser";
import fs from "fs";
import path from "path";

Expand Down
4 changes: 1 addition & 3 deletions scripts/link-hooks.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,7 @@ import fs from "fs";
import path from "path";
import url from "url";

import {
findUpRoot,
} from "./build/findUpDir.mjs";
import { findUpRoot } from "./build/findUpDir.mjs";

const __filename = url.fileURLToPath(new URL(import.meta.url));
const __dirname = path.dirname(__filename);
Expand Down
4 changes: 1 addition & 3 deletions scripts/post-vsts-artifact-comment.mjs
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
import {
Octokit,
} from "@octokit/rest";
import { Octokit } from "@octokit/rest";
import assert from "assert";
import ado from "azure-devops-node-api";
import fetch from "node-fetch";
Expand Down
8 changes: 2 additions & 6 deletions scripts/produceLKG.mjs
Original file line number Diff line number Diff line change
@@ -1,13 +1,9 @@
import fs from "fs";
import {
glob,
} from "glob";
import { glob } from "glob";
import path from "path";
import url from "url";

import {
localizationDirectories,
} from "./build/localization.mjs";
import { localizationDirectories } from "./build/localization.mjs";

const __filename = url.fileURLToPath(new URL(import.meta.url));
const __dirname = path.dirname(__filename);
Expand Down
4 changes: 1 addition & 3 deletions src/compiler/performanceCore.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
import {
isNodeLikeSystem,
} from "./_namespaces/ts";
import { isNodeLikeSystem } from "./_namespaces/ts";

// The following definitions provide the minimum compatible support for the Web Performance User Timings API
// between browsers and NodeJS:
Expand Down
4 changes: 1 addition & 3 deletions src/deprecatedCompat/5.0/identifierProperties.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,7 @@ import {
identifierToKeywordKind,
NodeFlags,
} from "../_namespaces/ts";
import {
deprecate,
} from "../deprecate";
import { deprecate } from "../deprecate";

declare module "../../compiler/types" {
export interface Identifier {
Expand Down
4 changes: 1 addition & 3 deletions src/deprecatedCompat/deprecations.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,7 @@ import {
UnionToIntersection,
Version,
} from "./_namespaces/ts";
import {
deprecate,
} from "./deprecate";
import { deprecate } from "./deprecate";

/** @internal */
export interface DeprecationOptions {
Expand Down
4 changes: 1 addition & 3 deletions src/harness/client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -74,9 +74,7 @@ import {
TodoCommentDescriptor,
UserPreferences,
} from "./_namespaces/ts";
import {
protocol,
} from "./_namespaces/ts.server";
import { protocol } from "./_namespaces/ts.server";

export interface SessionClientHost extends LanguageServiceHost {
writeMessage(message: string): void;
Expand Down
4 changes: 1 addition & 3 deletions src/harness/findUpDir.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
import {
existsSync,
} from "fs";
import { existsSync } from "fs";
import {
dirname,
join,
Expand Down
4 changes: 1 addition & 3 deletions src/harness/fourslashImpl.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,7 @@ 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 {
LoggerWithInMemoryLogs,
} from "./tsserverLogger";
import { LoggerWithInMemoryLogs } from "./tsserverLogger";

import ArrayOrSingle = FourSlashInterface.ArrayOrSingle;

Expand Down
16 changes: 4 additions & 12 deletions src/harness/harnessLanguageService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,25 +6,17 @@ import {
virtualFileSystemRoot,
} from "./_namespaces/Harness";
import * as ts from "./_namespaces/ts";
import {
getNewLineCharacter,
} from "./_namespaces/ts";
import { getNewLineCharacter } from "./_namespaces/ts";
import * as vfs from "./_namespaces/vfs";
import * as vpath from "./_namespaces/vpath";
import {
incrementalVerifier,
} from "./incrementalUtils";
import {
patchServiceForStateBaseline,
} from "./projectServiceStateLogger";
import { incrementalVerifier } from "./incrementalUtils";
import { patchServiceForStateBaseline } from "./projectServiceStateLogger";
import {
createLoggerWithInMemoryLogs,
HarnessLSCouldNotResolveModule,
LoggerWithInMemoryLogs,
} from "./tsserverLogger";
import {
createWatchUtils,
} from "./watchUtils";
import { createWatchUtils } from "./watchUtils";

export function makeDefaultProxy(info: ts.server.PluginCreateInfo): ts.LanguageService {
const proxy = Object.create(/*o*/ null); // eslint-disable-line no-null/no-null
Expand Down
4 changes: 1 addition & 3 deletions src/harness/projectServiceStateLogger.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,7 @@ import {
SourceMapFileWatcher,
TextStorage,
} from "./_namespaces/ts.server";
import {
LoggerWithInMemoryLogs,
} from "./tsserverLogger";
import { LoggerWithInMemoryLogs } from "./tsserverLogger";

interface ProjectData {
projectStateVersion: Project["projectStateVersion"];
Expand Down
4 changes: 1 addition & 3 deletions src/harness/sourceMapRecorder.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
import * as documents from "./_namespaces/documents";
import {
Compiler,
} from "./_namespaces/Harness";
import { Compiler } from "./_namespaces/Harness";
import * as ts from "./_namespaces/ts";
import * as Utils from "./_namespaces/Utils";

Expand Down
4 changes: 1 addition & 3 deletions src/harness/tsserverLogger.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
import * as ts from "./_namespaces/ts";
import {
Compiler,
} from "./harnessIO";
import { Compiler } from "./harnessIO";

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

Expand Down
4 changes: 1 addition & 3 deletions src/jsTyping/jsTyping.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,7 @@ import {
Version,
versionMajorMinor,
} from "./_namespaces/ts";
import {
stringifyIndented,
} from "./_namespaces/ts.server";
import { stringifyIndented } from "./_namespaces/ts.server";

export interface TypingResolutionHost {
directoryExists(path: string): boolean;
Expand Down
4 changes: 1 addition & 3 deletions src/jsTyping/shared.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
import {
sys,
} from "./_namespaces/ts";
import { sys } from "./_namespaces/ts";

export type ActionSet = "action::set";
export type ActionInvalidate = "action::invalidate";
Expand Down
4 changes: 1 addition & 3 deletions src/server/packageJsonCache.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,7 @@ import {
Ternary,
tryFileExists,
} from "./_namespaces/ts";
import {
ProjectService,
} from "./_namespaces/ts.server";
import { ProjectService } from "./_namespaces/ts.server";

/** @internal */
export interface PackageJsonCache {
Expand Down
4 changes: 1 addition & 3 deletions src/server/scriptVersionCache.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,7 @@ import {
TextSpan,
unchangedTextChangeRange,
} from "./_namespaces/ts";
import {
emptyArray,
} from "./_namespaces/ts.server";
import { emptyArray } from "./_namespaces/ts.server";
import * as protocol from "./protocol";

const lineCollectionCapacity = 4;
Expand Down
4 changes: 1 addition & 3 deletions src/services/codefixes/helpers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -111,9 +111,7 @@ import {
visitNode,
visitNodes,
} from "../_namespaces/ts";
import {
ImportAdder,
} from "../_namespaces/ts.codefix";
import { ImportAdder } from "../_namespaces/ts.codefix";

/**
* Finds members of the resolved type that are missing in the class pointed to by class decl
Expand Down
4 changes: 1 addition & 3 deletions src/services/completions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -389,9 +389,7 @@ import {
VariableDeclaration,
walkUpParenthesizedExpressions,
} from "./_namespaces/ts";
import {
StringCompletions,
} from "./_namespaces/ts.Completions";
import { StringCompletions } from "./_namespaces/ts.Completions";

// Exported only for tests
/** @internal */
Expand Down
Loading