@memberjunction/react-linter 0.0.1 → 5.38.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 (330) hide show
  1. package/dist/component-linter.d.ts +77 -0
  2. package/dist/component-linter.d.ts.map +1 -0
  3. package/dist/component-linter.js +1206 -0
  4. package/dist/component-linter.js.map +1 -0
  5. package/dist/control-flow-analyzer.d.ts +184 -0
  6. package/dist/control-flow-analyzer.d.ts.map +1 -0
  7. package/dist/control-flow-analyzer.js +798 -0
  8. package/dist/control-flow-analyzer.js.map +1 -0
  9. package/dist/index.d.ts +6 -0
  10. package/dist/index.d.ts.map +1 -0
  11. package/dist/index.js +8 -0
  12. package/dist/index.js.map +1 -0
  13. package/dist/library-lint-cache.d.ts +50 -0
  14. package/dist/library-lint-cache.d.ts.map +1 -0
  15. package/dist/library-lint-cache.js +173 -0
  16. package/dist/library-lint-cache.js.map +1 -0
  17. package/dist/lint-rule.d.ts +70 -0
  18. package/dist/lint-rule.d.ts.map +1 -0
  19. package/dist/lint-rule.js +30 -0
  20. package/dist/lint-rule.js.map +1 -0
  21. package/dist/lint-utils.d.ts +131 -0
  22. package/dist/lint-utils.d.ts.map +1 -0
  23. package/dist/lint-utils.js +358 -0
  24. package/dist/lint-utils.js.map +1 -0
  25. package/dist/linter-options.d.ts +51 -0
  26. package/dist/linter-options.d.ts.map +1 -0
  27. package/dist/linter-options.js +2 -0
  28. package/dist/linter-options.js.map +1 -0
  29. package/dist/prop-value-extractor.d.ts +147 -0
  30. package/dist/prop-value-extractor.d.ts.map +1 -0
  31. package/dist/prop-value-extractor.js +472 -0
  32. package/dist/prop-value-extractor.js.map +1 -0
  33. package/dist/runtime-rules/ai-tools-availability-check.d.ts +9 -0
  34. package/dist/runtime-rules/ai-tools-availability-check.d.ts.map +1 -0
  35. package/dist/runtime-rules/ai-tools-availability-check.js +223 -0
  36. package/dist/runtime-rules/ai-tools-availability-check.js.map +1 -0
  37. package/dist/runtime-rules/callback-event-validation.d.ts +22 -0
  38. package/dist/runtime-rules/callback-event-validation.d.ts.map +1 -0
  39. package/dist/runtime-rules/callback-event-validation.js +561 -0
  40. package/dist/runtime-rules/callback-event-validation.js.map +1 -0
  41. package/dist/runtime-rules/chart-field-validation.d.ts +10 -0
  42. package/dist/runtime-rules/chart-field-validation.d.ts.map +1 -0
  43. package/dist/runtime-rules/chart-field-validation.js +270 -0
  44. package/dist/runtime-rules/chart-field-validation.js.map +1 -0
  45. package/dist/runtime-rules/child-component-prop-validation.d.ts +11 -0
  46. package/dist/runtime-rules/child-component-prop-validation.d.ts.map +1 -0
  47. package/dist/runtime-rules/child-component-prop-validation.js +443 -0
  48. package/dist/runtime-rules/child-component-prop-validation.js.map +1 -0
  49. package/dist/runtime-rules/component-name-mismatch.d.ts +19 -0
  50. package/dist/runtime-rules/component-name-mismatch.d.ts.map +1 -0
  51. package/dist/runtime-rules/component-name-mismatch.js +82 -0
  52. package/dist/runtime-rules/component-name-mismatch.js.map +1 -0
  53. package/dist/runtime-rules/component-not-in-dependencies.d.ts +20 -0
  54. package/dist/runtime-rules/component-not-in-dependencies.d.ts.map +1 -0
  55. package/dist/runtime-rules/component-not-in-dependencies.js +92 -0
  56. package/dist/runtime-rules/component-not-in-dependencies.js.map +1 -0
  57. package/dist/runtime-rules/component-props-validation.d.ts +25 -0
  58. package/dist/runtime-rules/component-props-validation.d.ts.map +1 -0
  59. package/dist/runtime-rules/component-props-validation.js +228 -0
  60. package/dist/runtime-rules/component-props-validation.js.map +1 -0
  61. package/dist/runtime-rules/component-usage-without-destructuring.d.ts +20 -0
  62. package/dist/runtime-rules/component-usage-without-destructuring.d.ts.map +1 -0
  63. package/dist/runtime-rules/component-usage-without-destructuring.js +124 -0
  64. package/dist/runtime-rules/component-usage-without-destructuring.js.map +1 -0
  65. package/dist/runtime-rules/data-result-validation.d.ts +9 -0
  66. package/dist/runtime-rules/data-result-validation.d.ts.map +1 -0
  67. package/dist/runtime-rules/data-result-validation.js +763 -0
  68. package/dist/runtime-rules/data-result-validation.js.map +1 -0
  69. package/dist/runtime-rules/datagrid-field-validation.d.ts +10 -0
  70. package/dist/runtime-rules/datagrid-field-validation.d.ts.map +1 -0
  71. package/dist/runtime-rules/datagrid-field-validation.js +249 -0
  72. package/dist/runtime-rules/datagrid-field-validation.js.map +1 -0
  73. package/dist/runtime-rules/dependency-shadowing.d.ts +20 -0
  74. package/dist/runtime-rules/dependency-shadowing.d.ts.map +1 -0
  75. package/dist/runtime-rules/dependency-shadowing.js +147 -0
  76. package/dist/runtime-rules/dependency-shadowing.js.map +1 -0
  77. package/dist/runtime-rules/entity-field-access-validation.d.ts +12 -0
  78. package/dist/runtime-rules/entity-field-access-validation.d.ts.map +1 -0
  79. package/dist/runtime-rules/entity-field-access-validation.js +304 -0
  80. package/dist/runtime-rules/entity-field-access-validation.js.map +1 -0
  81. package/dist/runtime-rules/event-parameter-validation.d.ts +22 -0
  82. package/dist/runtime-rules/event-parameter-validation.d.ts.map +1 -0
  83. package/dist/runtime-rules/event-parameter-validation.js +406 -0
  84. package/dist/runtime-rules/event-parameter-validation.js.map +1 -0
  85. package/dist/runtime-rules/index.d.ts +61 -0
  86. package/dist/runtime-rules/index.d.ts.map +1 -0
  87. package/dist/runtime-rules/index.js +62 -0
  88. package/dist/runtime-rules/index.js.map +1 -0
  89. package/dist/runtime-rules/library-variable-names.d.ts +24 -0
  90. package/dist/runtime-rules/library-variable-names.d.ts.map +1 -0
  91. package/dist/runtime-rules/library-variable-names.js +88 -0
  92. package/dist/runtime-rules/library-variable-names.js.map +1 -0
  93. package/dist/runtime-rules/no-child-implementation.d.ts +18 -0
  94. package/dist/runtime-rules/no-child-implementation.d.ts.map +1 -0
  95. package/dist/runtime-rules/no-child-implementation.js +57 -0
  96. package/dist/runtime-rules/no-child-implementation.js.map +1 -0
  97. package/dist/runtime-rules/no-data-prop.d.ts +22 -0
  98. package/dist/runtime-rules/no-data-prop.d.ts.map +1 -0
  99. package/dist/runtime-rules/no-data-prop.js +111 -0
  100. package/dist/runtime-rules/no-data-prop.js.map +1 -0
  101. package/dist/runtime-rules/no-export-statements.d.ts +18 -0
  102. package/dist/runtime-rules/no-export-statements.d.ts.map +1 -0
  103. package/dist/runtime-rules/no-export-statements.js +143 -0
  104. package/dist/runtime-rules/no-export-statements.js.map +1 -0
  105. package/dist/runtime-rules/no-iife-wrapper.d.ts +18 -0
  106. package/dist/runtime-rules/no-iife-wrapper.d.ts.map +1 -0
  107. package/dist/runtime-rules/no-iife-wrapper.js +217 -0
  108. package/dist/runtime-rules/no-iife-wrapper.js.map +1 -0
  109. package/dist/runtime-rules/no-import-statements.d.ts +18 -0
  110. package/dist/runtime-rules/no-import-statements.d.ts.map +1 -0
  111. package/dist/runtime-rules/no-import-statements.js +65 -0
  112. package/dist/runtime-rules/no-import-statements.js.map +1 -0
  113. package/dist/runtime-rules/no-react-destructuring.d.ts +18 -0
  114. package/dist/runtime-rules/no-react-destructuring.d.ts.map +1 -0
  115. package/dist/runtime-rules/no-react-destructuring.js +60 -0
  116. package/dist/runtime-rules/no-react-destructuring.js.map +1 -0
  117. package/dist/runtime-rules/no-require-statements.d.ts +18 -0
  118. package/dist/runtime-rules/no-require-statements.d.ts.map +1 -0
  119. package/dist/runtime-rules/no-require-statements.js +109 -0
  120. package/dist/runtime-rules/no-require-statements.js.map +1 -0
  121. package/dist/runtime-rules/no-return-component.d.ts +18 -0
  122. package/dist/runtime-rules/no-return-component.d.ts.map +1 -0
  123. package/dist/runtime-rules/no-return-component.js +106 -0
  124. package/dist/runtime-rules/no-return-component.js.map +1 -0
  125. package/dist/runtime-rules/no-unwrap-utility-libs.d.ts +20 -0
  126. package/dist/runtime-rules/no-unwrap-utility-libs.d.ts.map +1 -0
  127. package/dist/runtime-rules/no-unwrap-utility-libs.js +75 -0
  128. package/dist/runtime-rules/no-unwrap-utility-libs.js.map +1 -0
  129. package/dist/runtime-rules/no-use-reducer.d.ts +19 -0
  130. package/dist/runtime-rules/no-use-reducer.d.ts.map +1 -0
  131. package/dist/runtime-rules/no-use-reducer.js +78 -0
  132. package/dist/runtime-rules/no-use-reducer.js.map +1 -0
  133. package/dist/runtime-rules/no-window-access.d.ts +23 -0
  134. package/dist/runtime-rules/no-window-access.d.ts.map +1 -0
  135. package/dist/runtime-rules/no-window-access.js +136 -0
  136. package/dist/runtime-rules/no-window-access.js.map +1 -0
  137. package/dist/runtime-rules/noisy-settings-updates.d.ts +18 -0
  138. package/dist/runtime-rules/noisy-settings-updates.d.ts.map +1 -0
  139. package/dist/runtime-rules/noisy-settings-updates.js +110 -0
  140. package/dist/runtime-rules/noisy-settings-updates.js.map +1 -0
  141. package/dist/runtime-rules/overflow-hidden-on-layout-container.d.ts +30 -0
  142. package/dist/runtime-rules/overflow-hidden-on-layout-container.d.ts.map +1 -0
  143. package/dist/runtime-rules/overflow-hidden-on-layout-container.js +220 -0
  144. package/dist/runtime-rules/overflow-hidden-on-layout-container.js.map +1 -0
  145. package/dist/runtime-rules/pass-standard-props.d.ts +19 -0
  146. package/dist/runtime-rules/pass-standard-props.d.ts.map +1 -0
  147. package/dist/runtime-rules/pass-standard-props.js +82 -0
  148. package/dist/runtime-rules/pass-standard-props.js.map +1 -0
  149. package/dist/runtime-rules/prefer-async-await.d.ts +17 -0
  150. package/dist/runtime-rules/prefer-async-await.d.ts.map +1 -0
  151. package/dist/runtime-rules/prefer-async-await.js +52 -0
  152. package/dist/runtime-rules/prefer-async-await.js.map +1 -0
  153. package/dist/runtime-rules/prefer-jsx-syntax.d.ts +17 -0
  154. package/dist/runtime-rules/prefer-jsx-syntax.d.ts.map +1 -0
  155. package/dist/runtime-rules/prefer-jsx-syntax.js +51 -0
  156. package/dist/runtime-rules/prefer-jsx-syntax.js.map +1 -0
  157. package/dist/runtime-rules/prop-state-sync.d.ts +19 -0
  158. package/dist/runtime-rules/prop-state-sync.d.ts.map +1 -0
  159. package/dist/runtime-rules/prop-state-sync.js +76 -0
  160. package/dist/runtime-rules/prop-state-sync.js.map +1 -0
  161. package/dist/runtime-rules/property-name-consistency.d.ts +20 -0
  162. package/dist/runtime-rules/property-name-consistency.d.ts.map +1 -0
  163. package/dist/runtime-rules/property-name-consistency.js +172 -0
  164. package/dist/runtime-rules/property-name-consistency.js.map +1 -0
  165. package/dist/runtime-rules/query-result-field-access-validation.d.ts +10 -0
  166. package/dist/runtime-rules/query-result-field-access-validation.d.ts.map +1 -0
  167. package/dist/runtime-rules/query-result-field-access-validation.js +304 -0
  168. package/dist/runtime-rules/query-result-field-access-validation.js.map +1 -0
  169. package/dist/runtime-rules/react-component-naming.d.ts +19 -0
  170. package/dist/runtime-rules/react-component-naming.d.ts.map +1 -0
  171. package/dist/runtime-rules/react-component-naming.js +72 -0
  172. package/dist/runtime-rules/react-component-naming.js.map +1 -0
  173. package/dist/runtime-rules/react-hooks-rules.d.ts +27 -0
  174. package/dist/runtime-rules/react-hooks-rules.d.ts.map +1 -0
  175. package/dist/runtime-rules/react-hooks-rules.js +223 -0
  176. package/dist/runtime-rules/react-hooks-rules.js.map +1 -0
  177. package/dist/runtime-rules/required-queries-not-called.d.ts +19 -0
  178. package/dist/runtime-rules/required-queries-not-called.d.ts.map +1 -0
  179. package/dist/runtime-rules/required-queries-not-called.js +146 -0
  180. package/dist/runtime-rules/required-queries-not-called.js.map +1 -0
  181. package/dist/runtime-rules/runquery-call-validation.d.ts +11 -0
  182. package/dist/runtime-rules/runquery-call-validation.d.ts.map +1 -0
  183. package/dist/runtime-rules/runquery-call-validation.js +886 -0
  184. package/dist/runtime-rules/runquery-call-validation.js.map +1 -0
  185. package/dist/runtime-rules/runview-call-validation.d.ts +10 -0
  186. package/dist/runtime-rules/runview-call-validation.d.ts.map +1 -0
  187. package/dist/runtime-rules/runview-call-validation.js +336 -0
  188. package/dist/runtime-rules/runview-call-validation.js.map +1 -0
  189. package/dist/runtime-rules/saved-user-settings-pattern.d.ts +19 -0
  190. package/dist/runtime-rules/saved-user-settings-pattern.d.ts.map +1 -0
  191. package/dist/runtime-rules/saved-user-settings-pattern.js +90 -0
  192. package/dist/runtime-rules/saved-user-settings-pattern.js.map +1 -0
  193. package/dist/runtime-rules/search-availability-check.d.ts +9 -0
  194. package/dist/runtime-rules/search-availability-check.d.ts.map +1 -0
  195. package/dist/runtime-rules/search-availability-check.js +220 -0
  196. package/dist/runtime-rules/search-availability-check.js.map +1 -0
  197. package/dist/runtime-rules/search-call-validation.d.ts +9 -0
  198. package/dist/runtime-rules/search-call-validation.d.ts.map +1 -0
  199. package/dist/runtime-rules/search-call-validation.js +336 -0
  200. package/dist/runtime-rules/search-call-validation.js.map +1 -0
  201. package/dist/runtime-rules/server-reload-on-client-operation.d.ts +18 -0
  202. package/dist/runtime-rules/server-reload-on-client-operation.d.ts.map +1 -0
  203. package/dist/runtime-rules/server-reload-on-client-operation.js +107 -0
  204. package/dist/runtime-rules/server-reload-on-client-operation.js.map +1 -0
  205. package/dist/runtime-rules/single-function-only.d.ts +18 -0
  206. package/dist/runtime-rules/single-function-only.d.ts.map +1 -0
  207. package/dist/runtime-rules/single-function-only.js +103 -0
  208. package/dist/runtime-rules/single-function-only.js.map +1 -0
  209. package/dist/runtime-rules/string-replace-all-occurrences.d.ts +19 -0
  210. package/dist/runtime-rules/string-replace-all-occurrences.d.ts.map +1 -0
  211. package/dist/runtime-rules/string-replace-all-occurrences.js +109 -0
  212. package/dist/runtime-rules/string-replace-all-occurrences.js.map +1 -0
  213. package/dist/runtime-rules/string-template-validation.d.ts +22 -0
  214. package/dist/runtime-rules/string-template-validation.d.ts.map +1 -0
  215. package/dist/runtime-rules/string-template-validation.js +163 -0
  216. package/dist/runtime-rules/string-template-validation.js.map +1 -0
  217. package/dist/runtime-rules/styles-validation.d.ts +10 -0
  218. package/dist/runtime-rules/styles-validation.d.ts.map +1 -0
  219. package/dist/runtime-rules/styles-validation.js +153 -0
  220. package/dist/runtime-rules/styles-validation.js.map +1 -0
  221. package/dist/runtime-rules/type-inference-errors.d.ts +23 -0
  222. package/dist/runtime-rules/type-inference-errors.d.ts.map +1 -0
  223. package/dist/runtime-rules/type-inference-errors.js +53 -0
  224. package/dist/runtime-rules/type-inference-errors.js.map +1 -0
  225. package/dist/runtime-rules/type-mismatch-operation.d.ts +23 -0
  226. package/dist/runtime-rules/type-mismatch-operation.d.ts.map +1 -0
  227. package/dist/runtime-rules/type-mismatch-operation.js +145 -0
  228. package/dist/runtime-rules/type-mismatch-operation.js.map +1 -0
  229. package/dist/runtime-rules/undefined-component-usage.d.ts +20 -0
  230. package/dist/runtime-rules/undefined-component-usage.d.ts.map +1 -0
  231. package/dist/runtime-rules/undefined-component-usage.js +138 -0
  232. package/dist/runtime-rules/undefined-component-usage.js.map +1 -0
  233. package/dist/runtime-rules/undefined-jsx-component.d.ts +25 -0
  234. package/dist/runtime-rules/undefined-jsx-component.d.ts.map +1 -0
  235. package/dist/runtime-rules/undefined-jsx-component.js +269 -0
  236. package/dist/runtime-rules/undefined-jsx-component.js.map +1 -0
  237. package/dist/runtime-rules/unsafe-array-operations.d.ts +25 -0
  238. package/dist/runtime-rules/unsafe-array-operations.d.ts.map +1 -0
  239. package/dist/runtime-rules/unsafe-array-operations.js +347 -0
  240. package/dist/runtime-rules/unsafe-array-operations.js.map +1 -0
  241. package/dist/runtime-rules/unsafe-formatting-methods.d.ts +24 -0
  242. package/dist/runtime-rules/unsafe-formatting-methods.d.ts.map +1 -0
  243. package/dist/runtime-rules/unsafe-formatting-methods.js +277 -0
  244. package/dist/runtime-rules/unsafe-formatting-methods.js.map +1 -0
  245. package/dist/runtime-rules/unused-component-dependencies.d.ts +19 -0
  246. package/dist/runtime-rules/unused-component-dependencies.d.ts.map +1 -0
  247. package/dist/runtime-rules/unused-component-dependencies.js +90 -0
  248. package/dist/runtime-rules/unused-component-dependencies.js.map +1 -0
  249. package/dist/runtime-rules/unused-libraries.d.ts +19 -0
  250. package/dist/runtime-rules/unused-libraries.d.ts.map +1 -0
  251. package/dist/runtime-rules/unused-libraries.js +127 -0
  252. package/dist/runtime-rules/unused-libraries.js.map +1 -0
  253. package/dist/runtime-rules/use-function-declaration.d.ts +18 -0
  254. package/dist/runtime-rules/use-function-declaration.d.ts.map +1 -0
  255. package/dist/runtime-rules/use-function-declaration.js +127 -0
  256. package/dist/runtime-rules/use-function-declaration.js.map +1 -0
  257. package/dist/runtime-rules/use-unwrap-components.d.ts +19 -0
  258. package/dist/runtime-rules/use-unwrap-components.d.ts.map +1 -0
  259. package/dist/runtime-rules/use-unwrap-components.js +84 -0
  260. package/dist/runtime-rules/use-unwrap-components.js.map +1 -0
  261. package/dist/runtime-rules/useeffect-unstable-dependencies.d.ts +23 -0
  262. package/dist/runtime-rules/useeffect-unstable-dependencies.d.ts.map +1 -0
  263. package/dist/runtime-rules/useeffect-unstable-dependencies.js +215 -0
  264. package/dist/runtime-rules/useeffect-unstable-dependencies.js.map +1 -0
  265. package/dist/runtime-rules/utilities-api-validation.d.ts +24 -0
  266. package/dist/runtime-rules/utilities-api-validation.d.ts.map +1 -0
  267. package/dist/runtime-rules/utilities-api-validation.js +121 -0
  268. package/dist/runtime-rules/utilities-api-validation.js.map +1 -0
  269. package/dist/runtime-rules/utilities-no-direct-instantiation.d.ts +20 -0
  270. package/dist/runtime-rules/utilities-no-direct-instantiation.d.ts.map +1 -0
  271. package/dist/runtime-rules/utilities-no-direct-instantiation.js +58 -0
  272. package/dist/runtime-rules/utilities-no-direct-instantiation.js.map +1 -0
  273. package/dist/runtime-rules/validate-component-references.d.ts +19 -0
  274. package/dist/runtime-rules/validate-component-references.d.ts.map +1 -0
  275. package/dist/runtime-rules/validate-component-references.js +255 -0
  276. package/dist/runtime-rules/validate-component-references.js.map +1 -0
  277. package/dist/schema-validation/component-prop-rule.d.ts +131 -0
  278. package/dist/schema-validation/component-prop-rule.d.ts.map +1 -0
  279. package/dist/schema-validation/component-prop-rule.js +625 -0
  280. package/dist/schema-validation/component-prop-rule.js.map +1 -0
  281. package/dist/schema-validation/index.d.ts +26 -0
  282. package/dist/schema-validation/index.d.ts.map +1 -0
  283. package/dist/schema-validation/index.js +26 -0
  284. package/dist/schema-validation/index.js.map +1 -0
  285. package/dist/schema-validation/semantic-validators/index.d.ts +23 -0
  286. package/dist/schema-validation/semantic-validators/index.d.ts.map +1 -0
  287. package/dist/schema-validation/semantic-validators/index.js +23 -0
  288. package/dist/schema-validation/semantic-validators/index.js.map +1 -0
  289. package/dist/schema-validation/semantic-validators/required-when-validator.d.ts +43 -0
  290. package/dist/schema-validation/semantic-validators/required-when-validator.d.ts.map +1 -0
  291. package/dist/schema-validation/semantic-validators/required-when-validator.js +94 -0
  292. package/dist/schema-validation/semantic-validators/required-when-validator.js.map +1 -0
  293. package/dist/schema-validation/semantic-validators/semantic-validator-registry.d.ts +122 -0
  294. package/dist/schema-validation/semantic-validators/semantic-validator-registry.d.ts.map +1 -0
  295. package/dist/schema-validation/semantic-validators/semantic-validator-registry.js +166 -0
  296. package/dist/schema-validation/semantic-validators/semantic-validator-registry.js.map +1 -0
  297. package/dist/schema-validation/semantic-validators/semantic-validator.d.ts +260 -0
  298. package/dist/schema-validation/semantic-validators/semantic-validator.d.ts.map +1 -0
  299. package/dist/schema-validation/semantic-validators/semantic-validator.js +301 -0
  300. package/dist/schema-validation/semantic-validators/semantic-validator.js.map +1 -0
  301. package/dist/schema-validation/semantic-validators/sql-where-clause-validator.d.ts +115 -0
  302. package/dist/schema-validation/semantic-validators/sql-where-clause-validator.d.ts.map +1 -0
  303. package/dist/schema-validation/semantic-validators/sql-where-clause-validator.js +381 -0
  304. package/dist/schema-validation/semantic-validators/sql-where-clause-validator.js.map +1 -0
  305. package/dist/schema-validation/semantic-validators/subset-of-entity-fields-validator.d.ts +60 -0
  306. package/dist/schema-validation/semantic-validators/subset-of-entity-fields-validator.d.ts.map +1 -0
  307. package/dist/schema-validation/semantic-validators/subset-of-entity-fields-validator.js +195 -0
  308. package/dist/schema-validation/semantic-validators/subset-of-entity-fields-validator.js.map +1 -0
  309. package/dist/schema-validation/semantic-validators/validation-context.d.ts +335 -0
  310. package/dist/schema-validation/semantic-validators/validation-context.d.ts.map +1 -0
  311. package/dist/schema-validation/semantic-validators/validation-context.js +13 -0
  312. package/dist/schema-validation/semantic-validators/validation-context.js.map +1 -0
  313. package/dist/styles-type-analyzer.d.ts +64 -0
  314. package/dist/styles-type-analyzer.d.ts.map +1 -0
  315. package/dist/styles-type-analyzer.js +242 -0
  316. package/dist/styles-type-analyzer.js.map +1 -0
  317. package/dist/type-context.d.ts +184 -0
  318. package/dist/type-context.d.ts.map +1 -0
  319. package/dist/type-context.js +415 -0
  320. package/dist/type-context.js.map +1 -0
  321. package/dist/type-inference-engine.d.ts +181 -0
  322. package/dist/type-inference-engine.d.ts.map +1 -0
  323. package/dist/type-inference-engine.js +1151 -0
  324. package/dist/type-inference-engine.js.map +1 -0
  325. package/dist/type-rules/type-compatibility-rule.d.ts +85 -0
  326. package/dist/type-rules/type-compatibility-rule.d.ts.map +1 -0
  327. package/dist/type-rules/type-compatibility-rule.js +211 -0
  328. package/dist/type-rules/type-compatibility-rule.js.map +1 -0
  329. package/package.json +35 -7
  330. package/README.md +0 -45
@@ -0,0 +1,121 @@
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 { RegisterClass } from '@memberjunction/global';
9
+ import * as t from '@babel/types';
10
+ import { BaseLintRule } from '../lint-rule.js';
11
+ /**
12
+ * Rule: utilities-api-validation
13
+ *
14
+ * Validates that components only access valid properties and methods
15
+ * on the utilities object (rv, rq, md, ai) and their sub-objects.
16
+ *
17
+ * Valid API surface:
18
+ * - utilities.rv: RunView(), RunViews()
19
+ * - utilities.rq: RunQuery()
20
+ * - utilities.md: GetEntityObject(), Entities
21
+ * - utilities.ai: ExecutePrompt(), EmbedText(), VectorService
22
+ *
23
+ * Severity: critical
24
+ * Applies to: all components
25
+ */
26
+ let UtilitiesApiValidationRule = class UtilitiesApiValidationRule extends BaseLintRule {
27
+ get Name() { return 'utilities-api-validation'; }
28
+ get AppliesTo() { return 'all'; }
29
+ Test(ast) {
30
+ const violations = [];
31
+ // Define the complete utilities API surface
32
+ const utilitiesAPI = {
33
+ rv: { methods: new Set(['RunView', 'RunViews']), properties: new Set() },
34
+ rq: { methods: new Set(['RunQuery']), properties: new Set() },
35
+ md: { methods: new Set(['GetEntityObject']), properties: new Set(['Entities']) },
36
+ ai: { methods: new Set(['ExecutePrompt', 'EmbedText']), properties: new Set(['VectorService']) },
37
+ };
38
+ const validUtilityProps = new Set(Object.keys(utilitiesAPI));
39
+ traverse(ast, {
40
+ // Check for utilities.* property access
41
+ MemberExpression(path) {
42
+ // Check for direct utilities.* access
43
+ if (t.isIdentifier(path.node.object) && path.node.object.name === 'utilities') {
44
+ if (t.isIdentifier(path.node.property)) {
45
+ const propName = path.node.property.name;
46
+ if (!validUtilityProps.has(propName)) {
47
+ violations.push({
48
+ rule: 'utilities-api-validation',
49
+ severity: 'critical',
50
+ line: path.node.loc?.start.line || 0,
51
+ column: path.node.loc?.start.column || 0,
52
+ message: `Invalid utilities property '${propName}'. Valid properties are: rv (RunView), rq (RunQuery), md (Metadata), ai (AI Tools)`,
53
+ code: `utilities.${propName}`,
54
+ });
55
+ }
56
+ }
57
+ return; // Don't check deeper for this node
58
+ }
59
+ // Check for utilities.{rv|rq|md|ai}.property access (non-call)
60
+ if (t.isCallExpression(path.parent) && path.parent.callee === path.node) {
61
+ return; // Skip - this is a method call, handled below
62
+ }
63
+ if (t.isMemberExpression(path.node.object) &&
64
+ t.isIdentifier(path.node.object.object) &&
65
+ path.node.object.object.name === 'utilities' &&
66
+ t.isIdentifier(path.node.object.property) &&
67
+ t.isIdentifier(path.node.property)) {
68
+ const utilityName = path.node.object.property.name;
69
+ const propName = path.node.property.name;
70
+ const api = utilitiesAPI[utilityName];
71
+ if (api && !api.properties.has(propName) && !api.methods.has(propName)) {
72
+ const validItems = [
73
+ ...Array.from(api.methods).map((m) => `${m}()`),
74
+ ...Array.from(api.properties),
75
+ ];
76
+ violations.push({
77
+ rule: 'utilities-api-validation',
78
+ severity: 'critical',
79
+ line: path.node.loc?.start.line || 0,
80
+ column: path.node.loc?.start.column || 0,
81
+ message: `Invalid access '${propName}' on utilities.${utilityName}. Valid: ${validItems.join(', ')}`,
82
+ code: `utilities.${utilityName}.${propName}`,
83
+ });
84
+ }
85
+ }
86
+ },
87
+ // Check for utilities.{rv|rq|md|ai}.method() calls
88
+ CallExpression(path) {
89
+ if (t.isMemberExpression(path.node.callee)) {
90
+ const callee = path.node.callee;
91
+ if (t.isMemberExpression(callee.object) &&
92
+ t.isIdentifier(callee.object.object) &&
93
+ callee.object.object.name === 'utilities' &&
94
+ t.isIdentifier(callee.object.property) &&
95
+ t.isIdentifier(callee.property)) {
96
+ const utilityName = callee.object.property.name;
97
+ const methodName = callee.property.name;
98
+ const api = utilitiesAPI[utilityName];
99
+ if (api && !api.methods.has(methodName)) {
100
+ const validMethods = Array.from(api.methods).join(', ');
101
+ violations.push({
102
+ rule: 'utilities-api-validation',
103
+ severity: 'critical',
104
+ line: path.node.loc?.start.line || 0,
105
+ column: path.node.loc?.start.column || 0,
106
+ message: `Invalid method '${methodName}' on utilities.${utilityName}. Valid methods: ${validMethods}`,
107
+ code: `utilities.${utilityName}.${methodName}()`,
108
+ });
109
+ }
110
+ }
111
+ }
112
+ },
113
+ });
114
+ return violations;
115
+ }
116
+ };
117
+ UtilitiesApiValidationRule = __decorate([
118
+ RegisterClass(BaseLintRule, 'utilities-api-validation')
119
+ ], UtilitiesApiValidationRule);
120
+ export { UtilitiesApiValidationRule };
121
+ //# sourceMappingURL=utilities-api-validation.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"utilities-api-validation.js","sourceRoot":"","sources":["../../src/runtime-rules/utilities-api-validation.ts"],"names":[],"mappings":";;;;;;AAAA,OAAO,EAAE,QAAQ,EAAY,MAAM,eAAe,CAAC;AACnD,OAAO,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAC;AACvD,OAAO,KAAK,CAAC,MAAM,cAAc,CAAC;AAClC,OAAO,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AAG5C;;;;;;;;;;;;;;GAcG;AAEI,IAAM,0BAA0B,GAAhC,MAAM,0BAA2B,SAAQ,YAAY;IAC1D,IAAI,IAAI,KAAK,OAAO,0BAA0B,CAAC,CAAC,CAAC;IACjD,IAAI,SAAS,KAA+B,OAAO,KAAK,CAAC,CAAC,CAAC;IAE3D,IAAI,CAAC,GAAW;QACd,MAAM,UAAU,GAAgB,EAAE,CAAC;QAEnC,4CAA4C;QAC5C,MAAM,YAAY,GAAsE;YACtF,EAAE,EAAE,EAAE,OAAO,EAAE,IAAI,GAAG,CAAC,CAAC,SAAS,EAAE,UAAU,CAAC,CAAC,EAAE,UAAU,EAAE,IAAI,GAAG,EAAE,EAAE;YACxE,EAAE,EAAE,EAAE,OAAO,EAAE,IAAI,GAAG,CAAC,CAAC,UAAU,CAAC,CAAC,EAAE,UAAU,EAAE,IAAI,GAAG,EAAE,EAAE;YAC7D,EAAE,EAAE,EAAE,OAAO,EAAE,IAAI,GAAG,CAAC,CAAC,iBAAiB,CAAC,CAAC,EAAE,UAAU,EAAE,IAAI,GAAG,CAAC,CAAC,UAAU,CAAC,CAAC,EAAE;YAChF,EAAE,EAAE,EAAE,OAAO,EAAE,IAAI,GAAG,CAAC,CAAC,eAAe,EAAE,WAAW,CAAC,CAAC,EAAE,UAAU,EAAE,IAAI,GAAG,CAAC,CAAC,eAAe,CAAC,CAAC,EAAE;SACjG,CAAC;QAEF,MAAM,iBAAiB,GAAG,IAAI,G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EAAE,IAAI,CAAC,IAAI,CAAC,GAAG,EAAE,KAAK,CAAC,MAAM,IAAI,CAAC;gCACxC,OAAO,EAAE,mBAAmB,UAAU,kBAAkB,WAAW,oBAAoB,YAAY,EAAE;gCACrG,IAAI,EAAE,aAAa,WAAW,IAAI,UAAU,IAAI;6BACjD,CAAC,CAAC;wBACL,CAAC;oBACH,CAAC;gBACH,CAAC;YACH,CAAC;SACF,CAAC,CAAC;QAEH,OAAO,UAAU,CAAC;IAClB,CAAC;CACJ,CAAA;AA1GY,0BAA0B;IADtC,aAAa,CAAC,YAAY,EAAE,0BAA0B,CAAC;GAC3C,0BAA0B,CA0GtC"}
@@ -0,0 +1,20 @@
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: utilities-no-direct-instantiation
7
+ *
8
+ * Prevents direct instantiation of classes that should be accessed via the utilities parameter.
9
+ * Classes like RunView, RunQuery, Metadata, and SimpleVectorService are provided by the runtime
10
+ * and should be used through the utilities object.
11
+ *
12
+ * Severity: high
13
+ * Applies to: all components
14
+ */
15
+ export declare class UtilitiesNoDirectInstantiationRule extends BaseLintRule {
16
+ get Name(): string;
17
+ get AppliesTo(): 'all' | 'child' | 'root';
18
+ Test(ast: t.File, componentName: string, componentSpec?: ComponentSpec): Violation[];
19
+ }
20
+ //# sourceMappingURL=utilities-no-direct-instantiation.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"utilities-no-direct-instantiation.d.ts","sourceRoot":"","sources":["../../src/runtime-rules/utilities-no-direct-instantiation.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,CAAC,MAAM,cAAc,CAAC;AAClC,OAAO,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AAC5C,OAAO,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAC;AAChD,OAAO,EAAE,aAAa,EAAE,MAAM,6CAA6C,CAAC;AAE5E;;;;;;;;;GASG;AACH,qBACa,kCAAmC,SAAQ,YAAY;IAClE,IAAI,IAAI,WAAkD;IAC1D,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;CAgCrF"}
@@ -0,0 +1,58 @@
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 { RegisterClass } from '@memberjunction/global';
9
+ import * as t from '@babel/types';
10
+ import { BaseLintRule } from '../lint-rule.js';
11
+ /**
12
+ * Rule: utilities-no-direct-instantiation
13
+ *
14
+ * Prevents direct instantiation of classes that should be accessed via the utilities parameter.
15
+ * Classes like RunView, RunQuery, Metadata, and SimpleVectorService are provided by the runtime
16
+ * and should be used through the utilities object.
17
+ *
18
+ * Severity: high
19
+ * Applies to: all components
20
+ */
21
+ let UtilitiesNoDirectInstantiationRule = class UtilitiesNoDirectInstantiationRule extends BaseLintRule {
22
+ get Name() { return 'utilities-no-direct-instantiation'; }
23
+ get AppliesTo() { return 'all'; }
24
+ Test(ast, componentName, componentSpec) {
25
+ const violations = [];
26
+ const restrictedClasses = new Map([
27
+ ['RunView', 'utilities.rv'],
28
+ ['RunQuery', 'utilities.rq'],
29
+ ['Metadata', 'utilities.md'],
30
+ ['SimpleVectorService', 'utilities.ai.VectorService'],
31
+ ]);
32
+ traverse(ast, {
33
+ NewExpression(path) {
34
+ // Check if instantiating a restricted class
35
+ if (t.isIdentifier(path.node.callee)) {
36
+ const className = path.node.callee.name;
37
+ if (restrictedClasses.has(className)) {
38
+ const utilityPath = restrictedClasses.get(className);
39
+ violations.push({
40
+ rule: 'utilities-no-direct-instantiation',
41
+ severity: 'high',
42
+ line: path.node.loc?.start.line || 0,
43
+ column: path.node.loc?.start.column || 0,
44
+ message: `Don't instantiate ${className} directly. Use ${utilityPath} instead which is provided in the component's utilities parameter.`,
45
+ code: `new ${className}()`,
46
+ });
47
+ }
48
+ }
49
+ },
50
+ });
51
+ return violations;
52
+ }
53
+ };
54
+ UtilitiesNoDirectInstantiationRule = __decorate([
55
+ RegisterClass(BaseLintRule, 'utilities-no-direct-instantiation')
56
+ ], UtilitiesNoDirectInstantiationRule);
57
+ export { UtilitiesNoDirectInstantiationRule };
58
+ //# sourceMappingURL=utilities-no-direct-instantiation.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"utilities-no-direct-instantiation.js","sourceRoot":"","sources":["../../src/runtime-rules/utilities-no-direct-instantiation.ts"],"names":[],"mappings":";;;;;;AAAA,OAAO,EAAE,QAAQ,EAAY,MAAM,eAAe,CAAC;AACnD,OAAO,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAC;AACvD,OAAO,KAAK,CAAC,MAAM,cAAc,CAAC;AAClC,OAAO,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AAI5C;;;;;;;;;GASG;AAEI,IAAM,kCAAkC,GAAxC,MAAM,kCAAmC,SAAQ,YAAY;IAClE,IAAI,IAAI,KAAK,OAAO,mCAAmC,CAAC,CAAC,CAAC;IAC1D,IAAI,SAAS,KAA+B,OAAO,KAAK,CAAC,CAAC,CAAC;IAE3D,IAAI,CAAC,GAAW,EAAE,aAAqB,EAAE,aAA6B;QACpE,MAAM,UAAU,GAAgB,EAAE,CAAC;QACnC,MAAM,iBAAiB,GAAG,IAAI,GAAG,CAAC;YAChC,CAAC,SAAS,EAAE,cAAc,CAAC;YAC3B,CAAC,UAAU,EAAE,cAAc,CAAC;YAC5B,CAAC,UAAU,EAAE,cAAc,CAAC;YAC5B,CAAC,qBAAqB,EAAE,4BAA4B,CAAC;SACtD,CAAC,CAAC;QAEH,QAAQ,CAAC,GAAG,EAAE;YACZ,aAAa,CAAC,IAA+B;gBAC3C,4CAA4C;gBAC5C,IAAI,CAAC,CAAC,YAAY,CAAC,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,EAAE,CAAC;oBACrC,MAAM,SAAS,GAAG,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC;oBAExC,IAAI,iBAAiB,CAAC,GAAG,CAAC,SAAS,CAAC,EAAE,CAAC;wBACrC,MAAM,WAAW,GAAG,iBAAiB,CAAC,GAAG,CAAC,SAAS,CAAC,CAAC;wBACrD,UAAU,CAAC,IAAI,CAAC;4BACd,IAAI,EAAE,mCAAmC;4BACzC,QAAQ,EAAE,MAAM;4BAChB,IAAI,EAAE,IAAI,CAAC,IAAI,CAAC,GAAG,EAAE,KAAK,CAAC,IAAI,IAAI,CAAC;4BACpC,MAAM,EAAE,IAAI,CAAC,IAAI,CAAC,GAAG,EAAE,KAAK,CAAC,MAAM,IAAI,CAAC;4BACxC,OAAO,EAAE,qBAAqB,SAAS,kBAAkB,WAAW,oEAAoE;4BACxI,IAAI,EAAE,OAAO,SAAS,IAAI;yBAC3B,CAAC,CAAC;oBACL,CAAC;gBACH,CAAC;YACH,CAAC;SACF,CAAC,CAAC;QAEH,OAAO,UAAU,CAAC;IAClB,CAAC;CACJ,CAAA;AApCY,kCAAkC;IAD9C,aAAa,CAAC,YAAY,EAAE,mCAAmC,CAAC;GACpD,kCAAkC,CAoC9C"}
@@ -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: validate-component-references
7
+ *
8
+ * Validates that component references used in JSX or React.createElement calls
9
+ * match declared dependencies. Also warns about unused dependencies.
10
+ *
11
+ * Severity: critical (for undefined references), low (for unused dependencies)
12
+ * Applies to: all components
13
+ */
14
+ export declare class ValidateComponentReferencesRule 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=validate-component-references.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"validate-component-references.d.ts","sourceRoot":"","sources":["../../src/runtime-rules/validate-component-references.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,CAAC,MAAM,cAAc,CAAC;AAClC,OAAO,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AAC5C,OAAO,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAC;AAChD,OAAO,EAAE,aAAa,EAAE,MAAM,6CAA6C,CAAC;AAE5E;;;;;;;;GAQG;AACH,qBACa,+BAAgC,SAAQ,YAAY;IAC/D,IAAI,IAAI,WAA8C;IACtD,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;CA8PrF"}
@@ -0,0 +1,255 @@
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 { RegisterClass } from '@memberjunction/global';
9
+ import * as t from '@babel/types';
10
+ import { BaseLintRule } from '../lint-rule.js';
11
+ /**
12
+ * Rule: validate-component-references
13
+ *
14
+ * Validates that component references used in JSX or React.createElement calls
15
+ * match declared dependencies. Also warns about unused dependencies.
16
+ *
17
+ * Severity: critical (for undefined references), low (for unused dependencies)
18
+ * Applies to: all components
19
+ */
20
+ let ValidateComponentReferencesRule = class ValidateComponentReferencesRule extends BaseLintRule {
21
+ get Name() { return 'validate-component-references'; }
22
+ get AppliesTo() { return 'all'; }
23
+ Test(ast, componentName, componentSpec) {
24
+ const violations = [];
25
+ // Skip if no spec or no dependencies
26
+ if (!componentSpec?.dependencies || componentSpec.dependencies.length === 0) {
27
+ return violations;
28
+ }
29
+ // Build a set of available component names from dependencies
30
+ const availableComponents = new Set();
31
+ for (const dep of componentSpec.dependencies) {
32
+ if (dep.location === 'embedded' && dep.name) {
33
+ availableComponents.add(dep.name);
34
+ }
35
+ }
36
+ // If no embedded dependencies, nothing to validate
37
+ if (availableComponents.size === 0) {
38
+ return violations;
39
+ }
40
+ // Track ALL defined variables in scope (from destructuring, imports, declarations, etc.)
41
+ const definedVariables = new Set();
42
+ const referencedComponents = new Set();
43
+ // First pass: collect all variable declarations and destructuring
44
+ traverse(ast, {
45
+ // Track variable declarations (const x = ...)
46
+ VariableDeclarator(path) {
47
+ if (t.isIdentifier(path.node.id)) {
48
+ definedVariables.add(path.node.id.name);
49
+ }
50
+ else if (t.isObjectPattern(path.node.id)) {
51
+ // Track all destructured variables
52
+ const collectDestructured = (pattern) => {
53
+ for (const prop of pattern.properties) {
54
+ if (t.isObjectProperty(prop)) {
55
+ if (t.isIdentifier(prop.value)) {
56
+ definedVariables.add(prop.value.name);
57
+ }
58
+ else if (t.isObjectPattern(prop.value)) {
59
+ collectDestructured(prop.value);
60
+ }
61
+ }
62
+ else if (t.isRestElement(prop) && t.isIdentifier(prop.argument)) {
63
+ definedVariables.add(prop.argument.name);
64
+ }
65
+ }
66
+ };
67
+ collectDestructured(path.node.id);
68
+ }
69
+ else if (t.isArrayPattern(path.node.id)) {
70
+ // Track array destructuring
71
+ for (const elem of path.node.id.elements) {
72
+ if (t.isIdentifier(elem)) {
73
+ definedVariables.add(elem.name);
74
+ }
75
+ }
76
+ }
77
+ },
78
+ // Track function declarations
79
+ FunctionDeclaration(path) {
80
+ if (path.node.id) {
81
+ definedVariables.add(path.node.id.name);
82
+ }
83
+ },
84
+ // Track class declarations
85
+ ClassDeclaration(path) {
86
+ if (path.node.id) {
87
+ definedVariables.add(path.node.id.name);
88
+ }
89
+ },
90
+ // Track function parameters
91
+ Function(path) {
92
+ for (const param of path.node.params) {
93
+ if (t.isIdentifier(param)) {
94
+ definedVariables.add(param.name);
95
+ }
96
+ else if (t.isObjectPattern(param)) {
97
+ // Track destructured parameters
98
+ const collectParams = (pattern) => {
99
+ for (const prop of pattern.properties) {
100
+ if (t.isObjectProperty(prop)) {
101
+ if (t.isIdentifier(prop.value)) {
102
+ definedVariables.add(prop.value.name);
103
+ }
104
+ else if (t.isObjectPattern(prop.value)) {
105
+ collectParams(prop.value);
106
+ }
107
+ }
108
+ }
109
+ };
110
+ collectParams(param);
111
+ }
112
+ }
113
+ },
114
+ });
115
+ // Second pass: check component usage
116
+ traverse(ast, {
117
+ // Look for React.createElement calls
118
+ CallExpression(path) {
119
+ const callee = path.node.callee;
120
+ // Check for React.createElement(ComponentName, ...)
121
+ if (t.isMemberExpression(callee) &&
122
+ t.isIdentifier(callee.object) &&
123
+ callee.object.name === 'React' &&
124
+ t.isIdentifier(callee.property) &&
125
+ callee.property.name === 'createElement') {
126
+ const firstArg = path.node.arguments[0];
127
+ // If first argument is an identifier (component reference)
128
+ if (t.isIdentifier(firstArg)) {
129
+ const componentRef = firstArg.name;
130
+ // Skip HTML elements and React built-ins
131
+ if (!componentRef.match(/^[a-z]/) && componentRef !== 'Fragment') {
132
+ // Only check if it's supposed to be a component dependency
133
+ // and it's not defined elsewhere in the code
134
+ if (availableComponents.has(componentRef)) {
135
+ referencedComponents.add(componentRef);
136
+ }
137
+ else if (!definedVariables.has(componentRef)) {
138
+ // Only complain if it's not defined anywhere
139
+ const availableList = Array.from(availableComponents).sort().join(', ');
140
+ const availableLibs = componentSpec?.libraries
141
+ ?.map((lib) => lib.globalVariable)
142
+ .filter(Boolean)
143
+ .join(', ') || '';
144
+ let message = `Component "${componentRef}" is not defined. Available component dependencies: ${availableList}`;
145
+ if (availableLibs) {
146
+ message += `. Available libraries: ${availableLibs}`;
147
+ }
148
+ violations.push({
149
+ rule: 'validate-component-references',
150
+ severity: 'critical',
151
+ line: firstArg.loc?.start.line || 0,
152
+ column: firstArg.loc?.start.column || 0,
153
+ message: message,
154
+ code: `React.createElement(${componentRef}, ...)`,
155
+ });
156
+ }
157
+ }
158
+ }
159
+ }
160
+ },
161
+ // Look for JSX elements
162
+ JSXElement(path) {
163
+ const openingElement = path.node.openingElement;
164
+ const elementName = openingElement.name;
165
+ if (t.isJSXIdentifier(elementName)) {
166
+ const componentRef = elementName.name;
167
+ // Skip HTML elements and fragments
168
+ if (!componentRef.match(/^[a-z]/) && componentRef !== 'Fragment') {
169
+ // Track if it's a known component dependency
170
+ if (availableComponents.has(componentRef)) {
171
+ referencedComponents.add(componentRef);
172
+ }
173
+ else if (!definedVariables.has(componentRef)) {
174
+ // Only complain if it's not defined anywhere (not from libraries, not from declarations)
175
+ const availableList = Array.from(availableComponents).sort().join(', ');
176
+ const availableLibs = componentSpec?.libraries
177
+ ?.map((lib) => lib.globalVariable)
178
+ .filter(Boolean)
179
+ .join(', ') || '';
180
+ let message = `Component "${componentRef}" is not defined. Available component dependencies: ${availableList}`;
181
+ if (availableLibs) {
182
+ message += `. Available libraries: ${availableLibs}`;
183
+ }
184
+ violations.push({
185
+ rule: 'validate-component-references',
186
+ severity: 'critical',
187
+ line: elementName.loc?.start.line || 0,
188
+ column: elementName.loc?.start.column || 0,
189
+ message: message,
190
+ code: `<${componentRef} ... />`,
191
+ });
192
+ }
193
+ }
194
+ }
195
+ },
196
+ // Look for destructuring from components prop specifically
197
+ ObjectPattern(path) {
198
+ // Check if this is destructuring from a 'components' parameter
199
+ const parent = path.parent;
200
+ // Check if it's a function parameter with components
201
+ if ((t.isFunctionDeclaration(parent) || t.isFunctionExpression(parent) || t.isArrowFunctionExpression(parent)) &&
202
+ parent.params.includes(path.node)) {
203
+ // Look for components property
204
+ for (const prop of path.node.properties) {
205
+ if (t.isObjectProperty(prop) && t.isIdentifier(prop.key) && prop.key.name === 'components' && t.isObjectPattern(prop.value)) {
206
+ // Check each destructured component
207
+ for (const componentProp of prop.value.properties) {
208
+ if (t.isObjectProperty(componentProp) && t.isIdentifier(componentProp.key)) {
209
+ const componentRef = componentProp.key.name;
210
+ referencedComponents.add(componentRef);
211
+ if (!availableComponents.has(componentRef)) {
212
+ const availableList = Array.from(availableComponents).sort().join(', ');
213
+ // Try to find similar names for suggestions
214
+ const suggestions = Array.from(availableComponents).filter((name) => name.toLowerCase().includes(componentRef.toLowerCase()) || componentRef.toLowerCase().includes(name.toLowerCase()));
215
+ let message = `Destructured component "${componentRef}" is not found in dependencies. Available components: ${availableList}`;
216
+ if (suggestions.length > 0) {
217
+ message += `. Did you mean: ${suggestions.join(' or ')}?`;
218
+ }
219
+ violations.push({
220
+ rule: 'validate-component-references',
221
+ severity: 'critical',
222
+ line: componentProp.key.loc?.start.line || 0,
223
+ column: componentProp.key.loc?.start.column || 0,
224
+ message: message,
225
+ code: `{ components: { ${componentRef}, ... } }`,
226
+ });
227
+ }
228
+ }
229
+ }
230
+ }
231
+ }
232
+ }
233
+ },
234
+ });
235
+ // Also warn about unused dependencies
236
+ for (const depName of availableComponents) {
237
+ if (!referencedComponents.has(depName)) {
238
+ violations.push({
239
+ rule: 'validate-component-references',
240
+ severity: 'low',
241
+ line: 1,
242
+ column: 0,
243
+ message: `Component dependency "${depName}" is defined but never used in the code.`,
244
+ code: `dependencies: [..., { name: "${depName}", ... }, ...]`,
245
+ });
246
+ }
247
+ }
248
+ return violations;
249
+ }
250
+ };
251
+ ValidateComponentReferencesRule = __decorate([
252
+ RegisterClass(BaseLintRule, 'validate-component-references')
253
+ ], ValidateComponentReferencesRule);
254
+ export { ValidateComponentReferencesRule };
255
+ //# sourceMappingURL=validate-component-references.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"validate-component-references.js","sourceRoot":"","sources":["../../src/runtime-rules/validate-component-references.ts"],"names":[],"mappings":";;;;;;AAAA,OAAO,EAAE,QAAQ,EAAY,MAAM,eAAe,CAAC;AACnD,OAAO,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAC;AACvD,OAAO,KAAK,CAAC,MAAM,cAAc,CAAC;AAClC,OAAO,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AAI5C;;;;;;;;GAQG;AAEI,IAAM,+BAA+B,GAArC,MAAM,+BAAgC,SAAQ,YAAY;IAC/D,IAAI,IAAI,KAAK,OAAO,+BAA+B,CAAC,CAAC,CAAC;IACtD,IAAI,SAAS,KAA+B,OAAO,KAAK,CAAC,CAAC,CAAC;IAE3D,IAAI,CAAC,GAAW,EAAE,aAAqB,EAAE,aAA6B;QACpE,MAAM,UAAU,GAAgB,EAAE,CAAC;QAEnC,qCAAqC;QACrC,IAAI,CAAC,aAAa,EAAE,YAAY,IAAI,aAAa,CAAC,YAAY,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;YAC5E,OAAO,UAAU,CAAC;QACpB,CAAC;QAED,6DAA6D;QAC7D,MAAM,mBAAmB,GAAG,IAAI,GAAG,EAAU,CAAC;QAC9C,KAAK,MAAM,GAAG,IAAI,aAAa,CAAC,YAAY,EAAE,CAAC;YAC7C,IAAI,GAAG,CAAC,QAAQ,KAAK,UAAU,IAAI,GAAG,CAAC,IAAI,EAAE,CAAC;gBAC5C,mBAAmB,CAAC,GAAG,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;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OAAO,IAAI,mBAAmB,EAAE,CAAC;YAC1C,IAAI,CAAC,oBAAoB,CAAC,GAAG,CAAC,OAAO,CAAC,EAAE,CAAC;gBACvC,UAAU,CAAC,IAAI,CAAC;oBACd,IAAI,EAAE,+BAA+B;oBACrC,QAAQ,EAAE,KAAK;oBACf,IAAI,EAAE,CAAC;oBACP,MAAM,EAAE,CAAC;oBACT,OAAO,EAAE,yBAAyB,OAAO,0CAA0C;oBACnF,IAAI,EAAE,gCAAgC,OAAO,gBAAgB;iBAC9D,CAAC,CAAC;YACL,CAAC;QACH,CAAC;QAED,OAAO,UAAU,CAAC;IAClB,CAAC;CACJ,CAAA;AAlQY,+BAA+B;IAD3C,aAAa,CAAC,YAAY,EAAE,+BAA+B,CAAC;GAChD,+BAA+B,CAkQ3C"}
@@ -0,0 +1,131 @@
1
+ /**
2
+ * Component Prop Rule - Unified component property validation
3
+ *
4
+ * This rule consolidates all component prop validation:
5
+ * 1. Prop existence (from dependency-prop-validation)
6
+ * 2. Required props checking
7
+ * 3. Prop type validation (via TypeContext)
8
+ * 4. Semantic constraint validation (via SemanticValidators)
9
+ * 5. Unknown props warning
10
+ *
11
+ * @category schema
12
+ * @severity high
13
+ *
14
+ * ## Rationale
15
+ * Component props are the contract between components. This rule ensures:
16
+ * - All required props are provided
17
+ * - Prop types match expected types
18
+ * - Prop values meet semantic constraints
19
+ * - Unknown props are flagged (may be typos)
20
+ *
21
+ * ## Integration
22
+ * - Uses SemanticValidatorRegistry for constraint validation
23
+ * - Uses TypeInferenceEngine for type checking
24
+ * - Uses ComponentMetadataEngine for dependency specs
25
+ *
26
+ * ## Phase 3 Consolidation
27
+ * This rule merges:
28
+ * - dependency-prop-validation (prop existence, required, types, unknown)
29
+ * - validate-component-props (semantic constraint validation)
30
+ */
31
+ import * as t from '@babel/types';
32
+ import { ComponentSpec } from '@memberjunction/interactive-component-types';
33
+ export interface Violation {
34
+ rule: string;
35
+ severity: 'critical' | 'high' | 'medium' | 'low';
36
+ line: number;
37
+ column: number;
38
+ message: string;
39
+ code?: string;
40
+ source?: 'user-component' | 'runtime-wrapper' | 'react-framework' | 'test-harness';
41
+ suggestion?: {
42
+ text: string;
43
+ example?: string;
44
+ };
45
+ }
46
+ export interface LintContext {
47
+ componentName: string;
48
+ componentSpec?: ComponentSpec;
49
+ typeContext: any;
50
+ typeEngine: any;
51
+ controlFlowAnalyzer: any;
52
+ /** SQL dialect for WHERE clause parsing in semantic validators */
53
+ sqlDialect?: import('@memberjunction/sql-dialect').SQLParserDialect;
54
+ /**
55
+ * Resolver for registry-located dependency components. Caller-supplied
56
+ * (see LinterOptions.componentResolver). Optional — rules degrade
57
+ * gracefully when absent.
58
+ */
59
+ componentResolver?: (name: string, namespace?: string, registry?: string) => ComponentSpec | undefined;
60
+ }
61
+ /**
62
+ * ComponentPropRule - Validates all aspects of component property usage
63
+ *
64
+ * Validates:
65
+ * 1. Props exist in component spec (schema validation)
66
+ * 2. Required props are provided
67
+ * 3. Prop types match expected types (via TypeContext)
68
+ * 4. Semantic constraints are met (via SemanticValidators)
69
+ * 5. Unknown props warning
70
+ */
71
+ export declare class ComponentPropRule {
72
+ name: string;
73
+ appliesTo: 'all' | 'child' | 'root';
74
+ private readonly standardProps;
75
+ private readonly reactSpecialProps;
76
+ /** SQL dialect for semantic validators, set from LintContext during validate() */
77
+ private _sqlDialect?;
78
+ /**
79
+ * Validate component props
80
+ */
81
+ validate(ast: t.File, context: LintContext): Violation[];
82
+ /**
83
+ * Build map of dependency components to their full specs
84
+ */
85
+ private buildDependencySpecs;
86
+ /**
87
+ * Build validation context helpers from parent spec's dataRequirements
88
+ */
89
+ private buildValidationHelpers;
90
+ /**
91
+ * Get element name from JSX opening element
92
+ */
93
+ private getElementName;
94
+ /**
95
+ * Get set of provided prop names
96
+ */
97
+ private getProvidedProps;
98
+ /**
99
+ * Get map of provided prop names to their JSXAttribute nodes
100
+ */
101
+ private getProvidedPropNodes;
102
+ /**
103
+ * Validate required props are provided
104
+ */
105
+ private validateRequiredProps;
106
+ /**
107
+ * Validate prop types match expected types
108
+ */
109
+ private validatePropTypes;
110
+ /**
111
+ * Get the type of an expression
112
+ */
113
+ private getExpressionType;
114
+ /**
115
+ * Check if actual type is compatible with expected type
116
+ */
117
+ private checkTypeCompatibility;
118
+ /**
119
+ * Validate unknown props (may be typos)
120
+ */
121
+ private validateUnknownProps;
122
+ /**
123
+ * Find closest matching prop name using Levenshtein distance
124
+ */
125
+ private findClosestMatch;
126
+ /**
127
+ * Validate semantic constraints on props
128
+ */
129
+ private validateSemanticConstraints;
130
+ }
131
+ //# sourceMappingURL=component-prop-rule.d.ts.map