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

Parse error on YAML headers #4

Closed
cdfa opened this issue Jul 29, 2019 · 7 comments
Closed

Parse error on YAML headers #4

cdfa opened this issue Jul 29, 2019 · 7 comments

Comments

@cdfa
Copy link

@cdfa cdfa commented Jul 29, 2019

Hi, I want to use this plugin for linting my Docz documentation written in MDX, but the plugin seems unable to parse the YAML headers used for configuration.

Example:

---
name: FollowReveal
route: /follow-reveal
---

# FollowReveal
...

Error:

1:3  error  Parsing error: Invalid left-hand side in prefix operation
> 1 | ---
    |   ^
  2 | name: FollowReveal
  3 | route: /follow-reveal
  4 | ---
@JounQin

This comment has been minimized.

Copy link
Member

@JounQin JounQin commented Jul 29, 2019

Thanks for reporting, I'll check as soon as possible.

@JounQin

This comment has been minimized.

Copy link
Member

@JounQin JounQin commented Jul 29, 2019

@cdfa I can not reproduce this error, can you try to upgrade you eslint version first? If it still throws error, please provide a runnable reproduction, so I can help to check.

@JounQin JounQin closed this Jul 29, 2019
JounQin added a commit that referenced this issue Jul 29, 2019
@cdfa

This comment has been minimized.

Copy link
Author

@cdfa cdfa commented Jul 30, 2019

I updated eslint to 6.1.0, but I'm still having the same issue. I created a branch so you can view it yourself. You can also see the error on CircleCi here

Steps to reproduce:

  • Clone the repo: git clone --single-branch --branch feature/mdx-lint cdfa/react-turn-reveal
  • Install dependencies (I use PNPM, because reasons noted in the Contributing.md, but for this case I think npm gives the same results): pnpm i
  • Run eslint: npm run lint:mdx:eslint

I seem to get different parse errors depending on whether I put "extends": ["plugin:@rxts/mdx/recommended"] in an override or in the global extends field.

@JounQin

This comment has been minimized.

Copy link
Member

@JounQin JounQin commented Jul 30, 2019

Thanks for reproduction, I'll take a look A.S.A.P. .

@JounQin JounQin reopened this Jul 30, 2019
@JounQin

This comment has been minimized.

Copy link
Member

@JounQin JounQin commented Jul 30, 2019

@cdfa You need to pass a custom parser, because the ast has been transformed by other parsers/plugins:

{
  "files": ["*.mdx"],
  "extends": ["plugin:@rxts/mdx/recommended"],
  "parserOptions": {
    "parser": "babel-eslint"
  }
}

However, there still is an error:

/Users/JounQin/Workspaces/GitHub/react-turn-reveal/index.mdx
  6:3  error  Parsing error: Unexpected token

> 1 | <!-- markdownlint-disable MD041 -->
    | ^

✖ 1 problem (1 error, 0 warnings)

I will fix it tonight.

@cdfa

This comment has been minimized.

Copy link
Author

@cdfa cdfa commented Jul 30, 2019

Ah great to learn the root cause! Thank you for your quick work!

JounQin added a commit that referenced this issue Jul 30, 2019
JounQin added a commit that referenced this issue Jul 30, 2019
@JounQin JounQin closed this in 5297a0b Jul 30, 2019
@JounQin

This comment has been minimized.

Copy link
Member

@JounQin JounQin commented Jul 30, 2019

@cdfa Please try v0.3.1

Sorry, it is still buggy for:
<Playground style={{ display: "flex", justifyContent: "center" }}>
  {() => {
    const perspective = 400;
    return (
      <div style={{ position: "relative", perspective: perspective + "px" }}>
        <FollowReveal perspective={perspective}>
          <Front>More info</Front>
        </FollowReveal>
        <PlaceHolderImage />
      </div>
    );
  }}
</Playground>

Wait for a while.

@JounQin JounQin reopened this Jul 30, 2019
@JounQin JounQin closed this in f7e7efe Jul 30, 2019
JounQin added a commit that referenced this issue Jul 30, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants
You can’t perform that action at this time.