You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/README.md
+2-1
Original file line number
Diff line number
Diff line change
@@ -15,7 +15,8 @@ This plugin allows us to check the `<template>` and `<script>` of `.vue` files w
15
15
ESLint editor integrations are useful to check your code in real-time.
16
16
17
17
:::warning Status of Vue.js 3.x supports
18
-
This plugin supports the basic syntax of Vue.js 3.0, but the Vue.js 3.0 experimental features `<script setup>` and `<style vars>` are not yet supported. Follow [#1248](https://github.com/vuejs/eslint-plugin-vue/issues/1248) for more details.
18
+
This plugin supports the basic syntax of Vue.js 3.0, but `<script setup>` does not yet fully support it.
19
+
Also, the Vue.js 3.0 experimental feature CSS variable injection is not yet supported. Follow [#1248](https://github.com/vuejs/eslint-plugin-vue/issues/1248) for more details.
Copy file name to clipboardExpand all lines: docs/rules/experimental-script-setup-vars.md
+4
Original file line number
Diff line number
Diff line change
@@ -19,6 +19,10 @@ This rule will find variables defined in `<script setup="args">` and mark them a
19
19
20
20
This rule only has an effect when the `no-undef` rule is enabled.
21
21
22
+
:::warning
23
+
`<script setup="args">` syntax wasn't rejected by Vue's RFC. Check out the [new syntax](https://github.com/vuejs/rfcs/blob/master/active-rfcs/0040-script-setup.md).
Copy file name to clipboardExpand all lines: docs/user-guide/README.md
+61-1
Original file line number
Diff line number
Diff line change
@@ -72,7 +72,8 @@ By default all rules from **base** and **essential** categories report ESLint er
72
72
:::
73
73
74
74
:::warning Status of Vue.js 3.x supports
75
-
This plugin supports the basic syntax of Vue.js 3.0, but the Vue.js 3.0 experimental features `<script setup>` and `<style vars>` are not yet supported. Follow [#1248](https://github.com/vuejs/eslint-plugin-vue/issues/1248) for more details.
75
+
This plugin supports the basic syntax of Vue.js 3.0, but `<script setup>` does not yet fully support it.
76
+
Also, the Vue.js 3.0 experimental feature CSS variable injection is not yet supported. Follow [#1248](https://github.com/vuejs/eslint-plugin-vue/issues/1248) for more details.
76
77
:::
77
78
78
79
### Running ESLint from the command line
@@ -335,3 +336,62 @@ Note that you cannot use angle-bracket type assertion style (`var x = <foo>bar;`
335
336
You need to turn off Vetur's template validation by adding `vetur.validation.template: false` to your `.vscode/settings.json`.
336
337
337
338
See also: "[Visual Studio Code](#editor-integrations)" section and [Vetur - Linting](https://vuejs.github.io/vetur/guide/linting-error.html#linting).
339
+
340
+
### Does not work well with `<script setup>`
341
+
342
+
#### The variables used in the `<template>` are warned by `no-unused-vars` rule
343
+
344
+
You must use [vue/script-setup-uses-vars](../rules/script-setup-uses-vars.md) rule.
345
+
In your configuration, use the rule set provided by `eslint-plugin-vue` or enable it rule.
346
+
347
+
Example **.eslintrc.js**:
348
+
349
+
```js
350
+
module.exports= {
351
+
// Use the rule set.
352
+
extends: ['plugin:vue/base'],
353
+
rules: {
354
+
// Enable vue/script-setup-uses-vars rule
355
+
'vue/script-setup-uses-vars':'error',
356
+
}
357
+
}
358
+
```
359
+
360
+
#### Parsing error with Top Level `await`
361
+
362
+
##### Using ESLint <= v7.x
363
+
364
+
The parser `espree` that comes with `ESLint` doesn't understand the syntax of ES2022, so it can't parse Top Level `await` either.
365
+
However, the `vue-eslint-parser` used by `eslint-plugin-vue` can use `espree` v8, which understands ES2022 by configuration.
366
+
367
+
```js
368
+
module.exports= {
369
+
parser:'vue-eslint-parser',
370
+
parserOptions: {
371
+
ecmaVersion:2022, // If you specify 2022, espree >= v8.x will be used automatically.
372
+
sourceType:'module'
373
+
},
374
+
}
375
+
```
376
+
377
+
However, note that the AST generated by `espree` v8 may not work well with some rules of `ESLint` v7.
378
+
379
+
<!--
380
+
##### Using ESLint >= v8.x
381
+
382
+
You need to specify `2022` for `parserOptions.ecmaVersion`.
383
+
384
+
```js
385
+
module.exports = {
386
+
parserOptions: {
387
+
ecmaVersion: 2022,
388
+
sourceType: 'module'
389
+
},
390
+
}
391
+
```
392
+
-->
393
+
394
+
#### Other Problems
395
+
396
+
This `eslint-plugin-vue` does not yet fully support `<script setup>`.
397
+
Follow [#1248](https://github.com/vuejs/eslint-plugin-vue/issues/1248) for more details.
0 commit comments