@@ -60,8 +60,6 @@ module.exports = {
60
60
categories : undefined ,
61
61
url : 'https://eslint.vuejs.org/rules/no-shadow-native-events.html'
62
62
} ,
63
- fixable : null ,
64
- hasSuggestions : false ,
65
63
schema : [ ] ,
66
64
messages : {
67
65
violation :
@@ -73,7 +71,10 @@ module.exports = {
73
71
/** @type {Map<ObjectExpression | Program, { contextReferenceIds: Set<Identifier>, emitReferenceIds: Set<Identifier> }> } */
74
72
const setupContexts = new Map ( )
75
73
76
- /** @type {Set<string> } */
74
+ /**
75
+ * Tracks violating emit definitions, so that calls of this emit are not reported additionally.
76
+ * @type {Set<string> }
77
+ * */
77
78
const definedAndReportedEmits = new Set ( )
78
79
79
80
/**
@@ -95,6 +96,7 @@ module.exports = {
95
96
}
96
97
97
98
/**
99
+ * Verify if an emit call violates the rule of not using a native dom event name.
98
100
* @param {NameWithLoc } nameWithLoc
99
101
*/
100
102
function verifyEmit ( nameWithLoc ) {
@@ -111,6 +113,25 @@ module.exports = {
111
113
} )
112
114
}
113
115
116
+ /**
117
+ * Verify if an emit declaration violates the rule of not using a native dom event name.
118
+ * @param {ComponentEmit[] } emits
119
+ */
120
+ const verifyEmitDeclaration = ( emits ) => {
121
+ for ( const { node, emitName } of emits ) {
122
+ if ( ! node || ! emitName || ! domEvents . includes ( emitName . toLowerCase ( ) ) ) {
123
+ continue
124
+ }
125
+
126
+ definedAndReportedEmits . add ( emitName )
127
+ context . report ( {
128
+ messageId : 'violation' ,
129
+ data : { name : emitName } ,
130
+ loc : node . loc
131
+ } )
132
+ }
133
+ }
134
+
114
135
const callVisitor = {
115
136
/**
116
137
* @param {CallExpression } node
@@ -162,23 +183,6 @@ module.exports = {
162
183
}
163
184
}
164
185
}
165
- /**
166
- * @param {ComponentEmit[] } emits
167
- */
168
- const verifyEmitDeclaration = ( emits ) => {
169
- for ( const { node, emitName } of emits ) {
170
- if ( ! node || ! emitName || ! domEvents . includes ( emitName . toLowerCase ( ) ) ) {
171
- continue
172
- }
173
-
174
- definedAndReportedEmits . add ( emitName )
175
- context . report ( {
176
- messageId : 'violation' ,
177
- data : { name : emitName } ,
178
- loc : node . loc
179
- } )
180
- }
181
- }
182
186
183
187
return utils . compositingVisitors (
184
188
utils . defineTemplateBodyVisitor (
0 commit comments