-
-
Notifications
You must be signed in to change notification settings - Fork 4.4k
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
<!-- style comments not recognized when parsing JSX #6964
Comments
They're in annex B, which means non-web browsers don't have to implement parsing for it. That said, it does seem useful for eslint to be able to parse them, if only so a rule can be created that forbids them :-) |
Thank you for this issue. Acorn, the base of our parser, does not support HTML style comments, so it needs to implement in Acorn. |
Thanks. I created the issue: acornjs/acorn#454 |
@mysticatea Do we need to do anything in espree, then, in order to get the comment to show up? Or maybe the problem is only in attaching the comments to code nodes? What's our next step here? |
I got a fact that HTML comments trigger a syntax error if it's using JSX option. $ echo "<!--" | eslint --stdin --no-eslintrc no errors $ echo "<!--" | eslint --stdin --no-eslintrc --parser-options "ecmaFeatures:{jsx:true}"
<text>
1:2 error Parsing error: Unexpected token !
✖ 1 problem (1 error, 0 warnings) |
I opened the issue: acornjs/acorn-jsx#41 |
|
@mysticatea has this issue been fixed in Espree now? Can we close this issue? |
Yes, it has been fixed. Thank you for pinging! |
Evidently
<!-- ...
single-line comments are valid in JavaScript. eslint doesn't seem to recognize this.Source: https://twitter.com/bterlson/status/768211703314067457 and http://www.ecma-international.org/ecma-262/7.0/index.html#prod-annexB-SingleLineHTMLOpenComment
The text was updated successfully, but these errors were encountered: