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
storysource: Add default parser option. Support prettier v1.13.0 #3660
Merged
Hypnosphi
merged 10 commits into
storybookjs:master
from
isoppp:issue-3657-storysource-support-prettier-0-13
Jun 3, 2018
+76
−33
Merged
Changes from all commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
1903555
storysource: Add default parser option. Support prettier v0.13.0 ( #3…
isoppp 8ec5a40
Revert "storysource: Add default parser option. Support prettier v0.1…
isoppp 86a4cb1
storysource: pass file path to prettier config / support to parser ch…
isoppp 35cd5cb
revert yarn.lock #3657
isoppp b166433
Merge remote-tracking branch 'origin/master' into issue-3657-storysou…
isoppp 3610c72
storybook: unlock prettier minor version
isoppp 7f2864b
storysource: update prettier version to 1.13.3 #3657
isoppp a450f4e
storysource: organized the options to pass to Prettier #3657
isoppp 05e419c
Revert "storysource: organized the options to pass to Prettier #3657"
isoppp 6ac4983
storysource: Modify to make parser or filepath always specified #3657
isoppp File filter
Filter by extension
Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
Not needed anymore, filepath is enough
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 thought the same.
But in this test , if the extension is txt and the contents are something else, prettier does not support to txt file, so it gets an error.
error:
Should i change the test?
I think that probably this is a rare case, so I think that do not have to deal with it unless need it.
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.
After giving it a second thought, we probably should always pass parser to prettier when user specifies it explicitly, which is exactly what we do now. So let's keep it as is
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.
But we probably should put
else if (filepath)
insideif (!config.parser)
, to cover cases when parser is not passedThere 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.
Or maybe we should just pass
babylon
whenparser
isn't set explicitly, because this is what we use by default ourselves. In this case,filepath
will be never neededThere 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.
Thank you for review. I tried fixing it.
And, i read Prettier code a little.
Prettier gives priority to parser over filepath.
If both are empty we gave babylon as Prettier will output errors in the future.