@@ -129,42 +129,29 @@ function create (context) {
129
129
el . node . loc . start . line >= cp . value . loc . start . line &&
130
130
el . node . loc . end . line <= cp . value . loc . end . line
131
131
) {
132
+ let message = `Unexpected asynchronous action in "{{name}}" computed property.`
132
133
if ( el . type === 'await' ) {
133
- context . report ( {
134
- node : el . node ,
135
- message : `Unexpected await operator in "${ cp . key } " computed property.`
136
- } )
134
+ message = `Unexpected await operator in "{{name}}" computed property.`
137
135
} else if ( el . type === 'yield' ) {
138
- context . report ( {
139
- node : el . node ,
140
- message : `Unexpected yield keyword in "${ cp . key } " computed property.`
141
- } )
136
+ message = `Unexpected yield keyword in "{{name}}" computed property.`
142
137
} else if ( el . type === 'yield*' ) {
143
- context . report ( {
144
- node : el . node ,
145
- message : `Unexpected yield* expression in "${ cp . key } " computed property.`
146
- } )
138
+ message = `Unexpected yield* expression in "{{name}}" computed property.`
147
139
} else if ( el . type === 'async' ) {
148
- context . report ( {
149
- node : el . node ,
150
- message : `Unexpected async function declaration in "${ cp . key } " computed property.`
151
- } )
140
+ message = `Unexpected async function declaration in "{{name}}" computed property.`
152
141
} else if ( el . type === 'promise' ) {
153
- context . report ( {
154
- node : el . node ,
155
- message : `Unexpected asynchronous action in "${ cp . key } " computed property.`
156
- } )
157
142
} else if ( el . type === 'new' ) {
158
- context . report ( {
159
- node : el . node ,
160
- message : `Unexpected Promise object in "${ cp . key } " computed property.`
161
- } )
143
+ message = `Unexpected Promise object in "{{name}}" computed property.`
162
144
} else if ( el . type === 'timed' ) {
163
- context . report ( {
164
- node : el . node ,
165
- message : `Unexpected timed function in "${ cp . key } " computed property.`
166
- } )
145
+ message = `Unexpected timed function in "{{name}}" computed property.`
167
146
}
147
+
148
+ context . report ( {
149
+ node : el . node ,
150
+ message,
151
+ data : {
152
+ name : cp . key
153
+ }
154
+ } )
168
155
}
169
156
} )
170
157
} )
0 commit comments