Skip to content

Typescript <> style type assertions cause JSX parsing errors. #919

@Benalink

Description

@Benalink

Tell us about your environment

  • ESLint version: 5.16.0
  • eslint-plugin-vue version: 3.8.0
  • Node version: 10.15.3

Please show your full configuration:

  "eslintConfig": {
    "root": true,
    "env": {
      "node": true
    },
    "extends": [
      "plugin:vue/essential",
      "@vue/prettier",
      "@vue/typescript"
    ],
    "rules": {},
    "parserOptions": {
      "parser": "@typescript-eslint/parser"
    }
  }

What did you do?

<script lang="ts">
let repro = function() {
    let anyWindow = <any>window;
}
</script>

What did you expect to happen?
No parsing errors are thrown

What actually happened?

> vue-cli-service lint "src/components/EslintFalsePositive.vue"

error: Parsing error: JSX element 'any' has no corresponding closing tag at src\components\EslintFalsePositive.vue:3:21:
  1 | <script lang="ts">
  2 | let repro = function() {
> 3 |     let anyWindow = <any>window
    |                     ^
  4 | }
  5 | </script>
  6 |


1 error found.

If I missed anything or you want the complete project I have included a new cli project with the only addition being the offending file https://github.com/Benalink/eslint-parser-bug

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions