Skip to content

[2.5.0] Markdown parsing failed #1123

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

Closed
zombieJ opened this issue Oct 22, 2019 · 7 comments · Fixed by #1127
Closed

[2.5.0] Markdown parsing failed #1123

zombieJ opened this issue Oct 22, 2019 · 7 comments · Fixed by #1127
Labels
bug Something isn't working has pr there is a PR raised to close this package: typescript-estree Issues related to @typescript-eslint/typescript-estree

Comments

@zombieJ
Copy link

zombieJ commented Oct 22, 2019

What code were you trying to parse?

Markdown text:

There are `primary` button, `default` button, `dashed` button, `danger` button and `link` button in antd.

```jsx
import { Button } from 'antd';

ReactDOM.render(
  <div>
    <Button type="primary">Primary</Button>
    <Button>Default</Button>
    <Button type="dashed">Dashed</Button>
    <Button type="danger">Danger</Button>
    <Button type="link">Link</Button>
  </div>,
  mountNode,
);
```

What did you expect to happen?

Works eslint normal as 2.4.0

What actually happened?

error Parsing error: '>' expected

Versions

package version
@typescript-eslint/parser 2.5.0
TypeScript 3.6.4
ESLint 6.5.1
node 10.16.3
npm 6.9.0
@zombieJ zombieJ added package: parser Issues related to @typescript-eslint/parser triage Waiting for team members to take a look labels Oct 22, 2019
@bradzacher bradzacher added awaiting response Issues waiting for a reply from the OP or another party and removed triage Waiting for team members to take a look labels Oct 22, 2019
@bradzacher
Copy link
Member

I don't understand - how are you using our parser to parse markdown?
What config are you using?

@zombieJ
Copy link
Author

zombieJ commented Oct 22, 2019

@bradzacher
Copy link
Member

It will probably work if you set this in your .eslintrc.js

parserOptions: {
  ecmaFeatures: {
    jsx: true,
  },
}

@zombieJ
Copy link
Author

zombieJ commented Oct 22, 2019

Thanks for quick response. Tested, seems still meet same error.
截屏2019-10-22下午1 51 55

截屏2019-10-22下午1 52 24

@JounQin
Copy link
Contributor

JounQin commented Oct 22, 2019

+1, my eslint-mdx breaks due to this, and I've wasted a whole afternoon to figure out this is a BREAKING CHANGE from @typescript-eslint/parser...

@bradzacher bradzacher added bug Something isn't working package: typescript-estree Issues related to @typescript-eslint/typescript-estree and removed awaiting response Issues waiting for a reply from the OP or another party package: parser Issues related to @typescript-eslint/parser labels Oct 22, 2019
@bradzacher
Copy link
Member

Again, as per #1124 - it is a bug, unintentionally introduced.

I understand you're frustrated, but please understand that ESLint is a very complex, and extensive environment.

ESLint itself calls into our parser in a certain format.
There are parsers which call into our parser in a different format.
And apparently, there are preprocessors which call into our parser in another different format.

TBH, I didn't even know that this particular use case existed before today.

@JounQin
Copy link
Contributor

JounQin commented Oct 22, 2019

@bradzacher Sorry for my impatient, I was just too upset at that time.

I personally wrote an eslint parser/plugin for mdx either, so I do understand the complexity of eslint. There are so many edge cases.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Something isn't working has pr there is a PR raised to close this package: typescript-estree Issues related to @typescript-eslint/typescript-estree
Projects
None yet
3 participants