From 4af0c0ef838976c7cd3f0c9b5c1d2e1d40767d0a Mon Sep 17 00:00:00 2001 From: Jack Bates Date: Sat, 12 Dec 2020 11:00:26 -0700 Subject: [PATCH] Remove Prettier --- package.json | 1 - src/pr-info.ts | 10 ++++------ 2 files changed, 4 insertions(+), 7 deletions(-) diff --git a/package.json b/package.json index 8740645e3..c32812fa9 100644 --- a/package.json +++ b/package.json @@ -34,7 +34,6 @@ "idembot": "^0.0.12", "moment": "^2.27.0", "node-fetch": "^2.6.1", - "prettier": "^2.2.0", "prettyjson": "^1.2.1", "request": "^2.88.2", "tslib": "^1.13.0", diff --git a/src/pr-info.ts b/src/pr-info.ts index 8221051d6..6b39a9e6e 100644 --- a/src/pr-info.ts +++ b/src/pr-info.ts @@ -21,7 +21,6 @@ import * as comment from "./util/comment"; import * as urls from "./urls"; import * as HeaderParser from "definitelytyped-header-parser"; import * as jsonDiff from "fast-json-patch"; -import * as prettier from "prettier"; import { PullRequestState } from "./schema/graphql-global-types"; const CriticalPopularityThreshold = 5_000_000; @@ -486,11 +485,10 @@ function makeJsonCheckerFromCore(requiredForm: any, ignoredKeys: string[], requi // Suggest the different lines to the author function makeJsonSuggestion() { - const suggestionLines = ( - Object.keys(suggestion).length <= 1 - ? prettier.format(JSON.stringify(suggestion), { tabWidth: 4, filepath: ".json" }) - : JSON.stringify(suggestion, undefined, 4) + "\n" - ).split(/^/m); + const text = JSON.stringify(suggestion, undefined, 4); + const suggestionLines = Object.keys(suggestion).length === 1 + ? [text.replace(/\n */g, " ") + "\n"] + : (text + "\n").split(/^/m); // "^" will match inside LineTerminatorSequence so // "\r\n".split(/^/m) is two lines. Sigh. // https://tc39.es/ecma262/#_ref_7303:~:text=the%20character%20Input%5Be%20%2D%201%5D%20is%20one%20of%20LineTerminator