stenciljs/eslint-plugin

@stencil/async-methods is not working properly

Open

#15 geöffnet am 11. Sept. 2020

Auf GitHub ansehen
 (15 Kommentare) (11 Reaktionen) (0 zugewiesene Personen)TypeScript (37 Forks)auto 404
Bug: ValidatedHelp WantedReply Received

Repository-Metriken

Stars
 (71 Stars)
PR-Merge-Metriken
 (PR-Metriken ausstehend)

Beschreibung

Working with the latest version of this plugin: "@stencil/eslint-plugin": "^0.3.1", We discover is not behaving as expected, when we run eslint is throwing the following error:

error External @Method() expandPopover() must return a Promise. Consider prefixing the method with async, such as @Method() async expandPopover() @stencil/async-methods

But we have the async decorator in the method:

    /**
     * some comment
     */
    @Method()
    async expandPopover(): Promise<void> {
        if(this.trigger === PopoverTooltipTrigger.Conditional){
            this.openPopover();
        }
    }

What is worse is that if you run the eslint --fix command, it will generate this code:

    /**
     * some comment
     */


    /**
     * some comment
     */
    

    /**
     * some comment
     */
    

    /**
     * some comment
     */
    @Method()
    asyncasync    async expandPopover(): Promise<void> {
        if(this.trigger === PopoverTooltipTrigger.Conditional){
            this.openPopover();
        }
    }

Is multiplying the comment by 4 and is adding multiple async words before the method declaration.

We couldn't figure it out how to fix this, can you help? Thanks.

Contributor Guide