Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 45e0126

Browse files
Prevent auto fix vue/attribute-hyphenation when it breaks props (#2229)
1 parent 7f906ea commit 45e0126

File tree

2 files changed

+9
-8
lines changed

2 files changed

+9
-8
lines changed

‎lib/rules/attribute-hyphenation.js‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,10 @@ module.exports = {
9999
return null
100100
}
101101

102+
if (/^[A-Z]/.test(name)) {
103+
return null
104+
}
105+
102106
return fixer.replaceText(
103107
node.key,
104108
text.replace(name, caseConverter(name))

‎tests/lib/rules/attribute-hyphenation.js‎

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ ruleTester.run('attribute-hyphenation', rule, {
8888
{
8989
filename: 'test.vue',
9090
code: '<template><div><custom MyProp="Bar"></custom></div></template>',
91-
output: '<template><div><custom my-prop="Bar"></custom></div></template>',
91+
output: null,
9292
options: ['always'],
9393
errors: [
9494
{
@@ -115,8 +115,7 @@ ruleTester.run('attribute-hyphenation', rule, {
115115
{
116116
filename: 'test.vue',
117117
code: '<template><div><custom :MyProp="prop"></custom></div></template>',
118-
output:
119-
'<template><div><custom :my-prop="prop"></custom></div></template>',
118+
output: null,
120119
options: ['always'],
121120
errors: [
122121
{
@@ -143,8 +142,7 @@ ruleTester.run('attribute-hyphenation', rule, {
143142
{
144143
filename: 'test.vue',
145144
code: '<template><div><custom v-bind:MyProp="prop"></custom></div></template>',
146-
output:
147-
'<template><div><custom v-bind:my-prop="prop"></custom></div></template>',
145+
output: null,
148146
options: ['always'],
149147
errors: [
150148
{
@@ -157,8 +155,7 @@ ruleTester.run('attribute-hyphenation', rule, {
157155
{
158156
filename: 'test.vue',
159157
code: '<template><div><custom v-bind:MyProp="prop"></custom></div></template>',
160-
output:
161-
'<template><div><custom v-bind:my-prop="prop"></custom></div></template>',
158+
output: null,
162159
options: ['always', { ignore: [] }],
163160
errors: [
164161
{
@@ -281,7 +278,7 @@ ruleTester.run('attribute-hyphenation', rule, {
281278
{
282279
filename: 'test.vue',
283280
code: '<template><div><slot MyProp="Bar"></slot></div></template>',
284-
output: '<template><div><slot my-prop="Bar"></slot></div></template>',
281+
output: null,
285282
options: ['always'],
286283
errors: [
287284
{

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /