@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,153 @@
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
+ import { StylesTypeAnalyzer } from '../styles-type-analyzer.js';
12
+ /**
13
+ * Rule: styles-validation
14
+ *
15
+ * Consolidated rule that combines:
16
+ * 1. styles-invalid-path — Validates that styles property access paths are valid
17
+ * according to the StylesTypeAnalyzer. Provides suggestions for misspelled
18
+ * or misplaced properties.
19
+ * 2. styles-unsafe-access — Validates safe access patterns on styles objects.
20
+ * Currently skips styles access because ComponentStyles interface guarantees
21
+ * structure (all required properties exist), but included for future activation.
22
+ *
23
+ * Severity: critical (invalid path), varies (unsafe access)
24
+ * Applies to: all components
25
+ */
26
+ // Lazy singleton for the styles analyzer
27
+ let _stylesAnalyzer = null;
28
+ function getStylesAnalyzer() {
29
+ if (!_stylesAnalyzer) {
30
+ _stylesAnalyzer = new StylesTypeAnalyzer();
31
+ }
32
+ return _stylesAnalyzer;
33
+ }
34
+ // Standard props that are always defined with guaranteed structure
35
+ // The ComponentStyles interface guarantees all required properties exist
36
+ // So we don't need to check for optional chaining on the styles object itself
37
+ const standardProps = new Set(['utilities', 'styles', 'components', 'callbacks', 'savedUserSettings', 'onSaveUserSettings']);
38
+ let StylesValidationRule = class StylesValidationRule extends BaseLintRule {
39
+ get Name() { return 'styles-validation'; }
40
+ get AppliesTo() { return 'all'; }
41
+ Test(ast, componentName, componentSpec) {
42
+ const violations = [];
43
+ const analyzer = getStylesAnalyzer();
44
+ traverse(ast, {
45
+ MemberExpression(path) {
46
+ // Build the complete property chain first
47
+ const propertyChain = [];
48
+ let current = path.node;
49
+ let hasOptionalChaining = path.node.optional || false;
50
+ // Walk up from the deepest member expression to build the full chain
51
+ while (t.isMemberExpression(current)) {
52
+ if (current.optional) {
53
+ hasOptionalChaining = true;
54
+ }
55
+ if (t.isIdentifier(current.property)) {
56
+ propertyChain.unshift(current.property.name);
57
+ }
58
+ if (t.isIdentifier(current.object)) {
59
+ propertyChain.unshift(current.object.name);
60
+ break;
61
+ }
62
+ current = current.object;
63
+ }
64
+ // Only process if this is a styles access
65
+ if (propertyChain[0] !== 'styles') {
66
+ return;
67
+ }
68
+ // --- styles-invalid-path logic ---
69
+ checkInvalidPath(path, propertyChain, analyzer, violations);
70
+ // --- styles-unsafe-access logic ---
71
+ // Skip styles access entirely - ComponentStyles interface guarantees structure.
72
+ // styles is a standard prop with a fixed interface, all required properties exist.
73
+ // This prevents false positives for patterns like: styles.borders.radius
74
+ // The ComponentStyles interface (runtime-types.ts) defines all required properties
75
+ // including colors, spacing, typography, borders, etc. as non-optional.
76
+ //
77
+ // When this rule becomes active in the future, hasOptionalChaining and
78
+ // standardProps are available to implement unsafe-access checks here.
79
+ },
80
+ });
81
+ return violations;
82
+ }
83
+ };
84
+ StylesValidationRule = __decorate([
85
+ RegisterClass(BaseLintRule, 'styles-validation')
86
+ ], StylesValidationRule);
87
+ export { StylesValidationRule };
88
+ /**
89
+ * Checks whether a styles property access path is valid according to the
90
+ * StylesTypeAnalyzer. Produces a violation with suggestions when invalid.
91
+ */
92
+ function checkInvalidPath(path, propertyChain, analyzer, violations) {
93
+ if (analyzer.isValidPath(propertyChain)) {
94
+ return;
95
+ }
96
+ const suggestions = analyzer.getSuggestionsForPath(propertyChain);
97
+ const accessPath = propertyChain.join('.');
98
+ let message = buildInvalidPathMessage(accessPath, propertyChain, suggestions);
99
+ // Get a contextual default value
100
+ const defaultValue = analyzer.getDefaultValueForPath(propertyChain);
101
+ message += `\n\nSuggested fix with safe access:\n ${accessPath.replace(/\./g, '?.')} || ${defaultValue}`;
102
+ violations.push({
103
+ rule: 'styles-validation',
104
+ severity: 'critical',
105
+ line: path.node.loc?.start.line || 0,
106
+ column: path.node.loc?.start.column || 0,
107
+ message,
108
+ code: accessPath,
109
+ suggestion: {
110
+ text: 'Fix invalid styles property paths. Use the correct ComponentStyles interface structure.',
111
+ example: `// ❌ WRONG - Invalid property paths:
112
+ styles.fontSize.small // fontSize is not at root level
113
+ styles.colors.background // colors.background exists
114
+ styles.spacing.small // should be styles.spacing.sm
115
+
116
+ // ✅ CORRECT - Valid property paths:
117
+ styles.typography.fontSize.sm // fontSize is under typography
118
+ styles.colors.background // correct path
119
+ styles.spacing.sm // correct size name
120
+
121
+ // With safe access and fallbacks:
122
+ styles?.typography?.fontSize?.sm || '14px'
123
+ styles?.colors?.background || '#FFFFFF'
124
+ styles?.spacing?.sm || '8px'`,
125
+ },
126
+ });
127
+ }
128
+ /**
129
+ * Builds a human-readable message for an invalid styles path, including
130
+ * did-you-mean suggestions, correct paths, and available properties.
131
+ */
132
+ function buildInvalidPathMessage(accessPath, propertyChain, suggestions) {
133
+ let message = `Invalid styles property path: "${accessPath}"`;
134
+ if (suggestions.didYouMean) {
135
+ message += `\n\nDid you mean: ${suggestions.didYouMean}?`;
136
+ }
137
+ if (suggestions.correctPaths.length > 0) {
138
+ message += `\n\nThe property "${propertyChain[propertyChain.length - 1]}" exists at:`;
139
+ suggestions.correctPaths.forEach((p) => {
140
+ message += `\n - ${p}`;
141
+ });
142
+ }
143
+ if (suggestions.availableAtParent.length > 0) {
144
+ const parentPath = propertyChain.slice(0, -1).join('.');
145
+ message += `\n\nAvailable properties at ${parentPath}:`;
146
+ message += `\n ${suggestions.availableAtParent.slice(0, 5).join(', ')}`;
147
+ if (suggestions.availableAtParent.length > 5) {
148
+ message += ` (and ${suggestions.availableAtParent.length - 5} more)`;
149
+ }
150
+ }
151
+ return message;
152
+ }
153
+ //# sourceMappingURL=styles-validation.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"styles-validation.js","sourceRoot":"","sources":["../../src/runtime-rules/styles-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,OAAO,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAC;AAE7D;;;;;;;;;;;;;GAaG;AAEH,yCAAyC;AACzC,IAAI,eAAe,GAA8B,IAAI,CAAC;AACtD,SAAS,iBAAiB;IACxB,IAAI,CAAC,eAAe,EAAE,CAAC;Q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AAC,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC;QACzE,IAAI,WAAW,CAAC,iBAAiB,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;YAC7C,OAAO,IAAI,SAAS,WAAW,CAAC,iBAAiB,CAAC,MAAM,GAAG,CAAC,QAAQ,CAAC;QACvE,CAAC;IACH,CAAC;IAED,OAAO,OAAO,CAAC;AACjB,CAAC"}
@@ -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: type-inference-errors
7
+ *
8
+ * Surfaces errors found by TypeInferenceEngine (e.g., date parameter validation).
9
+ *
10
+ * DEPRECATED: This rule is being replaced by TypeCompatibilityRule in Phase 1 refactor.
11
+ * Will be removed after Phase 1 validation is complete.
12
+ *
13
+ * Severity: high/medium (depends on error type)
14
+ * Applies to: all components
15
+ *
16
+ * Closure dependencies: TypeInferenceEngine (instantiated locally, no closure)
17
+ */
18
+ export declare class TypeInferenceErrorsRule 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=type-inference-errors.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"type-inference-errors.d.ts","sourceRoot":"","sources":["../../src/runtime-rules/type-inference-errors.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;AAEhD,OAAO,EAAE,aAAa,EAAE,MAAM,6CAA6C,CAAC;AAE5E;;;;;;;;;;;;GAYG;AACH,qBACa,uBAAwB,SAAQ,YAAY;IACvD,IAAI,IAAI,WAAsC;IAC9C,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;CA2BtF"}
@@ -0,0 +1,53 @@
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 { TypeInferenceEngine } from '../type-inference-engine.js';
10
+ /**
11
+ * Rule: type-inference-errors
12
+ *
13
+ * Surfaces errors found by TypeInferenceEngine (e.g., date parameter validation).
14
+ *
15
+ * DEPRECATED: This rule is being replaced by TypeCompatibilityRule in Phase 1 refactor.
16
+ * Will be removed after Phase 1 validation is complete.
17
+ *
18
+ * Severity: high/medium (depends on error type)
19
+ * Applies to: all components
20
+ *
21
+ * Closure dependencies: TypeInferenceEngine (instantiated locally, no closure)
22
+ */
23
+ let TypeInferenceErrorsRule = class TypeInferenceErrorsRule extends BaseLintRule {
24
+ get Name() { return 'type-inference-errors'; }
25
+ get AppliesTo() { return 'all'; }
26
+ Test(ast, _componentName, componentSpec) {
27
+ const violations = [];
28
+ // Create type inference engine
29
+ const typeEngine = new TypeInferenceEngine(componentSpec);
30
+ // Run analysis synchronously (validateQueryParameters is called during traversal)
31
+ // The async part of analyze() is not needed for date validation
32
+ typeEngine.analyze(ast);
33
+ // Get errors collected during analysis
34
+ const errors = typeEngine.getErrors();
35
+ // Convert type inference errors to violations
36
+ for (const error of errors) {
37
+ violations.push({
38
+ rule: 'type-inference-errors',
39
+ severity: error.type === 'error' ? 'high' : 'medium',
40
+ line: error.line,
41
+ column: error.column,
42
+ message: error.message,
43
+ code: error.code || '',
44
+ });
45
+ }
46
+ return violations;
47
+ }
48
+ };
49
+ TypeInferenceErrorsRule = __decorate([
50
+ RegisterClass(BaseLintRule, 'type-inference-errors')
51
+ ], TypeInferenceErrorsRule);
52
+ export { TypeInferenceErrorsRule };
53
+ //# sourceMappingURL=type-inference-errors.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"type-inference-errors.js","sourceRoot":"","sources":["../../src/runtime-rules/type-inference-errors.ts"],"names":[],"mappings":";;;;;;AACA,OAAO,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAC;AACvD,OAAO,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AAE5C,OAAO,EAAE,mBAAmB,EAAE,MAAM,0BAA0B,CAAC;AAG/D;;;;;;;;;;;;GAYG;AAEI,IAAM,uBAAuB,GAA7B,MAAM,uBAAwB,SAAQ,YAAY;IACvD,IAAI,IAAI,KAAK,OAAO,uBAAuB,CAAC,CAAC,CAAC;IAC9C,IAAI,SAAS,KAA+B,OAAO,KAAK,CAAC,CAAC,CAAC;IAE3D,IAAI,CAAC,GAAW,EAAE,cAAsB,EAAE,aAA6B;QACrE,MAAM,UAAU,GAAgB,EAAE,CAAC;QAEnC,+BAA+B;QAC/B,MAAM,UAAU,GAAG,IAAI,mBAAmB,CAAC,aAAa,CAAC,CAAC;QAE1D,kFAAkF;QAClF,gEAAgE;QAChE,UAAU,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC;QAExB,uCAAuC;QACvC,MAAM,MAAM,GAAG,UAAU,CAAC,SAAS,EAAE,CAAC;QAEtC,8CAA8C;QAC9C,KAAK,MAAM,KAAK,IAAI,MAAM,EAAE,CAAC;YAC3B,UAAU,CAAC,IAAI,CAAC;gBACd,IAAI,EAAE,uBAAuB;gBAC7B,QAAQ,EAAE,KAAK,CAAC,IAAI,KAAK,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,QAAQ;gBACpD,IAAI,EAAE,KAAK,CAAC,IAAI;gBAChB,MAAM,EAAE,KAAK,CAAC,MAAM;gBACpB,OAAO,EAAE,KAAK,CAAC,OAAO;gBACtB,IAAI,EAAE,KAAK,CAAC,IAAI,IAAI,EAAE;aACvB,CAAC,CAAC;QACL,CAAC;QAED,OAAO,UAAU,CAAC;IAClB,CAAC;CACJ,CAAA;AA/BY,uBAAuB;IADnC,aAAa,CAAC,YAAY,EAAE,uBAAuB,CAAC;GACxC,uBAAuB,CA+BnC"}
@@ -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: type-mismatch-operation
7
+ *
8
+ * Validates that operations are type-safe (e.g., no arithmetic on strings, array methods on non-arrays).
9
+ *
10
+ * DEPRECATED: This rule is being replaced by TypeCompatibilityRule in Phase 1 refactor.
11
+ * Will be removed after Phase 1 validation is complete.
12
+ *
13
+ * Severity: high
14
+ * Applies to: all components
15
+ *
16
+ * Closure dependencies: TypeInferenceEngine, ControlFlowAnalyzer (instantiated locally, no closure)
17
+ */
18
+ export declare class TypeMismatchOperationRule 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=type-mismatch-operation.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"type-mismatch-operation.d.ts","sourceRoot":"","sources":["../../src/runtime-rules/type-mismatch-operation.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;AAGhD,OAAO,EAAE,aAAa,EAAE,MAAM,6CAA6C,CAAC;AAE5E;;;;;;;;;;;;GAYG;AACH,qBACa,yBAA0B,SAAQ,YAAY;IACzD,IAAI,IAAI,WAAwC;IAChD,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;CAkItF"}
@@ -0,0 +1,145 @@
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
+ import { TypeInferenceEngine } from '../type-inference-engine.js';
12
+ import { ControlFlowAnalyzer } from '../control-flow-analyzer.js';
13
+ /**
14
+ * Rule: type-mismatch-operation
15
+ *
16
+ * Validates that operations are type-safe (e.g., no arithmetic on strings, array methods on non-arrays).
17
+ *
18
+ * DEPRECATED: This rule is being replaced by TypeCompatibilityRule in Phase 1 refactor.
19
+ * Will be removed after Phase 1 validation is complete.
20
+ *
21
+ * Severity: high
22
+ * Applies to: all components
23
+ *
24
+ * Closure dependencies: TypeInferenceEngine, ControlFlowAnalyzer (instantiated locally, no closure)
25
+ */
26
+ let TypeMismatchOperationRule = class TypeMismatchOperationRule extends BaseLintRule {
27
+ get Name() { return 'type-mismatch-operation'; }
28
+ get AppliesTo() { return 'all'; }
29
+ Test(ast, _componentName, componentSpec) {
30
+ const violations = [];
31
+ // Create type inference engine
32
+ const typeEngine = new TypeInferenceEngine(componentSpec);
33
+ // Create control flow analyzer
34
+ const cfa = new ControlFlowAnalyzer(ast, componentSpec);
35
+ // Run analysis synchronously (the async part is not needed for basic inference)
36
+ typeEngine.analyze(ast);
37
+ traverse(ast, {
38
+ // Check binary operations for type mismatches
39
+ BinaryExpression(path) {
40
+ const node = path.node;
41
+ const operator = node.operator;
42
+ // Skip comparison operators - they work with any types
43
+ if (['==', '!=', '===', '!==', '<', '<=', '>', '>=', 'in', 'instanceof'].includes(operator)) {
44
+ return;
45
+ }
46
+ // Check arithmetic operators (should be numbers)
47
+ if (['-', '*', '/', '%', '**', '|', '&', '^', '<<', '>>', '>>>'].includes(operator)) {
48
+ // Skip if left is PrivateName
49
+ if (t.isPrivateName(node.left))
50
+ return;
51
+ const leftType = typeEngine.inferExpressionType(node.left, path);
52
+ const rightType = typeEngine.inferExpressionType(node.right, path);
53
+ // Special case: Date - Date is valid (subtraction only)
54
+ if (operator === '-' && leftType.type === 'Date' && rightType.type === 'Date') {
55
+ // Date - Date produces a number (milliseconds), this is valid
56
+ return;
57
+ }
58
+ // Check if both sides are guarded by typeof checks using Control Flow Analyzer
59
+ const leftGuarded = cfa.isNarrowedToType(node.left, path, 'number');
60
+ const rightGuarded = cfa.isNarrowedToType(node.right, path, 'number');
61
+ // Only flag if we know the type is wrong (not unknown) AND not guarded by typeof
62
+ if (!leftGuarded && leftType.type !== 'unknown' && leftType.type !== 'number' && leftType.type !== 'Date') {
63
+ violations.push({
64
+ rule: 'type-mismatch-operation',
65
+ severity: 'high',
66
+ line: node.loc?.start.line || 0,
67
+ column: node.loc?.start.column || 0,
68
+ message: `Arithmetic operator "${operator}" used with ${leftType.type} on left side. Expected number.`,
69
+ code: `Convert to number: Number(value) ${operator} ...`,
70
+ });
71
+ }
72
+ if (!rightGuarded && rightType.type !== 'unknown' && rightType.type !== 'number' && rightType.type !== 'Date') {
73
+ violations.push({
74
+ rule: 'type-mismatch-operation',
75
+ severity: 'high',
76
+ line: node.loc?.start.line || 0,
77
+ column: node.loc?.start.column || 0,
78
+ message: `Arithmetic operator "${operator}" used with ${rightType.type} on right side. Expected number.`,
79
+ code: `Convert to number: ... ${operator} Number(value)`,
80
+ });
81
+ }
82
+ }
83
+ },
84
+ // Check array method calls on non-arrays
85
+ CallExpression(path) {
86
+ const node = path.node;
87
+ if (t.isMemberExpression(node.callee) && t.isIdentifier(node.callee.property)) {
88
+ const methodName = node.callee.property.name;
89
+ // Array-specific methods. Excludes `slice` and `concat` because
90
+ // both exist on String.prototype with identical signatures/semantics
91
+ // — flagging them on inferred-string types produces false positives
92
+ // (e.g. `someString.slice(1)`). The remaining names are genuinely
93
+ // array-only.
94
+ const arrayOnlyMethods = [
95
+ 'push', 'pop', 'shift', 'unshift', 'splice',
96
+ 'map', 'filter', 'reduce', 'reduceRight', 'forEach',
97
+ 'find', 'findIndex', 'some', 'every', 'flat', 'flatMap',
98
+ 'sort', 'reverse', 'join', 'fill', 'copyWithin',
99
+ ];
100
+ if (arrayOnlyMethods.includes(methodName)) {
101
+ const objectType = typeEngine.inferExpressionType(node.callee.object, path);
102
+ // Only flag if we know it's definitely not an array
103
+ if (objectType.type !== 'unknown' && objectType.type !== 'array') {
104
+ violations.push({
105
+ rule: 'type-mismatch-operation',
106
+ severity: 'high',
107
+ line: node.loc?.start.line || 0,
108
+ column: node.loc?.start.column || 0,
109
+ message: `Array method "${methodName}()" called on ${objectType.type}. This will fail at runtime.`,
110
+ code: `Ensure value is an array before calling .${methodName}()`,
111
+ });
112
+ }
113
+ }
114
+ // String-specific methods
115
+ const stringOnlyMethods = [
116
+ 'charAt', 'charCodeAt', 'codePointAt', 'substring', 'substr',
117
+ 'toUpperCase', 'toLowerCase', 'trim', 'trimStart', 'trimEnd',
118
+ 'padStart', 'padEnd', 'repeat', 'split', 'match', 'replace',
119
+ 'replaceAll', 'search', 'localeCompare', 'normalize',
120
+ ];
121
+ if (stringOnlyMethods.includes(methodName)) {
122
+ const objectType = typeEngine.inferExpressionType(node.callee.object, path);
123
+ // Only flag if we know it's definitely not a string
124
+ if (objectType.type !== 'unknown' && objectType.type !== 'string') {
125
+ violations.push({
126
+ rule: 'type-mismatch-operation',
127
+ severity: 'high',
128
+ line: node.loc?.start.line || 0,
129
+ column: node.loc?.start.column || 0,
130
+ message: `String method "${methodName}()" called on ${objectType.type}. This may fail at runtime.`,
131
+ code: `Ensure value is a string or convert: String(value).${methodName}()`,
132
+ });
133
+ }
134
+ }
135
+ }
136
+ },
137
+ });
138
+ return violations;
139
+ }
140
+ };
141
+ TypeMismatchOperationRule = __decorate([
142
+ RegisterClass(BaseLintRule, 'type-mismatch-operation')
143
+ ], TypeMismatchOperationRule);
144
+ export { TypeMismatchOperationRule };
145
+ //# sourceMappingURL=type-mismatch-operation.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"type-mismatch-operation.js","sourceRoot":"","sources":["../../src/runtime-rules/type-mismatch-operation.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;AAE5C,OAAO,EAAE,mBAAmB,EAAE,MAAM,0BAA0B,CAAC;AAC/D,OAAO,EAAE,mBAAmB,EAAE,MAAM,0BAA0B,CAAC;AAG/D;;;;;;;;;;;;GAYG;AAEI,IAAM,yBAAyB,GAA/B,MAAM,yBAA0B,SAAQ,YAAY;IACzD,IAAI,IAAI,KAAK,OAAO,yBAAyB,CAAC,CAAC,CAAC;IAChD,IAAI,SAAS,KAA+B,OAAO,KAAK,CAAC,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AkB,UAAU,iBAAiB,UAAU,CAAC,IAAI,6BAA6B;gCAClG,IAAI,EAAE,sDAAsD,UAAU,IAAI;6BAC3E,CAAC,CAAC;wBACL,CAAC;oBACH,CAAC;gBACH,CAAC;YACH,CAAC;SACF,CAAC,CAAC;QAEH,OAAO,UAAU,CAAC;IAClB,CAAC;CACJ,CAAA;AAtIY,yBAAyB;IADrC,aAAa,CAAC,YAAY,EAAE,yBAAyB,CAAC;GAC1C,yBAAyB,CAsIrC"}
@@ -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: undefined-component-usage
7
+ *
8
+ * Detects components that are destructured from the components prop but never used
9
+ * in JSX. These may be missing from the component spec's dependencies array or
10
+ * are simply unused.
11
+ *
12
+ * Severity: low (informational warning)
13
+ * Applies to: all components
14
+ */
15
+ export declare class UndefinedComponentUsageRule 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=undefined-component-usage.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"undefined-component-usage.d.ts","sourceRoot":"","sources":["../../src/runtime-rules/undefined-component-usage.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,2BAA4B,SAAQ,YAAY;IAC3D,IAAI,IAAI,WAA0C;IAClD,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;CAuHrF"}
@@ -0,0 +1,138 @@
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: undefined-component-usage
13
+ *
14
+ * Detects components that are destructured from the components prop but never used
15
+ * in JSX. These may be missing from the component spec's dependencies array or
16
+ * are simply unused.
17
+ *
18
+ * Severity: low (informational warning)
19
+ * Applies to: all components
20
+ */
21
+ let UndefinedComponentUsageRule = class UndefinedComponentUsageRule extends BaseLintRule {
22
+ get Name() { return 'undefined-component-usage'; }
23
+ get AppliesTo() { return 'all'; }
24
+ Test(ast, componentName, componentSpec) {
25
+ const violations = [];
26
+ const componentsFromProps = new Set();
27
+ const componentsUsedInJSX = new Set();
28
+ let hasComponentsProp = false;
29
+ traverse(ast, {
30
+ // First, find what's destructured from the components prop
31
+ VariableDeclarator(path) {
32
+ if (t.isObjectPattern(path.node.id) && t.isIdentifier(path.node.init)) {
33
+ // Check if destructuring from 'components'
34
+ if (path.node.init.name === 'components') {
35
+ hasComponentsProp = true;
36
+ for (const prop of path.node.id.properties) {
37
+ if (t.isObjectProperty(prop) && t.isIdentifier(prop.key)) {
38
+ componentsFromProps.add(prop.key.name);
39
+ }
40
+ }
41
+ }
42
+ }
43
+ },
44
+ // Also check object destructuring in function parameters
45
+ FunctionDeclaration(path) {
46
+ if (path.node.id && path.node.id.name === componentName && path.node.params[0]) {
47
+ const param = path.node.params[0];
48
+ if (t.isObjectPattern(param)) {
49
+ for (const prop of param.properties) {
50
+ if (t.isObjectProperty(prop) && t.isIdentifier(prop.key) && prop.key.name === 'components') {
51
+ hasComponentsProp = true;
52
+ // Look for nested destructuring like { components: { A, B } }
53
+ if (t.isObjectPattern(prop.value)) {
54
+ for (const innerProp of prop.value.properties) {
55
+ if (t.isObjectProperty(innerProp) && t.isIdentifier(innerProp.key)) {
56
+ componentsFromProps.add(innerProp.key.name);
57
+ }
58
+ }
59
+ }
60
+ }
61
+ }
62
+ }
63
+ }
64
+ },
65
+ // Track JSX element usage
66
+ JSXElement(path) {
67
+ const openingElement = path.node.openingElement;
68
+ // Check for direct usage (e.g., <ComponentName>)
69
+ if (t.isJSXIdentifier(openingElement.name) && /^[A-Z]/.test(openingElement.name.name)) {
70
+ const componentName = openingElement.name.name;
71
+ // Only track if it's from our destructured components
72
+ if (componentsFromProps.has(componentName)) {
73
+ componentsUsedInJSX.add(componentName);
74
+ }
75
+ }
76
+ // Also check for components.X pattern (e.g., <components.ComponentName>)
77
+ if (t.isJSXMemberExpression(openingElement.name)) {
78
+ if (t.isJSXIdentifier(openingElement.name.object) &&
79
+ openingElement.name.object.name === 'components' &&
80
+ t.isJSXIdentifier(openingElement.name.property)) {
81
+ const componentName = openingElement.name.property.name;
82
+ // Track usage of components accessed via dot notation
83
+ if (componentsFromProps.has(componentName)) {
84
+ componentsUsedInJSX.add(componentName);
85
+ }
86
+ }
87
+ }
88
+ },
89
+ });
90
+ // Only check if we found a components prop
91
+ if (hasComponentsProp && componentsFromProps.size > 0) {
92
+ // Find components that are destructured but never used
93
+ const unusedComponents = Array.from(componentsFromProps).filter((comp) => !componentsUsedInJSX.has(comp));
94
+ if (unusedComponents.length > 0) {
95
+ violations.push({
96
+ rule: 'undefined-component-usage',
97
+ severity: 'low',
98
+ line: 1,
99
+ column: 0,
100
+ message: `Component destructures ${unusedComponents.join(', ')} from components prop but never uses them. These may be missing from the component spec's dependencies array.`,
101
+ suggestion: {
102
+ text: 'Ensure all components destructured from the components prop are defined in the component spec dependencies',
103
+ example: `// Component spec should include all referenced components:
104
+ {
105
+ "name": "MyComponent",
106
+ "code": "...",
107
+ "dependencies": [
108
+ {
109
+ "name": "ModelTreeView",
110
+ "code": "function ModelTreeView({ ... }) { ... }"
111
+ },
112
+ {
113
+ "name": "PromptTable",
114
+ "code": "function PromptTable({ ... }) { ... }"
115
+ },
116
+ {
117
+ "name": "FilterPanel",
118
+ "code": "function FilterPanel({ ... }) { ... }"
119
+ }
120
+ // Add ALL components referenced in the root component
121
+ ]
122
+ }
123
+
124
+ // Then in your component:
125
+ const { ModelTreeView, PromptTable, FilterPanel } = components;
126
+ // All these will be available`,
127
+ },
128
+ });
129
+ }
130
+ }
131
+ return violations;
132
+ }
133
+ };
134
+ UndefinedComponentUsageRule = __decorate([
135
+ RegisterClass(BaseLintRule, 'undefined-component-usage')
136
+ ], UndefinedComponentUsageRule);
137
+ export { UndefinedComponentUsageRule };
138
+ //# sourceMappingURL=undefined-component-usage.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"undefined-component-usage.js","sourceRoot":"","sources":["../../src/runtime-rules/undefined-component-usage.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,2BAA2B,GAAjC,MAAM,2BAA4B,SAAQ,YAAY;IAC3D,IAAI,IAAI,KAAK,OAAO,2BAA2B,CAAC,CAAC,CAAC;IAClD,IAAI,SAAS,KAA+B,O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;;;;;;;;;;;;;;+BAuBU;qBACpB;iBACF,CAAC,CAAC;YACL,CAAC;QACH,CAAC;QAED,OAAO,UAAU,CAAC;IAClB,CAAC;CACJ,CAAA;AA3HY,2BAA2B;IADvC,aAAa,CAAC,YAAY,EAAE,2BAA2B,CAAC;GAC5C,2BAA2B,CA2HvC"}
@@ -0,0 +1,25 @@
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: undefined-jsx-component
7
+ *
8
+ * DISABLED: Too many false positives - needs better dependency/library checking.
9
+ * Re-enable after improving to check dependencies before assuming library components.
10
+ *
11
+ * Detects JSX elements that reference undefined components, providing guidance
12
+ * on how to properly access library components, dependency components, etc.
13
+ *
14
+ * Severity: critical/high/medium
15
+ * Applies to: all components
16
+ *
17
+ * NOTE: This rule is currently commented out in the monolith. Extracted as-is for
18
+ * future re-enablement.
19
+ */
20
+ export declare class UndefinedJsxComponentRule extends BaseLintRule {
21
+ get Name(): string;
22
+ get AppliesTo(): 'all' | 'child' | 'root';
23
+ Test(ast: t.File, componentName: string, componentSpec?: ComponentSpec): Violation[];
24
+ }
25
+ //# sourceMappingURL=undefined-jsx-component.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"undefined-jsx-component.d.ts","sourceRoot":"","sources":["../../src/runtime-rules/undefined-jsx-component.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;AA2B5E;;;;;;;;;;;;;;GAcG;AACH,qBACa,yBAA0B,SAAQ,YAAY;IACzD,IAAI,IAAI,WAAwC;IAChD,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;CAgOrF"}