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

<!-- style comments not recognized when parsing JSX #6964

Closed
aaronshaf opened this issue Aug 23, 2016 · 11 comments
Closed

<!-- style comments not recognized when parsing JSX #6964

aaronshaf opened this issue Aug 23, 2016 · 11 comments
Labels
accepted There is consensus among the team that this change meets the criteria for inclusion archived due to age This issue has been archived; please open a new issue for any further discussion bug ESLint is working incorrectly

Comments

@aaronshaf
Copy link

aaronshaf commented Aug 23, 2016

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

@eslintbot eslintbot added the triage An ESLint team member will look at this issue soon label Aug 23, 2016
@ljharb
Copy link
Sponsor Contributor

ljharb commented Aug 23, 2016

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 :-)

@mysticatea mysticatea added enhancement This change enhances an existing feature of ESLint evaluating The team will evaluate this issue to decide whether it meets the criteria for inclusion and removed triage An ESLint team member will look at this issue soon labels Aug 24, 2016
@mysticatea
Copy link
Member

Thank you for this issue.

Acorn, the base of our parser, does not support HTML style comments, so it needs to implement in Acorn.

@aaronshaf
Copy link
Author

Thanks. I created the issue: acornjs/acorn#454

@aaronshaf aaronshaf reopened this Aug 24, 2016
@mysticatea
Copy link
Member

mysticatea commented Aug 24, 2016

I'm sorry.
I re-confirmed that <!-- seems to be handled as single line comment correctly.

image

@platinumazure
Copy link
Member

@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?

@mysticatea
Copy link
Member

Espree seems to handle the HTML comments as single line comments.
So, I think we don't need to do something for this.

image

(Probably I saw a ghost around this issue...)

@mysticatea
Copy link
Member

mysticatea commented Aug 28, 2016

I got a fact that HTML comments trigger a syntax error if it's using JSX option.
I reopen this issue.

$ 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)

@mysticatea mysticatea reopened this Aug 28, 2016
@mysticatea mysticatea added bug ESLint is working incorrectly blocked This change can't be completed until another issue is resolved and removed enhancement This change enhances an existing feature of ESLint labels Aug 28, 2016
@mysticatea
Copy link
Member

I opened the issue: acornjs/acorn-jsx#41

@mysticatea
Copy link
Member

acorn-jsx's issue has been fixed now.
This issue will be fixed after espree upgrades acorn-jsx to 4.0.1.

@not-an-aardvark not-an-aardvark added accepted There is consensus among the team that this change meets the criteria for inclusion and removed evaluating The team will evaluate this issue to decide whether it meets the criteria for inclusion labels Aug 14, 2017
@not-an-aardvark not-an-aardvark changed the title <!-- style comments not recognized <!-- style comments not recognized when parsing JSX Aug 25, 2017
@nzakas
Copy link
Member

nzakas commented Oct 1, 2018

@mysticatea has this issue been fixed in Espree now? Can we close this issue?

@mysticatea
Copy link
Member

Yes, it has been fixed. Thank you for pinging!

@mysticatea mysticatea removed the blocked This change can't be completed until another issue is resolved label Oct 4, 2018
@eslint-deprecated eslint-deprecated bot locked and limited conversation to collaborators Apr 3, 2019
@eslint-deprecated eslint-deprecated bot added the archived due to age This issue has been archived; please open a new issue for any further discussion label Apr 3, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
accepted There is consensus among the team that this change meets the criteria for inclusion archived due to age This issue has been archived; please open a new issue for any further discussion bug ESLint is working incorrectly
Projects
None yet
Development

No branches or pull requests

7 participants