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
+1-1
Original file line number
Diff line number
Diff line change
@@ -15,7 +15,7 @@ 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 and `<script setup>`, but 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
+82-1
Original file line number
Diff line number
Diff line change
@@ -72,7 +72,7 @@ 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 and `<script setup>`, but 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
76
:::
77
77
78
78
### Running ESLint from the command line
@@ -335,3 +335,84 @@ Note that you cannot use angle-bracket type assertion style (`var x = <foo>bar;`
335
335
You need to turn off Vetur's template validation by adding `vetur.validation.template: false` to your `.vscode/settings.json`.
336
336
337
337
See also: "[Visual Studio Code](#editor-integrations)" section and [Vetur - Linting](https://vuejs.github.io/vetur/guide/linting-error.html#linting).
338
+
339
+
### Does not work well with `<script setup>`
340
+
341
+
#### The variables used in the `<template>` are warned by `no-unused-vars` rule
342
+
343
+
You must use [vue/script-setup-uses-vars](../rules/script-setup-uses-vars.md) rule.
344
+
In your configuration, use the rule set provided by `eslint-plugin-vue` or enable it rule.
345
+
346
+
Example **.eslintrc.js**:
347
+
348
+
```js
349
+
module.exports= {
350
+
// Use the rule set.
351
+
extends: ['plugin:vue/base'],
352
+
rules: {
353
+
// Enable vue/script-setup-uses-vars rule
354
+
'vue/script-setup-uses-vars':'error',
355
+
}
356
+
}
357
+
```
358
+
359
+
#### Compiler macros such as `defineProps` and `defineEmits` are warned by `no-undef` rule
360
+
361
+
You need to define [global variables](https://eslint.org/docs/user-guide/configuring/language-options#using-configuration-files-1) in your ESLint configuration file.
362
+
If you don't want to define global variables, use `import { defineProps, defineEmits } from 'vue'`.
363
+
364
+
Example **.eslintrc.js**:
365
+
366
+
```js
367
+
module.exports= {
368
+
globals: {
369
+
defineProps:"readonly",
370
+
defineEmits:"readonly",
371
+
defineExpose:"readonly",
372
+
withDefaults:"readonly"
373
+
}
374
+
}
375
+
```
376
+
377
+
See also [ESLint - Specifying Globals > Using configuration files](https://eslint.org/docs/user-guide/configuring/language-options#using-configuration-files-1).
378
+
379
+
#### Parsing error with Top Level `await`
380
+
381
+
##### Using ESLint <= v7.x
382
+
383
+
The parser `espree` that comes with `ESLint` v7.x doesn't understand the syntax of ES2022, so it can't parse the Top Level `await` either.
384
+
However, `espree` v8+ can understand the syntax of ES2022 and parse the Top Level `await`.
385
+
You install `espree` v8+ and specify `"espree"` and ES2022 in your configuration, the parser will be able to parse it.
386
+
387
+
```js
388
+
module.exports= {
389
+
parser:'vue-eslint-parser',
390
+
parserOptions: {
391
+
parser:'espree', // <-
392
+
ecmaVersion:2022, // <-
393
+
sourceType:'module'
394
+
},
395
+
}
396
+
```
397
+
398
+
However, note that the AST generated by `espree` v8+ may not work well with some rules of `ESLint` v7.x.
399
+
400
+
<!--
401
+
##### Using ESLint >= v8.x
402
+
403
+
You need to specify `2022` for `parserOptions.ecmaVersion`.
404
+
405
+
```js
406
+
module.exports = {
407
+
parserOptions: {
408
+
ecmaVersion: 2022,
409
+
sourceType: 'module'
410
+
},
411
+
}
412
+
```
413
+
-->
414
+
415
+
#### Other Problems
416
+
417
+
Try searching for existing issues.
418
+
If it does not exist, you should open a new issue and share your repository to reproduce the issue.
0 commit comments