Skip to content
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

Merged
merged 7 commits into from Jun 6, 2018

Conversation

@ad1992
Copy link
Contributor

commented May 26, 2018

Fixes #4448

@duailibe

This comment has been minimized.

Copy link
Member

commented May 26, 2018

Can't we just do a check here?

const result = coreFormat(text, opts);

const result = text ? coreFormat(text, opts) : "";

@ad1992 ad1992 force-pushed the ad1992:aakansha-prettier branch from e4cdd66 to f822770 May 26, 2018

@ad1992 ad1992 changed the title Fix empty file error in json Fix empty file error in json and graphql May 26, 2018

@ad1992

This comment has been minimized.

Copy link
Contributor Author

commented May 27, 2018

The specs for graphql_empty_file and json_empty_file are passing in local but not in travis. I am not sure why. Can someone rerun the specs.

@j-f1

This comment has been minimized.

Copy link
Member

commented May 27, 2018

It looks like they’re still failing after a re-run @ad1992.

@duailibe

This comment has been minimized.

Copy link
Member

commented May 27, 2018

are passing in local but not in travis

Are you running with AST_COMPARE=1 ?

@ad1992 ad1992 force-pushed the ad1992:aakansha-prettier branch from 71fa982 to 600b83f Jun 2, 2018

@ad1992

This comment has been minimized.

Copy link
Contributor Author

commented Jun 2, 2018

@duailibe yes you were right it was due to AST_COMPARE=1. Its fixed now.

@@ -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) : {};

This comment has been minimized.

Copy link
@duailibe

duailibe Jun 2, 2018

Member

This might no be the correct fix for this either... maybe we should handle that in prettier.__debug.parse

This comment has been minimized.

Copy link
@ad1992

ad1992 Jun 3, 2018

Author Contributor

I reverted this as it got fixed when I rebased with master.

// Jest Snapshot v1, https://goo.gl/fbAQLP

exports[`empty-file.graphql 1`] = `
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

This comment has been minimized.

Copy link
@duailibe

duailibe Jun 2, 2018

Member

Let's keep these tests in tests/empty/.

Just edit tests/empty/jsfmt.spec.js to add graphql and json to the parsers

@ad1992

This comment has been minimized.

Copy link
Contributor Author

commented Jun 5, 2018

@suchipi @duailibe can this be merged ?

@duailibe

This comment has been minimized.

Copy link
Member

commented Jun 5, 2018

Can you fix the lint failure?

@ad1992

This comment has been minimized.

Copy link
Contributor Author

commented Jun 5, 2018

@duailibe I had already run yarn lint --fix so there should not be any lint issue.
size = size + tabWidth - (size % tabWidth); got converted to this when I ran yarn lint --fix
size = size + tabWidth - size % tabWidth;
should I revert it back ?

@lydell

This comment has been minimized.

Copy link
Collaborator

commented Jun 5, 2018

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 yarn to update. Then I would guess yarn lint --fix would do the right thing.

@ad1992

This comment has been minimized.

Copy link
Contributor Author

commented Jun 5, 2018

Yes node_modules was out of date. Its fixed now.

@ad1992

This comment has been minimized.

Copy link
Contributor Author

commented Jun 6, 2018

@duailibe please review.

@duailibe duailibe merged commit 8ec5432 into prettier:master Jun 6, 2018

1 of 5 checks passed

ci/circleci: build_prod CircleCI is running your tests
Details
continuous-integration/appveyor/pr Waiting for AppVeyor build to complete
Details
continuous-integration/travis-ci/pr The Travis CI build is in progress
Details
deploy/netlify Deploy preview processing.
Details
ci/circleci: checkout_code Your tests passed on CircleCI!
Details
@duailibe

This comment has been minimized.

Copy link
Member

commented Jun 6, 2018

Thanks!

@ad1992 ad1992 deleted the ad1992:aakansha-prettier branch Jun 6, 2018

bors bot added a commit to mozilla/delivery-console that referenced this pull request Jun 8, 2018
Merge #185
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#&#8203;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 ([#&#8203;4593](`prettier/prettier#4593))
- Fix empty file error in JSON and GraphQL ([#&#8203;4553](`prettier/prettier#4553))
- Preserve decorator on TypeScript interfaces ([#&#8203;4632](`prettier/prettier#4632))
- Inline \_ or $ in the root of a method chain ([#&#8203;4621](`prettier/prettier#4621))

---

</details>




---

This PR has been generated by [Renovate Bot](https://renovatebot.com).

Co-authored-by: Renovate Bot <bot@renovateapp.com>
peterbe added a commit to mozilla-services/tecken that referenced this pull request Jun 22, 2018
Update dependency prettier to v1.13.5 (#906)
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#&#8203;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 ([#&#8203;4593](`prettier/prettier#4593))
- Fix empty file error in JSON and GraphQL ([#&#8203;4553](`prettier/prettier#4553))
- Preserve decorator on TypeScript interfaces ([#&#8203;4632](`prettier/prettier#4632))
- Inline \_ or $ in the root of a method chain ([#&#8203;4621](`prettier/prettier#4621))

---

</details>




---

This PR has been generated by [Renovate Bot](https://renovatebot.com).

@lock lock bot locked as resolved and limited conversation to collaborators Sep 4, 2018

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
5 participants
You can’t perform that action at this time.