-
Notifications
You must be signed in to change notification settings - Fork 659
Conversation
✅ Deploy Preview for docs-rometools ready!
To edit notification comments on pull requests, go to your Netlify site settings. |
@@ -147,76 +138,6 @@ export function createPlaygroundSettingsSetter< | |||
}; | |||
} | |||
|
|||
export function formatWithPrettier( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I moved this to the prettierWorker
to remove the prettier dependencies from the main bundle.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I just tried to parse a JSON file, but prettier formatter emits an error
Thanks. Should now be fixed! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Here's some feedback:
- prettier now handles JSON files;
- if you create a
.json
file and tickTypeScript
orJSX
under "Source Type", the extension of the file changes; - from the previous step, if you untick the option, the file now has
.js
extension
These are good points. I'll create an issue for updating the playground to add proper support for different languages (hide language and formatter options that aren't relevant) |
Summary
This PR adds basic JSON support to the playground. It's not the deluxe version.
To use JSON, it's necessary to switch to the multifile mode and change the extension to
json
.We should probably add a language dropdown in the future that lets you pick JavaScript, TypeScript, or JSON, similar to what Prettier has. I decided not to do this as part of this PR because it's mainly to unlock the development of the JSON formatter and not to promote the JSON formatting on the playground.
Test Plan
I tested the playground with a JSON, jS ,and TypeScript file