From cc7452d30452b431ac3900792e96e2daec33cdc8 Mon Sep 17 00:00:00 2001 From: Sysix Date: Sat, 4 Oct 2025 17:21:31 +0200 Subject: [PATCH 01/11] refactor(no-import-compiler-macros): check only in ` ` } @@ -45,7 +46,7 @@ tester.run('no-import-compiler-macros', rule, { `, output: ` `, errors: [ From b700664b5661376ae2bf6c4f17e3b109afd01c91 Mon Sep 17 00:00:00 2001 From: Sysix Date: Sat, 4 Oct 2025 17:39:03 +0200 Subject: [PATCH 03/11] u --- tests/lib/rules/no-import-compiler-macros.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/lib/rules/no-import-compiler-macros.js b/tests/lib/rules/no-import-compiler-macros.js index 827415263..46a0a0620 100644 --- a/tests/lib/rules/no-import-compiler-macros.js +++ b/tests/lib/rules/no-import-compiler-macros.js @@ -46,7 +46,7 @@ tester.run('no-import-compiler-macros', rule, { `, output: ` `, errors: [ From 18415064ec5065f5211f9a9c95a7e6421627c01d Mon Sep 17 00:00:00 2001 From: Sysix Date: Sat, 4 Oct 2025 17:41:40 +0200 Subject: [PATCH 04/11] changeset --- .changeset/lemon-socks-follow.md | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 .changeset/lemon-socks-follow.md diff --git a/.changeset/lemon-socks-follow.md b/.changeset/lemon-socks-follow.md new file mode 100644 index 000000000..63fe55f10 --- /dev/null +++ b/.changeset/lemon-socks-follow.md @@ -0,0 +1,5 @@ +--- +'eslint-plugin-vue': patch +--- + +no-import-compiler-macros: check only in ` ` }, + { + filename: 'test.vue', + code: ` + + ` + }, { filename: 'test.vue', code: ` @@ -46,7 +54,7 @@ tester.run('no-import-compiler-macros', rule, { `, output: ` `, errors: [ From f1e1ddb7df96b502ecf24c3ccb8710957e0cb329 Mon Sep 17 00:00:00 2001 From: Sysix Date: Sat, 4 Oct 2025 17:39:03 +0200 Subject: [PATCH 06/11] u --- tests/lib/rules/no-import-compiler-macros.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/lib/rules/no-import-compiler-macros.js b/tests/lib/rules/no-import-compiler-macros.js index 1971044ba..9d260859a 100644 --- a/tests/lib/rules/no-import-compiler-macros.js +++ b/tests/lib/rules/no-import-compiler-macros.js @@ -54,7 +54,7 @@ tester.run('no-import-compiler-macros', rule, { `, output: ` `, errors: [ From cd3469fe980915e671dd874de22404b5b9a85594 Mon Sep 17 00:00:00 2001 From: Sysix Date: Fri, 31 Oct 2025 15:31:28 +0100 Subject: [PATCH 07/11] update --- lib/rules/no-import-compiler-macros.js | 16 +++++------ tests/lib/rules/no-import-compiler-macros.js | 30 ++++++++++++++------ 2 files changed, 29 insertions(+), 17 deletions(-) diff --git a/lib/rules/no-import-compiler-macros.js b/lib/rules/no-import-compiler-macros.js index b396e2e0a..7a6fd98da 100644 --- a/lib/rules/no-import-compiler-macros.js +++ b/lib/rules/no-import-compiler-macros.js @@ -37,7 +37,9 @@ module.exports = { schema: [], messages: { noImportCompilerMacros: - "'{{name}}' is a compiler macro and doesn't need to be imported." + "'{{name}}' is a compiler macro and doesn't need to be imported.", + onlyValidInScriptSetup: + "'{{name}}' is a compiler macro and can only be used inside ` - }, - { - filename: 'test.vue', - code: ` - - ` } ], invalid: [ @@ -223,6 +214,27 @@ tester.run('no-import-compiler-macros', rule, { endColumn: 60 } ] + }, + { + filename: 'test.ts', + code: ` + import { defineProps } from 'vue' + `, + output: ` + + `, + errors: [ + { + messageId: 'onlyValidInScriptSetup', + data: { + name: 'defineProps' + }, + line: 2, + column: 16, + endLine: 2, + endColumn: 27 + } + ] } ] }) From 41c7f59ef000e8b32ff5e3595856a3302e570baf Mon Sep 17 00:00:00 2001 From: Sysix Date: Fri, 31 Oct 2025 16:02:52 +0100 Subject: [PATCH 08/11] update --- .changeset/lemon-socks-follow.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.changeset/lemon-socks-follow.md b/.changeset/lemon-socks-follow.md index 63fe55f10..28b13e0f1 100644 --- a/.changeset/lemon-socks-follow.md +++ b/.changeset/lemon-socks-follow.md @@ -2,4 +2,4 @@ 'eslint-plugin-vue': patch --- -no-import-compiler-macros: check only in ` ` From dcbdf1dc6cdf6853f87b7a74a9f25f826e9b848f Mon Sep 17 00:00:00 2001 From: Flo Edelmann Date: Fri, 31 Oct 2025 16:44:48 +0100 Subject: [PATCH 10/11] Add test case --- tests/lib/rules/no-import-compiler-macros.js | 27 ++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/tests/lib/rules/no-import-compiler-macros.js b/tests/lib/rules/no-import-compiler-macros.js index 9fbe32339..96d7a61db 100644 --- a/tests/lib/rules/no-import-compiler-macros.js +++ b/tests/lib/rules/no-import-compiler-macros.js @@ -215,6 +215,33 @@ tester.run('no-import-compiler-macros', rule, { } ] }, + { + filename: 'test.vue', + code: ` + + `, + output: ` + + `, + errors: [ + { + messageId: 'onlyValidInScriptSetup', + data: { + name: 'defineProps' + }, + line: 4, + column: 16, + endLine: 4, + endColumn: 27 + } + ] + }, { filename: 'test.ts', code: ` From b4e550c1daf2283a44b8316d4dd7a957780ad8b6 Mon Sep 17 00:00:00 2001 From: Flo Edelmann Date: Fri, 31 Oct 2025 16:45:51 +0100 Subject: [PATCH 11/11] Update changeset --- .changeset/lemon-socks-follow.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.changeset/lemon-socks-follow.md b/.changeset/lemon-socks-follow.md index 28b13e0f1..302cdda48 100644 --- a/.changeset/lemon-socks-follow.md +++ b/.changeset/lemon-socks-follow.md @@ -1,5 +1,5 @@ --- -'eslint-plugin-vue': patch +'eslint-plugin-vue': minor --- -no-import-compiler-macros: make it clear that macros are not allowed outside `