From ce5f19c52a4f4d321406b60c8466e0a89baa53c7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?M=C3=A1rton=20Csord=C3=A1s?= Date: Mon, 18 Oct 2021 19:21:07 +0200 Subject: [PATCH] Fix pylint error at no-deprecated-router-link-tag-prop --- .../no-deprecated-router-link-tag-prop.js | 13 +++---- .../no-deprecated-router-link-tag-prop.js | 34 +++++++++++-------- 2 files changed, 27 insertions(+), 20 deletions(-) diff --git a/lib/rules/no-deprecated-router-link-tag-prop.js b/lib/rules/no-deprecated-router-link-tag-prop.js index dafdda1e9..d9d1a2ee4 100644 --- a/lib/rules/no-deprecated-router-link-tag-prop.js +++ b/lib/rules/no-deprecated-router-link-tag-prop.js @@ -21,7 +21,7 @@ module.exports = { description: 'disallow using deprecated `tag` property on `RouterLink` (in Vue.js 3.0.0+)', categories: undefined, - url: 'https://eslint.vuejs.org/rules/no-deprecated-router-link-tag-prop' + url: 'https://eslint.vuejs.org/rules/no-deprecated-router-link-tag-prop.html' }, fixable: null, schema: [ @@ -40,7 +40,8 @@ module.exports = { } ], messages: { - deprecated: "'tag' property on '{{element}}' component is deprecated. Use scoped slots instead." + deprecated: + "'tag' property on '{{element}}' component is deprecated. Use scoped slots instead." } }, /** @param {RuleContext} context */ @@ -51,16 +52,16 @@ module.exports = { } return utils.defineTemplateBodyVisitor(context, { - "VElement"(node) { + VElement(node) { if (!components.includes(node.rawName)) return const attributes = node.startTag.attributes - attributes.forEach(attr => { + attributes.forEach((attr) => { /** @type VIdentifier | null */ - let tagAttr = null; + let tagAttr = null if (attr.key.type === 'VIdentifier') { - tagAttr = attr.key; + tagAttr = attr.key } else if (attr.directive && attr.key.type === 'VDirectiveKey') { const arg = attr.key.argument if (arg && arg.type === 'VIdentifier') { diff --git a/tests/lib/rules/no-deprecated-router-link-tag-prop.js b/tests/lib/rules/no-deprecated-router-link-tag-prop.js index e4ffbb306..6e61cd862 100644 --- a/tests/lib/rules/no-deprecated-router-link-tag-prop.js +++ b/tests/lib/rules/no-deprecated-router-link-tag-prop.js @@ -52,7 +52,7 @@ tester.run('no-deprecated-router-link-tag-prop', rule, { ` - }, + } ], invalid: [ { @@ -64,10 +64,11 @@ tester.run('no-deprecated-router-link-tag-prop', rule, { `, errors: [ { - message: "'tag' property on 'RouterLink' component is deprecated. Use scoped slots instead.", + message: + "'tag' property on 'RouterLink' component is deprecated. Use scoped slots instead.", line: 3, column: 21 - }, + } ] }, { @@ -80,10 +81,11 @@ tester.run('no-deprecated-router-link-tag-prop', rule, { options: [{ components: ['RouterLink'] }], errors: [ { - message: "'tag' property on 'RouterLink' component is deprecated. Use scoped slots instead.", + message: + "'tag' property on 'RouterLink' component is deprecated. Use scoped slots instead.", line: 3, column: 21 - }, + } ] }, { @@ -95,10 +97,11 @@ tester.run('no-deprecated-router-link-tag-prop', rule, { `, errors: [ { - message: "'tag' property on 'RouterLink' component is deprecated. Use scoped slots instead.", + message: + "'tag' property on 'RouterLink' component is deprecated. Use scoped slots instead.", line: 3, column: 22 - }, + } ] }, { @@ -111,10 +114,11 @@ tester.run('no-deprecated-router-link-tag-prop', rule, { options: [{ components: ['RouterLink'] }], errors: [ { - message: "'tag' property on 'RouterLink' component is deprecated. Use scoped slots instead.", + message: + "'tag' property on 'RouterLink' component is deprecated. Use scoped slots instead.", line: 3, column: 22 - }, + } ] }, { @@ -127,10 +131,11 @@ tester.run('no-deprecated-router-link-tag-prop', rule, { options: [{ components: ['NuxtLink'] }], errors: [ { - message: "'tag' property on 'NuxtLink' component is deprecated. Use scoped slots instead.", + message: + "'tag' property on 'NuxtLink' component is deprecated. Use scoped slots instead.", line: 3, column: 19 - }, + } ] }, { @@ -143,11 +148,12 @@ tester.run('no-deprecated-router-link-tag-prop', rule, { options: [{ components: ['NuxtLink'] }], errors: [ { - message: "'tag' property on 'NuxtLink' component is deprecated. Use scoped slots instead.", + message: + "'tag' property on 'NuxtLink' component is deprecated. Use scoped slots instead.", line: 3, column: 20 - }, + } ] - }, + } ] })