@@ -2,33 +2,6 @@ import { TSESTree, AST_NODE_TYPES } from "@typescript-eslint/utils";
2
2
import { Scope } from "@typescript-eslint/utils/ts-eslint" ;
3
3
import createRule from "../utils/createRule.js" ;
4
4
5
- /**
6
- * Rule to optimize repeated member access patterns by extracting variables
7
- * For more rule details refer to docs/rules/no-repeated-member-access.md
8
- *
9
- * The following material is an overview of implementation details
10
- * It is divided into several phases
11
- *
12
- * 1. Analysis Phase:
13
- * - Traverse AST to identify member access chains (e.g., obj.prop.val)
14
- * - Store chains into hierarchical structures (e.g., ["obj", "obj.prop", "obj.prop.val"])
15
- * - Cache analysis results to avoid repeatedly processing
16
- *
17
- * 2. Tracking Phase:
18
- * - Count usage frequency of each chain within current scope
19
- * - Identify modified chains (assignments, increments, function calls, etc.)
20
- * - Mark all parts alongside the chain as modified
21
- *
22
- * 3. Reporting Phase:
23
- * - For chains that meet usage threshold and are not modified, suggest variable extraction
24
- * - Report only the longest valid chains
25
- *
26
- * Things to note:
27
- * - Only process chains starting with identifiers or "this" (avoid function call results)
28
- * - Skip computed property access (e.g., obj[key])
29
- * - Mark modified chains as un-extractable
30
- * - Support TypeScript non-null assertion operator (!) (minor bugs might still persist in some cases)
31
- */
32
5
const noRepeatedMemberAccess = createRule ( {
33
6
name : "no-repeated-member-access" ,
34
7
meta : {
0 commit comments