We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
<script setup>
1 parent 553abe6 commit cc7452dCopy full SHA for cc7452d
lib/rules/no-import-compiler-macros.js
@@ -4,6 +4,8 @@
4
*/
5
'use strict'
6
7
+const utils = require('../utils')
8
+
9
const COMPILER_MACROS = new Set([
10
'defineProps',
11
'defineEmits',
@@ -43,9 +45,13 @@ module.exports = {
43
45
* @returns {RuleListener}
44
46
47
create(context) {
48
+ const scriptSetup = utils.getScriptSetupElement(context)
49
+ if (!scriptSetup) {
50
+ return {}
51
+ }
52
const sourceCode = context.getSourceCode()
53
- return {
54
+ return utils.defineScriptSetupVisitor(context, {
55
ImportDeclaration(node) {
56
if (node.specifiers.length === 0 || !VUE_MODULES.has(node.source.value))
57
return
@@ -96,6 +102,6 @@ module.exports = {
96
102
})
97
103
}
98
104
99
- }
105
+ })
100
106
101
107
0 commit comments