@memberjunction/react-test-harness 5.29.0 → 5.30.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (324) hide show
  1. package/README.md +140 -153
  2. package/dist/__tests__/setup/vitest-setup.d.ts +11 -0
  3. package/dist/__tests__/setup/vitest-setup.d.ts.map +1 -0
  4. package/dist/__tests__/setup/vitest-setup.js +73 -0
  5. package/dist/__tests__/setup/vitest-setup.js.map +1 -0
  6. package/dist/index.d.ts +1 -0
  7. package/dist/index.d.ts.map +1 -1
  8. package/dist/index.js +1 -0
  9. package/dist/index.js.map +1 -1
  10. package/dist/lib/component-linter.d.ts +10 -13
  11. package/dist/lib/component-linter.d.ts.map +1 -1
  12. package/dist/lib/component-linter.js +96 -8552
  13. package/dist/lib/component-linter.js.map +1 -1
  14. package/dist/lib/component-runner.d.ts.map +1 -1
  15. package/dist/lib/component-runner.js +34 -10
  16. package/dist/lib/component-runner.js.map +1 -1
  17. package/dist/lib/lint-rule.d.ts +70 -0
  18. package/dist/lib/lint-rule.d.ts.map +1 -0
  19. package/dist/lib/lint-rule.js +41 -0
  20. package/dist/lib/lint-rule.js.map +1 -0
  21. package/dist/lib/lint-utils.d.ts +131 -0
  22. package/dist/lib/lint-utils.d.ts.map +1 -0
  23. package/dist/lib/lint-utils.js +358 -0
  24. package/dist/lib/lint-utils.js.map +1 -0
  25. package/dist/lib/prop-value-extractor.d.ts +2 -2
  26. package/dist/lib/prop-value-extractor.js +2 -2
  27. package/dist/lib/runtime-rules/ai-tools-availability-check.d.ts +9 -0
  28. package/dist/lib/runtime-rules/ai-tools-availability-check.d.ts.map +1 -0
  29. package/dist/lib/runtime-rules/ai-tools-availability-check.js +223 -0
  30. package/dist/lib/runtime-rules/ai-tools-availability-check.js.map +1 -0
  31. package/dist/lib/runtime-rules/callback-event-validation.d.ts +22 -0
  32. package/dist/lib/runtime-rules/callback-event-validation.d.ts.map +1 -0
  33. package/dist/lib/runtime-rules/callback-event-validation.js +561 -0
  34. package/dist/lib/runtime-rules/callback-event-validation.js.map +1 -0
  35. package/dist/lib/runtime-rules/chart-field-validation.d.ts +10 -0
  36. package/dist/lib/runtime-rules/chart-field-validation.d.ts.map +1 -0
  37. package/dist/lib/runtime-rules/chart-field-validation.js +270 -0
  38. package/dist/lib/runtime-rules/chart-field-validation.js.map +1 -0
  39. package/dist/lib/runtime-rules/child-component-prop-validation.d.ts +10 -0
  40. package/dist/lib/runtime-rules/child-component-prop-validation.d.ts.map +1 -0
  41. package/dist/lib/runtime-rules/child-component-prop-validation.js +447 -0
  42. package/dist/lib/runtime-rules/child-component-prop-validation.js.map +1 -0
  43. package/dist/lib/runtime-rules/component-name-mismatch.d.ts +19 -0
  44. package/dist/lib/runtime-rules/component-name-mismatch.d.ts.map +1 -0
  45. package/dist/lib/runtime-rules/component-name-mismatch.js +82 -0
  46. package/dist/lib/runtime-rules/component-name-mismatch.js.map +1 -0
  47. package/dist/lib/runtime-rules/component-not-in-dependencies.d.ts +20 -0
  48. package/dist/lib/runtime-rules/component-not-in-dependencies.d.ts.map +1 -0
  49. package/dist/lib/runtime-rules/component-not-in-dependencies.js +92 -0
  50. package/dist/lib/runtime-rules/component-not-in-dependencies.js.map +1 -0
  51. package/dist/lib/runtime-rules/component-props-validation.d.ts +25 -0
  52. package/dist/lib/runtime-rules/component-props-validation.d.ts.map +1 -0
  53. package/dist/lib/runtime-rules/component-props-validation.js +228 -0
  54. package/dist/lib/runtime-rules/component-props-validation.js.map +1 -0
  55. package/dist/lib/runtime-rules/component-usage-without-destructuring.d.ts +20 -0
  56. package/dist/lib/runtime-rules/component-usage-without-destructuring.d.ts.map +1 -0
  57. package/dist/lib/runtime-rules/component-usage-without-destructuring.js +124 -0
  58. package/dist/lib/runtime-rules/component-usage-without-destructuring.js.map +1 -0
  59. package/dist/lib/runtime-rules/data-result-validation.d.ts +9 -0
  60. package/dist/lib/runtime-rules/data-result-validation.d.ts.map +1 -0
  61. package/dist/lib/runtime-rules/data-result-validation.js +763 -0
  62. package/dist/lib/runtime-rules/data-result-validation.js.map +1 -0
  63. package/dist/lib/runtime-rules/datagrid-field-validation.d.ts +10 -0
  64. package/dist/lib/runtime-rules/datagrid-field-validation.d.ts.map +1 -0
  65. package/dist/lib/runtime-rules/datagrid-field-validation.js +245 -0
  66. package/dist/lib/runtime-rules/datagrid-field-validation.js.map +1 -0
  67. package/dist/lib/runtime-rules/dependency-shadowing.d.ts +20 -0
  68. package/dist/lib/runtime-rules/dependency-shadowing.d.ts.map +1 -0
  69. package/dist/lib/runtime-rules/dependency-shadowing.js +147 -0
  70. package/dist/lib/runtime-rules/dependency-shadowing.js.map +1 -0
  71. package/dist/lib/runtime-rules/entity-field-access-validation.d.ts +12 -0
  72. package/dist/lib/runtime-rules/entity-field-access-validation.d.ts.map +1 -0
  73. package/dist/lib/runtime-rules/entity-field-access-validation.js +304 -0
  74. package/dist/lib/runtime-rules/entity-field-access-validation.js.map +1 -0
  75. package/dist/lib/runtime-rules/event-parameter-validation.d.ts +22 -0
  76. package/dist/lib/runtime-rules/event-parameter-validation.d.ts.map +1 -0
  77. package/dist/lib/runtime-rules/event-parameter-validation.js +406 -0
  78. package/dist/lib/runtime-rules/event-parameter-validation.js.map +1 -0
  79. package/dist/lib/runtime-rules/index.d.ts +59 -0
  80. package/dist/lib/runtime-rules/index.d.ts.map +1 -0
  81. package/dist/lib/runtime-rules/index.js +60 -0
  82. package/dist/lib/runtime-rules/index.js.map +1 -0
  83. package/dist/lib/runtime-rules/library-variable-names.d.ts +24 -0
  84. package/dist/lib/runtime-rules/library-variable-names.d.ts.map +1 -0
  85. package/dist/lib/runtime-rules/library-variable-names.js +88 -0
  86. package/dist/lib/runtime-rules/library-variable-names.js.map +1 -0
  87. package/dist/lib/runtime-rules/no-child-implementation.d.ts +18 -0
  88. package/dist/lib/runtime-rules/no-child-implementation.d.ts.map +1 -0
  89. package/dist/lib/runtime-rules/no-child-implementation.js +57 -0
  90. package/dist/lib/runtime-rules/no-child-implementation.js.map +1 -0
  91. package/dist/lib/runtime-rules/no-data-prop.d.ts +22 -0
  92. package/dist/lib/runtime-rules/no-data-prop.d.ts.map +1 -0
  93. package/dist/lib/runtime-rules/no-data-prop.js +111 -0
  94. package/dist/lib/runtime-rules/no-data-prop.js.map +1 -0
  95. package/dist/lib/runtime-rules/no-export-statements.d.ts +18 -0
  96. package/dist/lib/runtime-rules/no-export-statements.d.ts.map +1 -0
  97. package/dist/lib/runtime-rules/no-export-statements.js +143 -0
  98. package/dist/lib/runtime-rules/no-export-statements.js.map +1 -0
  99. package/dist/lib/runtime-rules/no-iife-wrapper.d.ts +18 -0
  100. package/dist/lib/runtime-rules/no-iife-wrapper.d.ts.map +1 -0
  101. package/dist/lib/runtime-rules/no-iife-wrapper.js +217 -0
  102. package/dist/lib/runtime-rules/no-iife-wrapper.js.map +1 -0
  103. package/dist/lib/runtime-rules/no-import-statements.d.ts +18 -0
  104. package/dist/lib/runtime-rules/no-import-statements.d.ts.map +1 -0
  105. package/dist/lib/runtime-rules/no-import-statements.js +65 -0
  106. package/dist/lib/runtime-rules/no-import-statements.js.map +1 -0
  107. package/dist/lib/runtime-rules/no-react-destructuring.d.ts +18 -0
  108. package/dist/lib/runtime-rules/no-react-destructuring.d.ts.map +1 -0
  109. package/dist/lib/runtime-rules/no-react-destructuring.js +60 -0
  110. package/dist/lib/runtime-rules/no-react-destructuring.js.map +1 -0
  111. package/dist/lib/runtime-rules/no-require-statements.d.ts +18 -0
  112. package/dist/lib/runtime-rules/no-require-statements.d.ts.map +1 -0
  113. package/dist/lib/runtime-rules/no-require-statements.js +109 -0
  114. package/dist/lib/runtime-rules/no-require-statements.js.map +1 -0
  115. package/dist/lib/runtime-rules/no-return-component.d.ts +18 -0
  116. package/dist/lib/runtime-rules/no-return-component.d.ts.map +1 -0
  117. package/dist/lib/runtime-rules/no-return-component.js +106 -0
  118. package/dist/lib/runtime-rules/no-return-component.js.map +1 -0
  119. package/dist/lib/runtime-rules/no-use-reducer.d.ts +19 -0
  120. package/dist/lib/runtime-rules/no-use-reducer.d.ts.map +1 -0
  121. package/dist/lib/runtime-rules/no-use-reducer.js +78 -0
  122. package/dist/lib/runtime-rules/no-use-reducer.js.map +1 -0
  123. package/dist/lib/runtime-rules/no-window-access.d.ts +23 -0
  124. package/dist/lib/runtime-rules/no-window-access.d.ts.map +1 -0
  125. package/dist/lib/runtime-rules/no-window-access.js +136 -0
  126. package/dist/lib/runtime-rules/no-window-access.js.map +1 -0
  127. package/dist/lib/runtime-rules/noisy-settings-updates.d.ts +18 -0
  128. package/dist/lib/runtime-rules/noisy-settings-updates.d.ts.map +1 -0
  129. package/dist/lib/runtime-rules/noisy-settings-updates.js +110 -0
  130. package/dist/lib/runtime-rules/noisy-settings-updates.js.map +1 -0
  131. package/dist/lib/runtime-rules/pass-standard-props.d.ts +19 -0
  132. package/dist/lib/runtime-rules/pass-standard-props.d.ts.map +1 -0
  133. package/dist/lib/runtime-rules/pass-standard-props.js +82 -0
  134. package/dist/lib/runtime-rules/pass-standard-props.js.map +1 -0
  135. package/dist/lib/runtime-rules/prefer-async-await.d.ts +17 -0
  136. package/dist/lib/runtime-rules/prefer-async-await.d.ts.map +1 -0
  137. package/dist/lib/runtime-rules/prefer-async-await.js +52 -0
  138. package/dist/lib/runtime-rules/prefer-async-await.js.map +1 -0
  139. package/dist/lib/runtime-rules/prefer-jsx-syntax.d.ts +17 -0
  140. package/dist/lib/runtime-rules/prefer-jsx-syntax.d.ts.map +1 -0
  141. package/dist/lib/runtime-rules/prefer-jsx-syntax.js +51 -0
  142. package/dist/lib/runtime-rules/prefer-jsx-syntax.js.map +1 -0
  143. package/dist/lib/runtime-rules/prop-state-sync.d.ts +19 -0
  144. package/dist/lib/runtime-rules/prop-state-sync.d.ts.map +1 -0
  145. package/dist/lib/runtime-rules/prop-state-sync.js +76 -0
  146. package/dist/lib/runtime-rules/prop-state-sync.js.map +1 -0
  147. package/dist/lib/runtime-rules/property-name-consistency.d.ts +20 -0
  148. package/dist/lib/runtime-rules/property-name-consistency.d.ts.map +1 -0
  149. package/dist/lib/runtime-rules/property-name-consistency.js +172 -0
  150. package/dist/lib/runtime-rules/property-name-consistency.js.map +1 -0
  151. package/dist/lib/runtime-rules/query-result-field-access-validation.d.ts +10 -0
  152. package/dist/lib/runtime-rules/query-result-field-access-validation.d.ts.map +1 -0
  153. package/dist/lib/runtime-rules/query-result-field-access-validation.js +304 -0
  154. package/dist/lib/runtime-rules/query-result-field-access-validation.js.map +1 -0
  155. package/dist/lib/runtime-rules/react-component-naming.d.ts +19 -0
  156. package/dist/lib/runtime-rules/react-component-naming.d.ts.map +1 -0
  157. package/dist/lib/runtime-rules/react-component-naming.js +72 -0
  158. package/dist/lib/runtime-rules/react-component-naming.js.map +1 -0
  159. package/dist/lib/runtime-rules/react-hooks-rules.d.ts +27 -0
  160. package/dist/lib/runtime-rules/react-hooks-rules.d.ts.map +1 -0
  161. package/dist/lib/runtime-rules/react-hooks-rules.js +223 -0
  162. package/dist/lib/runtime-rules/react-hooks-rules.js.map +1 -0
  163. package/dist/lib/runtime-rules/required-queries-not-called.d.ts +19 -0
  164. package/dist/lib/runtime-rules/required-queries-not-called.d.ts.map +1 -0
  165. package/dist/lib/runtime-rules/required-queries-not-called.js +146 -0
  166. package/dist/lib/runtime-rules/required-queries-not-called.js.map +1 -0
  167. package/dist/lib/runtime-rules/runquery-call-validation.d.ts +11 -0
  168. package/dist/lib/runtime-rules/runquery-call-validation.d.ts.map +1 -0
  169. package/dist/lib/runtime-rules/runquery-call-validation.js +886 -0
  170. package/dist/lib/runtime-rules/runquery-call-validation.js.map +1 -0
  171. package/dist/lib/runtime-rules/runview-call-validation.d.ts +10 -0
  172. package/dist/lib/runtime-rules/runview-call-validation.d.ts.map +1 -0
  173. package/dist/lib/runtime-rules/runview-call-validation.js +336 -0
  174. package/dist/lib/runtime-rules/runview-call-validation.js.map +1 -0
  175. package/dist/lib/runtime-rules/saved-user-settings-pattern.d.ts +19 -0
  176. package/dist/lib/runtime-rules/saved-user-settings-pattern.d.ts.map +1 -0
  177. package/dist/lib/runtime-rules/saved-user-settings-pattern.js +90 -0
  178. package/dist/lib/runtime-rules/saved-user-settings-pattern.js.map +1 -0
  179. package/dist/lib/runtime-rules/search-availability-check.d.ts +9 -0
  180. package/dist/lib/runtime-rules/search-availability-check.d.ts.map +1 -0
  181. package/dist/lib/runtime-rules/search-availability-check.js +220 -0
  182. package/dist/lib/runtime-rules/search-availability-check.js.map +1 -0
  183. package/dist/lib/runtime-rules/search-call-validation.d.ts +9 -0
  184. package/dist/lib/runtime-rules/search-call-validation.d.ts.map +1 -0
  185. package/dist/lib/runtime-rules/search-call-validation.js +336 -0
  186. package/dist/lib/runtime-rules/search-call-validation.js.map +1 -0
  187. package/dist/lib/runtime-rules/server-reload-on-client-operation.d.ts +18 -0
  188. package/dist/lib/runtime-rules/server-reload-on-client-operation.d.ts.map +1 -0
  189. package/dist/lib/runtime-rules/server-reload-on-client-operation.js +107 -0
  190. package/dist/lib/runtime-rules/server-reload-on-client-operation.js.map +1 -0
  191. package/dist/lib/runtime-rules/single-function-only.d.ts +18 -0
  192. package/dist/lib/runtime-rules/single-function-only.d.ts.map +1 -0
  193. package/dist/lib/runtime-rules/single-function-only.js +103 -0
  194. package/dist/lib/runtime-rules/single-function-only.js.map +1 -0
  195. package/dist/lib/runtime-rules/string-replace-all-occurrences.d.ts +19 -0
  196. package/dist/lib/runtime-rules/string-replace-all-occurrences.d.ts.map +1 -0
  197. package/dist/lib/runtime-rules/string-replace-all-occurrences.js +109 -0
  198. package/dist/lib/runtime-rules/string-replace-all-occurrences.js.map +1 -0
  199. package/dist/lib/runtime-rules/string-template-validation.d.ts +22 -0
  200. package/dist/lib/runtime-rules/string-template-validation.d.ts.map +1 -0
  201. package/dist/lib/runtime-rules/string-template-validation.js +163 -0
  202. package/dist/lib/runtime-rules/string-template-validation.js.map +1 -0
  203. package/dist/lib/runtime-rules/styles-validation.d.ts +10 -0
  204. package/dist/lib/runtime-rules/styles-validation.d.ts.map +1 -0
  205. package/dist/lib/runtime-rules/styles-validation.js +153 -0
  206. package/dist/lib/runtime-rules/styles-validation.js.map +1 -0
  207. package/dist/lib/runtime-rules/type-inference-errors.d.ts +23 -0
  208. package/dist/lib/runtime-rules/type-inference-errors.d.ts.map +1 -0
  209. package/dist/lib/runtime-rules/type-inference-errors.js +53 -0
  210. package/dist/lib/runtime-rules/type-inference-errors.js.map +1 -0
  211. package/dist/lib/runtime-rules/type-mismatch-operation.d.ts +23 -0
  212. package/dist/lib/runtime-rules/type-mismatch-operation.d.ts.map +1 -0
  213. package/dist/lib/runtime-rules/type-mismatch-operation.js +141 -0
  214. package/dist/lib/runtime-rules/type-mismatch-operation.js.map +1 -0
  215. package/dist/lib/runtime-rules/undefined-component-usage.d.ts +20 -0
  216. package/dist/lib/runtime-rules/undefined-component-usage.d.ts.map +1 -0
  217. package/dist/lib/runtime-rules/undefined-component-usage.js +138 -0
  218. package/dist/lib/runtime-rules/undefined-component-usage.js.map +1 -0
  219. package/dist/lib/runtime-rules/undefined-jsx-component.d.ts +25 -0
  220. package/dist/lib/runtime-rules/undefined-jsx-component.d.ts.map +1 -0
  221. package/dist/lib/runtime-rules/undefined-jsx-component.js +269 -0
  222. package/dist/lib/runtime-rules/undefined-jsx-component.js.map +1 -0
  223. package/dist/lib/runtime-rules/unsafe-array-operations.d.ts +25 -0
  224. package/dist/lib/runtime-rules/unsafe-array-operations.d.ts.map +1 -0
  225. package/dist/lib/runtime-rules/unsafe-array-operations.js +347 -0
  226. package/dist/lib/runtime-rules/unsafe-array-operations.js.map +1 -0
  227. package/dist/lib/runtime-rules/unsafe-formatting-methods.d.ts +24 -0
  228. package/dist/lib/runtime-rules/unsafe-formatting-methods.d.ts.map +1 -0
  229. package/dist/lib/runtime-rules/unsafe-formatting-methods.js +277 -0
  230. package/dist/lib/runtime-rules/unsafe-formatting-methods.js.map +1 -0
  231. package/dist/lib/runtime-rules/unused-component-dependencies.d.ts +19 -0
  232. package/dist/lib/runtime-rules/unused-component-dependencies.d.ts.map +1 -0
  233. package/dist/lib/runtime-rules/unused-component-dependencies.js +90 -0
  234. package/dist/lib/runtime-rules/unused-component-dependencies.js.map +1 -0
  235. package/dist/lib/runtime-rules/unused-libraries.d.ts +19 -0
  236. package/dist/lib/runtime-rules/unused-libraries.d.ts.map +1 -0
  237. package/dist/lib/runtime-rules/unused-libraries.js +127 -0
  238. package/dist/lib/runtime-rules/unused-libraries.js.map +1 -0
  239. package/dist/lib/runtime-rules/use-function-declaration.d.ts +18 -0
  240. package/dist/lib/runtime-rules/use-function-declaration.d.ts.map +1 -0
  241. package/dist/lib/runtime-rules/use-function-declaration.js +127 -0
  242. package/dist/lib/runtime-rules/use-function-declaration.js.map +1 -0
  243. package/dist/lib/runtime-rules/use-unwrap-components.d.ts +19 -0
  244. package/dist/lib/runtime-rules/use-unwrap-components.d.ts.map +1 -0
  245. package/dist/lib/runtime-rules/use-unwrap-components.js +84 -0
  246. package/dist/lib/runtime-rules/use-unwrap-components.js.map +1 -0
  247. package/dist/lib/runtime-rules/useeffect-unstable-dependencies.d.ts +23 -0
  248. package/dist/lib/runtime-rules/useeffect-unstable-dependencies.d.ts.map +1 -0
  249. package/dist/lib/runtime-rules/useeffect-unstable-dependencies.js +215 -0
  250. package/dist/lib/runtime-rules/useeffect-unstable-dependencies.js.map +1 -0
  251. package/dist/lib/runtime-rules/utilities-api-validation.d.ts +24 -0
  252. package/dist/lib/runtime-rules/utilities-api-validation.d.ts.map +1 -0
  253. package/dist/lib/runtime-rules/utilities-api-validation.js +121 -0
  254. package/dist/lib/runtime-rules/utilities-api-validation.js.map +1 -0
  255. package/dist/lib/runtime-rules/utilities-no-direct-instantiation.d.ts +20 -0
  256. package/dist/lib/runtime-rules/utilities-no-direct-instantiation.d.ts.map +1 -0
  257. package/dist/lib/runtime-rules/utilities-no-direct-instantiation.js +58 -0
  258. package/dist/lib/runtime-rules/utilities-no-direct-instantiation.js.map +1 -0
  259. package/dist/lib/runtime-rules/validate-component-references.d.ts +19 -0
  260. package/dist/lib/runtime-rules/validate-component-references.d.ts.map +1 -0
  261. package/dist/lib/runtime-rules/validate-component-references.js +255 -0
  262. package/dist/lib/runtime-rules/validate-component-references.js.map +1 -0
  263. package/dist/lib/schema-validation/component-prop-rule.d.ts +125 -0
  264. package/dist/lib/schema-validation/component-prop-rule.d.ts.map +1 -0
  265. package/dist/lib/schema-validation/component-prop-rule.js +630 -0
  266. package/dist/lib/schema-validation/component-prop-rule.js.map +1 -0
  267. package/dist/lib/schema-validation/index.d.ts +26 -0
  268. package/dist/lib/schema-validation/index.d.ts.map +1 -0
  269. package/dist/lib/schema-validation/index.js +26 -0
  270. package/dist/lib/schema-validation/index.js.map +1 -0
  271. package/dist/lib/schema-validation/semantic-validators/index.d.ts +23 -0
  272. package/dist/lib/schema-validation/semantic-validators/index.d.ts.map +1 -0
  273. package/dist/lib/schema-validation/semantic-validators/index.js +23 -0
  274. package/dist/lib/schema-validation/semantic-validators/index.js.map +1 -0
  275. package/dist/lib/{constraint-validators → schema-validation/semantic-validators}/required-when-validator.d.ts +2 -2
  276. package/dist/lib/schema-validation/semantic-validators/required-when-validator.d.ts.map +1 -0
  277. package/dist/lib/{constraint-validators → schema-validation/semantic-validators}/required-when-validator.js +3 -3
  278. package/dist/lib/schema-validation/semantic-validators/required-when-validator.js.map +1 -0
  279. package/dist/lib/schema-validation/semantic-validators/semantic-validator-registry.d.ts +122 -0
  280. package/dist/lib/schema-validation/semantic-validators/semantic-validator-registry.d.ts.map +1 -0
  281. package/dist/lib/schema-validation/semantic-validators/semantic-validator-registry.js +166 -0
  282. package/dist/lib/schema-validation/semantic-validators/semantic-validator-registry.js.map +1 -0
  283. package/dist/lib/{constraint-validators/base-constraint-validator.d.ts → schema-validation/semantic-validators/semantic-validator.d.ts} +12 -11
  284. package/dist/lib/schema-validation/semantic-validators/semantic-validator.d.ts.map +1 -0
  285. package/dist/lib/{constraint-validators/base-constraint-validator.js → schema-validation/semantic-validators/semantic-validator.js} +11 -10
  286. package/dist/lib/schema-validation/semantic-validators/semantic-validator.js.map +1 -0
  287. package/dist/lib/{constraint-validators → schema-validation/semantic-validators}/sql-where-clause-validator.d.ts +2 -8
  288. package/dist/lib/schema-validation/semantic-validators/sql-where-clause-validator.d.ts.map +1 -0
  289. package/dist/lib/{constraint-validators → schema-validation/semantic-validators}/sql-where-clause-validator.js +7 -18
  290. package/dist/lib/schema-validation/semantic-validators/sql-where-clause-validator.js.map +1 -0
  291. package/dist/lib/{constraint-validators → schema-validation/semantic-validators}/subset-of-entity-fields-validator.d.ts +2 -2
  292. package/dist/lib/schema-validation/semantic-validators/subset-of-entity-fields-validator.d.ts.map +1 -0
  293. package/dist/lib/{constraint-validators → schema-validation/semantic-validators}/subset-of-entity-fields-validator.js +3 -3
  294. package/dist/lib/schema-validation/semantic-validators/subset-of-entity-fields-validator.js.map +1 -0
  295. package/dist/lib/{constraint-validators → schema-validation/semantic-validators}/validation-context.d.ts +14 -5
  296. package/dist/lib/schema-validation/semantic-validators/validation-context.d.ts.map +1 -0
  297. package/dist/lib/{constraint-validators → schema-validation/semantic-validators}/validation-context.js +1 -1
  298. package/dist/lib/schema-validation/semantic-validators/validation-context.js.map +1 -0
  299. package/dist/lib/type-context.d.ts.map +1 -1
  300. package/dist/lib/type-context.js +16 -1
  301. package/dist/lib/type-context.js.map +1 -1
  302. package/dist/lib/type-inference-engine.d.ts +13 -0
  303. package/dist/lib/type-inference-engine.d.ts.map +1 -1
  304. package/dist/lib/type-inference-engine.js +144 -22
  305. package/dist/lib/type-inference-engine.js.map +1 -1
  306. package/dist/lib/type-rules/type-compatibility-rule.d.ts +79 -0
  307. package/dist/lib/type-rules/type-compatibility-rule.d.ts.map +1 -0
  308. package/dist/lib/type-rules/type-compatibility-rule.js +211 -0
  309. package/dist/lib/type-rules/type-compatibility-rule.js.map +1 -0
  310. package/package.json +15 -12
  311. package/dist/lib/constraint-validators/base-constraint-validator.d.ts.map +0 -1
  312. package/dist/lib/constraint-validators/base-constraint-validator.js.map +0 -1
  313. package/dist/lib/constraint-validators/index.d.ts +0 -21
  314. package/dist/lib/constraint-validators/index.d.ts.map +0 -1
  315. package/dist/lib/constraint-validators/index.js +0 -21
  316. package/dist/lib/constraint-validators/index.js.map +0 -1
  317. package/dist/lib/constraint-validators/required-when-validator.d.ts.map +0 -1
  318. package/dist/lib/constraint-validators/required-when-validator.js.map +0 -1
  319. package/dist/lib/constraint-validators/sql-where-clause-validator.d.ts.map +0 -1
  320. package/dist/lib/constraint-validators/sql-where-clause-validator.js.map +0 -1
  321. package/dist/lib/constraint-validators/subset-of-entity-fields-validator.d.ts.map +0 -1
  322. package/dist/lib/constraint-validators/subset-of-entity-fields-validator.js.map +0 -1
  323. package/dist/lib/constraint-validators/validation-context.d.ts.map +0 -1
  324. package/dist/lib/constraint-validators/validation-context.js.map +0 -1
package/README.md CHANGED
@@ -1,194 +1,181 @@
1
1
  # @memberjunction/react-test-harness
2
2
 
3
- Automated test harness for MemberJunction React components using Playwright. Provides static analysis (linting), constraint validation, browser-based rendering tests, and a CLI for running test suites against dynamically compiled components.
3
+ Automated test harness for MemberJunction interactive React components. Provides static analysis (linting) with 57 extensible rules, type inference, constraint validation, browser-based rendering via Playwright, and a CLI for running test suites.
4
4
 
5
- ## Architecture
5
+ ## Quick Start
6
+
7
+ ### Linting a Component
8
+
9
+ ```typescript
10
+ import { ComponentLinter } from '@memberjunction/react-test-harness';
6
11
 
7
- ```mermaid
8
- graph TD
9
- subgraph "@memberjunction/react-test-harness"
10
- A[TestHarness] --> B[ComponentLinter]
11
- A --> C[ComponentRunner]
12
- A --> D[BrowserContext]
13
-
14
- B --> E[Type Inference Engine]
15
- B --> F[Control Flow Analyzer]
16
- B --> G[Prop Value Extractor]
17
- B --> H[Styles Type Analyzer]
18
-
19
- subgraph "Constraint Validators"
20
- I[BaseConstraintValidator]
21
- I --> J[RequiredWhenValidator]
22
- I --> K[SQLWhereClauseValidator]
23
- I --> L[SubsetOfEntityFieldsValidator]
24
- end
25
-
26
- C --> D
27
- D --> M["Playwright Browser"]
28
-
29
- N[CLI] --> A
30
- end
31
-
32
- subgraph "Dependencies"
33
- O["@memberjunction/react-runtime<br/>(Component Compilation)"]
34
- P["Babel Parser<br/>(AST Analysis)"]
35
- end
36
-
37
- B --> P
38
- C --> O
39
-
40
- style A fill:#2d6a9f,stroke:#1a4971,color:#fff
41
- style B fill:#2d8659,stroke:#1a5c3a,color:#fff
42
- style C fill:#2d8659,stroke:#1a5c3a,color:#fff
43
- style D fill:#7c5295,stroke:#563a6b,color:#fff
44
- style E fill:#b8762f,stroke:#8a5722,color:#fff
45
- style I fill:#7c5295,stroke:#563a6b,color:#fff
46
- style N fill:#2d6a9f,stroke:#1a4971,color:#fff
12
+ const result = await ComponentLinter.lintComponent(
13
+ code, // JavaScript/JSX source
14
+ 'MyComponent', // Component name
15
+ componentSpec, // ComponentSpec with metadata
16
+ true, // isRootComponent
17
+ );
18
+
19
+ if (!result.success) {
20
+ for (const v of result.violations) {
21
+ console.log(`[${v.severity}] ${v.rule}: ${v.message} (line ${v.line})`);
22
+ }
23
+ }
47
24
  ```
48
25
 
49
- ## Overview
26
+ ### Browser-Based Testing
50
27
 
51
- This package provides comprehensive testing for MemberJunction's dynamically compiled React components. It combines static analysis (without executing) and runtime testing (via Playwright) to validate components before deployment.
28
+ ```typescript
29
+ import { ComponentRunner } from '@memberjunction/react-test-harness';
52
30
 
53
- **Key capabilities:**
31
+ const runner = new ComponentRunner();
32
+ const result = await runner.executeComponent(componentSpec, {
33
+ contextUser,
34
+ props: { data: testData },
35
+ });
54
36
 
55
- - **Component Linting**: Static analysis of component source using Babel AST parsing
56
- - **Type Inference**: Infers component prop types from source code and usage patterns
57
- - **Constraint Validation**: Validates data constraints like SQL WHERE clauses, required-when conditions, and entity field subsets
58
- - **Control Flow Analysis**: Detects unreachable code, missing returns, and complex control flow patterns
59
- - **Browser Rendering**: Launches components in a real browser via Playwright for visual/functional testing
60
- - **Prop Value Extraction**: Extracts and validates prop values from JSX source
61
- - **Library Lint Caching**: Caches lint results for external libraries to improve performance
62
- - **CLI Tool**: `mj-react-test` command for running test suites
37
+ console.log('Rendered:', result.success);
38
+ console.log('Errors:', result.errors);
39
+ ```
63
40
 
64
- ## Installation
41
+ ### Writing Custom Rules
65
42
 
66
- ```bash
67
- npm install @memberjunction/react-test-harness
43
+ Rules extend `BaseLintRule` and auto-register via `@RegisterClass`:
44
+
45
+ ```typescript
46
+ import { RegisterClass } from '@memberjunction/global';
47
+ import { BaseLintRule } from '@memberjunction/react-test-harness';
48
+
49
+ @RegisterClass(BaseLintRule, 'my-custom-rule')
50
+ export class MyCustomRule extends BaseLintRule {
51
+ get Name() { return 'my-custom-rule'; }
52
+ get AppliesTo(): 'all' | 'child' | 'root' { return 'all'; }
53
+
54
+ Test(ast, componentName, componentSpec, options, typeContext) {
55
+ const violations = [];
56
+ // Babel AST traversal and validation logic
57
+ return violations;
58
+ }
59
+ }
68
60
  ```
69
61
 
70
- ## Usage
62
+ External packages (e.g., Skip-Brain) can define custom rules — the linter discovers them automatically via MJGlobal's ClassFactory.
71
63
 
72
- ### CLI
64
+ ## Testing
73
65
 
74
66
  ```bash
75
- # Run the test harness
76
- npx mj-react-test
67
+ cd packages/React/test-harness
77
68
 
78
- # Or if installed globally
79
- mj-react-test
80
- ```
69
+ # Build (required before testing)
70
+ npm run build
81
71
 
82
- ### Programmatic API
72
+ # Run all 425 tests
73
+ npx vitest run
83
74
 
84
- ```typescript
85
- import { TestHarness } from '@memberjunction/react-test-harness';
75
+ # Run with verbose output (see individual fixture results)
76
+ npx vitest run --reporter=verbose
86
77
 
87
- const harness = new TestHarness();
78
+ # Watch mode
79
+ npx vitest
80
+ ```
81
+
82
+ ### Database Connection (Optional)
83
+
84
+ Some rules validate against entity metadata from the database. Create `.env`:
88
85
 
89
- // Run all tests for a component
90
- const results = await harness.RunTests(componentSource, {
91
- libraries: libraryConfigs,
92
- entityMetadata: entityInfo
93
- });
86
+ ```
87
+ DB_HOST=your-host
88
+ DB_DATABASE=your-db
89
+ DB_USERNAME=your-user
90
+ DB_PASSWORD=your-password
91
+ DB_PORT=1433
92
+ DB_TRUST_SERVER_CERTIFICATE=1
94
93
  ```
95
94
 
96
- ### Component Linting
95
+ Without a database, DB-dependent fixtures still run but rules that need entity metadata emit low-severity warnings instead of violations.
97
96
 
98
- ```typescript
99
- import { ComponentLinter } from '@memberjunction/react-test-harness';
97
+ ## Architecture
100
98
 
101
- const linter = new ComponentLinter();
102
- const lintResults = linter.Lint(componentSource, {
103
- checkPropTypes: true,
104
- checkControlFlow: true,
105
- validateConstraints: true
106
- });
99
+ See [LINTER-ARCHITECTURE.md](LINTER-ARCHITECTURE.md) for comprehensive documentation including:
100
+ - How rules work and how to add new ones
101
+ - Rule categories and what each validates
102
+ - Type inference engine capabilities
103
+ - Metadata fallback strategy
104
+ - SQL dialect configuration
105
+ - Test fixture organization
107
106
 
108
- for (const issue of lintResults.issues) {
109
- console.log(`${issue.severity}: ${issue.message} (line ${issue.line})`);
110
- }
111
- ```
107
+ ## Lint Rules (57)
112
108
 
113
- ### Browser-Based Testing
109
+ ### Data Access (5 rules)
110
+ - `runview-call-validation` — RunView/RunViews call-site validation
111
+ - `runquery-call-validation` — RunQuery call-site validation with parameter type checking
112
+ - `data-result-validation` — RunView/RunQuery/Search result usage patterns
113
+ - `search-availability-check` — `utilities.search` null guard
114
+ - `search-call-validation` — Search/PreviewSearch parameter validation
114
115
 
115
- ```typescript
116
- import { ComponentRunner, BrowserContext } from '@memberjunction/react-test-harness';
116
+ ### Entity & Query Fields (4 rules)
117
+ - `entity-field-access-validation` — Field access on RunView results (typos, case, type coercion)
118
+ - `query-result-field-access-validation` — Field access on RunQuery results
119
+ - `chart-field-validation` — Chart prop field references
120
+ - `datagrid-field-validation` — Grid column field references
117
121
 
118
- const browser = await BrowserContext.Create();
119
- const runner = new ComponentRunner(browser);
122
+ ### Runtime Constraints (8 rules)
123
+ - `no-import-statements`, `no-export-statements`, `no-require-statements`
124
+ - `no-iife-wrapper`, `no-return-component`, `no-window-access`
125
+ - `use-function-declaration`, `single-function-only`
120
126
 
121
- const result = await runner.Render(compiledComponent, {
122
- props: { data: testData },
123
- timeout: 5000
124
- });
127
+ ### Component Structure (9 rules)
128
+ - `react-component-naming`, `component-name-mismatch`, `pass-standard-props`
129
+ - `no-react-destructuring`, `no-data-prop`, `no-child-implementation`
130
+ - `component-props-validation`, `child-component-prop-validation`
131
+ - `component-usage-without-destructuring`
125
132
 
126
- console.log('Rendered successfully:', result.success);
127
- console.log('Console errors:', result.consoleErrors);
133
+ ### Dependencies (7 rules)
134
+ - `component-not-in-dependencies`, `undefined-component-usage`
135
+ - `unused-libraries`, `unused-component-dependencies`
136
+ - `library-variable-names`, `dependency-shadowing`, `validate-component-references`
128
137
 
129
- await browser.Close();
130
- ```
138
+ ### Callbacks & Events (1 consolidated rule)
139
+ - `callback-event-validation` — Method usage, parameter signatures, passthrough, event null-checks
131
140
 
132
- ### Constraint Validation
141
+ ### Best Practices (8 rules)
142
+ - `prefer-async-await`, `prefer-jsx-syntax`, `react-hooks-rules`
143
+ - `useeffect-unstable-dependencies`, `unsafe-array-operations`, `unsafe-formatting-methods`
144
+ - `string-replace-all-occurrences`, `string-template-validation`
133
145
 
134
- ```typescript
135
- import {
136
- SQLWhereClauseValidator,
137
- RequiredWhenValidator,
138
- SubsetOfEntityFieldsValidator
139
- } from '@memberjunction/react-test-harness';
140
-
141
- // Validate a SQL WHERE clause
142
- const sqlValidator = new SQLWhereClauseValidator();
143
- const sqlResult = sqlValidator.Validate("Status = 'Active' AND Age > 18", context);
144
-
145
- // Validate required-when conditions
146
- const reqValidator = new RequiredWhenValidator();
147
- const reqResult = reqValidator.Validate("IsAdmin = true", context);
148
-
149
- // Validate field subset
150
- const subsetValidator = new SubsetOfEntityFieldsValidator();
151
- const subsetResult = subsetValidator.Validate(["Name", "Email", "Status"], context);
152
- ```
146
+ ### Type Safety (2 rules)
147
+ - `type-inference-errors`, `type-mismatch-operation`
153
148
 
154
- ## Components
155
-
156
- | Component | Description |
157
- |-----------|-------------|
158
- | `TestHarness` | Main orchestrator for running all test types |
159
- | `ComponentLinter` | Static analysis of component source code |
160
- | `ComponentRunner` | Browser-based component rendering tests |
161
- | `BrowserContext` | Manages Playwright browser lifecycle |
162
- | `TypeInferenceEngine` | Infers prop types from source code |
163
- | `ControlFlowAnalyzer` | Detects control flow issues |
164
- | `PropValueExtractor` | Extracts and validates prop values |
165
- | `StylesTypeAnalyzer` | Analyzes component style patterns |
166
- | `LibraryLintCache` | Caches lint results for external libraries |
167
- | `LinterTestTool` | Testing utilities for linter development |
149
+ ### Styles (1 consolidated rule)
150
+ - `styles-validation` — Invalid path access, unsafe patterns
168
151
 
169
- ## Testing
152
+ ### Utilities (3 rules)
153
+ - `utilities-api-validation`, `utilities-no-direct-instantiation`, `ai-tools-availability-check`
170
154
 
171
- ```bash
172
- npm test
173
- npm run test:watch
174
- ```
155
+ ### State & Settings (5 rules)
156
+ - `saved-user-settings-pattern`, `noisy-settings-updates`, `prop-state-sync`
157
+ - `property-name-consistency`, `server-reload-on-client-operation`
158
+
159
+ ### Other (4 rules)
160
+ - `no-use-reducer`, `required-queries-not-called`
161
+ - `undefined-jsx-component`, `no-child-implementation`
162
+
163
+ ## Exports
175
164
 
176
- Uses Vitest for unit testing.
177
-
178
- ## Dependencies
179
-
180
- | Package | Purpose |
181
- |---------|---------|
182
- | `@memberjunction/react-runtime` | Component compilation and registry |
183
- | `@memberjunction/interactive-component-types` | Component type definitions |
184
- | `@memberjunction/core` | Core MJ functionality |
185
- | `@memberjunction/core-entities` | Entity types |
186
- | `@babel/parser` | AST parsing for static analysis |
187
- | `@babel/traverse` | AST traversal |
188
- | `@playwright/test` | Browser automation |
189
- | `commander` | CLI framework |
190
- | `chalk` | Terminal styling |
191
- | `node-sql-parser` | SQL WHERE clause validation |
165
+ ```typescript
166
+ // Core linting
167
+ export { ComponentLinter, LintResult, Violation } from './lib/component-linter';
168
+ export { BaseLintRule } from './lib/lint-rule';
169
+
170
+ // Test harness
171
+ export { ReactTestHarness, TestHarnessOptions } from './lib/test-harness';
172
+ export { ComponentRunner, ComponentExecutionOptions, ComponentExecutionResult } from './lib/component-runner';
173
+ export { BrowserManager, BrowserContextOptions } from './lib/browser-context';
174
+
175
+ // Utilities
176
+ export { LibraryLintCache, CompiledLibraryRules, CompiledValidator } from './lib/library-lint-cache';
177
+ export { ComponentSpec } from '@memberjunction/interactive-component-types';
178
+ ```
192
179
 
193
180
  ## License
194
181
 
@@ -0,0 +1,11 @@
1
+ /**
2
+ * Vitest Setup File — Database Connection (runs in each test worker)
3
+ *
4
+ * Establishes a SQL Server connection and initializes the MJ metadata provider
5
+ * so that component linter tests can access entity metadata, library lint rules,
6
+ * and other database-dependent validation logic.
7
+ *
8
+ * Credentials are loaded from packages/React/test-harness/.env
9
+ */
10
+ export {};
11
+ //# sourceMappingURL=vitest-setup.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"vitest-setup.d.ts","sourceRoot":"","sources":["../../../src/__tests__/setup/vitest-setup.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG"}
@@ -0,0 +1,73 @@
1
+ /**
2
+ * Vitest Setup File — Database Connection (runs in each test worker)
3
+ *
4
+ * Establishes a SQL Server connection and initializes the MJ metadata provider
5
+ * so that component linter tests can access entity metadata, library lint rules,
6
+ * and other database-dependent validation logic.
7
+ *
8
+ * Credentials are loaded from packages/React/test-harness/.env
9
+ */
10
+ import sql from 'mssql';
11
+ import dotenv from 'dotenv';
12
+ import path from 'path';
13
+ import { fileURLToPath } from 'url';
14
+ const __dirname = path.dirname(fileURLToPath(import.meta.url));
15
+ const ENV_PATH = path.resolve(__dirname, '../../../.env');
16
+ let connectionPool = null;
17
+ // Load .env
18
+ dotenv.config({ path: ENV_PATH, override: true });
19
+ const dbHost = process.env.DB_HOST || 'localhost';
20
+ const dbPort = parseInt(process.env.DB_PORT || '1433', 10);
21
+ const dbDatabase = process.env.DB_DATABASE;
22
+ const dbUsername = process.env.DB_USERNAME;
23
+ const dbPassword = process.env.DB_PASSWORD;
24
+ const trustCert = process.env.DB_TRUST_SERVER_CERTIFICATE === '1';
25
+ if (dbDatabase && dbUsername && dbPassword) {
26
+ const sqlConfig = {
27
+ server: dbHost,
28
+ port: dbPort,
29
+ database: dbDatabase,
30
+ user: dbUsername,
31
+ password: dbPassword,
32
+ options: {
33
+ encrypt: true,
34
+ trustServerCertificate: trustCert,
35
+ enableArithAbort: true,
36
+ },
37
+ pool: {
38
+ max: 10,
39
+ min: 2,
40
+ idleTimeoutMillis: 30000,
41
+ },
42
+ };
43
+ try {
44
+ connectionPool = new sql.ConnectionPool(sqlConfig);
45
+ await connectionPool.connect();
46
+ const { setupSQLServerClient, SQLServerProviderConfigData } = await import('@memberjunction/sqlserver-dataprovider');
47
+ const providerConfig = new SQLServerProviderConfigData(connectionPool, '__mj', 180000);
48
+ await setupSQLServerClient(providerConfig);
49
+ const { Metadata } = await import('@memberjunction/core');
50
+ const md = new Metadata();
51
+ console.log(`✅ MJ Provider initialized — ${md.Entities.length} entities loaded`);
52
+ process.env.__MJ_DB_AVAILABLE = 'true';
53
+ }
54
+ catch (error) {
55
+ const msg = error instanceof Error ? error.message : String(error);
56
+ console.warn(`⚠️ Database connection failed — DB-dependent tests will be skipped.\n Error: ${msg}`);
57
+ process.env.__MJ_DB_AVAILABLE = 'false';
58
+ if (connectionPool) {
59
+ try {
60
+ await connectionPool.close();
61
+ }
62
+ catch { /* ignore */ }
63
+ connectionPool = null;
64
+ }
65
+ }
66
+ }
67
+ else {
68
+ console.warn('⚠️ Database credentials not configured — DB-dependent tests will be skipped.\n' +
69
+ ' Set DB_HOST, DB_DATABASE, DB_USERNAME, DB_PASSWORD in .env to enable them.');
70
+ }
71
+ // Connection pool closes automatically when the process exits.
72
+ // Don't use afterAll — vitest may run this setup per-file with tight hook timeouts.
73
+ //# sourceMappingURL=vitest-setup.js.map
@@ -0,0 +1 @@
1
+ {"version":3,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,CAAC,YAAY,CAAC,CAAC;YAC5D,cAAc,GAAG,IAAI,CAAC;QACxB,CAAC;IACH,CAAC;AACH,CAAC;KAAM,CAAC;IACN,OAAO,CAAC,IAAI,CACV,iFAAiF;QACjF,+EAA+E,CAChF,CAAC;AACJ,CAAC;AAED,+DAA+D;AAC/D,oFAAoF"}
package/dist/index.d.ts CHANGED
@@ -3,6 +3,7 @@ export { BrowserManager, BrowserContextOptions } from './lib/browser-context.js'
3
3
  export { ComponentRunner, ComponentExecutionOptions, ComponentExecutionResult } from './lib/component-runner.js';
4
4
  export { AssertionHelpers } from './lib/assertion-helpers.js';
5
5
  export { ComponentLinter, LintResult, Violation } from './lib/component-linter.js';
6
+ export { BaseLintRule } from './lib/lint-rule.js';
6
7
  export { LibraryLintCache, CompiledLibraryRules, CompiledValidator } from './lib/library-lint-cache.js';
7
8
  export { ComponentSpec } from '@memberjunction/interactive-component-types';
8
9
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,kBAAkB,EAAE,MAAM,oBAAoB,CAAC;AAC1E,OAAO,EAAE,cAAc,EAAE,qBAAqB,EAAE,MAAM,uBAAuB,CAAC;AAE9E,OAAO,EAAE,eAAe,EAAE,yBAAyB,EAAE,wBAAwB,EAAE,MAAM,wBAAwB,CAAC;AAC9G,OAAO,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AAC3D,OAAO,EAAE,eAAe,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,wBAAwB,CAAC;AAChF,OAAO,EAAE,gBAAgB,EAAE,oBAAoB,EAAE,iBAAiB,EAAE,MAAM,0BAA0B,CAAC;AACrG,OAAO,EAAE,aAAa,EAAE,MAAM,6CAA6C,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,kBAAkB,EAAE,MAAM,oBAAoB,CAAC;AAC1E,OAAO,EAAE,cAAc,EAAE,qBAAqB,EAAE,MAAM,uBAAuB,CAAC;AAE9E,OAAO,EAAE,eAAe,EAAE,yBAAyB,EAAE,wBAAwB,EAAE,MAAM,wBAAwB,CAAC;AAC9G,OAAO,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AAC3D,OAAO,EAAE,eAAe,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,wBAAwB,CAAC;AAChF,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAC/C,OAAO,EAAE,gBAAgB,EAAE,oBAAoB,EAAE,iBAAiB,EAAE,MAAM,0BAA0B,CAAC;AACrG,OAAO,EAAE,aAAa,EAAE,MAAM,6CAA6C,CAAC"}
package/dist/index.js CHANGED
@@ -4,6 +4,7 @@ export { BrowserManager } from './lib/browser-context.js';
4
4
  export { ComponentRunner } from './lib/component-runner.js';
5
5
  export { AssertionHelpers } from './lib/assertion-helpers.js';
6
6
  export { ComponentLinter } from './lib/component-linter.js';
7
+ export { BaseLintRule } from './lib/lint-rule.js';
7
8
  export { LibraryLintCache } from './lib/library-lint-cache.js';
8
9
  export { ComponentSpec } from '@memberjunction/interactive-component-types';
9
10
  //# sourceMappingURL=index.js.map
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAsB,MAAM,oBAAoB,CAAC;AAC1E,OAAO,EAAE,cAAc,EAAyB,MAAM,uBAAuB,CAAC;AAC9E,0EAA0E;AAC1E,OAAO,EAAE,eAAe,EAAuD,MAAM,wBAAwB,CAAC;AAC9G,OAAO,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AAC3D,OAAO,EAAE,eAAe,EAAyB,MAAM,wBAAwB,CAAC;AAChF,OAAO,EAAE,gBAAgB,EAA2C,MAAM,0BAA0B,CAAC;AACrG,OAAO,EAAE,aAAa,EAAE,MAAM,6CAA6C,CAAC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAsB,MAAM,oBAAoB,CAAC;AAC1E,OAAO,EAAE,cAAc,EAAyB,MAAM,uBAAuB,CAAC;AAC9E,0EAA0E;AAC1E,OAAO,EAAE,eAAe,EAAuD,MAAM,wBAAwB,CAAC;AAC9G,OAAO,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AAC3D,OAAO,EAAE,eAAe,EAAyB,MAAM,wBAAwB,CAAC;AAChF,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAC/C,OAAO,EAAE,gBAAgB,EAA2C,MAAM,0BAA0B,CAAC;AACrG,OAAO,EAAE,aAAa,EAAE,MAAM,6CAA6C,CAAC"}
@@ -1,6 +1,8 @@
1
1
  import { ComponentSpec } from '@memberjunction/interactive-component-types';
2
2
  import type { UserInfo } from '@memberjunction/core';
3
3
  import { ComponentExecutionOptions } from './component-runner.js';
4
+ import type { SQLParserDialect } from '@memberjunction/sql-dialect';
5
+ import './runtime-rules/index.js';
4
6
  export interface LintResult {
5
7
  success: boolean;
6
8
  violations: Violation[];
@@ -27,25 +29,20 @@ export interface Violation {
27
29
  };
28
30
  }
29
31
  export declare class ComponentLinter {
30
- private static stylesAnalyzer;
31
- private static getStylesAnalyzer;
32
- private static containsReturn;
33
- private static isVariableFromRunQueryOrView;
34
- private static universalComponentRules;
35
32
  static validateComponentSyntax(code: string, componentName: string): Promise<{
36
33
  valid: boolean;
37
34
  errors: string[];
38
35
  }>;
39
- static lintComponent(code: string, componentName: string, componentSpec?: ComponentSpec, isRootComponent?: boolean, contextUser?: UserInfo, debugMode?: boolean, options?: ComponentExecutionOptions): Promise<LintResult>;
40
- private static validateDataRequirements;
41
- private static getFunctionName;
42
- private static deduplicateViolations;
43
36
  /**
44
- * Adds suggestions directly to violations based on their rule type
45
- * @param violations Array of violations to enhance with suggestions
46
- * @returns The same violations array with suggestions embedded
37
+ * The SQL dialect used for WHERE clause validation in semantic validators.
38
+ * Defaults to SQL Server. Set via the `sqlDialect` parameter on `lintComponent()`.
47
39
  */
48
- private static addSuggestionsToViolations;
40
+ private static _sqlDialect;
41
+ /** Current SQL dialect used for WHERE clause parsing */
42
+ static get SqlDialect(): SQLParserDialect;
43
+ static lintComponent(code: string, componentName: string, componentSpec?: ComponentSpec, isRootComponent?: boolean, contextUser?: UserInfo, debugMode?: boolean, options?: ComponentExecutionOptions, sqlDialect?: SQLParserDialect): Promise<LintResult>;
44
+ private static validateDataRequirements;
45
+ private static deduplicateViolations;
49
46
  private static generateSyntaxErrorSuggestions;
50
47
  /**
51
48
  * Apply library-specific lint rules based on ComponentLibrary LintRules field
@@ -1 +1 @@
1
- {"version":3,"file":"component-linter.d.ts","sourceRoot":"","sources":["../../src/lib/component-linter.ts"],"names":[],"mappings":"AAQA,OAAO,EAAE,aAAa,EAAwD,MAAM,6CAA6C,CAAC;AAIlI,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAC;AAErD,OAAO,EAAE,yBAAyB,EAAE,MAAM,oBAAoB,CAAC;AAU/D,MAAM,WAAW,UAAU;IACzB,OAAO,EAAE,OAAO,CAAC;IACjB,UAAU,EAAE,SAAS,EAAE,CAAC;IACxB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,SAAS,EAAE,OAAO,CAAC;CACpB;AAED,MAAM,WAAW,WAAW;IAC1B,SAAS,CAAC,EAAE,OAAO,CAAC;CACrB;AAED,MAAM,WAAW,SAAS;IACxB,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,EAAE,UAAU,GAAG,MAAM,GAAG,QAAQ,GAAG,KA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