From 6f24c45bb9730599f597f94d09885b35621ce099 Mon Sep 17 00:00:00 2001 From: Hiroki Osame Date: Thu, 15 Aug 2024 23:22:21 +0900 Subject: [PATCH 1/2] fix(no-deprecated-slot-attribute): handle v-for with dynamic slot --- lib/rules/syntaxes/slot-attribute.js | 19 ++++++++++---- .../lib/rules/no-deprecated-slot-attribute.js | 25 +++++++++++++++++++ 2 files changed, 39 insertions(+), 5 deletions(-) diff --git a/lib/rules/syntaxes/slot-attribute.js b/lib/rules/syntaxes/slot-attribute.js index 61891df3b..27087cb37 100644 --- a/lib/rules/syntaxes/slot-attribute.js +++ b/lib/rules/syntaxes/slot-attribute.js @@ -56,10 +56,8 @@ module.exports = { // parse error or empty expression return false } - const slotName = sourceCode.getText(slotAttr.value.expression).trim() - // If non-Latin characters are included it can not be converted. - // It does not check the space only because `a>b?c:d` should be rejected. - return !/[^a-z]/i.test(slotName) + + return slotAttr.value.expression.type === 'Identifier' } /** @@ -102,7 +100,18 @@ module.exports = { yield fixer.remove(scopeAttr) } - yield fixer.insertTextBefore(element, ``, errors: ['`slot` attributes are deprecated.'] + }, + { + code: ` + `, + output: null, + errors: ['`slot` attributes are deprecated.'] } ] })