Skip to content

Is it possible to detect unclosed JSX/HTML tags? #474

@alxndrsn

Description

@alxndrsn

I occasionally run into bugs in my astro projects when a JSX tag is left unclosed. Depending on following tags, this may pass linting, or may fail cryptically later.

E.g.

Passes

<div>
  <div>
    <unclosed>
  </div>
</div>

Fails

<div>
  <div>
    <unclosed>
  </div>
  <!-- a comment -->
</div>

Fails with:

Parsing error: Unknown token at 39, expected: "<!--", actual: "</div>\n  <"

The error message itself seems a bit confusing.


I've created a repo with reproduction at https://github.com/alxndrsn/astro-eslint-parser-weirdness

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions