@@ -9,8 +9,13 @@ const utils = require('../utils')
9
9
// Rule Definition
10
10
// ------------------------------------------------------------------------------
11
11
12
- function getAttributeType ( name , isDirective ) {
13
- if ( isDirective ) {
12
+ function getAttributeType ( attribute , sourceCode ) {
13
+ const isBind = attribute . directive && attribute . key . name . name === 'bind'
14
+ const name = isBind
15
+ ? ( attribute . key . argument ? sourceCode . getText ( attribute . key . argument ) : '' )
16
+ : ( attribute . directive ? attribute . key . name . name : attribute . key . name )
17
+
18
+ if ( attribute . directive && ! isBind ) {
14
19
if ( name === 'for' ) {
15
20
return 'LIST_RENDERING'
16
21
} else if ( name === 'if' || name === 'else-if' || name === 'else' || name === 'show' || name === 'cloak' ) {
@@ -23,6 +28,8 @@ function getAttributeType (name, isDirective) {
23
28
return 'EVENTS'
24
29
} else if ( name === 'html' || name === 'text' ) {
25
30
return 'CONTENT'
31
+ } else if ( name === 'slot' ) {
32
+ return 'UNIQUE'
26
33
} else {
27
34
return 'OTHER_DIRECTIVES'
28
35
}
@@ -38,10 +45,9 @@ function getAttributeType (name, isDirective) {
38
45
}
39
46
}
40
47
}
41
- function getPosition ( attribute , attributePosition ) {
42
- const attributeType = attribute . directive && attribute . key . name === 'bind'
43
- ? getAttributeType ( attribute . key . argument , false )
44
- : getAttributeType ( attribute . key . name , attribute . directive )
48
+
49
+ function getPosition ( attribute , attributePosition , sourceCode ) {
50
+ const attributeType = getAttributeType ( attribute , sourceCode )
45
51
return attributePosition . hasOwnProperty ( attributeType ) ? attributePosition [ attributeType ] : - 1
46
52
}
47
53
@@ -91,8 +97,8 @@ function create (context) {
91
97
previousNode = null
92
98
} ,
93
99
'VAttribute' ( node ) {
94
- if ( ( currentPosition === - 1 ) || ( currentPosition <= getPosition ( node , attributePosition ) ) ) {
95
- currentPosition = getPosition ( node , attributePosition )
100
+ if ( ( currentPosition === - 1 ) || ( currentPosition <= getPosition ( node , attributePosition , sourceCode ) ) ) {
101
+ currentPosition = getPosition ( node , attributePosition , sourceCode )
96
102
previousNode = node
97
103
} else {
98
104
reportIssue ( node , previousNode )
0 commit comments