Skip to content

Supports for <script setup> and <style> variable injection #78

Closed
@ota-meshi

Description

@ota-meshi
Member

Vue.js 3.0 is about to include <script setup> and <style vars> as experimental features. (refer to vuejs/rfcs#189)

It seems that can write script like function arguments in <script setup="..."> and script like object expression in <style vars="...">.

Can vue-eslint-parser be changed to support these parsers?

If the parser supports these parses then, I have one more question to ask.
Perhaps the arguments given to <script setup> will need to be registered with the scope manager as global variables.
Should the parser register this global variable? Or is it okay if the vue/experimental-script-setup-vars rules etc. register (and remove from through) global variables?


EIDT:


Related to vuejs/eslint-plugin-vue#1248.

Activity

aggmoulik

aggmoulik commented on Oct 17, 2020

@aggmoulik

Anyone is working on this issue ?

ota-meshi

ota-meshi commented on Oct 18, 2020

@ota-meshi
MemberAuthor

Hi @aggmoulik.
No one is working because we haven't yet discussed how to change it.

aggmoulik

aggmoulik commented on Oct 19, 2020

@aggmoulik

Okay, So let's do that discussion.

changed the title [-]Supports for <script setup> and <style vars>[/-] [+]Supports for <script setup> and <style> variable injection[/+] on Dec 4, 2020
MartinMa

MartinMa commented on Apr 21, 2021

@MartinMa

I have no idea how any of this works, but my eslint setup throws no-unused-vars errors when using the new experimental <script setup> syntax. Any idea how I can work around that? Should I disable the no-unused-vars rule for now or better stick to the more verbose setup syntax? The VS Code extension Volar already supports the new syntax with IntelliSense in the template block.

ota-meshi

ota-meshi commented on Apr 22, 2021

@ota-meshi
MemberAuthor

The RFC hasn't been merged yet, so I'm not thinking about the details.
Currently, you need to turn off the no-unused-vars rule for <script setup>.
If you create a special ESLint rule, use markVariableAsUsed to mark the variables. https://eslint.org/docs/developer-guide/working-with-rules#the-context-object

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

      Participants

      @MartinMa@ota-meshi@aggmoulik

      Issue actions

        Supports for <script setup> and <style> variable injection · Issue #78 · vuejs/vue-eslint-parser