From c2808faf2a455c3a700f9e6ebc9f257f66c57477 Mon Sep 17 00:00:00 2001 From: Sosuke Suzuki Date: Thu, 2 Sep 2021 17:55:30 +0900 Subject: [PATCH] Fix Playground (#11433) * Revert ENABLED_OPTIONS * Fix * Fix typo --- website/playground/Playground.js | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) diff --git a/website/playground/Playground.js b/website/playground/Playground.js index 4000b2b0b..234e87feb 100644 --- a/website/playground/Playground.js +++ b/website/playground/Playground.js @@ -23,6 +23,13 @@ const CATEGORIES_ORDER = [ "HTML", "Special", ]; +const ISSUES_URL = "https://github.com/prettier/prettier/issues/new?body="; +const MAX_LENGTH = 8000 - ISSUES_URL.length; // it seems that GitHub limit is 8195 +const COPY_MESSAGE = + "\n"; + +const isProduction = location.host === "prettier.io"; +const isPreview = location.host.includes("netlify.app"); const ENABLED_OPTIONS = [ "parser", "printWidth", @@ -37,16 +44,19 @@ const ENABLED_OPTIONS = [ "trailingComma", "proseWrap", "htmlWhitespaceSensitivity", - "bracketSameLine", "insertPragma", "requirePragma", "vueIndentScriptAndStyle", "embeddedLanguageFormatting", ]; -const ISSUES_URL = "https://github.com/prettier/prettier/issues/new?body="; -const MAX_LENGTH = 8000 - ISSUES_URL.length; // it seems that GitHub limit is 8195 -const COPY_MESSAGE = - "\n"; +// "jsxBracketSameLine" will be deprecated in 2.4 +if (isProduction) { + ENABLED_OPTIONS.push("jsxBracketSameLine"); +} +// "bracketSameLine" will be landed in 2.4 +if (isPreview) { + ENABLED_OPTIONS.push("bracketSameLine"); +} class Playground extends React.Component { constructor(props) {