-
-
Notifications
You must be signed in to change notification settings - Fork 4.4k
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
Fix empty file error in json and graphql #4553
Conversation
Can't we just do a check here? Line 249 in fda7bf5
const result = text ? coreFormat(text, opts) : ""; |
The specs for |
It looks like they’re still failing after a re-run @ad1992. |
Are you running with |
@duailibe yes you were right it was due to |
tests_config/run_spec.js
Outdated
@@ -63,14 +63,15 @@ function run_spec(dirname, parsers, options) { | |||
if (AST_COMPARE) { | |||
const compareOptions = Object.assign({}, mergedOptions); | |||
delete compareOptions.cursorOffset; | |||
const astMassaged = parse(input, compareOptions); | |||
const astMassaged = | |||
input && input.trim().length ? parse(input, compareOptions) : {}; |
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.
This might no be the correct fix for this either... maybe we should handle that in prettier.__debug.parse
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 reverted this as it got fixed when I rebased with master.
// Jest Snapshot v1, https://goo.gl/fbAQLP | ||
|
||
exports[`empty-file.graphql 1`] = ` | ||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
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.
Let's keep these tests in tests/empty/
.
Just edit tests/empty/jsfmt.spec.js
to add graphql
and json
to the parsers
Can you fix the lint failure? |
@duailibe I had already run |
Well, Travis says that the parens should be there: https://travis-ci.org/prettier/prettier/jobs/387448061#L489 Perhaps your local node_modules is out of date? Try running |
Yes |
@duailibe please review. |
Thanks! |
185: Update dependency prettier to v1.13.5 r=rehandalal a=renovate[bot] This Pull Request updates dependency [prettier](https://github.com/prettier/prettier) from `v1.13.4` to `v1.13.5` <details> <summary>Release Notes</summary> ### [`v1.13.5`](https://github.com/prettier/prettier/blob/master/CHANGELOG.md#​1135) [Compare Source](prettier/prettier@1.13.4...1.13.5) [link](prettier/prettier@1.13.4...1.13.5) - Better handling of trailing spaces in Markdown ([#​4593](`https://github.com/prettier/prettier/pull/4593`)) - Fix empty file error in JSON and GraphQL ([#​4553](`https://github.com/prettier/prettier/pull/4553`)) - Preserve decorator on TypeScript interfaces ([#​4632](`https://github.com/prettier/prettier/pull/4632`)) - Inline \_ or $ in the root of a method chain ([#​4621](`https://github.com/prettier/prettier/pull/4621`)) --- </details> --- This PR has been generated by [Renovate Bot](https://renovatebot.com). Co-authored-by: Renovate Bot <[email protected]>
This Pull Request updates dependency [prettier](https://github.com/prettier/prettier) from `v1.13.4` to `v1.13.5` <details> <summary>Release Notes</summary> ### [`v1.13.5`](https://github.com/prettier/prettier/blob/master/CHANGELOG.md#​1135) [Compare Source](prettier/prettier@1.13.4...1.13.5) [diff](prettier/prettier@1.13.4...1.13.5) - Better handling of trailing spaces in Markdown ([#​4593](`https://github.com/prettier/prettier/pull/4593`)) - Fix empty file error in JSON and GraphQL ([#​4553](`https://github.com/prettier/prettier/pull/4553`)) - Preserve decorator on TypeScript interfaces ([#​4632](`https://github.com/prettier/prettier/pull/4632`)) - Inline \_ or $ in the root of a method chain ([#​4621](`https://github.com/prettier/prettier/pull/4621`)) --- </details> --- This PR has been generated by [Renovate Bot](https://renovatebot.com).
Fixes #4448