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

Parser mishandling comments in jsx including //. #606

Closed
Thiry1 opened this issue Jun 10, 2019 · 2 comments · Fixed by #607
Closed

Parser mishandling comments in jsx including //. #606

Thiry1 opened this issue Jun 10, 2019 · 2 comments · Fixed by #607
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

@Thiry1
Copy link

Thiry1 commented Jun 10, 2019

const parser = require('@typescript-eslint/typescript-estree');
const code = `
  <div>
    <div>hello</div>
    // This is not a comment.
  </div>
`;
const ast = parser.parse(code, {
    jsx: true,
    comment: true,
});
return ast.comments;

What did you expect to happen?
[] is returned.

What actually happened?
[ { type: 'Line', value: ' This is not a comment.', range: [ 34, 59 ], loc: { start: [Object], end: [Object] } } ] is returned.
Versions

package version
@typescript-eslint/typescript-estree 1.10.2
TypeScript 3.5.1
node 11.9.0
npm 6.9.0
@Thiry1 Thiry1 added package: typescript-estree Issues related to @typescript-eslint/typescript-estree triage Waiting for maintainers to take a look labels Jun 10, 2019
@Thiry1 Thiry1 changed the title Parser mishandling comments in multiple lines jsx including //. Parser mishandling comments in jsx including //. Jun 10, 2019
@bradzacher bradzacher added bug Something isn't working and removed triage Waiting for maintainers to take a look labels Jun 10, 2019
@bradzacher
Copy link
Member

Probably a regression caused by #596.

Just curious - why is there double slash non-comments in your JSX?

@Thiry1
Copy link
Author

Thiry1 commented Jun 10, 2019

Just curious - why is there double slash non-comments in your JSX?

In my case, I wrote URL in JSX. URL has double slash :D

@bradzacher bradzacher added the has pr there is a PR raised to close this label Jun 10, 2019
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Apr 21, 2020
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
Development

Successfully merging a pull request may close this issue.

2 participants