@memberjunction/react-test-harness 5.28.0 → 5.30.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 (324) hide show
  1. package/README.md +140 -153
  2. package/dist/__tests__/setup/vitest-setup.d.ts +11 -0
  3. package/dist/__tests__/setup/vitest-setup.d.ts.map +1 -0
  4. package/dist/__tests__/setup/vitest-setup.js +73 -0
  5. package/dist/__tests__/setup/vitest-setup.js.map +1 -0
  6. package/dist/index.d.ts +1 -0
  7. package/dist/index.d.ts.map +1 -1
  8. package/dist/index.js +1 -0
  9. package/dist/index.js.map +1 -1
  10. package/dist/lib/component-linter.d.ts +10 -13
  11. package/dist/lib/component-linter.d.ts.map +1 -1
  12. package/dist/lib/component-linter.js +96 -8552
  13. package/dist/lib/component-linter.js.map +1 -1
  14. package/dist/lib/component-runner.d.ts.map +1 -1
  15. package/dist/lib/component-runner.js +34 -10
  16. package/dist/lib/component-runner.js.map +1 -1
  17. package/dist/lib/lint-rule.d.ts +70 -0
  18. package/dist/lib/lint-rule.d.ts.map +1 -0
  19. package/dist/lib/lint-rule.js +41 -0
  20. package/dist/lib/lint-rule.js.map +1 -0
  21. package/dist/lib/lint-utils.d.ts +131 -0
  22. package/dist/lib/lint-utils.d.ts.map +1 -0
  23. package/dist/lib/lint-utils.js +358 -0
  24. package/dist/lib/lint-utils.js.map +1 -0
  25. package/dist/lib/prop-value-extractor.d.ts +2 -2
  26. package/dist/lib/prop-value-extractor.js +2 -2
  27. package/dist/lib/runtime-rules/ai-tools-availability-check.d.ts +9 -0
  28. package/dist/lib/runtime-rules/ai-tools-availability-check.d.ts.map +1 -0
  29. package/dist/lib/runtime-rules/ai-tools-availability-check.js +223 -0
  30. package/dist/lib/runtime-rules/ai-tools-availability-check.js.map +1 -0
  31. package/dist/lib/runtime-rules/callback-event-validation.d.ts +22 -0
  32. package/dist/lib/runtime-rules/callback-event-validation.d.ts.map +1 -0
  33. package/dist/lib/runtime-rules/callback-event-validation.js +561 -0
  34. package/dist/lib/runtime-rules/callback-event-validation.js.map +1 -0
  35. package/dist/lib/runtime-rules/chart-field-validation.d.ts +10 -0
  36. package/dist/lib/runtime-rules/chart-field-validation.d.ts.map +1 -0
  37. package/dist/lib/runtime-rules/chart-field-validation.js +270 -0
  38. package/dist/lib/runtime-rules/chart-field-validation.js.map +1 -0
  39. package/dist/lib/runtime-rules/child-component-prop-validation.d.ts +10 -0
  40. package/dist/lib/runtime-rules/child-component-prop-validation.d.ts.map +1 -0
  41. package/dist/lib/runtime-rules/child-component-prop-validation.js +447 -0
  42. package/dist/lib/runtime-rules/child-component-prop-validation.js.map +1 -0
  43. package/dist/lib/runtime-rules/component-name-mismatch.d.ts +19 -0
  44. package/dist/lib/runtime-rules/component-name-mismatch.d.ts.map +1 -0
  45. package/dist/lib/runtime-rules/component-name-mismatch.js +82 -0
  46. package/dist/lib/runtime-rules/component-name-mismatch.js.map +1 -0
  47. package/dist/lib/runtime-rules/component-not-in-dependencies.d.ts +20 -0
  48. package/dist/lib/runtime-rules/component-not-in-dependencies.d.ts.map +1 -0
  49. package/dist/lib/runtime-rules/component-not-in-dependencies.js +92 -0
  50. package/dist/lib/runtime-rules/component-not-in-dependencies.js.map +1 -0
  51. package/dist/lib/runtime-rules/component-props-validation.d.ts +25 -0
  52. package/dist/lib/runtime-rules/component-props-validation.d.ts.map +1 -0
  53. package/dist/lib/runtime-rules/component-props-validation.js +228 -0
  54. package/dist/lib/runtime-rules/component-props-validation.js.map +1 -0
  55. package/dist/lib/runtime-rules/component-usage-without-destructuring.d.ts +20 -0
  56. package/dist/lib/runtime-rules/component-usage-without-destructuring.d.ts.map +1 -0
  57. package/dist/lib/runtime-rules/component-usage-without-destructuring.js +124 -0
  58. package/dist/lib/runtime-rules/component-usage-without-destructuring.js.map +1 -0
  59. package/dist/lib/runtime-rules/data-result-validation.d.ts +9 -0
  60. package/dist/lib/runtime-rules/data-result-validation.d.ts.map +1 -0
  61. package/dist/lib/runtime-rules/data-result-validation.js +763 -0
  62. package/dist/lib/runtime-rules/data-result-validation.js.map +1 -0
  63. package/dist/lib/runtime-rules/datagrid-field-validation.d.ts +10 -0
  64. package/dist/lib/runtime-rules/datagrid-field-validation.d.ts.map +1 -0
  65. package/dist/lib/runtime-rules/datagrid-field-validation.js +245 -0
  66. package/dist/lib/runtime-rules/datagrid-field-validation.js.map +1 -0
  67. package/dist/lib/runtime-rules/dependency-shadowing.d.ts +20 -0
  68. package/dist/lib/runtime-rules/dependency-shadowing.d.ts.map +1 -0
  69. package/dist/lib/runtime-rules/dependency-shadowing.js +147 -0
  70. package/dist/lib/runtime-rules/dependency-shadowing.js.map +1 -0
  71. package/dist/lib/runtime-rules/entity-field-access-validation.d.ts +12 -0
  72. package/dist/lib/runtime-rules/entity-field-access-validation.d.ts.map +1 -0
  73. package/dist/lib/runtime-rules/entity-field-access-validation.js +304 -0
  74. package/dist/lib/runtime-rules/entity-field-access-validation.js.map +1 -0
  75. package/dist/lib/runtime-rules/event-parameter-validation.d.ts +22 -0
  76. package/dist/lib/runtime-rules/event-parameter-validation.d.ts.map +1 -0
  77. package/dist/lib/runtime-rules/event-parameter-validation.js +406 -0
  78. package/dist/lib/runtime-rules/event-parameter-validation.js.map +1 -0
  79. package/dist/lib/runtime-rules/index.d.ts +59 -0
  80. package/dist/lib/runtime-rules/index.d.ts.map +1 -0
  81. package/dist/lib/runtime-rules/index.js +60 -0
  82. package/dist/lib/runtime-rules/index.js.map +1 -0
  83. package/dist/lib/runtime-rules/library-variable-names.d.ts +24 -0
  84. package/dist/lib/runtime-rules/library-variable-names.d.ts.map +1 -0
  85. package/dist/lib/runtime-rules/library-variable-names.js +88 -0
  86. package/dist/lib/runtime-rules/library-variable-names.js.map +1 -0
  87. package/dist/lib/runtime-rules/no-child-implementation.d.ts +18 -0
  88. package/dist/lib/runtime-rules/no-child-implementation.d.ts.map +1 -0
  89. package/dist/lib/runtime-rules/no-child-implementation.js +57 -0
  90. package/dist/lib/runtime-rules/no-child-implementation.js.map +1 -0
  91. package/dist/lib/runtime-rules/no-data-prop.d.ts +22 -0
  92. package/dist/lib/runtime-rules/no-data-prop.d.ts.map +1 -0
  93. package/dist/lib/runtime-rules/no-data-prop.js +111 -0
  94. package/dist/lib/runtime-rules/no-data-prop.js.map +1 -0
  95. package/dist/lib/runtime-rules/no-export-statements.d.ts +18 -0
  96. package/dist/lib/runtime-rules/no-export-statements.d.ts.map +1 -0
  97. package/dist/lib/runtime-rules/no-export-statements.js +143 -0
  98. package/dist/lib/runtime-rules/no-export-statements.js.map +1 -0
  99. package/dist/lib/runtime-rules/no-iife-wrapper.d.ts +18 -0
  100. package/dist/lib/runtime-rules/no-iife-wrapper.d.ts.map +1 -0
  101. package/dist/lib/runtime-rules/no-iife-wrapper.js +217 -0
  102. package/dist/lib/runtime-rules/no-iife-wrapper.js.map +1 -0
  103. package/dist/lib/runtime-rules/no-import-statements.d.ts +18 -0
  104. package/dist/lib/runtime-rules/no-import-statements.d.ts.map +1 -0
  105. package/dist/lib/runtime-rules/no-import-statements.js +65 -0
  106. package/dist/lib/runtime-rules/no-import-statements.js.map +1 -0
  107. package/dist/lib/runtime-rules/no-react-destructuring.d.ts +18 -0
  108. package/dist/lib/runtime-rules/no-react-destructuring.d.ts.map +1 -0
  109. package/dist/lib/runtime-rules/no-react-destructuring.js +60 -0
  110. package/dist/lib/runtime-rules/no-react-destructuring.js.map +1 -0
  111. package/dist/lib/runtime-rules/no-require-statements.d.ts +18 -0
  112. package/dist/lib/runtime-rules/no-require-statements.d.ts.map +1 -0
  113. package/dist/lib/runtime-rules/no-require-statements.js +109 -0
  114. package/dist/lib/runtime-rules/no-require-statements.js.map +1 -0
  115. package/dist/lib/runtime-rules/no-return-component.d.ts +18 -0
  116. package/dist/lib/runtime-rules/no-return-component.d.ts.map +1 -0
  117. package/dist/lib/runtime-rules/no-return-component.js +106 -0
  118. package/dist/lib/runtime-rules/no-return-component.js.map +1 -0
  119. package/dist/lib/runtime-rules/no-use-reducer.d.ts +19 -0
  120. package/dist/lib/runtime-rules/no-use-reducer.d.ts.map +1 -0
  121. package/dist/lib/runtime-rules/no-use-reducer.js +78 -0
  122. package/dist/lib/runtime-rules/no-use-reducer.js.map +1 -0
  123. package/dist/lib/runtime-rules/no-window-access.d.ts +23 -0
  124. package/dist/lib/runtime-rules/no-window-access.d.ts.map +1 -0
  125. package/dist/lib/runtime-rules/no-window-access.js +136 -0
  126. package/dist/lib/runtime-rules/no-window-access.js.map +1 -0
  127. package/dist/lib/runtime-rules/noisy-settings-updates.d.ts +18 -0
  128. package/dist/lib/runtime-rules/noisy-settings-updates.d.ts.map +1 -0
  129. package/dist/lib/runtime-rules/noisy-settings-updates.js +110 -0
  130. package/dist/lib/runtime-rules/noisy-settings-updates.js.map +1 -0
  131. package/dist/lib/runtime-rules/pass-standard-props.d.ts +19 -0
  132. package/dist/lib/runtime-rules/pass-standard-props.d.ts.map +1 -0
  133. package/dist/lib/runtime-rules/pass-standard-props.js +82 -0
  134. package/dist/lib/runtime-rules/pass-standard-props.js.map +1 -0
  135. package/dist/lib/runtime-rules/prefer-async-await.d.ts +17 -0
  136. package/dist/lib/runtime-rules/prefer-async-await.d.ts.map +1 -0
  137. package/dist/lib/runtime-rules/prefer-async-await.js +52 -0
  138. package/dist/lib/runtime-rules/prefer-async-await.js.map +1 -0
  139. package/dist/lib/runtime-rules/prefer-jsx-syntax.d.ts +17 -0
  140. package/dist/lib/runtime-rules/prefer-jsx-syntax.d.ts.map +1 -0
  141. package/dist/lib/runtime-rules/prefer-jsx-syntax.js +51 -0
  142. package/dist/lib/runtime-rules/prefer-jsx-syntax.js.map +1 -0
  143. package/dist/lib/runtime-rules/prop-state-sync.d.ts +19 -0
  144. package/dist/lib/runtime-rules/prop-state-sync.d.ts.map +1 -0
  145. package/dist/lib/runtime-rules/prop-state-sync.js +76 -0
  146. package/dist/lib/runtime-rules/prop-state-sync.js.map +1 -0
  147. package/dist/lib/runtime-rules/property-name-consistency.d.ts +20 -0
  148. package/dist/lib/runtime-rules/property-name-consistency.d.ts.map +1 -0
  149. package/dist/lib/runtime-rules/property-name-consistency.js +172 -0
  150. package/dist/lib/runtime-rules/property-name-consistency.js.map +1 -0
  151. package/dist/lib/runtime-rules/query-result-field-access-validation.d.ts +10 -0
  152. package/dist/lib/runtime-rules/query-result-field-access-validation.d.ts.map +1 -0
  153. package/dist/lib/runtime-rules/query-result-field-access-validation.js +304 -0
  154. package/dist/lib/runtime-rules/query-result-field-access-validation.js.map +1 -0
  155. package/dist/lib/runtime-rules/react-component-naming.d.ts +19 -0
  156. package/dist/lib/runtime-rules/react-component-naming.d.ts.map +1 -0
  157. package/dist/lib/runtime-rules/react-component-naming.js +72 -0
  158. package/dist/lib/runtime-rules/react-component-naming.js.map +1 -0
  159. package/dist/lib/runtime-rules/react-hooks-rules.d.ts +27 -0
  160. package/dist/lib/runtime-rules/react-hooks-rules.d.ts.map +1 -0
  161. package/dist/lib/runtime-rules/react-hooks-rules.js +223 -0
  162. package/dist/lib/runtime-rules/react-hooks-rules.js.map +1 -0
  163. package/dist/lib/runtime-rules/required-queries-not-called.d.ts +19 -0
  164. package/dist/lib/runtime-rules/required-queries-not-called.d.ts.map +1 -0
  165. package/dist/lib/runtime-rules/required-queries-not-called.js +146 -0
  166. package/dist/lib/runtime-rules/required-queries-not-called.js.map +1 -0
  167. package/dist/lib/runtime-rules/runquery-call-validation.d.ts +11 -0
  168. package/dist/lib/runtime-rules/runquery-call-validation.d.ts.map +1 -0
  169. package/dist/lib/runtime-rules/runquery-call-validation.js +886 -0
  170. package/dist/lib/runtime-rules/runquery-call-validation.js.map +1 -0
  171. package/dist/lib/runtime-rules/runview-call-validation.d.ts +10 -0
  172. package/dist/lib/runtime-rules/runview-call-validation.d.ts.map +1 -0
  173. package/dist/lib/runtime-rules/runview-call-validation.js +336 -0
  174. package/dist/lib/runtime-rules/runview-call-validation.js.map +1 -0
  175. package/dist/lib/runtime-rules/saved-user-settings-pattern.d.ts +19 -0
  176. package/dist/lib/runtime-rules/saved-user-settings-pattern.d.ts.map +1 -0
  177. package/dist/lib/runtime-rules/saved-user-settings-pattern.js +90 -0
  178. package/dist/lib/runtime-rules/saved-user-settings-pattern.js.map +1 -0
  179. package/dist/lib/runtime-rules/search-availability-check.d.ts +9 -0
  180. package/dist/lib/runtime-rules/search-availability-check.d.ts.map +1 -0
  181. package/dist/lib/runtime-rules/search-availability-check.js +220 -0
  182. package/dist/lib/runtime-rules/search-availability-check.js.map +1 -0
  183. package/dist/lib/runtime-rules/search-call-validation.d.ts +9 -0
  184. package/dist/lib/runtime-rules/search-call-validation.d.ts.map +1 -0
  185. package/dist/lib/runtime-rules/search-call-validation.js +336 -0
  186. package/dist/lib/runtime-rules/search-call-validation.js.map +1 -0
  187. package/dist/lib/runtime-rules/server-reload-on-client-operation.d.ts +18 -0
  188. package/dist/lib/runtime-rules/server-reload-on-client-operation.d.ts.map +1 -0
  189. package/dist/lib/runtime-rules/server-reload-on-client-operation.js +107 -0
  190. package/dist/lib/runtime-rules/server-reload-on-client-operation.js.map +1 -0
  191. package/dist/lib/runtime-rules/single-function-only.d.ts +18 -0
  192. package/dist/lib/runtime-rules/single-function-only.d.ts.map +1 -0
  193. package/dist/lib/runtime-rules/single-function-only.js +103 -0
  194. package/dist/lib/runtime-rules/single-function-only.js.map +1 -0
  195. package/dist/lib/runtime-rules/string-replace-all-occurrences.d.ts +19 -0
  196. package/dist/lib/runtime-rules/string-replace-all-occurrences.d.ts.map +1 -0
  197. package/dist/lib/runtime-rules/string-replace-all-occurrences.js +109 -0
  198. package/dist/lib/runtime-rules/string-replace-all-occurrences.js.map +1 -0
  199. package/dist/lib/runtime-rules/string-template-validation.d.ts +22 -0
  200. package/dist/lib/runtime-rules/string-template-validation.d.ts.map +1 -0
  201. package/dist/lib/runtime-rules/string-template-validation.js +163 -0
  202. package/dist/lib/runtime-rules/string-template-validation.js.map +1 -0
  203. package/dist/lib/runtime-rules/styles-validation.d.ts +10 -0
  204. package/dist/lib/runtime-rules/styles-validation.d.ts.map +1 -0
  205. package/dist/lib/runtime-rules/styles-validation.js +153 -0
  206. package/dist/lib/runtime-rules/styles-validation.js.map +1 -0
  207. package/dist/lib/runtime-rules/type-inference-errors.d.ts +23 -0
  208. package/dist/lib/runtime-rules/type-inference-errors.d.ts.map +1 -0
  209. package/dist/lib/runtime-rules/type-inference-errors.js +53 -0
  210. package/dist/lib/runtime-rules/type-inference-errors.js.map +1 -0
  211. package/dist/lib/runtime-rules/type-mismatch-operation.d.ts +23 -0
  212. package/dist/lib/runtime-rules/type-mismatch-operation.d.ts.map +1 -0
  213. package/dist/lib/runtime-rules/type-mismatch-operation.js +141 -0
  214. package/dist/lib/runtime-rules/type-mismatch-operation.js.map +1 -0
  215. package/dist/lib/runtime-rules/undefined-component-usage.d.ts +20 -0
  216. package/dist/lib/runtime-rules/undefined-component-usage.d.ts.map +1 -0
  217. package/dist/lib/runtime-rules/undefined-component-usage.js +138 -0
  218. package/dist/lib/runtime-rules/undefined-component-usage.js.map +1 -0
  219. package/dist/lib/runtime-rules/undefined-jsx-component.d.ts +25 -0
  220. package/dist/lib/runtime-rules/undefined-jsx-component.d.ts.map +1 -0
  221. package/dist/lib/runtime-rules/undefined-jsx-component.js +269 -0
  222. package/dist/lib/runtime-rules/undefined-jsx-component.js.map +1 -0
  223. package/dist/lib/runtime-rules/unsafe-array-operations.d.ts +25 -0
  224. package/dist/lib/runtime-rules/unsafe-array-operations.d.ts.map +1 -0
  225. package/dist/lib/runtime-rules/unsafe-array-operations.js +347 -0
  226. package/dist/lib/runtime-rules/unsafe-array-operations.js.map +1 -0
  227. package/dist/lib/runtime-rules/unsafe-formatting-methods.d.ts +24 -0
  228. package/dist/lib/runtime-rules/unsafe-formatting-methods.d.ts.map +1 -0
  229. package/dist/lib/runtime-rules/unsafe-formatting-methods.js +277 -0
  230. package/dist/lib/runtime-rules/unsafe-formatting-methods.js.map +1 -0
  231. package/dist/lib/runtime-rules/unused-component-dependencies.d.ts +19 -0
  232. package/dist/lib/runtime-rules/unused-component-dependencies.d.ts.map +1 -0
  233. package/dist/lib/runtime-rules/unused-component-dependencies.js +90 -0
  234. package/dist/lib/runtime-rules/unused-component-dependencies.js.map +1 -0
  235. package/dist/lib/runtime-rules/unused-libraries.d.ts +19 -0
  236. package/dist/lib/runtime-rules/unused-libraries.d.ts.map +1 -0
  237. package/dist/lib/runtime-rules/unused-libraries.js +127 -0
  238. package/dist/lib/runtime-rules/unused-libraries.js.map +1 -0
  239. package/dist/lib/runtime-rules/use-function-declaration.d.ts +18 -0
  240. package/dist/lib/runtime-rules/use-function-declaration.d.ts.map +1 -0
  241. package/dist/lib/runtime-rules/use-function-declaration.js +127 -0
  242. package/dist/lib/runtime-rules/use-function-declaration.js.map +1 -0
  243. package/dist/lib/runtime-rules/use-unwrap-components.d.ts +19 -0
  244. package/dist/lib/runtime-rules/use-unwrap-components.d.ts.map +1 -0
  245. package/dist/lib/runtime-rules/use-unwrap-components.js +84 -0
  246. package/dist/lib/runtime-rules/use-unwrap-components.js.map +1 -0
  247. package/dist/lib/runtime-rules/useeffect-unstable-dependencies.d.ts +23 -0
  248. package/dist/lib/runtime-rules/useeffect-unstable-dependencies.d.ts.map +1 -0
  249. package/dist/lib/runtime-rules/useeffect-unstable-dependencies.js +215 -0
  250. package/dist/lib/runtime-rules/useeffect-unstable-dependencies.js.map +1 -0
  251. package/dist/lib/runtime-rules/utilities-api-validation.d.ts +24 -0
  252. package/dist/lib/runtime-rules/utilities-api-validation.d.ts.map +1 -0
  253. package/dist/lib/runtime-rules/utilities-api-validation.js +121 -0
  254. package/dist/lib/runtime-rules/utilities-api-validation.js.map +1 -0
  255. package/dist/lib/runtime-rules/utilities-no-direct-instantiation.d.ts +20 -0
  256. package/dist/lib/runtime-rules/utilities-no-direct-instantiation.d.ts.map +1 -0
  257. package/dist/lib/runtime-rules/utilities-no-direct-instantiation.js +58 -0
  258. package/dist/lib/runtime-rules/utilities-no-direct-instantiation.js.map +1 -0
  259. package/dist/lib/runtime-rules/validate-component-references.d.ts +19 -0
  260. package/dist/lib/runtime-rules/validate-component-references.d.ts.map +1 -0
  261. package/dist/lib/runtime-rules/validate-component-references.js +255 -0
  262. package/dist/lib/runtime-rules/validate-component-references.js.map +1 -0
  263. package/dist/lib/schema-validation/component-prop-rule.d.ts +125 -0
  264. package/dist/lib/schema-validation/component-prop-rule.d.ts.map +1 -0
  265. package/dist/lib/schema-validation/component-prop-rule.js +630 -0
  266. package/dist/lib/schema-validation/component-prop-rule.js.map +1 -0
  267. package/dist/lib/schema-validation/index.d.ts +26 -0
  268. package/dist/lib/schema-validation/index.d.ts.map +1 -0
  269. package/dist/lib/schema-validation/index.js +26 -0
  270. package/dist/lib/schema-validation/index.js.map +1 -0
  271. package/dist/lib/schema-validation/semantic-validators/index.d.ts +23 -0
  272. package/dist/lib/schema-validation/semantic-validators/index.d.ts.map +1 -0
  273. package/dist/lib/schema-validation/semantic-validators/index.js +23 -0
  274. package/dist/lib/schema-validation/semantic-validators/index.js.map +1 -0
  275. package/dist/lib/{constraint-validators → schema-validation/semantic-validators}/required-when-validator.d.ts +2 -2
  276. package/dist/lib/schema-validation/semantic-validators/required-when-validator.d.ts.map +1 -0
  277. package/dist/lib/{constraint-validators → schema-validation/semantic-validators}/required-when-validator.js +3 -3
  278. package/dist/lib/schema-validation/semantic-validators/required-when-validator.js.map +1 -0
  279. package/dist/lib/schema-validation/semantic-validators/semantic-validator-registry.d.ts +122 -0
  280. package/dist/lib/schema-validation/semantic-validators/semantic-validator-registry.d.ts.map +1 -0
  281. package/dist/lib/schema-validation/semantic-validators/semantic-validator-registry.js +166 -0
  282. package/dist/lib/schema-validation/semantic-validators/semantic-validator-registry.js.map +1 -0
  283. package/dist/lib/{constraint-validators/base-constraint-validator.d.ts → schema-validation/semantic-validators/semantic-validator.d.ts} +12 -11
  284. package/dist/lib/schema-validation/semantic-validators/semantic-validator.d.ts.map +1 -0
  285. package/dist/lib/{constraint-validators/base-constraint-validator.js → schema-validation/semantic-validators/semantic-validator.js} +11 -10
  286. package/dist/lib/schema-validation/semantic-validators/semantic-validator.js.map +1 -0
  287. package/dist/lib/{constraint-validators → schema-validation/semantic-validators}/sql-where-clause-validator.d.ts +2 -2
  288. package/dist/lib/schema-validation/semantic-validators/sql-where-clause-validator.d.ts.map +1 -0
  289. package/dist/lib/{constraint-validators → schema-validation/semantic-validators}/sql-where-clause-validator.js +8 -4
  290. package/dist/lib/schema-validation/semantic-validators/sql-where-clause-validator.js.map +1 -0
  291. package/dist/lib/{constraint-validators → schema-validation/semantic-validators}/subset-of-entity-fields-validator.d.ts +2 -2
  292. package/dist/lib/schema-validation/semantic-validators/subset-of-entity-fields-validator.d.ts.map +1 -0
  293. package/dist/lib/{constraint-validators → schema-validation/semantic-validators}/subset-of-entity-fields-validator.js +3 -3
  294. package/dist/lib/schema-validation/semantic-validators/subset-of-entity-fields-validator.js.map +1 -0
  295. package/dist/lib/{constraint-validators → schema-validation/semantic-validators}/validation-context.d.ts +14 -5
  296. package/dist/lib/schema-validation/semantic-validators/validation-context.d.ts.map +1 -0
  297. package/dist/lib/{constraint-validators → schema-validation/semantic-validators}/validation-context.js +1 -1
  298. package/dist/lib/schema-validation/semantic-validators/validation-context.js.map +1 -0
  299. package/dist/lib/type-context.d.ts.map +1 -1
  300. package/dist/lib/type-context.js +16 -1
  301. package/dist/lib/type-context.js.map +1 -1
  302. package/dist/lib/type-inference-engine.d.ts +13 -0
  303. package/dist/lib/type-inference-engine.d.ts.map +1 -1
  304. package/dist/lib/type-inference-engine.js +144 -22
  305. package/dist/lib/type-inference-engine.js.map +1 -1
  306. package/dist/lib/type-rules/type-compatibility-rule.d.ts +79 -0
  307. package/dist/lib/type-rules/type-compatibility-rule.d.ts.map +1 -0
  308. package/dist/lib/type-rules/type-compatibility-rule.js +211 -0
  309. package/dist/lib/type-rules/type-compatibility-rule.js.map +1 -0
  310. package/package.json +15 -11
  311. package/dist/lib/constraint-validators/base-constraint-validator.d.ts.map +0 -1
  312. package/dist/lib/constraint-validators/base-constraint-validator.js.map +0 -1
  313. package/dist/lib/constraint-validators/index.d.ts +0 -21
  314. package/dist/lib/constraint-validators/index.d.ts.map +0 -1
  315. package/dist/lib/constraint-validators/index.js +0 -21
  316. package/dist/lib/constraint-validators/index.js.map +0 -1
  317. package/dist/lib/constraint-validators/required-when-validator.d.ts.map +0 -1
  318. package/dist/lib/constraint-validators/required-when-validator.js.map +0 -1
  319. package/dist/lib/constraint-validators/sql-where-clause-validator.d.ts.map +0 -1
  320. package/dist/lib/constraint-validators/sql-where-clause-validator.js.map +0 -1
  321. package/dist/lib/constraint-validators/subset-of-entity-fields-validator.d.ts.map +0 -1
  322. package/dist/lib/constraint-validators/subset-of-entity-fields-validator.js.map +0 -1
  323. package/dist/lib/constraint-validators/validation-context.d.ts.map +0 -1
  324. package/dist/lib/constraint-validators/validation-context.js.map +0 -1
@@ -0,0 +1,106 @@
1
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
2
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
3
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
4
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
5
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
6
+ };
7
+ import * as t from '@babel/types';
8
+ import { RegisterClass } from '@memberjunction/global';
9
+ import { BaseLintRule } from '../lint-rule.js';
10
+ import { createViolation } from '../lint-utils.js';
11
+ /**
12
+ * Rule: no-return-component
13
+ *
14
+ * Ensures that components don't have return statements or component references
15
+ * at the end of the file. The component function should stand alone.
16
+ *
17
+ * Severity: critical
18
+ * Applies to: all components
19
+ */
20
+ let NoReturnComponentRule = class NoReturnComponentRule extends BaseLintRule {
21
+ get Name() { return 'no-return-component'; }
22
+ get AppliesTo() { return 'all'; }
23
+ Test(ast, componentName) {
24
+ const violations = [];
25
+ // Check for return statements at the program/top level
26
+ if (ast.program && ast.program.body) {
27
+ for (const statement of ast.program.body) {
28
+ // Check for return statement returning the component
29
+ if (t.isReturnStatement(statement)) {
30
+ const argument = statement.argument;
31
+ // Check if it's returning the component identifier or any identifier
32
+ if (argument && t.isIdentifier(argument)) {
33
+ // If it's returning the component name or any identifier at top level
34
+ violations.push(createViolation('no-return-component', 'critical', statement, `Do not return the component at the end of the file. The component function should stand alone.`, `return ${argument.name};`, {
35
+ text: 'Remove the return statement at the end of the file. The component function should stand alone.',
36
+ example: `// ❌ WRONG - Returning the component:
37
+ function MyComponent({ utilities, styles, components }) {
38
+ const [state, setState] = useState('');
39
+
40
+ return <div>{state}</div>;
41
+ }
42
+
43
+ return MyComponent; // <-- Remove this!
44
+
45
+ // ❌ ALSO WRONG - Component reference at end:
46
+ function MyComponent({ utilities, styles, components }) {
47
+ return <div>Hello</div>;
48
+ }
49
+
50
+ MyComponent; // <-- Remove this!
51
+
52
+ // ✅ CORRECT - Just the function declaration:
53
+ function MyComponent({ utilities, styles, components }) {
54
+ const [state, setState] = useState('');
55
+
56
+ return <div>{state}</div>;
57
+ }
58
+ // Nothing after the function - file ends here
59
+
60
+ // The runtime will find and execute your component
61
+ // by its function name. No need to return or reference it!`,
62
+ }));
63
+ }
64
+ }
65
+ // Also check for expression statements that might be standalone identifiers
66
+ if (t.isExpressionStatement(statement) && t.isIdentifier(statement.expression) && statement.expression.name === componentName) {
67
+ violations.push(createViolation('no-return-component', 'critical', statement, `Do not reference the component "${componentName}" at the end of the file. The component function should stand alone.`, statement.expression.name, {
68
+ text: 'Remove the return statement at the end of the file. The component function should stand alone.',
69
+ example: `// ❌ WRONG - Returning the component:
70
+ function MyComponent({ utilities, styles, components }) {
71
+ const [state, setState] = useState('');
72
+
73
+ return <div>{state}</div>;
74
+ }
75
+
76
+ return MyComponent; // <-- Remove this!
77
+
78
+ // ❌ ALSO WRONG - Component reference at end:
79
+ function MyComponent({ utilities, styles, components }) {
80
+ return <div>Hello</div>;
81
+ }
82
+
83
+ MyComponent; // <-- Remove this!
84
+
85
+ // ✅ CORRECT - Just the function declaration:
86
+ function MyComponent({ utilities, styles, components }) {
87
+ const [state, setState] = useState('');
88
+
89
+ return <div>{state}</div>;
90
+ }
91
+ // Nothing after the function - file ends here
92
+
93
+ // The runtime will find and execute your component
94
+ // by its function name. No need to return or reference it!`,
95
+ }));
96
+ }
97
+ }
98
+ }
99
+ return violations;
100
+ }
101
+ };
102
+ NoReturnComponentRule = __decorate([
103
+ RegisterClass(BaseLintRule, 'no-return-component')
104
+ ], NoReturnComponentRule);
105
+ export { NoReturnComponentRule };
106
+ //# sourceMappingURL=no-return-component.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"no-return-component.js","sourceRoot":"","sources":["../../../src/lib/runtime-rules/no-return-component.ts"],"names":[],"mappings":";;;;;;AAAA,OAAO,KAAK,CAAC,MAAM,cAAc,CAAC;AAClC,OAAO,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAC;AACvD,OAAO,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AAE5C,OAAO,EAAE,eAAe,EAAE,MAAM,eAAe,CAAC;AAEhD;;;;;;;;GAQG;AAEI,IAAM,qBAAqB,GAA3B,MAAM,qBAAsB,SAAQ,YAAY;IACrD,IAAI,IAAI,KAAK,OAAO,qBAAqB,CAAC,CAAC,CAAC;IAC5C,IAAI,SAAS,KAA+B,OAAO,KAAK,CAAC,CAAC,CAAC;IAE3D,IAAI,CAAC,GAAW,EAAE,aAAqB;QACrC,MAAM,UAAU,GAAgB,EAAE,CAAC;QAEnC,uDAAuD;QACvD,IAAI,GAAG,CAAC,OAAO,IAAI,GAAG,CAAC,OAAO,CAAC,IAAI,EAAE,CAAC;YACpC,KAAK,MAAM,SAAS,IAAI,GAAG,CAAC,OAAO,CAAC,IAAI,EAAE,CAAC;gBACzC,qDAAqD;gBACrD,IAAI,CAAC,CAAC,iBAAiB,CAAC,SAAS,CAAC,EAAE,CAAC;oBACnC,MAAM,QAAQ,GAAG,SAAS,CAAC,QAAQ,CAAC;oBAEpC,qEAAqE;oBACrE,IAAI,QAAQ,IAAI,CAAC,CAAC,YAAY,CAAC,QAAQ,CAAC,EAAE,CAAC;wBACzC,sEAAsE;wBACtE,UAAU,CAAC,IAAI,CACb,eAAe,CACb,qBAAqB,EACrB,UAAU,EACV,SAAS,EACT,gGAAgG,EAChG,UAAU,QAAQ,CAAC,IAAI,GAAG,EAC1B;4BACE,IAAI,EAAE,gGAAgG;4BACtG,OAAO,EAAE;;;;;;;;;;;;;;;;;;;;;;;;;4DAyBiC;yBAC3C,CACF,CACF,CAAC;oBACJ,CAAC;gBACH,CAAC;gBAED,4EAA4E;gBAC5E,IAAI,CAAC,CAAC,qBAAqB,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC,YAAY,CAAC,SAAS,CAAC,UAAU,CAAC,IAAI,SAAS,CAAC,UAAU,CAAC,IAAI,KAAK,aAAa,EAAE,CAAC;oBAC9H,UAAU,CAAC,IAAI,CACb,eAAe,CACb,qBAAqB,EACrB,UAAU,EACV,SAAS,EACT,mCAAmC,aAAa,sEAAsE,EACtH,SAAS,CAAC,UAAU,CAAC,IAAI,EACzB;wBACE,IAAI,EAAE,gGAAgG;wBACtG,OAAO,EAAE;;;;;;;;;;;;;;;;;;;;;;;;;4DAyBmC;qBAC7C,CACF,CACF,CAAC;gBACJ,CAAC;YACH,CAAC;QACH,CAAC;QAED,OAAO,UAAU,CAAC;IACpB,CAAC;CACF,CAAA;AAxGY,qBAAqB;IADjC,aAAa,CAAC,YAAY,EAAE,qBAAqB,CAAC;GACtC,qBAAqB,CAwGjC"}
@@ -0,0 +1,19 @@
1
+ import * as t from '@babel/types';
2
+ import { BaseLintRule } from '../lint-rule.js';
3
+ import { Violation } from '../component-linter.js';
4
+ /**
5
+ * Rule: no-use-reducer
6
+ *
7
+ * Prevents usage of useReducer hook in interactive components.
8
+ * Components should manage state with useState and persist important
9
+ * settings with onSaveUserSettings instead.
10
+ *
11
+ * Severity: high (pattern violation, not a functional issue)
12
+ * Applies to: all components
13
+ */
14
+ export declare class NoUseReducerRule extends BaseLintRule {
15
+ get Name(): string;
16
+ get AppliesTo(): 'all' | 'child' | 'root';
17
+ Test(ast: t.File, componentName: string): Violation[];
18
+ }
19
+ //# sourceMappingURL=no-use-reducer.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"no-use-reducer.d.ts","sourceRoot":"","sources":["../../../src/lib/runtime-rules/no-use-reducer.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,CAAC,MAAM,cAAc,CAAC;AAElC,OAAO,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AAC5C,OAAO,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAC;AAEhD;;;;;;;;;GASG;AACH,qBACa,gBAAiB,SAAQ,YAAY;IAChD,IAAI,IAAI,WAA+B;IACvC,IAAI,SAAS,IAAI,KAAK,GAAG,OAAO,GAAG,MAAM,CAAkB;IAE3D,IAAI,CAAC,GAAG,EAAE,CAAC,CAAC,IAAI,EAAE,aAAa,EAAE,MAAM,GAAG,SAAS,EAAE;CAsDtD"}
@@ -0,0 +1,78 @@
1
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
2
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
3
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
4
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
5
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
6
+ };
7
+ import { traverse } from '../lint-utils.js';
8
+ import * as t from '@babel/types';
9
+ import { RegisterClass } from '@memberjunction/global';
10
+ import { BaseLintRule } from '../lint-rule.js';
11
+ /**
12
+ * Rule: no-use-reducer
13
+ *
14
+ * Prevents usage of useReducer hook in interactive components.
15
+ * Components should manage state with useState and persist important
16
+ * settings with onSaveUserSettings instead.
17
+ *
18
+ * Severity: high (pattern violation, not a functional issue)
19
+ * Applies to: all components
20
+ */
21
+ let NoUseReducerRule = class NoUseReducerRule extends BaseLintRule {
22
+ get Name() { return 'no-use-reducer'; }
23
+ get AppliesTo() { return 'all'; }
24
+ Test(ast, componentName) {
25
+ const violations = [];
26
+ traverse(ast, {
27
+ CallExpression(path) {
28
+ const callee = path.node.callee;
29
+ if ((t.isIdentifier(callee) && callee.name === 'useReducer') ||
30
+ (t.isMemberExpression(callee) &&
31
+ t.isIdentifier(callee.object) &&
32
+ callee.object.name === 'React' &&
33
+ t.isIdentifier(callee.property) &&
34
+ callee.property.name === 'useReducer')) {
35
+ violations.push({
36
+ rule: 'no-use-reducer',
37
+ severity: 'high', // High but not critical - it's a pattern violation
38
+ line: path.node.loc?.start.line || 0,
39
+ column: path.node.loc?.start.column || 0,
40
+ message: `Component "${componentName}" uses useReducer at line ${path.node.loc?.start.line}. Components should manage state with useState and persist important settings with onSaveUserSettings.`,
41
+ code: path.toString(),
42
+ suggestion: {
43
+ text: 'Use useState for state management, not useReducer',
44
+ example: `// Instead of:
45
+ const [state, dispatch] = useReducer(reducer, initialState);
46
+
47
+ // Use useState:
48
+ function Component({ savedUserSettings, onSaveUserSettings }) {
49
+ const [selectedId, setSelectedId] = useState(
50
+ savedUserSettings?.selectedId
51
+ );
52
+ const [filters, setFilters] = useState(
53
+ savedUserSettings?.filters || {}
54
+ );
55
+
56
+ // Handle actions directly
57
+ const handleAction = (action) => {
58
+ switch(action.type) {
59
+ case 'SELECT':
60
+ setSelectedId(action.payload);
61
+ onSaveUserSettings?.({ ...savedUserSettings, selectedId: action.payload });
62
+ break;
63
+ }
64
+ };
65
+ }`,
66
+ },
67
+ });
68
+ }
69
+ },
70
+ });
71
+ return violations;
72
+ }
73
+ };
74
+ NoUseReducerRule = __decorate([
75
+ RegisterClass(BaseLintRule, 'no-use-reducer')
76
+ ], NoUseReducerRule);
77
+ export { NoUseReducerRule };
78
+ //# sourceMappingURL=no-use-reducer.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"no-use-reducer.js","sourceRoot":"","sources":["../../../src/lib/runtime-rules/no-use-reducer.ts"],"names":[],"mappings":";;;;;;AAAA,OAAO,EAAE,QAAQ,EAAY,MAAM,eAAe,CAAC;AACnD,OAAO,KAAK,CAAC,MAAM,cAAc,CAAC;AAClC,OAAO,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAC;AACvD,OAAO,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AAG5C;;;;;;;;;GASG;AAEI,IAAM,gBAAgB,GAAtB,MAAM,gBAAiB,SAAQ,YAAY;IAChD,IAAI,IAAI,KAAK,OAAO,gBAAgB,CAAC,CAAC,CAAC;IACvC,IAAI,SAAS,KAA+B,OAAO,KAAK,CAAC,CAAC,CAAC;IAE3D,IAAI,CAAC,GAAW,EAAE,aAAqB;QACrC,MAAM,UAAU,GAAgB,EAAE,CAAC;QAEnC,QAAQ,CAAC,GAAG,EAAE;YACZ,cAAc,CAAC,IAAgC;gBAC7C,MAAM,MAAM,GAAG,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC;gBAEhC,IACE,CAAC,CAAC,CAAC,YAAY,CAAC,MAAM,CAAC,IAAI,MAAM,CAAC,IAAI,KAAK,YAAY,CAAC;oBACxD,CAAC,CAAC,CAAC,kBAAkB,CAAC,MAAM,CAAC;wBAC3B,CAAC,CAAC,YAAY,CAAC,MAAM,CAAC,MAAM,CAAC;wBAC7B,MAAM,CAAC,MAAM,CAAC,IAAI,KAAK,OAAO;wBAC9B,CAAC,CAAC,YAAY,CAAC,MAAM,CAAC,QAAQ,CAAC;wBAC/B,MAAM,CAAC,QAAQ,CAAC,IAAI,KAAK,YAAY,CAAC,EACxC,CAAC;oBACD,UAAU,CAAC,IAAI,CAAC;wBACd,IAAI,EAAE,gBAAgB;wBACtB,QAAQ,EAAE,MAAM,EAAE,mDAAmD;wBACrE,IAAI,EAAE,IAAI,CAAC,IAAI,CAAC,GAAG,EAAE,KAAK,CAAC,IAAI,IAAI,CAAC;wBACpC,MAAM,EAAE,IAAI,CAAC,IAAI,CAAC,GAAG,EAAE,KAAK,CAAC,MAAM,IAAI,CAAC;wBACxC,OAAO,EAAE,cAAc,aAAa,6BAA6B,IAAI,CAAC,IAAI,CAAC,GAAG,EAAE,KAAK,CAAC,IAAI,wGAAwG;wBAClM,IAAI,EAAE,IAAI,CAAC,QAAQ,EAAE;wBACrB,UAAU,EAAE;4BACV,IAAI,EAAE,mDAAmD;4BACzD,OAAO,EAAE;;;;;;;;;;;;;;;;;;;;;EAqBrB;yBACW;qBACF,CAAC,CAAC;gBACL,CAAC;YACH,CAAC;SACF,CAAC,CAAC;QAEH,OAAO,UAAU,CAAC;IACpB,CAAC;CACF,CAAA;AA1DY,gBAAgB;IAD5B,aAAa,CAAC,YAAY,EAAE,gBAAgB,CAAC;GACjC,gBAAgB,CA0D5B"}
@@ -0,0 +1,23 @@
1
+ import * as t from '@babel/types';
2
+ import { BaseLintRule } from '../lint-rule.js';
3
+ import { Violation } from '../component-linter.js';
4
+ import { ComponentSpec } from '@memberjunction/interactive-component-types';
5
+ /**
6
+ * Rule: no-window-access
7
+ *
8
+ * Prevents components from accessing the window object. Libraries should be accessed
9
+ * through unwrapComponents, not through window. Interactive components must be
10
+ * self-contained and not rely on global state.
11
+ *
12
+ * Allows export handler patterns (window.ComponentNameExport) for intentional
13
+ * component export functionality with proper cleanup.
14
+ *
15
+ * Severity: critical
16
+ * Applies to: all components
17
+ */
18
+ export declare class NoWindowAccessRule extends BaseLintRule {
19
+ get Name(): string;
20
+ get AppliesTo(): 'all' | 'child' | 'root';
21
+ Test(ast: t.File, componentName: string, componentSpec?: ComponentSpec): Violation[];
22
+ }
23
+ //# sourceMappingURL=no-window-access.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"no-window-access.d.ts","sourceRoot":"","sources":["../../../src/lib/runtime-rules/no-window-access.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,CAAC,MAAM,cAAc,CAAC;AAElC,OAAO,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AAC5C,OAAO,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAC;AAChD,OAAO,EAAE,aAAa,EAAE,MAAM,6CAA6C,CAAC;AAE5E;;;;;;;;;;;;GAYG;AACH,qBACa,kBAAmB,SAAQ,YAAY;IAClD,IAAI,IAAI,WAAiC;IACzC,IAAI,SAAS,IAAI,KAAK,GAAG,OAAO,GAAG,MAAM,CAAkB;IAE3D,IAAI,CAAC,GAAG,EAAE,CAAC,CAAC,IAAI,EAAE,aAAa,EAAE,MAAM,EAAE,aAAa,CAAC,EAAE,aAAa,GAAG,SAAS,EAAE;CA8GrF"}
@@ -0,0 +1,136 @@
1
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
2
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
3
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
4
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
5
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
6
+ };
7
+ import { traverse } from '../lint-utils.js';
8
+ import * as t from '@babel/types';
9
+ import { RegisterClass } from '@memberjunction/global';
10
+ import { BaseLintRule } from '../lint-rule.js';
11
+ /**
12
+ * Rule: no-window-access
13
+ *
14
+ * Prevents components from accessing the window object. Libraries should be accessed
15
+ * through unwrapComponents, not through window. Interactive components must be
16
+ * self-contained and not rely on global state.
17
+ *
18
+ * Allows export handler patterns (window.ComponentNameExport) for intentional
19
+ * component export functionality with proper cleanup.
20
+ *
21
+ * Severity: critical
22
+ * Applies to: all components
23
+ */
24
+ let NoWindowAccessRule = class NoWindowAccessRule extends BaseLintRule {
25
+ get Name() { return 'no-window-access'; }
26
+ get AppliesTo() { return 'all'; }
27
+ Test(ast, componentName, componentSpec) {
28
+ const violations = [];
29
+ // Build a map of library names to their global variables from the component spec
30
+ const libraryMap = new Map();
31
+ if (componentSpec?.libraries) {
32
+ for (const lib of componentSpec.libraries) {
33
+ // Skip empty library objects or those without required fields
34
+ if (lib.globalVariable && lib.name) {
35
+ // Store both the library name and globalVariable for lookup
36
+ libraryMap.set(lib.name.toLowerCase(), lib.globalVariable);
37
+ libraryMap.set(lib.globalVariable.toLowerCase(), lib.globalVariable);
38
+ }
39
+ }
40
+ }
41
+ traverse(ast, {
42
+ MemberExpression(path) {
43
+ // Check if accessing window object
44
+ if (t.isIdentifier(path.node.object) && path.node.object.name === 'window') {
45
+ // Check what property is being accessed from window
46
+ let propertyName = '';
47
+ let isDestructuring = false;
48
+ if (t.isIdentifier(path.node.property)) {
49
+ propertyName = path.node.property.name;
50
+ }
51
+ else if (t.isMemberExpression(path.node.property)) {
52
+ // Handle chained access like window.Recharts.ResponsiveContainer
53
+ const firstProp = path.node.property;
54
+ if (t.isIdentifier(firstProp.object)) {
55
+ propertyName = firstProp.object.name;
56
+ }
57
+ }
58
+ // Check if this is part of a destructuring assignment
59
+ let currentPath = path.parentPath;
60
+ while (currentPath) {
61
+ if (t.isVariableDeclarator(currentPath.node) && t.isObjectPattern(currentPath.node.id)) {
62
+ isDestructuring = true;
63
+ break;
64
+ }
65
+ currentPath = currentPath.parentPath;
66
+ }
67
+ // Check if the property matches a known library
68
+ const matchedLibrary = libraryMap.get(propertyName.toLowerCase());
69
+ // Allow export handler patterns: window.ComponentNameExport
70
+ // These are intentional patterns for export functionality with proper cleanup
71
+ const isExportPattern = propertyName.endsWith('Export') || propertyName.endsWith('Handler') || propertyName.endsWith('Callback');
72
+ if (isExportPattern) {
73
+ // Skip - this is an intentional pattern for component export functionality
74
+ return;
75
+ }
76
+ if (matchedLibrary) {
77
+ // Specific guidance for library access
78
+ violations.push({
79
+ rule: 'no-window-access',
80
+ severity: 'critical',
81
+ line: path.node.loc?.start.line || 0,
82
+ column: path.node.loc?.start.column || 0,
83
+ message: `Component "${componentName}" should not access window.${propertyName}. Use "${matchedLibrary}" directly - it's already available in the component's closure scope. Change "window.${propertyName}" to just "${matchedLibrary}".`,
84
+ code: path.toString().substring(0, 100),
85
+ });
86
+ }
87
+ else if (isDestructuring) {
88
+ // Likely trying to destructure from an unknown library
89
+ violations.push({
90
+ rule: 'no-window-access',
91
+ severity: 'critical',
92
+ line: path.node.loc?.start.line || 0,
93
+ column: path.node.loc?.start.column || 0,
94
+ message: `Component "${componentName}" is trying to access window.${propertyName}. Libraries must be accessed using unwrapComponents, not through the window object. If this library is in your spec, use: const { ... } = unwrapComponents(${propertyName}, [...]); If it's not in your spec, you cannot use it.`,
95
+ code: path.toString().substring(0, 100),
96
+ });
97
+ }
98
+ else {
99
+ // General window access
100
+ violations.push({
101
+ rule: 'no-window-access',
102
+ severity: 'critical',
103
+ line: path.node.loc?.start.line || 0,
104
+ column: path.node.loc?.start.column || 0,
105
+ message: `Component "${componentName}" must not access the window object. Interactive components should be self-contained and not rely on global state.`,
106
+ code: path.toString().substring(0, 100),
107
+ });
108
+ }
109
+ }
110
+ },
111
+ Identifier(path) {
112
+ // Also check for direct window references (less common but possible)
113
+ if (path.node.name === 'window' && path.isReferencedIdentifier()) {
114
+ // Make sure it's not part of a member expression we already caught
115
+ const parent = path.parent;
116
+ if (!t.isMemberExpression(parent) || parent.object !== path.node) {
117
+ violations.push({
118
+ rule: 'no-window-access',
119
+ severity: 'critical',
120
+ line: path.node.loc?.start.line || 0,
121
+ column: path.node.loc?.start.column || 0,
122
+ message: `Component "${componentName}" must not reference the window object directly. Interactive components should be self-contained.`,
123
+ code: path.toString().substring(0, 100),
124
+ });
125
+ }
126
+ }
127
+ },
128
+ });
129
+ return violations;
130
+ }
131
+ };
132
+ NoWindowAccessRule = __decorate([
133
+ RegisterClass(BaseLintRule, 'no-window-access')
134
+ ], NoWindowAccessRule);
135
+ export { NoWindowAccessRule };
136
+ //# sourceMappingURL=no-window-access.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"no-window-access.js","sourceRoot":"","sources":["../../../src/lib/runtime-rules/no-window-access.ts"],"names":[],"mappings":";;;;;;AAAA,OAAO,EAAE,QAAQ,EAAY,MAAM,eAAe,CAAC;AACnD,OAAO,KAAK,CAAC,MAAM,cAAc,CAAC;AAClC,OAAO,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAC;AACvD,OAAO,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AAI5C;;;;;;;;;;;;GAYG;AAEI,IAAM,kBAAkB,GAAxB,MAAM,kBAAmB,SAAQ,YAAY;IAClD,IAAI,IAAI,KAAK,OAAO,kBAAkB,CAAC,CAAC,CAAC;IACzC,IAAI,SAAS,KAA+B,OAAO,KAAK,CAAC,CAAC,CAAC;IAE3D,IAAI,CAAC,GAAW,EAAE,aAAqB,EAAE,aAA6B;QACpE,MAAM,UAAU,GAAgB,EAAE,CAAC;QAEnC,iFAAiF;QACjF,MAAM,UAAU,GAAG,IAAI,GAAG,EAAkB,CAAC;QAC7C,IAAI,aAAa,EAAE,SAAS,EAAE,CAAC;YAC7B,KAAK,MAAM,GAAG,IAAI,aAAa,CAAC,SAAS,EAAE,CAAC;gBAC1C,8DAA8D;gBAC9D,IAAI,GAAG,CAAC,cAAc,IAAI,GAAG,CAAC,IAAI,EAAE,CAAC;oBACnC,4DAA4D;oBAC5D,UAAU,CAAC,GAAG,CAAC,GAAG,CAAC,IAAI,CAAC,WAAW,EAAE,EAAE,GAAG,CAAC,cAAc,CAAC,CAAC;oBAC3D,UAAU,CAAC,GAAG,CAAC,GAAG,CAAC,cAAc,CAAC,WAAW,EAAE,EAAE,GAAG,CAAC,cAAc,CAAC,CAAC;gBACvE,CAAC;YACH,CAAC;QACH,CAAC;QAED,QAAQ,CAAC,GAAG,EAAE;YACZ,gBAAgB,CAAC,IAAkC;gBACjD,mCAAmC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AO,UAAU,CAAC;IACpB,CAAC;CACF,CAAA;AAlHY,kBAAkB;IAD9B,aAAa,CAAC,YAAY,EAAE,kBAAkB,CAAC;GACnC,kBAAkB,CAkH9B"}
@@ -0,0 +1,18 @@
1
+ import * as t from '@babel/types';
2
+ import { BaseLintRule } from '../lint-rule.js';
3
+ import { Violation } from '../component-linter.js';
4
+ /**
5
+ * Rule: noisy-settings-updates
6
+ *
7
+ * Prevents saving settings on every change/keystroke. Settings should only be
8
+ * saved on blur, submit, or after debouncing to avoid excessive updates.
9
+ *
10
+ * Severity: critical
11
+ * Applies to: all components
12
+ */
13
+ export declare class NoisySettingsUpdatesRule extends BaseLintRule {
14
+ get Name(): string;
15
+ get AppliesTo(): 'all' | 'child' | 'root';
16
+ Test(ast: t.File, _componentName: string): Violation[];
17
+ }
18
+ //# sourceMappingURL=noisy-settings-updates.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"noisy-settings-updates.d.ts","sourceRoot":"","sources":["../../../src/lib/runtime-rules/noisy-settings-updates.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,CAAC,MAAM,cAAc,CAAC;AAElC,OAAO,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AAC5C,OAAO,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAC;AAgChD;;;;;;;;GAQG;AACH,qBACa,wBAAyB,SAAQ,YAAY;IACxD,IAAI,IAAI,WAAuC;IAC/C,IAAI,SAAS,IAAI,KAAK,GAAG,OAAO,GAAG,MAAM,CAAkB;IAE3D,IAAI,CAAC,GAAG,EAAE,CAAC,CAAC,IAAI,EAAE,cAAc,EAAE,MAAM,GAAG,SAAS,EAAE;CA4DvD"}
@@ -0,0 +1,110 @@
1
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
2
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
3
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
4
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
5
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
6
+ };
7
+ import { traverse } from '../lint-utils.js';
8
+ import * as t from '@babel/types';
9
+ import { RegisterClass } from '@memberjunction/global';
10
+ import { BaseLintRule } from '../lint-rule.js';
11
+ /**
12
+ * Helper function to extract function name from a NodePath
13
+ */
14
+ function getFunctionName(path) {
15
+ const node = path.node;
16
+ // Check for named function
17
+ if (t.isFunctionDeclaration(node) && node.id) {
18
+ return node.id.name;
19
+ }
20
+ // Check for arrow function assigned to variable
21
+ if (t.isArrowFunctionExpression(node) || t.isFunctionExpression(node)) {
22
+ const parent = path.parent;
23
+ if (t.isVariableDeclarator(parent) && t.isIdentifier(parent.id)) {
24
+ return parent.id.name;
25
+ }
26
+ }
27
+ // Check for function assigned as property
28
+ if (t.isArrowFunctionExpression(node) || t.isFunctionExpression(node)) {
29
+ const parent = path.parent;
30
+ if (t.isObjectProperty(parent) && t.isIdentifier(parent.key)) {
31
+ return parent.key.name;
32
+ }
33
+ }
34
+ return null;
35
+ }
36
+ /**
37
+ * Rule: noisy-settings-updates
38
+ *
39
+ * Prevents saving settings on every change/keystroke. Settings should only be
40
+ * saved on blur, submit, or after debouncing to avoid excessive updates.
41
+ *
42
+ * Severity: critical
43
+ * Applies to: all components
44
+ */
45
+ let NoisySettingsUpdatesRule = class NoisySettingsUpdatesRule extends BaseLintRule {
46
+ get Name() { return 'noisy-settings-updates'; }
47
+ get AppliesTo() { return 'all'; }
48
+ Test(ast, _componentName) {
49
+ const violations = [];
50
+ traverse(ast, {
51
+ CallExpression(path) {
52
+ // Check for onSaveUserSettings calls
53
+ if (t.isOptionalCallExpression(path.node) || t.isCallExpression(path.node)) {
54
+ const callee = path.node.callee;
55
+ if (t.isIdentifier(callee) && callee.name === 'onSaveUserSettings') {
56
+ // Check if this is inside an onChange/onInput handler
57
+ let parent = path.getFunctionParent();
58
+ if (parent) {
59
+ const funcName = getFunctionName(parent);
60
+ if (funcName && (funcName.includes('Change') || funcName.includes('Input'))) {
61
+ // Check if it's not debounced or on blur
62
+ const parentBody = parent.node.body;
63
+ const hasDebounce = parentBody && parentBody.toString().includes('debounce');
64
+ const hasTimeout = parentBody && parentBody.toString().includes('setTimeout');
65
+ if (!hasDebounce && !hasTimeout) {
66
+ violations.push({
67
+ rule: 'noisy-settings-updates',
68
+ severity: 'critical',
69
+ line: path.node.loc?.start.line || 0,
70
+ column: path.node.loc?.start.column || 0,
71
+ message: `Saving settings on every change/keystroke. Save on blur, submit, or after debouncing.`,
72
+ suggestion: {
73
+ text: 'Save settings sparingly - only on meaningful user actions',
74
+ example: `// ❌ WRONG - Saving on every keystroke:
75
+ const handleSearchChange = (e) => {
76
+ setSearchTerm(e.target.value);
77
+ onSaveUserSettings?.({ searchTerm: e.target.value }); // TOO NOISY!
78
+ };
79
+
80
+ // ✅ CORRECT - Save on blur or debounced:
81
+ const handleSearchBlur = () => {
82
+ if (searchTerm !== savedUserSettings?.searchTerm) {
83
+ onSaveUserSettings?.({ ...savedUserSettings, searchTerm });
84
+ }
85
+ };
86
+
87
+ // ✅ CORRECT - Debounced save:
88
+ const saveSearchTerm = useMemo(() =>
89
+ debounce((term) => {
90
+ onSaveUserSettings?.({ ...savedUserSettings, searchTerm: term });
91
+ }, 500),
92
+ [savedUserSettings]
93
+ );`,
94
+ },
95
+ });
96
+ }
97
+ }
98
+ }
99
+ }
100
+ }
101
+ },
102
+ });
103
+ return violations;
104
+ }
105
+ };
106
+ NoisySettingsUpdatesRule = __decorate([
107
+ RegisterClass(BaseLintRule, 'noisy-settings-updates')
108
+ ], NoisySettingsUpdatesRule);
109
+ export { NoisySettingsUpdatesRule };
110
+ //# sourceMappingURL=noisy-settings-updates.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"noisy-settings-updates.js","sourceRoot":"","sources":["../../../src/lib/runtime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,WAAW,IAAI,CAAC,UAAU,EAAE,CAAC;oCAChC,UAAU,CAAC,IAAI,CAAC;wCACd,IAAI,EAAE,wBAAwB;wCAC9B,QAAQ,EAAE,UAAU;wCACpB,IAAI,EAAE,IAAI,CAAC,IAAI,CAAC,GAAG,EAAE,KAAK,CAAC,IAAI,IAAI,CAAC;wCACpC,MAAM,EAAE,IAAI,CAAC,IAAI,CAAC,GAAG,EAAE,KAAK,CAAC,MAAM,IAAI,CAAC;wCACxC,OAAO,EAAE,uFAAuF;wCAChG,UAAU,EAAE;4CACV,IAAI,EAAE,2DAA2D;4CACjE,OAAO,EAAE;;;;;;;;;;;;;;;;;;;GAmB5B;yCACkB;qCACF,CAAC,CAAC;gCACL,CAAC;4BACH,CAAC;wBACH,CAAC;oBACH,CAAC;gBACH,CAAC;YACH,CAAC;SACF,CAAC,CAAC;QAEH,OAAO,UAAU,CAAC;IACpB,CAAC;CACF,CAAA;AAhEY,wBAAwB;IADpC,aAAa,CAAC,YAAY,EAAE,wBAAwB,CAAC;GACzC,wBAAwB,CAgEpC"}
@@ -0,0 +1,19 @@
1
+ import * as t from '@babel/types';
2
+ import { BaseLintRule } from '../lint-rule.js';
3
+ import { Violation } from '../component-linter.js';
4
+ import { ComponentSpec } from '@memberjunction/interactive-component-types';
5
+ /**
6
+ * Rule: pass-standard-props
7
+ *
8
+ * Ensures that all dependency components receive the standard props:
9
+ * styles, utilities, and components.
10
+ *
11
+ * Severity: critical
12
+ * Applies to: all components
13
+ */
14
+ export declare class PassStandardPropsRule extends BaseLintRule {
15
+ get Name(): string;
16
+ get AppliesTo(): 'all' | 'child' | 'root';
17
+ Test(ast: t.File, _componentName: string, componentSpec?: ComponentSpec): Violation[];
18
+ }
19
+ //# sourceMappingURL=pass-standard-props.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"pass-standard-props.d.ts","sourceRoot":"","sources":["../../../src/lib/runtime-rules/pass-standard-props.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,CAAC,MAAM,cAAc,CAAC;AAElC,OAAO,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AAC5C,OAAO,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAC;AAChD,OAAO,EAAE,aAAa,EAAE,MAAM,6CAA6C,CAAC;AAG5E;;;;;;;;GAQG;AACH,qBACa,qBAAsB,SAAQ,YAAY;IACrD,IAAI,IAAI,WAAoC;IAC5C,IAAI,SAAS,IAAI,KAAK,GAAG,OAAO,GAAG,MAAM,CAAkB;IAE3D,IAAI,CAAC,GAAG,EAAE,CAAC,CAAC,IAAI,EAAE,cAAc,EAAE,MAAM,EAAE,aAAa,CAAC,EAAE,aAAa,GAAG,SAAS,EAAE;CAwEtF"}
@@ -0,0 +1,82 @@
1
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
2
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
3
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
4
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
5
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
6
+ };
7
+ import { RegisterClass } from '@memberjunction/global';
8
+ import { BaseLintRule } from '../lint-rule.js';
9
+ import { traverse, createViolation, getJSXElementName, hasJSXAttribute } from '../lint-utils.js';
10
+ /**
11
+ * Rule: pass-standard-props
12
+ *
13
+ * Ensures that all dependency components receive the standard props:
14
+ * styles, utilities, and components.
15
+ *
16
+ * Severity: critical
17
+ * Applies to: all components
18
+ */
19
+ let PassStandardPropsRule = class PassStandardPropsRule extends BaseLintRule {
20
+ get Name() { return 'pass-standard-props'; }
21
+ get AppliesTo() { return 'all'; }
22
+ Test(ast, _componentName, componentSpec) {
23
+ const violations = [];
24
+ const requiredProps = ['styles', 'utilities', 'components'];
25
+ // ONLY check components that are explicitly in our dependencies
26
+ // Do NOT check library components, HTML elements, or anything else
27
+ const ourComponentNames = new Set();
28
+ // Only add components from the componentSpec.dependencies array
29
+ if (componentSpec?.dependencies && Array.isArray(componentSpec.dependencies)) {
30
+ for (const dep of componentSpec.dependencies) {
31
+ if (dep && dep.name) {
32
+ ourComponentNames.add(dep.name);
33
+ }
34
+ }
35
+ }
36
+ // If there are no dependencies, skip this rule entirely
37
+ if (ourComponentNames.size === 0) {
38
+ return violations;
39
+ }
40
+ traverse(ast, {
41
+ JSXElement(path) {
42
+ const openingElement = path.node.openingElement;
43
+ const elementName = getJSXElementName(openingElement);
44
+ // Only check if this is one of our dependency components
45
+ if (elementName && ourComponentNames.has(elementName)) {
46
+ // Check for required props
47
+ const missingProps = [];
48
+ for (const propName of requiredProps) {
49
+ if (!hasJSXAttribute(openingElement, propName)) {
50
+ missingProps.push(propName);
51
+ }
52
+ }
53
+ if (missingProps.length > 0) {
54
+ violations.push(createViolation('pass-standard-props', 'critical', openingElement, `Dependency component "${elementName}" is missing required props: ${missingProps.join(', ')}. Components from dependencies must receive styles, utilities, and components props.`, `<${elementName} ... />`, {
55
+ text: 'Always pass standard props to all components',
56
+ example: `// Always include these props when calling components:
57
+ <ChildComponent
58
+ items={items} // Data props
59
+
60
+ // Settings persistence
61
+ savedUserSettings={savedUserSettings?.childComponent}
62
+ onSaveUserSettings={handleChildSettings}
63
+
64
+ // Standard props
65
+ styles={styles}
66
+ utilities={utilities}
67
+ components={components}
68
+ callbacks={callbacks}
69
+ />`,
70
+ }));
71
+ }
72
+ }
73
+ },
74
+ });
75
+ return violations;
76
+ }
77
+ };
78
+ PassStandardPropsRule = __decorate([
79
+ RegisterClass(BaseLintRule, 'pass-standard-props')
80
+ ], PassStandardPropsRule);
81
+ export { PassStandardPropsRule };
82
+ //# sourceMappingURL=pass-standard-props.js.map