From 8e338b01d5ce046f25591eaf3403b9dd7c86c535 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A1ndor=20Levcs=C3=A1k?= Date: Mon, 3 Jul 2023 20:07:30 +0200 Subject: [PATCH] Prevent auto fix `vue/attribute-hyphenation` when it breaks props --- lib/rules/attribute-hyphenation.js | 4 ++++ tests/lib/rules/attribute-hyphenation.js | 13 +++++-------- 2 files changed, 9 insertions(+), 8 deletions(-) diff --git a/lib/rules/attribute-hyphenation.js b/lib/rules/attribute-hyphenation.js index 24bacffc2..8f57531c0 100644 --- a/lib/rules/attribute-hyphenation.js +++ b/lib/rules/attribute-hyphenation.js @@ -99,6 +99,10 @@ module.exports = { return null } + if (/^[A-Z]/.test(name)) { + return null + } + return fixer.replaceText( node.key, text.replace(name, caseConverter(name)) diff --git a/tests/lib/rules/attribute-hyphenation.js b/tests/lib/rules/attribute-hyphenation.js index 146c25658..2692345a0 100644 --- a/tests/lib/rules/attribute-hyphenation.js +++ b/tests/lib/rules/attribute-hyphenation.js @@ -88,7 +88,7 @@ ruleTester.run('attribute-hyphenation', rule, { { filename: 'test.vue', code: '', - output: '', + output: null, options: ['always'], errors: [ { @@ -115,8 +115,7 @@ ruleTester.run('attribute-hyphenation', rule, { { filename: 'test.vue', code: '', - output: - '', + output: null, options: ['always'], errors: [ { @@ -143,8 +142,7 @@ ruleTester.run('attribute-hyphenation', rule, { { filename: 'test.vue', code: '', - output: - '', + output: null, options: ['always'], errors: [ { @@ -157,8 +155,7 @@ ruleTester.run('attribute-hyphenation', rule, { { filename: 'test.vue', code: '', - output: - '', + output: null, options: ['always', { ignore: [] }], errors: [ { @@ -281,7 +278,7 @@ ruleTester.run('attribute-hyphenation', rule, { { filename: 'test.vue', code: '', - output: '', + output: null, options: ['always'], errors: [ {