File tree Expand file tree Collapse file tree 1 file changed +15
-3
lines changed Expand file tree Collapse file tree 1 file changed +15
-3
lines changed Original file line number Diff line number Diff line change @@ -19,7 +19,7 @@ module.exports = {
19
19
recommended : false ,
20
20
url : 'https://eslint.vuejs.org/rules/require-shorthand-boolean-prop.html'
21
21
} ,
22
- fixable : null , // or " code" or "whitespace"
22
+ fixable : ' code' ,
23
23
schema : [
24
24
{
25
25
enum : [ 'always' , 'never' ]
@@ -38,7 +38,13 @@ module.exports = {
38
38
context . report ( {
39
39
node,
40
40
loc : node . loc ,
41
- message : 'Unexpected shorthand prop.'
41
+ message : 'Unexpected shorthand prop.' ,
42
+ fix ( fixer ) {
43
+ const { rawName } = attr . key || { }
44
+ return rawName
45
+ ? fixer . replaceTextRange ( attr . range , `:${ rawName } ="true"` )
46
+ : null
47
+ }
42
48
} )
43
49
}
44
50
continue
@@ -49,7 +55,13 @@ module.exports = {
49
55
context . report ( {
50
56
node,
51
57
loc : node . loc ,
52
- message : "Unexpected 'true' value."
58
+ message : "Unexpected 'true' value." ,
59
+ fix ( fixer ) {
60
+ const { rawName } = ( attr . key || { } ) . argument || { }
61
+ return rawName
62
+ ? fixer . replaceTextRange ( attr . range , rawName )
63
+ : null
64
+ }
53
65
} )
54
66
}
55
67
continue
You can’t perform that action at this time.
0 commit comments