Skip to content

Commit a84bc60

Browse files
committed
clearer naming
1 parent 00709fb commit a84bc60

File tree

1 file changed

+10
-10
lines changed

1 file changed

+10
-10
lines changed

plugins/rules/memberAccess.ts

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -145,14 +145,14 @@ const noRepeatedMemberAccess = createRule({
145145
const scope = sourceCode.getScope(node);
146146
const scopeData = getChainMap(scope);
147147

148-
for (const [existingChain, record] of scopeData) {
148+
for (const [existingChain, chainInfo] of scopeData) {
149149
// Check if the existing chain starts with the modified chain followed by a dot or bracket, and if so, marks them as modified
150150
if (
151151
existingChain === chain ||
152152
existingChain.startsWith(chain + ".") ||
153153
existingChain.startsWith(chain + "[")
154154
) {
155-
record.modified = true;
155+
chainInfo.modified = true;
156156
}
157157
}
158158
if (!scopeData.has(chain)) {
@@ -173,7 +173,7 @@ const noRepeatedMemberAccess = createRule({
173173
if (!chainInfo) return;
174174

175175
const scope = sourceCode.getScope(node);
176-
const infoMap = getChainMap(scope);
176+
const chainMap = getChainMap(scope);
177177

178178
// keeps record of the longest valid chain, and only report it instead of shorter ones (to avoid repeated reports)
179179
let longestValidChain = "";
@@ -183,18 +183,18 @@ const noRepeatedMemberAccess = createRule({
183183
// Skip single-level chains
184184
if (!chain.includes(".")) continue;
185185

186-
const record = infoMap.get(chain) || {
186+
const chainInfo = chainMap.get(chain) || {
187187
count: 0,
188188
modified: false,
189189
};
190-
if (record.modified) break;
190+
if (chainInfo.modified) break;
191191

192-
record.count++;
193-
infoMap.set(chain, record);
192+
chainInfo.count++;
193+
chainMap.set(chain, chainInfo);
194194

195195
// record longest extractable chain
196196
if (
197-
record.count >= minOccurrences &&
197+
chainInfo.count >= minOccurrences &&
198198
chain.length > longestValidChain.length
199199
) {
200200
longestValidChain = chain;
@@ -203,11 +203,11 @@ const noRepeatedMemberAccess = createRule({
203203

204204
// report the longest chain
205205
if (longestValidChain && !reportedChains.has(longestValidChain)) {
206-
const record = infoMap.get(longestValidChain)!;
206+
const chainInfo = chainMap.get(longestValidChain)!;
207207
context.report({
208208
node: node,
209209
messageId: "repeatedAccess",
210-
data: { chain: longestValidChain, count: record.count },
210+
data: { chain: longestValidChain, count: chainInfo.count },
211211
});
212212
reportedChains.add(longestValidChain);
213213
}

0 commit comments

Comments
 (0)