- 
          
- 
                Notifications
    You must be signed in to change notification settings 
- Fork 6.3k
Closed
Description
Version
3.0.0-rc.10
Node and OS info
Node 10.8.0 / npm 6.2.0 / Windows 10
Steps to reproduce
- Create a new Vue project with TypeScript and ESLint.
- Create a .vue file with a component and include a <script lang="ts">-tag.
- Use the TypeScript cast operator (<Type>object)anywhere in the script tag.
- Run npm run lint.
Example code that produces the error:
<script lang="js">
    import { Component, Prop, Vue } from "vue-property-decorator";
    @Component
    export default class Navigation extends Vue {
        @Prop(String) private scrollTarget!: string;
        mounted(): void {
            if (!this.scrollTarget) {
                return;
            }
            window.addEventListener("scroll", ev => {
                if (window.scrollY > ((<HTMLElement>document.querySelector(this.scrollTarget)).offsetTop + (<HTMLElement>document.querySelector(this.scrollTarget)).offsetHeight)) {
                    console.log("Scrolled past!");
                }
            });
        }
    }
</script>What is expected?
ESLint should have no complaints and everything should work fine.
What is actually happening?
ESLint determines the cast operator as an opening tag of HTML and thus declares the whole code to JSX.
When including the line with the console.log call, ESLint demands a closing curly bracket after the closing quotemark.
When commenting the same line, ESLint states
JSX element 'HTMLElement' has no corresponding closing tag
Metadata
Metadata
Assignees
Labels
No labels