fix(playground): backward compatibility for --parser babylon (#5690)
parent
3a6c126f86
commit
284764f030
|
@ -1,7 +1,7 @@
|
|||
export default function(parser) {
|
||||
switch (parser) {
|
||||
case "babel":
|
||||
case "babylon": // backward compatibility for v1.15 playground
|
||||
case "babylon": // backward compatibility
|
||||
return [
|
||||
'function HelloWorld({greeting = "hello", greeted = \'"World"\', silent = false, onMouseOver,}) {',
|
||||
"",
|
||||
|
|
|
@ -36,6 +36,7 @@ function formatMarkdown(
|
|||
function getMarkdownSyntax(options) {
|
||||
switch (options.parser) {
|
||||
case "babel":
|
||||
case "babylon": // backward compatibility
|
||||
case "flow":
|
||||
return "jsx";
|
||||
case "typescript":
|
||||
|
|
|
@ -11,7 +11,9 @@ export function getDefaults(availableOptions, optionNames) {
|
|||
for (const option of availableOptions) {
|
||||
if (optionNames.includes(option.name)) {
|
||||
defaults[option.name] =
|
||||
option.name === "parser" ? "babel" : option.default;
|
||||
option.name === "parser"
|
||||
? "babylon" // TODO(1.16): replace with `babel`
|
||||
: option.default;
|
||||
}
|
||||
}
|
||||
return defaults;
|
||||
|
|
|
@ -17,7 +17,7 @@ var parsers = {
|
|||
importScriptOnce("lib/parser-babylon.js");
|
||||
return prettierPlugins.babylon.parsers.babel;
|
||||
},
|
||||
// backward compatibility for v1.15 playground
|
||||
// backward compatibility
|
||||
get babylon() {
|
||||
importScriptOnce("lib/parser-babylon.js");
|
||||
return prettierPlugins.babylon.parsers.babylon;
|
||||
|
|
Loading…
Reference in New Issue