Skip to content

Conversation

@JounQin
Copy link
Member

@JounQin JounQin commented Aug 18, 2019

  • I’ve added tests to confirm my change works.
  • (If changing the API or CLI) I’ve documented the changes I’ve made (in the docs/ directory)
  • (If the change is user-facing) I’ve added my changes to the CHANGELOG.unreleased.md file following the template.
  • I’ve read the contributing guidelines.

Try the playground for this PR

@JounQin
Copy link
Member Author

JounQin commented Aug 18, 2019

@evilebottnawi @ikatyang I have no idea why babel parser throws, and loc is undefined only on Node 4, would you like to help?

Besides, the error come from

line: error.loc.line,

@j-f1
Copy link
Member

j-f1 commented Aug 18, 2019

You could try changing that section to this:

if (error.loc) {
  throw createError(
    // babel error prints (l:c) with cols that are zero indexed
    // so we need our custom error
    error.message.replace(/ \(.*\)/, ""),
    {
      start: {
        line: error.loc.line,
        column: error.loc.column + 1
      }
    }
  );
} else {
  throw error;
}

That should show you the real error that’s causing the crash.

@JounQin
Copy link
Member Author

JounQin commented Aug 18, 2019

It seems Array#includes is not polyfilled on Node 4.

@JounQin
Copy link
Member Author

JounQin commented Aug 19, 2019

@j-f1 The tests have been fixed, would you like to review again?

@JounQin
Copy link
Member Author

JounQin commented Aug 19, 2019

@evilebottnawi @ikatyang Please help to review.

@alexander-akait
Copy link
Member

Sorry, i am not familiar with mdx, i can't review

@thorn0
Copy link
Member

thorn0 commented Nov 14, 2019

I'm not really familiar with MDX too albeit I learnt a lot about it today. =)

@JounQin
Copy link
Member Author

JounQin commented Nov 16, 2019

@evilebottnawi @ikatyang @thorn0

This PR becomes much cleaner and easier for reviewing after #6949 been merged, thanks for @thorn0's great work.

Please help to review it.

@thorn0 thorn0 merged commit 257fba9 into prettier:master Nov 18, 2019
@JounQin JounQin deleted the feat/mdx_fragment branch November 18, 2019 12:12
@lock lock bot added the locked-due-to-inactivity Please open a new issue and fill out the template instead of commenting. label Feb 16, 2020
@lock lock bot locked as resolved and limited conversation to collaborators Feb 16, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

locked-due-to-inactivity Please open a new issue and fill out the template instead of commenting.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants