Skip to content

Commit f539191

Browse files
committed
feat: add test
1 parent 781692c commit f539191

File tree

3 files changed

+32
-4
lines changed

3 files changed

+32
-4
lines changed

Diff for: docs/rules/index.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -233,7 +233,7 @@ For example:
233233
| [vue/no-deprecated-model-definition] | disallow deprecated `model` definition (in Vue.js 3.0.0+) | :bulb: | :warning: |
234234
| [vue/no-duplicate-attr-inheritance] | enforce `inheritAttrs` to be set to `false` when using `v-bind="$attrs"` | | :hammer: |
235235
| [vue/no-empty-component-block] | disallow the `<template>` `<script>` `<style>` block to be empty | :wrench: | :hammer: |
236-
| [vue/no-import-compiler-macros] | disallow importing vue compiler macros | :wrench: | :warning: |
236+
| [vue/no-import-compiler-macros] | disallow importing Vue compiler macros | :wrench: | :warning: |
237237
| [vue/no-multiple-objects-in-class] | disallow passing multiple objects in an array to class | | :hammer: |
238238
| [vue/no-potential-component-option-typo] | disallow a potential typo in your component property | :bulb: | :hammer: |
239239
| [vue/no-ref-object-reactivity-loss] | disallow usages of ref objects that can lead to loss of reactivity | | :warning: |

Diff for: docs/rules/no-import-compiler-macros.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,12 @@
22
pageClass: rule-details
33
sidebarDepth: 0
44
title: vue/no-import-compiler-macros
5-
description: disallow importing vue compiler macros
5+
description: disallow importing Vue compiler macros
66
---
77

88
# vue/no-import-compiler-macros
99

10-
> disallow importing vue compiler macros
10+
> disallow importing Vue compiler macros
1111
1212
- :exclamation: <badge text="This rule has not been released yet." vertical="middle" type="error"> _**This rule has not been released yet.**_ </badge>
1313
- :wrench: The `--fix` option on the [command line](https://eslint.org/docs/user-guide/command-line-interface#fix-problems) can automatically fix some of the problems reported by this rule.

Diff for: tests/lib/rules/no-import-compiler-macros.js

+29-1
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ tester.run('no-import-compiler-macros', rule, {
2121
filename: 'test.vue',
2222
code: `
2323
<script setup>
24-
import { ref } from 'vue'
24+
import { ref, computed } from 'vue'
2525
import { someFunction } from '@vue/runtime-core'
2626
</script>
2727
`
@@ -59,6 +59,34 @@ tester.run('no-import-compiler-macros', rule, {
5959
}
6060
]
6161
},
62+
{
63+
filename: 'test.vue',
64+
code: `
65+
<script setup>
66+
import {
67+
ref,
68+
defineProps
69+
} from 'vue'
70+
</script>
71+
`,
72+
output: `
73+
<script setup>
74+
import {
75+
ref
76+
} from 'vue'
77+
</script>
78+
`,
79+
errors: [
80+
{
81+
messageId: 'noImportCompilerMacros',
82+
data: {
83+
name: 'defineProps'
84+
},
85+
line: 5,
86+
column: 9
87+
}
88+
]
89+
},
6290
{
6391
filename: 'test.vue',
6492
code: `

0 commit comments

Comments
 (0)