Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
ota-meshi opened this issue Jul 17, 2020 · 5 comments · Fixed by #115
Closed

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

ota-meshi opened this issue Jul 17, 2020 · 5 comments · Fixed by #115

Comments

@ota-meshi
Copy link
Member

ota-meshi commented Jul 17, 2020

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.

@aggmoulik
Copy link

aggmoulik commented Oct 17, 2020

Anyone is working on this issue ?

@ota-meshi
Copy link
Member Author

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

@aggmoulik
Copy link

Okay, So let's do that discussion.

@ota-meshi ota-meshi changed the title Supports for <script setup> and <style vars> Supports for <script setup> and <style> variable injection Dec 4, 2020
@MartinMa
Copy link

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
Copy link
Member Author

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
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants