@@ -145,14 +145,14 @@ const noRepeatedMemberAccess = createRule({
145
145
const scope = sourceCode . getScope ( node ) ;
146
146
const scopeData = getChainMap ( scope ) ;
147
147
148
- for ( const [ existingChain , record ] of scopeData ) {
148
+ for ( const [ existingChain , chainInfo ] of scopeData ) {
149
149
// Check if the existing chain starts with the modified chain followed by a dot or bracket, and if so, marks them as modified
150
150
if (
151
151
existingChain === chain ||
152
152
existingChain . startsWith ( chain + "." ) ||
153
153
existingChain . startsWith ( chain + "[" )
154
154
) {
155
- record . modified = true ;
155
+ chainInfo . modified = true ;
156
156
}
157
157
}
158
158
if ( ! scopeData . has ( chain ) ) {
@@ -173,7 +173,7 @@ const noRepeatedMemberAccess = createRule({
173
173
if ( ! chainInfo ) return ;
174
174
175
175
const scope = sourceCode . getScope ( node ) ;
176
- const infoMap = getChainMap ( scope ) ;
176
+ const chainMap = getChainMap ( scope ) ;
177
177
178
178
// keeps record of the longest valid chain, and only report it instead of shorter ones (to avoid repeated reports)
179
179
let longestValidChain = "" ;
@@ -183,18 +183,18 @@ const noRepeatedMemberAccess = createRule({
183
183
// Skip single-level chains
184
184
if ( ! chain . includes ( "." ) ) continue ;
185
185
186
- const record = infoMap . get ( chain ) || {
186
+ const chainInfo = chainMap . get ( chain ) || {
187
187
count : 0 ,
188
188
modified : false ,
189
189
} ;
190
- if ( record . modified ) break ;
190
+ if ( chainInfo . modified ) break ;
191
191
192
- record . count ++ ;
193
- infoMap . set ( chain , record ) ;
192
+ chainInfo . count ++ ;
193
+ chainMap . set ( chain , chainInfo ) ;
194
194
195
195
// record longest extractable chain
196
196
if (
197
- record . count >= minOccurrences &&
197
+ chainInfo . count >= minOccurrences &&
198
198
chain . length > longestValidChain . length
199
199
) {
200
200
longestValidChain = chain ;
@@ -203,11 +203,11 @@ const noRepeatedMemberAccess = createRule({
203
203
204
204
// report the longest chain
205
205
if ( longestValidChain && ! reportedChains . has ( longestValidChain ) ) {
206
- const record = infoMap . get ( longestValidChain ) ! ;
206
+ const chainInfo = chainMap . get ( longestValidChain ) ! ;
207
207
context . report ( {
208
208
node : node ,
209
209
messageId : "repeatedAccess" ,
210
- data : { chain : longestValidChain , count : record . count } ,
210
+ data : { chain : longestValidChain , count : chainInfo . count } ,
211
211
} ) ;
212
212
reportedChains . add ( longestValidChain ) ;
213
213
}
0 commit comments