From 84d8998c85250a3f15b28ee52d9df4d2094ebe31 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andreas=20N=C3=A4sman?= Date: Sat, 12 Feb 2022 21:13:18 +0200 Subject: [PATCH] Add Reactivity Transform macros https://vuejs.org/guide/extras/reactivity-transform.html --- docs/user-guide/README.md | 4 ++-- lib/index.js | 9 ++++++++- tools/update-lib-index.js | 9 ++++++++- 3 files changed, 18 insertions(+), 4 deletions(-) diff --git a/docs/user-guide/README.md b/docs/user-guide/README.md index b083a6bd3..ddb36d896 100644 --- a/docs/user-guide/README.md +++ b/docs/user-guide/README.md @@ -358,10 +358,10 @@ module.exports = { } ``` -#### Compiler macros such as `defineProps` and `defineEmits` generate `no-undef` warnings +#### Compiler macros such as `defineProps` and `$ref` generate `no-undef` warnings You need to enable the compiler macros environment in your ESLint configuration file. -If you don't want to expose these variables globally, you can use `/* global defineProps, defineEmits */` instead. +If you don't want to expose these variables globally, you can use `/* global defineProps, $ref */` instead. Example **.eslintrc.js**: diff --git a/lib/index.js b/lib/index.js index 941de0b56..34d675708 100644 --- a/lib/index.js +++ b/lib/index.js @@ -233,9 +233,16 @@ module.exports = { environments: { 'setup-compiler-macros': { globals: { - defineProps: 'readonly', + $$: 'readonly', + $: 'readonly', + $computed: 'readonly', + $customRef: 'readonly', + $ref: 'readonly', + $shallowRef: 'readonly', + $toRef: 'readonly', defineEmits: 'readonly', defineExpose: 'readonly', + defineProps: 'readonly', withDefaults: 'readonly' } } diff --git a/tools/update-lib-index.js b/tools/update-lib-index.js index b9a5dcbd9..251d5c172 100644 --- a/tools/update-lib-index.js +++ b/tools/update-lib-index.js @@ -41,9 +41,16 @@ module.exports = { environments: { 'setup-compiler-macros': { globals: { - defineProps: 'readonly', + $$: 'readonly', + $: 'readonly', + $computed: 'readonly', + $customRef: 'readonly', + $ref: 'readonly', + $shallowRef: 'readonly', + $toRef: 'readonly', defineEmits: 'readonly', defineExpose: 'readonly', + defineProps: 'readonly', withDefaults: 'readonly' } }