@codeperfect/eslint-plugin 3.7.0 → 3.9.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (203) hide show
  1. package/README.md +11 -19
  2. package/dist/adapters/angular/angular-lifecycle-usage-adapter.d.ts +15 -0
  3. package/dist/adapters/angular/angular-lifecycle-usage-adapter.d.ts.map +1 -0
  4. package/dist/adapters/angular/angular-lifecycle-usage-adapter.js +87 -0
  5. package/dist/adapters/angular/angular-template-expression-utilities.js +2 -2
  6. package/dist/adapters/angular/angular-template-usage-context.d.ts +1 -1
  7. package/dist/adapters/angular/angular-template-usage-context.d.ts.map +1 -1
  8. package/dist/adapters/angular/angular-template-usage-context.js +2 -2
  9. package/dist/adapters/angular/no-unused-public-members-template-adapter.js +2 -2
  10. package/dist/adapters/angular/plugin.d.ts.map +1 -1
  11. package/dist/adapters/angular/plugin.js +7 -3
  12. package/dist/codeperfect-eslint-plugin-1.0.0.tgz +0 -0
  13. package/dist/domain/architecture/consistent-barrel-files/exports-only-rule-utilities.d.ts +39 -0
  14. package/dist/domain/architecture/consistent-barrel-files/exports-only-rule-utilities.d.ts.map +1 -0
  15. package/dist/domain/architecture/consistent-barrel-files/exports-only-rule-utilities.js +131 -0
  16. package/dist/domain/architecture/consistent-barrel-files/exports-only-rule.d.ts.map +1 -1
  17. package/dist/domain/architecture/consistent-barrel-files/exports-only-rule.js +12 -1
  18. package/dist/domain/architecture/index.d.ts +2 -0
  19. package/dist/domain/architecture/index.d.ts.map +1 -1
  20. package/dist/domain/architecture/index.js +3 -1
  21. package/dist/domain/architecture/no-directory-only-imports/index.d.ts +2 -0
  22. package/dist/domain/architecture/no-directory-only-imports/index.d.ts.map +1 -0
  23. package/dist/domain/architecture/no-directory-only-imports/index.js +2 -0
  24. package/dist/domain/architecture/no-directory-only-imports/no-directory-only-imports-rule.d.ts +5 -0
  25. package/dist/domain/architecture/no-directory-only-imports/no-directory-only-imports-rule.d.ts.map +1 -0
  26. package/dist/domain/architecture/no-directory-only-imports/no-directory-only-imports-rule.js +83 -0
  27. package/dist/domain/architecture/no-unused-exports/no-unused-exports-identifier-utilities.d.ts +1 -1
  28. package/dist/domain/architecture/no-unused-exports/no-unused-exports-identifier-utilities.d.ts.map +1 -1
  29. package/dist/domain/architecture/no-unused-exports/no-unused-exports-identifier-utilities.js +2 -2
  30. package/dist/domain/architecture/no-unused-exports/no-unused-exports-symbol-utilities.d.ts +1 -1
  31. package/dist/domain/architecture/no-unused-exports/no-unused-exports-symbol-utilities.d.ts.map +1 -1
  32. package/dist/domain/architecture/no-unused-exports/no-unused-exports-symbol-utilities.js +2 -2
  33. package/dist/domain/architecture/no-unused-exports/no-unused-exports-usage-index-builder.d.ts +1 -1
  34. package/dist/domain/architecture/no-unused-exports/no-unused-exports-usage-index-builder.d.ts.map +1 -1
  35. package/dist/domain/architecture/no-unused-exports/no-unused-exports-usage-index-builder.js +2 -2
  36. package/dist/domain/architecture/no-unused-exports/no-unused-exports-usage-index.d.ts +1 -1
  37. package/dist/domain/architecture/no-unused-exports/no-unused-exports-usage-index.d.ts.map +1 -1
  38. package/dist/domain/architecture/no-unused-exports/no-unused-exports-usage-index.js +2 -2
  39. package/dist/domain/architecture/no-unused-exports/rule.d.ts +14 -1
  40. package/dist/domain/architecture/no-unused-exports/rule.d.ts.map +1 -1
  41. package/dist/domain/architecture/no-unused-exports/rule.js +17 -4
  42. package/dist/domain/architecture/no-unused-public-members/member-api-reachability-utilities.d.ts +1 -1
  43. package/dist/domain/architecture/no-unused-public-members/member-api-reachability-utilities.d.ts.map +1 -1
  44. package/dist/domain/architecture/no-unused-public-members/member-api-reachability-utilities.js +2 -2
  45. package/dist/domain/architecture/no-unused-public-members/member-api-relevance-utilities.d.ts +1 -1
  46. package/dist/domain/architecture/no-unused-public-members/member-api-relevance-utilities.d.ts.map +1 -1
  47. package/dist/domain/architecture/no-unused-public-members/member-api-relevance-utilities.js +2 -2
  48. package/dist/domain/architecture/no-unused-public-members/member-api-type-utilities.d.ts +1 -1
  49. package/dist/domain/architecture/no-unused-public-members/member-api-type-utilities.d.ts.map +1 -1
  50. package/dist/domain/architecture/no-unused-public-members/member-api-type-utilities.js +2 -2
  51. package/dist/domain/architecture/no-unused-public-members/member-contract-utilities.d.ts +1 -1
  52. package/dist/domain/architecture/no-unused-public-members/member-contract-utilities.d.ts.map +1 -1
  53. package/dist/domain/architecture/no-unused-public-members/member-contract-utilities.js +13 -2
  54. package/dist/domain/architecture/no-unused-public-members/member-declaration-utilities.d.ts +1 -1
  55. package/dist/domain/architecture/no-unused-public-members/member-declaration-utilities.d.ts.map +1 -1
  56. package/dist/domain/architecture/no-unused-public-members/member-declaration-utilities.js +9 -4
  57. package/dist/domain/architecture/no-unused-public-members/member-factory-utilities.d.ts +1 -1
  58. package/dist/domain/architecture/no-unused-public-members/member-factory-utilities.d.ts.map +1 -1
  59. package/dist/domain/architecture/no-unused-public-members/member-factory-utilities.js +2 -2
  60. package/dist/domain/architecture/no-unused-public-members/member-function-utilities.d.ts +1 -1
  61. package/dist/domain/architecture/no-unused-public-members/member-function-utilities.d.ts.map +1 -1
  62. package/dist/domain/architecture/no-unused-public-members/member-function-utilities.js +2 -2
  63. package/dist/domain/architecture/no-unused-public-members/member-host-utilities.d.ts +3 -3
  64. package/dist/domain/architecture/no-unused-public-members/member-host-utilities.d.ts.map +1 -1
  65. package/dist/domain/architecture/no-unused-public-members/member-host-utilities.js +40 -25
  66. package/dist/domain/architecture/no-unused-public-members/member-operation-utilities.d.ts +1 -1
  67. package/dist/domain/architecture/no-unused-public-members/member-operation-utilities.d.ts.map +1 -1
  68. package/dist/domain/architecture/no-unused-public-members/member-operation-utilities.js +2 -2
  69. package/dist/domain/architecture/no-unused-public-members/member-parameter-flow-utilities.d.ts +1 -1
  70. package/dist/domain/architecture/no-unused-public-members/member-parameter-flow-utilities.d.ts.map +1 -1
  71. package/dist/domain/architecture/no-unused-public-members/member-parameter-flow-utilities.js +2 -2
  72. package/dist/domain/architecture/no-unused-public-members/member-public-api-utilities.d.ts +1 -1
  73. package/dist/domain/architecture/no-unused-public-members/member-public-api-utilities.d.ts.map +1 -1
  74. package/dist/domain/architecture/no-unused-public-members/member-public-api-utilities.js +2 -2
  75. package/dist/domain/architecture/no-unused-public-members/member-request-body-utilities.d.ts +1 -1
  76. package/dist/domain/architecture/no-unused-public-members/member-request-body-utilities.d.ts.map +1 -1
  77. package/dist/domain/architecture/no-unused-public-members/member-request-body-utilities.js +2 -2
  78. package/dist/domain/architecture/no-unused-public-members/member-scope-utilities.d.ts +1 -1
  79. package/dist/domain/architecture/no-unused-public-members/member-scope-utilities.d.ts.map +1 -1
  80. package/dist/domain/architecture/no-unused-public-members/member-scope-utilities.js +39 -15
  81. package/dist/domain/architecture/no-unused-public-members/member-usage-call-utilities.d.ts +1 -1
  82. package/dist/domain/architecture/no-unused-public-members/member-usage-call-utilities.d.ts.map +1 -1
  83. package/dist/domain/architecture/no-unused-public-members/member-usage-call-utilities.js +2 -2
  84. package/dist/domain/architecture/no-unused-public-members/member-usage-expression-reference-utilities.d.ts +1 -1
  85. package/dist/domain/architecture/no-unused-public-members/member-usage-expression-reference-utilities.d.ts.map +1 -1
  86. package/dist/domain/architecture/no-unused-public-members/member-usage-expression-reference-utilities.js +2 -2
  87. package/dist/domain/architecture/no-unused-public-members/member-usage-handoff-utilities.d.ts +1 -1
  88. package/dist/domain/architecture/no-unused-public-members/member-usage-handoff-utilities.d.ts.map +1 -1
  89. package/dist/domain/architecture/no-unused-public-members/member-usage-handoff-utilities.js +2 -2
  90. package/dist/domain/architecture/no-unused-public-members/member-usage-index-utilities.d.ts +1 -1
  91. package/dist/domain/architecture/no-unused-public-members/member-usage-index-utilities.d.ts.map +1 -1
  92. package/dist/domain/architecture/no-unused-public-members/member-usage-index-utilities.js +2 -2
  93. package/dist/domain/architecture/no-unused-public-members/member-usage-local-flow-utilities.d.ts +1 -1
  94. package/dist/domain/architecture/no-unused-public-members/member-usage-local-flow-utilities.d.ts.map +1 -1
  95. package/dist/domain/architecture/no-unused-public-members/member-usage-local-flow-utilities.js +2 -2
  96. package/dist/domain/architecture/no-unused-public-members/member-usage-reference-utilities.d.ts +1 -1
  97. package/dist/domain/architecture/no-unused-public-members/member-usage-reference-utilities.d.ts.map +1 -1
  98. package/dist/domain/architecture/no-unused-public-members/member-usage-reference-utilities.js +2 -2
  99. package/dist/domain/architecture/no-unused-public-members/member-usage-serialization-utilities.d.ts +1 -1
  100. package/dist/domain/architecture/no-unused-public-members/member-usage-serialization-utilities.d.ts.map +1 -1
  101. package/dist/domain/architecture/no-unused-public-members/member-usage-serialization-utilities.js +2 -2
  102. package/dist/domain/architecture/no-unused-public-members/member-usage-type-utilities.d.ts +1 -1
  103. package/dist/domain/architecture/no-unused-public-members/member-usage-type-utilities.d.ts.map +1 -1
  104. package/dist/domain/architecture/no-unused-public-members/member-usage-type-utilities.js +2 -2
  105. package/dist/domain/architecture/no-unused-public-members/member-usage-utilities.d.ts +1 -1
  106. package/dist/domain/architecture/no-unused-public-members/member-usage-utilities.d.ts.map +1 -1
  107. package/dist/domain/architecture/no-unused-public-members/member-usage-utilities.js +13 -2
  108. package/dist/domain/architecture/no-unused-public-members/member-usage-value-utilities.d.ts +1 -1
  109. package/dist/domain/architecture/no-unused-public-members/member-usage-value-utilities.d.ts.map +1 -1
  110. package/dist/domain/architecture/no-unused-public-members/member-usage-value-utilities.js +2 -2
  111. package/dist/domain/architecture/no-unused-public-members/member-usage-whole-object-utilities.d.ts +1 -1
  112. package/dist/domain/architecture/no-unused-public-members/member-usage-whole-object-utilities.d.ts.map +1 -1
  113. package/dist/domain/architecture/no-unused-public-members/member-usage-whole-object-utilities.js +2 -2
  114. package/dist/domain/architecture/no-unused-public-members/member-utilities.d.ts +1 -1
  115. package/dist/domain/architecture/no-unused-public-members/member-utilities.d.ts.map +1 -1
  116. package/dist/domain/architecture/no-unused-public-members/member-utilities.js +2 -2
  117. package/dist/domain/architecture/no-unused-public-members/rule.d.ts +14 -1
  118. package/dist/domain/architecture/no-unused-public-members/rule.d.ts.map +1 -1
  119. package/dist/domain/architecture/no-unused-public-members/rule.js +16 -3
  120. package/dist/domain/architecture/package-subpath-imports/index.d.ts +2 -0
  121. package/dist/domain/architecture/package-subpath-imports/index.d.ts.map +1 -0
  122. package/dist/domain/architecture/package-subpath-imports/index.js +2 -0
  123. package/dist/domain/architecture/package-subpath-imports/package-subpath-import-alias-utilities.d.ts +12 -0
  124. package/dist/domain/architecture/package-subpath-imports/package-subpath-import-alias-utilities.d.ts.map +1 -0
  125. package/dist/domain/architecture/package-subpath-imports/package-subpath-import-alias-utilities.js +215 -0
  126. package/dist/domain/architecture/package-subpath-imports/package-subpath-import-matching-utilities.d.ts +24 -0
  127. package/dist/domain/architecture/package-subpath-imports/package-subpath-import-matching-utilities.d.ts.map +1 -0
  128. package/dist/domain/architecture/package-subpath-imports/package-subpath-import-matching-utilities.js +46 -0
  129. package/dist/domain/architecture/package-subpath-imports/package-subpath-import-path-utilities.d.ts +36 -0
  130. package/dist/domain/architecture/package-subpath-imports/package-subpath-import-path-utilities.d.ts.map +1 -0
  131. package/dist/domain/architecture/package-subpath-imports/package-subpath-import-path-utilities.js +103 -0
  132. package/dist/domain/architecture/package-subpath-imports/package-subpath-import-types.d.ts +44 -0
  133. package/dist/domain/architecture/package-subpath-imports/package-subpath-import-types.d.ts.map +1 -0
  134. package/dist/domain/architecture/package-subpath-imports/package-subpath-import-types.js +1 -0
  135. package/dist/domain/architecture/package-subpath-imports/package-subpath-import-utilities.d.ts +13 -0
  136. package/dist/domain/architecture/package-subpath-imports/package-subpath-import-utilities.d.ts.map +1 -0
  137. package/dist/domain/architecture/package-subpath-imports/package-subpath-import-utilities.js +194 -0
  138. package/dist/domain/architecture/package-subpath-imports/prefer-package-subpath-imports-rule.d.ts +5 -0
  139. package/dist/domain/architecture/package-subpath-imports/prefer-package-subpath-imports-rule.d.ts.map +1 -0
  140. package/dist/domain/architecture/package-subpath-imports/prefer-package-subpath-imports-rule.js +106 -0
  141. package/dist/domain/architecture/program-analysis/source-dependency-utilities.d.ts +1 -1
  142. package/dist/domain/architecture/program-analysis/source-dependency-utilities.d.ts.map +1 -1
  143. package/dist/domain/architecture/program-analysis/source-dependency-utilities.js +2 -2
  144. package/dist/domain/architecture/program-analysis/source-file-facts.d.ts +1 -1
  145. package/dist/domain/architecture/program-analysis/source-file-facts.d.ts.map +1 -1
  146. package/dist/domain/architecture/program-analysis/source-file-facts.js +2 -2
  147. package/dist/domain/docs/single-line-jsdoc/rule.js +2 -2
  148. package/dist/domain/index.d.ts +1 -1
  149. package/dist/domain/index.d.ts.map +1 -1
  150. package/dist/domain/index.js +2 -2
  151. package/dist/domain/testing/require-act-result-capture/rule.js +2 -2
  152. package/dist/index.d.ts +1 -3
  153. package/dist/index.d.ts.map +1 -1
  154. package/dist/index.js +2 -3
  155. package/dist/infrastructure/codeperfect-plugin.d.ts +4 -0
  156. package/dist/infrastructure/codeperfect-plugin.d.ts.map +1 -1
  157. package/dist/infrastructure/codeperfect-plugin.js +4 -2
  158. package/dist/infrastructure/index.d.ts +0 -1
  159. package/dist/infrastructure/index.d.ts.map +1 -1
  160. package/dist/infrastructure/index.js +1 -2
  161. package/dist/infrastructure/presets.d.ts.map +1 -1
  162. package/dist/infrastructure/presets.js +5 -1
  163. package/docs/README.md +20 -0
  164. package/docs/api/index.md +19 -0
  165. package/docs/api/type-aliases/CodeperfectPreset.md +13 -0
  166. package/docs/api/variables/aaa.md +13 -0
  167. package/docs/api/variables/all.md +13 -0
  168. package/docs/api/variables/architecture.md +13 -0
  169. package/docs/api/variables/codeperfectPlugin.md +111 -0
  170. package/docs/api/variables/core.md +13 -0
  171. package/docs/api/variables/documentation.md +13 -0
  172. package/docs/api/variables/testing.md +13 -0
  173. package/docs/design/README.md +6 -0
  174. package/docs/design/architecture.md +218 -0
  175. package/docs/design/release.md +30 -0
  176. package/docs/rules/assert-actual-expected-names.md +163 -0
  177. package/docs/rules/barrel-files-exports-only.md +88 -0
  178. package/docs/rules/consistent-barrel-files.md +107 -0
  179. package/docs/rules/enforce-aaa-structure.md +220 -0
  180. package/docs/rules/no-directory-only-imports.md +72 -0
  181. package/docs/rules/no-import-export-aliases.md +54 -0
  182. package/docs/rules/no-import-export-extensions.md +63 -0
  183. package/docs/rules/no-interface-member-docs.md +101 -0
  184. package/docs/rules/no-multiple-declarators.md +105 -0
  185. package/docs/rules/no-reexports-outside-barrels.md +106 -0
  186. package/docs/rules/no-unused-exports.md +283 -0
  187. package/docs/rules/no-unused-public-members.md +389 -0
  188. package/docs/rules/no-useless-delegation.md +56 -0
  189. package/docs/rules/prefer-interface-types.md +138 -0
  190. package/docs/rules/prefer-package-subpath-imports.md +82 -0
  191. package/docs/rules/prefer-vi-mocked-import.md +129 -0
  192. package/docs/rules/require-act-result-capture.md +183 -0
  193. package/docs/rules/require-example-language.md +172 -0
  194. package/docs/rules/require-test-companion.md +125 -0
  195. package/docs/rules/single-act-statement.md +133 -0
  196. package/docs/rules/single-line-jsdoc.md +140 -0
  197. package/package.json +27 -26
  198. package/dist/application/custom-rules.d.ts +0 -70
  199. package/dist/application/custom-rules.d.ts.map +0 -1
  200. package/dist/application/custom-rules.js +0 -37
  201. package/dist/application/index.d.ts +0 -4
  202. package/dist/application/index.d.ts.map +0 -1
  203. package/dist/application/index.js +0 -3
@@ -0,0 +1,218 @@
1
+ # Architecture
2
+
3
+ ## Package Boundaries
4
+
5
+ `@codeperfect/eslint-plugin` publishes a narrow public surface:
6
+
7
+ - named `codeperfectPlugin`
8
+ - first-party presets implemented in `src/infrastructure/presets.ts`
9
+ - package-owned rules through the public plugin object's `rules` map, assembled in `src/infrastructure/codeperfect-plugin.ts`
10
+
11
+ The package does not own a shared-config composition layer. Local repository lint configuration stays in `eslint.config.ts`.
12
+
13
+ ## Source Layout
14
+
15
+ - `src/index.ts` is the public entrypoint used for package exports and API documentation generation.
16
+ - `src/domain/` contains the concrete rule implementations and domain-only support code.
17
+ - `src/infrastructure/` contains ESLint-facing adapters such as the plugin rule map and ready-to-use presets.
18
+ - `eslint.config.ts` owns the repository-specific architecture overlay, including the `boundaries` layer rules.
19
+ - `docs/rules/` contains curated rule reference pages.
20
+
21
+ ## Documentation Layout
22
+
23
+ - `docs/design/` is reserved for curated architecture and maintenance documentation.
24
+ - `docs/api/` is reserved for autogenerated API output.
25
+ - `docs/rules/` remains curated rule reference content and is not overwritten by the docs generation command.
26
+
27
+ ## Unused Member Analysis
28
+
29
+ A TypeScript Program is the compiler's snapshot of source files; its checker
30
+ resolves references to declarations and types. An analysis scope selects eligible
31
+ production files inside one configured API folder.
32
+
33
+ - `src/domain/architecture/program-analysis/` owns shared syntax catalogs,
34
+ native reference-symbol lookups, and lazy module/triple-slash dependency edges.
35
+ Both unused-code rules reuse these facts without sharing file classifications.
36
+ Global scripts and augmentations remain conservative dependency roots.
37
+ - The member rule's domain-owned scope index resolves eligible API entries and
38
+ their exact parent folders using the linted file's effective options.
39
+ - Production usage indexes are partitioned by owner before resolving consumer
40
+ symbols and call signatures. Heritage indexes use the same eligible files;
41
+ local forwarding and factory-return traversal enforce source-file membership
42
+ at each recursive step.
43
+ - A transient reverse-dependency index selects eager reference consumers for
44
+ each declared member name, including same-file and owner-local global or
45
+ augmentation sources. Cycles use a visited set, not recursive expansion.
46
+ Disconnected references remain available for structural and deferred symbol
47
+ identity checks; dependencies outside the owner are not traversed for consumers.
48
+ Whole-object operations and adapter inputs retain the full eligible owner scope.
49
+ - Observed imports are retained regardless of folder direction. Folder labels and
50
+ architecture permissions do not prove that a consumer is absent.
51
+ - Operation catalogs remain syntax-only until candidates survive reference and
52
+ adapter checks. Each scope lazily classifies operations, then evaluates pending
53
+ candidates in operation-first batches, removing consumed members from later
54
+ work. Completed positive and negative answers use declaration-keyed weak sets,
55
+ not a retained operation-by-member result matrix.
56
+ - Node types, contextual types (including absent contexts), and property lists
57
+ are shared within a type checker, never between replacement semantic snapshots.
58
+ Member-specific identity and contract checks remain distinct.
59
+ - Immutable function catalogs separate own calls/returns from nested closure
60
+ calls, preserving each sink's existing traversal semantics. Scope-owned
61
+ parameter summaries distinguish standard JSON serialization from opaque
62
+ request bodies; factory results additionally distinguish candidate declarations.
63
+ - Local flow uses iterative graph discovery and strongly connected components:
64
+ mutually reachable parameter/return states form one group. Groups complete
65
+ callee-first; a consumed exit marks the whole group used, otherwise it completes
66
+ negative. In-progress visits are never cached as negative results. Predecessor
67
+ edges are discarded after grouping; each completed group drops its graph
68
+ records immediately. Remaining work queues leave scope when the query returns;
69
+ only reusable syntax facts and weakly owned completed answers remain.
70
+ - The optional Angular adapter receives only that owner's production files.
71
+ Public API exemptions remain separate from consumer scope.
72
+ - Nested API exposure is queried only for remaining candidates. Lazy type
73
+ traversal checks declaration identity and stops on a match instead of
74
+ collecting an export's entire type graph. Completed answers distinguish the
75
+ program, candidate, API location, and remaining depth; traversal-local queues
76
+ leave scope with the query. The existing six-level type budget is retained,
77
+ with depth-neutral union/intersection edges.
78
+ - A conservative declaration-reference graph plus visible generic arguments
79
+ rejects unrelated closed type branches before recursive instantiation.
80
+ Declaration cycles use completed SCC results. Captured parameters, unavailable
81
+ substitutions, and ambient augmentation uncertainty retain semantic traversal;
82
+ syntax references alone never establish an API exemption.
83
+ - `no-unused-exports` retains its existing consumer analysis and runs independently
84
+ of the member rule.
85
+ Dependency edges do not themselves count as concrete export consumption.
86
+
87
+ ### Cache Ownership
88
+
89
+ Cache owners define when facts may be reused and when the garbage collector can
90
+ release them. Weak keys permit collection after callers release the owner; they
91
+ do not force collection or detach TypeScript's own trees.
92
+
93
+ | Owner | Retained facts and limits |
94
+ | -------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
95
+ | Most recently cached Program, held weakly | Option-dependent API/scope indexes and production-usage buckets. Switching Programs evicts the previous entries even if that Program remains alive. Each named cache replaces its previous configuration rather than retaining option history. |
96
+ | Analysis scope, held weakly | Production usage and heritage indexes, lazy operation summaries, completed parameter-flow answers, and candidate-specific factory answers. Production indexes use scope objects as weak keys, not historical folder names. |
97
+ | Program or checker, held weakly | Native reference symbols and dependencies, node/contextual types, properties, resolved call facts, and candidate API/relevance answers. These facts never cross replacement semantic snapshots; nested node/type/candidate keys are weak. Source-reachability results are bounded to 16 source roots per owner. |
98
+ | Immutable syntax node, held weakly | Shared file and function catalogs containing syntax facts only; these may survive syntax reuse across Programs without preserving old semantic answers. |
99
+ | Angular checker and template metadata, held weakly | Component metadata is checker-specific even when class syntax is reused. Parsed nodes follow the immutable metadata object. A replacement checker rereads external templates and creates a new parse snapshot. |
100
+
101
+ Completed operation and flow answers do not retain an operation-by-candidate
102
+ matrix or temporary discovery/grouping queues. API type answers distinguish
103
+ remaining depth, with at most seven depth entries (zero through six) per
104
+ type/location/candidate combination.
105
+
106
+ Scope or configuration replacement makes obsolete analysis collectible unless
107
+ callers still hold it. Releasing a Program also permits its checker-owned facts
108
+ to be collected, but syntax snapshots or native type graphs still held by
109
+ TypeScript, parser services, or other callers remain outside plugin ownership.
110
+ The export rule retains its independent Program-weak index.
111
+
112
+ ### Measured Performance
113
+
114
+ The reference workload completes with both unused-code rules under Node's
115
+ default heap and explicit `--max-old-space-size=4096`. The measurements below
116
+ satisfy the [approved benchmark contract](../../.specs/SPEC.md#benchmark-setup);
117
+ they are observations for these inputs, not timeouts or memory ceilings enforced
118
+ by the rules.
119
+
120
+ **Environment and inputs.** Measured on 2026-11-12 using Windows 11 Pro
121
+ 10.0.26200, Ryzen 9 9950X (16 cores / 32 logical processors), approximately
122
+ 61.7 GiB physical memory, Node v24.18.0, ESLint 10.14.0, TypeScript 6.0.3,
123
+ typescript-eslint 8.72.2, and `@codeperfect/eslint-config` 2.7.0. The local
124
+ reference project contains four independent package API folders. Healthy data
125
+ contains 265 tracked TypeScript files, including tests and tooling. Recursive
126
+ data adds an eight-way generic builder fixture exposed through one package API.
127
+ The host is shared; CPU scheduling is not isolated and filesystem caches are
128
+ not cleared.
129
+
130
+ Each result is the median of three fresh sequential Node processes, including
131
+ startup and exit. Existing typed ESLint configuration and other rules remain
132
+ enabled, with `projectService: true`, no result cache, no lint concurrency, and
133
+ `NODE_OPTIONS` unset. Memory columns are maxima across each row's three runs.
134
+ Used heap is observed garbage-collection/phase high water, not a continuous peak.
135
+ RSS is resident process memory, measured separately using Windows peak working
136
+ set and Node's maximum RSS. One GiB is 1,073,741,824 bytes.
137
+
138
+ | Dataset | Heap | Three wall times (seconds) | Median seconds | Observed heap GiB | Peak RSS GiB |
139
+ | --------- | -------- | -------------------------- | -------------: | ----------------: | -----------: |
140
+ | Healthy | Default | 21.332 / 21.281 / 21.176 | 21.281 | 2.921 | 3.343 |
141
+ | Healthy | 4096 MiB | 21.336 / 21.401 / 21.152 | 21.336 | 2.896 | 3.314 |
142
+ | Recursive | Default | 21.140 / 21.402 / 21.547 | 21.402 | 2.893 | 3.319 |
143
+ | Recursive | 4096 MiB | 21.223 / 21.284 / 24.052 | 21.284 | 2.925 | 3.341 |
144
+
145
+ The unchanged project also completed before optimization; its original reported
146
+ crash was not reproduced. The synthetic recursive workload did exhaust the heap
147
+ in both installed and pre-optimization source member-rule runs, including the
148
+ explicit 4096 MiB source run. Those crashed runs have no completed diagnostic
149
+ array. They establish a reproducible type-expansion regression, not the exact
150
+ cause of the originally reported crash.
151
+
152
+ **Correctness and controls.** All 46 cold-process measurements complete:
153
+ 34 combined/export-only/member-only/both-disabled matrix runs and 12 matched
154
+ compiled export controls. Completed baseline diagnostic arrays match directly,
155
+ not just by count. Healthy combined analysis retains 52 existing errors and
156
+ recursive combined analysis retains 53; neither has target-rule, fatal, or warning
157
+ findings. The recursive fixture adds only its sorting error; excluding that file
158
+ leaves the exact original healthy combined array. Export-only and both-disabled
159
+ diagnostics match their respective original baselines. Additional findings when
160
+ the member rule is disabled are nine existing unused disable directives.
161
+
162
+ Source export-only default/4096 MiB medians are 20.823/20.766 seconds for healthy
163
+ data and 20.860/20.725 seconds for recursive data. Installed default-heap medians
164
+ are 19.615 and 19.659 seconds, but source and installed loaders differ.
165
+ Matched controls preload both built plugins identically, retain other candidate
166
+ rules, and swap only the export implementation. Baseline/candidate medians are
167
+ 22.329/22.176 seconds for healthy data and 22.124/22.184 seconds for recursive
168
+ data, with overlapping ranges and exact export diagnostics. This does not prove
169
+ zero overhead or statistical equivalence on every workload.
170
+
171
+ Two additional processes each perform six full lint passes, alternating the
172
+ original effective options with an added nonmatching test glob and restoring
173
+ the original options. All 12 passes retain exact combined diagnostics without
174
+ result caching. Repeated/restored `lintFiles` calls take 5.099-5.884 seconds;
175
+ these exclude startup and explicit harness setup, include lazy ESLint work
176
+ inside the calls, and are not cold-process acceptance medians.
177
+
178
+ **Ownership limits.** A separate forced-GC probe warms native scope, syntax,
179
+ reference, API, and type facts through eight outer/nested configurations. With
180
+ the Program alive, only its current observed scope/index remains; after external
181
+ owners are released, the observed Program, checker, scopes, and indexes collect.
182
+ The small fixture catalogs operations but does not execute flow summaries or the
183
+ full Linter. Its roughly 74.8 MB live-Program versus 29.9 MB released-Program heap
184
+ samples demonstrate ownership, not a production memory-reduction guarantee.
185
+ TypeScript/parser-owned graphs remain outside plugin control.
186
+
187
+ **Provenance and local evidence.** The measured source snapshot is
188
+ `28853bf8d3b135f4bc2bf1f1411a33efa58b1d6bb655e854caae5238c6a27e84`;
189
+ all 318 source files match it. Healthy and recursive dataset hashes are
190
+ `91fa56129f682b10e16eac3880c5fa15c2dd35cb9217fc2eec0659d8fa6eb59e` and
191
+ `c39cbb0605ea399a5e6e90d908174541f55d8b43248530739b60ae149c959895`.
192
+ The original runner and fixture are unchanged. The worker's only historical
193
+ change corrects source inventories to include untracked, nonignored files;
194
+ reversing that exact change reproduces its original checksum. Original and
195
+ corrected inventories agree for this final source; loader and timing/GC protocol
196
+ are unchanged.
197
+
198
+ Local, untracked evidence is retained in
199
+ `logs/member-benchmark/proof-20261112-111458/`: `manifest.json` identifies every
200
+ run and command; `report.json` retains checked results, build/script hashes,
201
+ and diagnostic baselines. Referenced run directories contain full diagnostic
202
+ arrays, input fingerprints, GC logs, and phase telemetry. Reproduction drivers
203
+ in `logs/member-benchmark/` are `final-matrix.ps1`, `final-warm.ps1`,
204
+ `final-export-comparison.ps1`, and `final-report.mjs`, in that order. The first
205
+ prints a new manifest path; pass it to subsequent PowerShell drivers with
206
+ `-ManifestPath` and to Node positionally. These local helpers/data are not shipped.
207
+ Stress phases restore fixture/API changes in `finally` and refuse to overwrite
208
+ concurrent edits. Cache-collection evidence is retained in `logs/cache-retention/`.
209
+
210
+ The measured implementation passed `npm run validate`: all 11 stages, including
211
+ build/packaging, formatting/lint, type checking, unit/E2E tests, API documentation,
212
+ and mutation testing. The local log is `logs/validate-cache-ownership-final.log`.
213
+
214
+ ## Maintenance Expectations
215
+
216
+ - Keep the README focused on install, usage, exports, and links into this docs tree.
217
+ - When the exported surface changes, regenerate `docs/api/` and review the design docs for drift.
218
+ - When a rule is added or renamed, update `docs/rules/`, the plugin rule map, preset selections, and any published references together.
@@ -0,0 +1,30 @@
1
+ # Release Process
2
+
3
+ ## Branches
4
+
5
+ Pushes to `main` and `master` are release branches. GitHub Actions validates the repository and then runs Semantic Release.
6
+
7
+ ## Required Inputs
8
+
9
+ - commits must follow the emoji conventional-commit format enforced by `commitlint.config.ts`
10
+ - `npm run validate` must pass on the release branch
11
+ - `npm run docs` must regenerate `docs/api/` without manual cleanup
12
+ - npm publishing must be configured through trusted publishing or an `NPM_TOKEN` secret
13
+
14
+ ## Workflow Summary
15
+
16
+ 1. `ci.yml` validates pull requests and pushes against `main` and `master`.
17
+ 2. `release.yml` runs validation, rebuilds docs, and executes Semantic Release.
18
+ 3. Semantic Release analyzes commit messages, creates a version tag, publishes the package to npm, and creates the GitHub release.
19
+ 4. `docs.yml` publishes the `docs/` directory to GitHub Pages when a version tag is pushed.
20
+
21
+ The release workflow also repairs the legacy initial-release tag shape if the repository still has `v<major>` for a published `major.0.0` release. In that one case it creates the matching `v<major>.0.0` tag on the same commit before running Semantic Release.
22
+
23
+ ## Local Verification
24
+
25
+ Use this sequence before merging release-impacting changes:
26
+
27
+ 1. `npm run docs`
28
+ 2. `npm run validate`
29
+ 3. `npm run validate`
30
+ 4. `npm run release:dry-run`
@@ -0,0 +1,163 @@
1
+ # `codeperfect/assert-actual-expected-names`
2
+
3
+ ## Summary
4
+
5
+ Require values used in assertions to follow `actual*` and `expected*` naming conventions (including the short forms `actual` and `expected`).
6
+
7
+ ## Enabled by
8
+
9
+ - `testing`
10
+ - internal `codeperfect` plugin registry
11
+
12
+ ## Why this rule exists
13
+
14
+ Tests read more clearly when the compared values advertise their role directly. In assertions, names like `result` and `value` hide intent, while `actualResult` and `expectedValue` make the comparison obvious at a glance.
15
+
16
+ ## Rule Details
17
+
18
+ - Values passed to `expect()` should be named with:
19
+ - `actual*` (or `actual`)
20
+
21
+ - Values passed as matcher arguments should be named with:
22
+ - `expected*` (or `expected`)
23
+
24
+ - Variables may be declared in either the Act or Assert phase
25
+ - Neutral names (e.g. `computedResult`) are allowed before assertion, but must not be used directly in `expect`
26
+ - The rule applies to all matcher types (e.g. `toBe`, `toEqual`, `toStrictEqual`, etc.)
27
+ - The rule checks identifier names used in assertions; inline expressions are handled by AAA structure and phase rules
28
+
29
+ ## Invalid
30
+
31
+ ```typescript
32
+ it("rejects generic names in assert", () => {
33
+ // Arrange
34
+ const input = 1;
35
+
36
+ // Act
37
+ const result = run(input);
38
+
39
+ // Assert
40
+ const value = 1;
41
+ expect(result).toBe(value);
42
+ });
43
+
44
+ it("requires expected prefix", () => {
45
+ // Arrange
46
+ const input = 1;
47
+
48
+ // Act
49
+ const actualResult = run(input);
50
+
51
+ // Assert
52
+ const value = 1;
53
+ expect(actualResult).toBe(value);
54
+ });
55
+
56
+ it("requires actual prefix", () => {
57
+ // Arrange
58
+ const input = 1;
59
+
60
+ // Act
61
+ const result = run(input);
62
+
63
+ // Assert
64
+ const expectedValue = 1;
65
+ expect(result).toBe(expectedValue);
66
+ });
67
+ ```
68
+
69
+ ## Valid
70
+
71
+ ```typescript
72
+ it("uses actual and expected prefixes", () => {
73
+ // Arrange
74
+ const input = 1;
75
+
76
+ // Act
77
+ const computedResult = run(input);
78
+
79
+ // Assert
80
+ const actualResult = computedResult;
81
+ const expectedValue = 1;
82
+ expect(actualResult).toBe(expectedValue);
83
+ });
84
+
85
+ it("allows the short actual and expected names", () => {
86
+ // Arrange
87
+ const input = 1;
88
+
89
+ // Act
90
+ const computedResult = run(input);
91
+
92
+ // Assert
93
+ const actual = computedResult;
94
+ const expected = 1;
95
+ expect(actual).toBe(expected);
96
+ });
97
+
98
+ it("allows actual to be introduced during Act", () => {
99
+ // Arrange
100
+ const input = 1;
101
+
102
+ // Act
103
+ const actual = run(input);
104
+
105
+ // Assert
106
+ const expected = 1;
107
+ expect(actual).toBe(expected);
108
+ });
109
+
110
+ it("keeps descriptive prefixes for matcher arguments", () => {
111
+ // Arrange
112
+ const input = 2;
113
+
114
+ // Act
115
+ const computedTotal = run(input);
116
+
117
+ // Assert
118
+ const actualTotal = computedTotal;
119
+ const expectedTotal = 2;
120
+ expect(actualTotal).toBe(expectedTotal);
121
+ });
122
+
123
+ it("supports multiple assertions", () => {
124
+ // Arrange
125
+ const input = 2;
126
+
127
+ // Act
128
+ const computed = run(input);
129
+
130
+ // Assert
131
+ const actualA = computed;
132
+ const expectedA = 2;
133
+ const actualB = computed * 2;
134
+ const expectedB = 4;
135
+
136
+ expect(actualA).toBe(expectedA);
137
+ expect(actualB).toBe(expectedB);
138
+ });
139
+
140
+ it("supports other matcher types", () => {
141
+ // Arrange
142
+ const input = { count: 1 };
143
+
144
+ // Act
145
+ const actual = run(input);
146
+
147
+ // Assert
148
+ const expected = { count: 1 };
149
+ expect(actual).toEqual(expected);
150
+ });
151
+
152
+ it("supports negative assertions", () => {
153
+ // Arrange
154
+ const input = 1;
155
+
156
+ // Act
157
+ const actual = run(input);
158
+
159
+ // Assert
160
+ const expected = 2;
161
+ expect(actual).not.toBe(expected);
162
+ });
163
+ ```
@@ -0,0 +1,88 @@
1
+ # `codeperfect/barrel-files-exports-only`
2
+
3
+ ## Summary
4
+
5
+ Restrict barrel files to local re-export statements and type-only declarations. Disallow exports from outside the barrel folder tree, imports, executable code, and runtime logic.
6
+
7
+ ## Enabled by
8
+
9
+ - `barrel-files`
10
+ - internal `codeperfect` plugin registry
11
+
12
+ ## Why this rule exists
13
+
14
+ Barrel files should remain simple aggregation points. Introducing imports or executable logic makes module boundaries harder to reason about, increases coupling, and can lead to unexpected side effects.
15
+
16
+ ## Rule Details
17
+
18
+ - Barrel files may contain:
19
+ - `export` statements whose targets resolve to the barrel's folder or one of its descendant folders (e.g. `export * from`, `export { ... } from`)
20
+ - type-only declarations and specifier exports (e.g. `export type * from`, `export { type ... } from`, `export type { ... }`)
21
+ - Barrel files must not contain:
22
+ - `import` statements
23
+ - variable declarations (`const`, `let`, `var`)
24
+ - function or class implementations
25
+ - executable code (e.g. function calls, conditionals)
26
+ - Files that are empty (e.g. placeholder `index.ts`) are allowed
27
+
28
+ ## Invalid
29
+
30
+ ```typescript
31
+ import { feature } from "./feature";
32
+ export { feature };
33
+ ```
34
+
35
+ ```typescript
36
+ // disallows runtime logic
37
+ export const value = 1;
38
+ ```
39
+
40
+ ```typescript
41
+ // disallows function declarations
42
+ export function run() {
43
+ return 1;
44
+ }
45
+ ```
46
+
47
+ ```typescript
48
+ // disallows side effects
49
+ console.log("loaded");
50
+ ```
51
+
52
+ ## Valid
53
+
54
+ ```typescript
55
+ export * from "./feature";
56
+ ```
57
+
58
+ ```typescript
59
+ export { feature } from "./feature";
60
+ ```
61
+
62
+ ```typescript
63
+ export type { Feature } from "./feature";
64
+ ```
65
+
66
+ ```typescript
67
+ // shared/index.ts may aggregate modules within shared/ and its descendants
68
+ export { Feature } from "./feature";
69
+ export type { NestedFeature } from "./nested/feature";
70
+ ```
71
+
72
+ ```typescript
73
+ // index.ts (empty barrel file)
74
+ ```
75
+
76
+ ```typescript
77
+ // non-barrel file (allowed to import)
78
+ import { feature } from "./dependency";
79
+ ```
80
+
81
+ ## Invalid export sources
82
+
83
+ Re-exporting from a sibling folder, another workspace, or an installed package is invalid. When TypeScript parser services are available, the rule checks the resolved file, including configured path aliases.
84
+
85
+ ```typescript
86
+ // apps/automation/src/shared/index.ts
87
+ export type { AutomationBridgeCommandMessage } from "@forex/api-contract";
88
+ ```
@@ -0,0 +1,107 @@
1
+ # `codeperfect/consistent-barrel-files`
2
+
3
+ ## Summary
4
+
5
+ Enforce a consistent barrel file strategy by either requiring or forbidding barrel files with allowed names.
6
+
7
+ ## Enabled by
8
+
9
+ - `barrel-files`
10
+ - internal `codeperfect` plugin registry
11
+
12
+ ## Why this rule exists
13
+
14
+ Repositories should choose a clear barrel-file strategy. Mixed naming or partially adopted barrels create ambiguous import surfaces and inconsistent folder conventions.
15
+
16
+ ## Options
17
+
18
+ ```typescript
19
+ type Options = {
20
+ enforce?: boolean; // default: true
21
+ allowedNames?: string[]; // default: ["index"]
22
+ };
23
+ ```
24
+
25
+ - `enforce: true`
26
+ - Folders must include a barrel file with an allowed name
27
+
28
+ - `enforce: false`
29
+ - Barrel files with allowed names must not exist
30
+
31
+ - `allowedNames`
32
+ - Defines which filenames are considered barrel files (e.g. `"index"`, `"mod"`, etc.)
33
+
34
+ ## Rule Details
35
+
36
+ - A "barrel file" is any file whose name matches one of the `allowedNames`
37
+ - The rule applies to folders containing at least one non-barrel module file
38
+ - All folders must follow the same strategy:
39
+ - either consistently include a barrel file (`enforce: true`)
40
+ - or consistently avoid them (`enforce: false`)
41
+
42
+ - Mixed usage across folders is not allowed
43
+
44
+ ## Invalid
45
+
46
+ ### Missing required barrel file (`enforce: true`)
47
+
48
+ ```tree
49
+ feature/
50
+ feature.ts
51
+ ```
52
+
53
+ ### Forbidden barrel file present (`enforce: false`)
54
+
55
+ ```tree
56
+ feature/
57
+ feature.ts
58
+ index.ts
59
+ ```
60
+
61
+ ### Mixed strategy across folders
62
+
63
+ ```tree
64
+ featureA/
65
+ featureA.ts
66
+ index.ts
67
+
68
+ featureB/
69
+ featureB.ts
70
+ ```
71
+
72
+ ## Valid
73
+
74
+ ### Enforced barrel files (`enforce: true`)
75
+
76
+ ```tree
77
+ feature/
78
+ feature.ts
79
+ index.ts
80
+ ```
81
+
82
+ ```typescript
83
+ // feature/index.ts
84
+ export * from "./feature";
85
+ ```
86
+
87
+ ```typescript
88
+ // feature/feature.ts
89
+ export const feature = 1;
90
+ ```
91
+
92
+ ### No barrel files (`enforce: false`)
93
+
94
+ ```tree
95
+ feature/
96
+ feature.ts
97
+ ```
98
+
99
+ ### Custom allowed barrel names
100
+
101
+ With `{ allowedNames: ["mod"] }`:
102
+
103
+ ```tree
104
+ feature/
105
+ feature.ts
106
+ mod.ts
107
+ ```