Description
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:
-
<style>
may not need to be parsed.
SFC style CSS variable injection (new edition) rfcs#231 -
<script setup="...">
may not need to be parsed.
However, multiple<script>
blocks must be parsed as a single script.
<script setup>
rfcs#227
Related to vuejs/eslint-plugin-vue#1248.
Activity
aggmoulik commentedon Oct 17, 2020
Anyone is working on this issue ?
ota-meshi commentedon Oct 18, 2020
Hi @aggmoulik.
No one is working because we haven't yet discussed how to change it.
aggmoulik commentedon Oct 19, 2020
Okay, So let's do that discussion.
[-]Supports for <script setup> and <style vars>[/-][+]Supports for <script setup> and <style> variable injection[/+]MartinMa commentedon Apr 21, 2021
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 theno-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 commentedon Apr 22, 2021
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<script setup>
#108<script setup>
#110<script>
andexport
in<script setup>
#115