@oracle/oraclejet-audit 10.0.0 → 11.1.3

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 (702) hide show
  1. package/jaf-amd.js +12 -4
  2. package/jaf.js +6 -1
  3. package/jafapi.js +6 -1
  4. package/lib/AST.js +6 -1
  5. package/lib/AST_Ts.js +6 -1
  6. package/lib/AstJson.js +6 -1
  7. package/lib/AstNodeTypes.js +6 -1
  8. package/lib/Comments.js +6 -1
  9. package/lib/ComponentSvcs.js +5 -0
  10. package/lib/Components.js +6 -1
  11. package/lib/Config.js +6 -1
  12. package/lib/ConfigLib.js +6 -1
  13. package/lib/CssLib.js +5 -0
  14. package/lib/CssUtils.js +5 -0
  15. package/lib/DomUtils.js +6 -1
  16. package/lib/FileIndex.js +5 -0
  17. package/lib/FileSet.js +5 -0
  18. package/lib/FsUtils.js +6 -1
  19. package/lib/Histo.js +6 -0
  20. package/lib/HtmlTree.js +6 -1
  21. package/lib/HtmlUtils.js +5 -0
  22. package/lib/Issue.js +5 -0
  23. package/lib/JafEvents.js +5 -0
  24. package/lib/JafLib.js +6 -1
  25. package/lib/Json.js +6 -0
  26. package/lib/JsonLoader.js +6 -1
  27. package/lib/MetaLib.js +6 -1
  28. package/lib/NetUtils.js +5 -0
  29. package/lib/NodeTypes.js +5 -0
  30. package/lib/Parser.js +6 -1
  31. package/lib/RegTypes.js +5 -0
  32. package/lib/Registry.js +5 -0
  33. package/lib/Reporter.js +5 -0
  34. package/lib/RuleContext.js +5 -0
  35. package/lib/RulePack.js +5 -0
  36. package/lib/RuleSet.js +6 -1
  37. package/lib/Rules.js +6 -1
  38. package/lib/Scope.js +6 -1
  39. package/lib/SemVer.js +5 -0
  40. package/lib/Server.js +5 -0
  41. package/lib/SevLib.js +5 -0
  42. package/lib/Severity.js +6 -1
  43. package/lib/Stats.js +6 -0
  44. package/lib/Ts.js +6 -1
  45. package/lib/Utils.js +6 -1
  46. package/lib/Watch.js +5 -0
  47. package/lib/Writer.js +5 -0
  48. package/lib/ZipUtils.js +5 -0
  49. package/lib/api.js +6 -0
  50. package/lib/cliStats.js +6 -0
  51. package/lib/clone.js +5 -0
  52. package/lib/cmdline.js +6 -1
  53. package/lib/colors.js +5 -0
  54. package/lib/exportRules.js +6 -0
  55. package/lib/extends.js +6 -0
  56. package/lib/filetypes.js +6 -0
  57. package/lib/groups.js +6 -0
  58. package/lib/help.js +6 -1
  59. package/lib/imanual.js +6 -0
  60. package/lib/jetver.js +6 -1
  61. package/lib/macros.js +6 -0
  62. package/lib/metaLoader.js +5 -0
  63. package/lib/metahist.js +5 -0
  64. package/lib/msgidLoader.js +6 -1
  65. package/lib/ns.js +6 -1
  66. package/lib/nslist.js +6 -1
  67. package/lib/outFormat.js +6 -0
  68. package/lib/outfile.js +5 -0
  69. package/lib/ruleLoader.js +5 -0
  70. package/lib/scaffold.js +6 -1
  71. package/lib/scaffoldRule.js +6 -1
  72. package/lib/schema.js +5 -0
  73. package/lib/scopewalker.js +6 -0
  74. package/lib/spinner.js +5 -0
  75. package/lib/spinnernoop.js +5 -0
  76. package/lib/tabs.js +5 -0
  77. package/lib/xmanual.js +6 -0
  78. package/libext/expparser.js +6 -1
  79. package/meta/10.1.0/jetauditmeta.js +9 -0
  80. package/meta/11.0.0/jetauditmeta.js +9 -0
  81. package/meta/11.1.0/jetauditmeta.js +9 -0
  82. package/meta/metaverlist.json +1 -1
  83. package/package.json +2 -3
  84. package/rulepacks/csp/csp-html-script-unsafe-inline.js +5 -0
  85. package/rulepacks/csp/csp-html-style-unsafe-inline.js +5 -0
  86. package/rulepacks/csp/csp-html-unsafe-expr.js +5 -0
  87. package/rulepacks/csp/csp-js-script-unsafe-eval.js +6 -1
  88. package/rulepacks/csp/csp-js-style-unsafe-inline.js +5 -0
  89. package/rulepacks/csp/csp-ts-script-unsafe-eval.js +6 -0
  90. package/rulepacks/csp/csp-ts-style-unsafe-inline.js +6 -0
  91. package/rulepacks/csp/msgid.json +6 -1
  92. package/rulepacks/csp/rules.json +6 -1
  93. package/rulepacks/jetwc/jetwc-absolute-jetversion.js +6 -1
  94. package/rulepacks/jetwc/jetwc-aria-redefinition.js +6 -1
  95. package/rulepacks/jetwc/jetwc-bootstrap.js +6 -1
  96. package/rulepacks/jetwc/jetwc-compjson-bp-ar.js +6 -1
  97. package/rulepacks/jetwc/jetwc-compjson-bp-obj.js +6 -1
  98. package/rulepacks/jetwc/jetwc-component-dependencies.js +6 -1
  99. package/rulepacks/jetwc/jetwc-component-displayname.js +6 -1
  100. package/rulepacks/jetwc/jetwc-component-foldername.js +6 -1
  101. package/rulepacks/jetwc/jetwc-component-location.js +6 -1
  102. package/rulepacks/jetwc/jetwc-component-type.js +6 -1
  103. package/rulepacks/jetwc/jetwc-data-property-prefix.js +6 -1
  104. package/rulepacks/jetwc/jetwc-deprecated-lifecycle.js +6 -1
  105. package/rulepacks/jetwc/jetwc-disabled-property.js +6 -1
  106. package/rulepacks/jetwc/jetwc-displayname.js +6 -1
  107. package/rulepacks/jetwc/jetwc-dynamic-slot-context.js +6 -1
  108. package/rulepacks/jetwc/jetwc-dynamic-slots-naming.js +6 -1
  109. package/rulepacks/jetwc/jetwc-event-displayname.js +6 -1
  110. package/rulepacks/jetwc/jetwc-events.js +6 -1
  111. package/rulepacks/jetwc/jetwc-jet-version.js +6 -1
  112. package/rulepacks/jetwc/jetwc-loader-file.js +6 -1
  113. package/rulepacks/jetwc/jetwc-method-displayname.js +6 -1
  114. package/rulepacks/jetwc/jetwc-methods.js +6 -1
  115. package/rulepacks/jetwc/jetwc-namespace.js +6 -1
  116. package/rulepacks/jetwc/jetwc-nested-defaults.js +6 -1
  117. package/rulepacks/jetwc/jetwc-nls-languages.js +6 -1
  118. package/rulepacks/jetwc/jetwc-nls-root.js +6 -1
  119. package/rulepacks/jetwc/jetwc-oj-register.js +6 -1
  120. package/rulepacks/jetwc/jetwc-ojcss.js +6 -1
  121. package/rulepacks/jetwc/jetwc-pack-children.js +6 -1
  122. package/rulepacks/jetwc/jetwc-packable-components.js +6 -1
  123. package/rulepacks/jetwc/jetwc-prerelease-dependencies.js +6 -1
  124. package/rulepacks/jetwc/jetwc-prerelease-pattern.js +6 -1
  125. package/rulepacks/jetwc/jetwc-prerelease-version.js +6 -1
  126. package/rulepacks/jetwc/jetwc-property-changed.js +6 -1
  127. package/rulepacks/jetwc/jetwc-property-displayname.js +6 -1
  128. package/rulepacks/jetwc/jetwc-property-nesting.js +6 -1
  129. package/rulepacks/jetwc/jetwc-public-modules.js +6 -1
  130. package/rulepacks/jetwc/jetwc-register-css.js +6 -1
  131. package/rulepacks/jetwc/jetwc-register-with-promises.js +6 -1
  132. package/rulepacks/jetwc/jetwc-require-paths.js +6 -1
  133. package/rulepacks/jetwc/jetwc-required-subproperty.js +6 -0
  134. package/rulepacks/jetwc/jetwc-reserved-property.js +6 -1
  135. package/rulepacks/jetwc/jetwc-schema.js +6 -1
  136. package/rulepacks/jetwc/jetwc-semantic-version.js +6 -1
  137. package/rulepacks/jetwc/jetwc-slot-displayname.js +6 -1
  138. package/rulepacks/jetwc/jetwc-slots.js +6 -1
  139. package/rulepacks/jetwc/jetwc-standard-files.js +6 -1
  140. package/rulepacks/jetwc/jetwc-subproperty-writeback.js +6 -0
  141. package/rulepacks/jetwc/jetwc-template-slots.js +6 -1
  142. package/rulepacks/jetwc/jetwc-unused-events.js +6 -1
  143. package/rulepacks/jetwc/jetwc-unused-slots.js +6 -1
  144. package/rulepacks/jetwc/jetwc-vb-category.js +6 -1
  145. package/rulepacks/jetwc/jetwc-vb-icon.js +6 -1
  146. package/rulepacks/jetwc/jetwc-version-openrange.js +6 -1
  147. package/rulepacks/jetwc/jetwc-writeback-required.js +6 -1
  148. package/rulepacks/jetwc/msgid.json +6 -0
  149. package/rulepacks/jetwc/rules.json +6 -1
  150. package/rulepacks/jetwc-lib/component-audit-utils.js +6 -1
  151. package/rulepacks/jetwco/jetwco-bootstrap.js +6 -1
  152. package/rulepacks/jetwco/jetwco-compjson-ns-reg.js +6 -1
  153. package/rulepacks/jetwco/jetwco-component-api-baseline-changes.js +6 -0
  154. package/rulepacks/jetwco/jetwco-component-api-changes.js +6 -1
  155. package/rulepacks/jetwco/jetwco-component-cdn.js +6 -1
  156. package/rulepacks/jetwco/jetwco-exchange-version-check.js +6 -1
  157. package/rulepacks/jetwco/jetwco-license-info.js +6 -1
  158. package/rulepacks/jetwco/jetwco-prerelease-cdn.js +6 -1
  159. package/rulepacks/jetwco/jetwco-thirdparty-ba.js +6 -1
  160. package/rulepacks/jetwco/msgid.json +6 -0
  161. package/rulepacks/jetwco/rules.json +6 -1
  162. package/rulepacks/spoc/msgid.json +5 -0
  163. package/rulepacks/spoc/rules.json +5 -0
  164. package/rulepacks/spoc/spoc-dom-manip-inv-tag.js +5 -0
  165. package/rulepacks/spoc/spoc-dom-manip-tag-pos.js +5 -0
  166. package/rulepacks/spoc/spoc-dom-manip.js +5 -0
  167. package/rules/jaf/jaf-css-diagnose.js +5 -0
  168. package/rules/jaf/jaf-html-diagnose.js +5 -0
  169. package/rules/jaf/jaf-init-schema.js +5 -0
  170. package/rules/jaf/jaf-js-diagnose.js +5 -0
  171. package/rules/jaf/jaf-ts-diagnose.js +6 -0
  172. package/rules/jaf/msgid.json +6 -1
  173. package/rules/jaf/rules.json +6 -1
  174. package/rules/jet/helpers/acc-aria-label.js +6 -1
  175. package/rules/jet/helpers/bp-checkPropType.js +5 -0
  176. package/rules/jet/helpers/cssHelper.js +6 -1
  177. package/rules/jet/helpers/extractStylesFromClass.js +6 -1
  178. package/rules/jet/helpers/has-slot-name.js +6 -1
  179. package/rules/jet/helpers/has-slot.js +5 -0
  180. package/rules/jet/helpers/json-prop-pos.js +5 -0
  181. package/rules/jet/helpers/json-propname-pos.js +5 -0
  182. package/rules/jet/helpers/style-selector.js +6 -1
  183. package/rules/jet/helpers/valid-attr.js +5 -0
  184. package/rules/jet/helpers/vartrack.js +5 -0
  185. package/rules/jet/jet-css-ojselector.js +5 -0
  186. package/rules/jet/msgid.json +6 -1
  187. package/rules/jet/oj-acc-aria-labelledby.js +5 -0
  188. package/rules/jet/oj-acc-aria-prop.js +5 -0
  189. package/rules/jet/oj-acc-avatar-aria-role.js +5 -0
  190. package/rules/jet/oj-acc-combobox-aria-label.js +6 -1
  191. package/rules/jet/oj-acc-film-strip-aria-label.js +5 -0
  192. package/rules/jet/oj-acc-input-aria-label.js +6 -1
  193. package/rules/jet/oj-acc-select-aria-label.js +6 -1
  194. package/rules/jet/oj-cca-compjson-bp-ar.js +5 -0
  195. package/rules/jet/oj-cca-compjson-bp-dsplyname.js +5 -0
  196. package/rules/jet/oj-cca-compjson-bp-jetver.js +5 -0
  197. package/rules/jet/oj-cca-compjson-bp-obj.js +5 -0
  198. package/rules/jet/oj-cca-compjson-ns-reg.js +5 -0
  199. package/rules/jet/oj-css-bp-border-color.js +5 -0
  200. package/rules/jet/oj-css-bp-dir-flow.js +6 -1
  201. package/rules/jet/oj-css-bp-float.js +5 -0
  202. package/rules/jet/oj-css-bp-textalign.js +5 -0
  203. package/rules/jet/oj-css-style-abs-units.js +5 -0
  204. package/rules/jet/oj-css-style-bp-color.js +6 -1
  205. package/rules/jet/oj-css-style-bp-display.js +6 -1
  206. package/rules/jet/oj-css-style-bp-font-family.js +6 -1
  207. package/rules/jet/oj-css-style-bp-font.js +5 -0
  208. package/rules/jet/oj-css-style-deprecated.js +6 -1
  209. package/rules/jet/oj-css-style-override.js +6 -1
  210. package/rules/jet/oj-css-var-override.js +5 -0
  211. package/rules/jet/oj-form-maxcols.js +6 -0
  212. package/rules/jet/oj-html-5-attr-obs.js +5 -0
  213. package/rules/jet/oj-html-5-tag-obs.js +5 -0
  214. package/rules/jet/oj-html-attr-$unique.js +5 -0
  215. package/rules/jet/oj-html-attr-2def.js +5 -0
  216. package/rules/jet/oj-html-attr-json.js +6 -1
  217. package/rules/jet/oj-html-attr-prefix-expr.js +6 -1
  218. package/rules/jet/oj-html-attr-prefix-ro.js +5 -0
  219. package/rules/jet/oj-html-attr-req.js +5 -0
  220. package/rules/jet/oj-html-bindforeach-data.js +5 -0
  221. package/rules/jet/oj-html-bindif-test.js +5 -0
  222. package/rules/jet/oj-html-binding-attr.js +5 -0
  223. package/rules/jet/oj-html-cca-count.js +5 -0
  224. package/rules/jet/oj-html-cca-tagname.js +6 -1
  225. package/rules/jet/oj-html-cdn.js +5 -0
  226. package/rules/jet/oj-html-combo-converter.js +5 -0
  227. package/rules/jet/oj-html-cspexpr.js +6 -1
  228. package/rules/jet/oj-html-databind-all.js +5 -0
  229. package/rules/jet/oj-html-dlg-title.js +5 -0
  230. package/rules/jet/oj-html-file-pick-accept.js +6 -0
  231. package/rules/jet/oj-html-form-bindif.js +6 -1
  232. package/rules/jet/oj-html-form-layout-maxcols.js +6 -0
  233. package/rules/jet/oj-html-form-noflex.js +5 -0
  234. package/rules/jet/oj-html-input-isodate.js +6 -0
  235. package/rules/jet/oj-html-invalid-doctype.js +6 -1
  236. package/rules/jet/oj-html-jq-databind.js +6 -1
  237. package/rules/jet/oj-html-ko-comment.js +5 -0
  238. package/rules/jet/oj-html-ko-databind.js +5 -0
  239. package/rules/jet/oj-html-label-for-prefix.js +5 -0
  240. package/rules/jet/oj-html-missing-doctype.js +6 -1
  241. package/rules/jet/oj-html-oj-lib.js +5 -0
  242. package/rules/jet/oj-html-ojattr-520.js +6 -1
  243. package/rules/jet/oj-html-ojattr-deprecated.js +6 -1
  244. package/rules/jet/oj-html-ojattr-enum-deprecated.js +6 -1
  245. package/rules/jet/oj-html-ojattr-evt-syntax.js +5 -0
  246. package/rules/jet/oj-html-ojattr-value.js +6 -1
  247. package/rules/jet/oj-html-ojattr.js +6 -1
  248. package/rules/jet/oj-html-ojevent.js +6 -1
  249. package/rules/jet/oj-html-ojslot.js +5 -0
  250. package/rules/jet/oj-html-ojstyle.js +5 -0
  251. package/rules/jet/oj-html-ojtag-datacmd.js +6 -1
  252. package/rules/jet/oj-html-ojtag-datactx.js +5 -0
  253. package/rules/jet/oj-html-ojtag-deprecated.js +6 -1
  254. package/rules/jet/oj-html-ojtag-globattr-noprefix.js +5 -0
  255. package/rules/jet/oj-html-ojtag-id.js +5 -0
  256. package/rules/jet/oj-html-ojtag-nonglobattr-prefix.js +5 -0
  257. package/rules/jet/oj-html-ojtag-ns.js +5 -0
  258. package/rules/jet/oj-html-picker-attrs.js +6 -0
  259. package/rules/jet/oj-html-redwood-cssnovars.js +6 -0
  260. package/rules/jet/oj-html-redwood-cssvars.js +6 -0
  261. package/rules/jet/oj-html-self-close.js +5 -0
  262. package/rules/jet/oj-html-slot-item-minmax.js +6 -0
  263. package/rules/jet/oj-html-slot-name.js +6 -1
  264. package/rules/jet/oj-html-slot-pref-content.js +6 -0
  265. package/rules/jet/oj-html-style-abs-units.js +5 -0
  266. package/rules/jet/oj-html-style-bp-color.js +5 -0
  267. package/rules/jet/oj-html-style-bp-display.js +6 -1
  268. package/rules/jet/oj-html-style-bp-font-family.js +5 -0
  269. package/rules/jet/oj-html-style-bp-font.js +5 -0
  270. package/rules/jet/oj-html-style-deprecated.js +5 -0
  271. package/rules/jet/oj-html-style.js +6 -1
  272. package/rules/jet/oj-html-stylesel.js +6 -1
  273. package/rules/jet/oj-html-tag-attr-noprefix.js +5 -0
  274. package/rules/jet/oj-html-template-index.js +6 -0
  275. package/rules/jet/oj-html-unsup-theme.js +6 -1
  276. package/rules/jet/oj-html-wctag-$props.js +6 -1
  277. package/rules/jet/oj-html-wctag-arialabelledby.js +5 -0
  278. package/rules/jet/oj-html-wctag-for.js +5 -0
  279. package/rules/jet/oj-html-wctag-id.js +5 -0
  280. package/rules/jet/oj-html-wctag-packprivate.js +6 -0
  281. package/rules/jet/oj-js-comp-attr-deprecated.js +5 -0
  282. package/rules/jet/oj-js-comp-meth-deprecated.js +5 -0
  283. package/rules/jet/oj-js-no-ext-final.js +5 -0
  284. package/rules/jet/oj-js-noconsole.js +5 -0
  285. package/rules/jet/oj-js-ojcomp-deprecated.js +6 -1
  286. package/rules/jet/oj-js-ojcomp-exist.js +5 -0
  287. package/rules/jet/oj-js-ojcomp-new.js +5 -0
  288. package/rules/jet/oj-js-poly-promise.js +6 -1
  289. package/rules/jet/oj-js-var-undef.js +5 -0
  290. package/rules/jet/oj-json-syntax.js +6 -1
  291. package/rules/jet/oj-ts-comp-attr-deprecated.js +5 -0
  292. package/rules/jet/oj-ts-comp-meth-deprecated.js +5 -0
  293. package/rules/jet/oj-ts-no-ext-final.js +6 -0
  294. package/rules/jet/oj-ts-noconsole.js +6 -1
  295. package/rules/jet/oj-ts-ojcomp-deprecated.js +6 -1
  296. package/rules/jet/oj-ts-ojcomp-exist.js +6 -1
  297. package/rules/jet/oj-ts-ojcomp-new.js +6 -1
  298. package/rules/jet/oj-ts-poly-promise.js +6 -1
  299. package/rules/jet/rules.json +6 -1
  300. package/schema/component-schema.json +122 -2
  301. package/src/JafCore.js +6 -1
  302. package/types/index.d.ts +144 -35
  303. package/lib/manual.js +0 -1
  304. package/lib/stats.js +0 -1
  305. package/rules/exch/helpers/json-prop-pos.js +0 -1
  306. package/rules/exch/msgid.json +0 -1
  307. package/rules/exch/oj-cca-comp-zip-content-composite.js +0 -1
  308. package/rules/exch/oj-cca-comp-zip-content-pack.js +0 -1
  309. package/rules/exch/oj-cca-comp-zip-expand.js +0 -1
  310. package/rules/exch/oj-cca-compjson-evnames.js +0 -1
  311. package/rules/exch/oj-cca-compjson-file.js +0 -1
  312. package/rules/exch/oj-cca-compjson-prefix.js +0 -1
  313. package/rules/exch/oj-cca-compjson-prop-compdeps.js +0 -1
  314. package/rules/exch/oj-cca-compjson-prop-deps.js +0 -1
  315. package/rules/exch/oj-cca-compjson-prop-jetver.js +0 -1
  316. package/rules/exch/oj-cca-compjson-prop-obs.js +0 -1
  317. package/rules/exch/oj-cca-compjson-prop-type.js +0 -1
  318. package/rules/exch/oj-cca-compjson-prop-types.js +0 -1
  319. package/rules/exch/oj-cca-compjson-prop-undef.js +0 -1
  320. package/rules/exch/oj-cca-compjson-prop-version.js +0 -1
  321. package/rules/exch/oj-cca-compjson-schema.js +0 -1
  322. package/rules/exch/oj-cca-zip-compjson.js +0 -1
  323. package/rules/exch/rules.json +0 -1
  324. package/rules/jet/oj-css-bp-bgcolor.js +0 -1
  325. package/tests/components/attr-req-test/component.json +0 -1
  326. package/tests/components/demo-analog-clock/component.json +0 -1
  327. package/tests/components/demo-analog-clock/demo-analog-clock-viewModel.js +0 -1
  328. package/tests/components/demo-analog-clock/extension/demo/js/viewModels/demo.js +0 -1
  329. package/tests/components/demo-analog-clock/loader.js +0 -1
  330. package/tests/components/demo-card/component.json +0 -1
  331. package/tests/components/demo-chart-orientation-control/component.json +0 -1
  332. package/tests/components/demo-chart-stack-control/component.json +0 -1
  333. package/tests/components/made-up/component.json +0 -1
  334. package/tests/components/oj-made-up/component.json +0 -1
  335. package/tests/components/sp-activity-item/component.json +0 -1
  336. package/tests/config/config_base.json +0 -1
  337. package/tests/golden/10.0.0/golden_base.json +0 -1
  338. package/tests/golden/8.1.0/golden_base.json +0 -1
  339. package/tests/golden/9.0.0/golden_base.json +0 -1
  340. package/tests/rulepacks/hooks/hook-rpext.js +0 -1
  341. package/tests/rulepacks/hooks/hook-start-close-rulepack.js +0 -1
  342. package/tests/rulepacks/hooks/rule-rpext.js +0 -1
  343. package/tests/rulepacks/hooks/rules.json +0 -1
  344. package/tests/rulepacks/tags/proc_directive.js +0 -1
  345. package/tests/rulepacks/tags/rules.json +0 -1
  346. package/tests/rulepacks/tags/tag-count-setup.js +0 -1
  347. package/tests/rulepacks/tags/tag-count.js +0 -1
  348. package/tests/rules/bugs/JET-4770_PASS_1.html +0 -9
  349. package/tests/rules/comments/com_FAIL_1.js +0 -57
  350. package/tests/rules/comments/com_FAIL_2.js +0 -96
  351. package/tests/rules/comments/com_PASS_1.js +0 -42
  352. package/tests/rules/comments/com_PASS_2.js +0 -63
  353. package/tests/rules/comments/com_PASS_3.js +0 -40
  354. package/tests/rules/comments/com_PASS_4.js +0 -36
  355. package/tests/rules/comments/com_PASS_5.js +0 -19
  356. package/tests/rules/csp/html-script-unsafe-inline/FAIL_1.html +0 -11
  357. package/tests/rules/csp/html-script-unsafe-inline/FAIL_2.html +0 -8
  358. package/tests/rules/csp/html-script-unsafe-inline/PASS_1.html +0 -8
  359. package/tests/rules/csp/html-script-unsafe-inline/PASS_2.html +0 -8
  360. package/tests/rules/csp/html-script-unsafe-inline/PASS_3.html +0 -8
  361. package/tests/rules/csp/html-style-unsafe-inline/FAIL_1.html +0 -11
  362. package/tests/rules/csp/html-style-unsafe-inline/PASS_1.html +0 -11
  363. package/tests/rules/csp/html-unsafe-expr/FAIL_1.html +0 -14
  364. package/tests/rules/csp/html-unsafe-expr/PASS_1.html +0 -23
  365. package/tests/rules/csp/js-script-unsafe-eval/FAIL_1.js +0 -17
  366. package/tests/rules/csp/js-script-unsafe-eval/FAIL_2.js +0 -40
  367. package/tests/rules/csp/js-script-unsafe-eval/FAIL_3.js +0 -22
  368. package/tests/rules/csp/js-script-unsafe-eval/PASS_1.js +0 -20
  369. package/tests/rules/csp/js-script-unsafe-eval/PASS_2.js +0 -44
  370. package/tests/rules/csp/js-script-unsafe-eval/PASS_3.js +0 -16
  371. package/tests/rules/csp/js-style-unsafe-inline/FAIL_1.js +0 -25
  372. package/tests/rules/csp/js-style-unsafe-inline/PASS.js +0 -22
  373. package/tests/rules/demo/noself_FAIL_1.js +0 -101
  374. package/tests/rules/import/import_FAIL_1.js +0 -11
  375. package/tests/rules/import/import_PASS_1.js +0 -10
  376. package/tests/rules/jet-composites/demo-buttonset-enum/component.json +0 -57
  377. package/tests/rules/jet-composites/demo-buttonset-enum/loader.js +0 -19
  378. package/tests/rules/jet-composites/demo-buttonset-enum/view.html +0 -48
  379. package/tests/rules/jet-composites/demo-card/component.json +0 -28
  380. package/tests/rules/jet-composites/demo-card/loader.js +0 -16
  381. package/tests/rules/jet-composites/demo-card/view.html +0 -30
  382. package/tests/rules/jet-composites/demo-card/viewModel.js +0 -46
  383. package/tests/rules/jet-composites/demo-card/view_PASS_1.html +0 -21
  384. package/tests/rules/jet-composites/demo-contact-form/component.json +0 -23
  385. package/tests/rules/jet-composites/demo-contact-form/loader.js +0 -16
  386. package/tests/rules/jet-composites/demo-contact-form/view.html +0 -9
  387. package/tests/rules/jet-composites/demo-grocery-list/component.json +0 -18
  388. package/tests/rules/jet-composites/demo-grocery-list/loader.js +0 -19
  389. package/tests/rules/jet-composites/demo-grocery-list/view.html +0 -22
  390. package/tests/rules/jet-composites/demo-grocery-list/viewModel.js +0 -48
  391. package/tests/rules/jet-composites/dummy-component-1/component.json +0 -82
  392. package/tests/rules/jet-composites/dummy-component-2/component.json +0 -72
  393. package/tests/rules/jet-composites/foo-my-cca/component.json +0 -14
  394. package/tests/rules/jet-composites/foo-unsup-theme/component.json +0 -29
  395. package/tests/rules/jet-composites/header/component.json +0 -12
  396. package/tests/rules/jet-composites/oj-cgbu-omc/attribute-selection/component.json +0 -154
  397. package/tests/rules/jet-composites/oj-cgbu-omc/component.json +0 -11
  398. package/tests/rules/jet-composites/oj-cgbu-omc/reference/component.json +0 -185
  399. package/tests/rules/jet-composites/oj-cgbu-omc/wctag_props_FAIL_1.html +0 -34
  400. package/tests/rules/jet-composites/oj-enum-depr/component.json +0 -69
  401. package/tests/rules/jet-composites/oj-html-wctag-id/id_FAIL_1.html +0 -10
  402. package/tests/rules/jet-composites/oj-html-wctag-id/id_PASS_1.html +0 -6
  403. package/tests/rules/misc/oj.js +0 -12
  404. package/tests/rules/oj-acc-aria-labelledby/aria_labelledby_FAIL_1.html +0 -23
  405. package/tests/rules/oj-acc-aria-labelledby/aria_labelledby_FAIL_2.html +0 -22
  406. package/tests/rules/oj-acc-aria-labelledby/aria_labelledby_PASS_1.html +0 -23
  407. package/tests/rules/oj-acc-aria-labelledby/aria_labelledby_PASS_2.html +0 -22
  408. package/tests/rules/oj-acc-aria-labelledby/aria_labelledby_PASS_3.html +0 -22
  409. package/tests/rules/oj-acc-aria-labelledby/aria_labelledby_PASS_4.html +0 -22
  410. package/tests/rules/oj-acc-aria-labelledby/aria_labelledby_PASS_5.html +0 -22
  411. package/tests/rules/oj-acc-aria-prop/aria_prop_FAIL_1.html +0 -22
  412. package/tests/rules/oj-acc-avatar-aria-role/aria_avatar_role_FAIL_1.html +0 -20
  413. package/tests/rules/oj-acc-avatar-aria-role/aria_avatar_role_PASS_1.html +0 -23
  414. package/tests/rules/oj-acc-avatar-aria-role/aria_avatar_role_PASS_2.html +0 -24
  415. package/tests/rules/oj-acc-avatar-aria-role/aria_avatar_role_PASS_3.html +0 -21
  416. package/tests/rules/oj-acc-avatar-aria-role/aria_avatar_role_PASS_4.html +0 -22
  417. package/tests/rules/oj-acc-avatar-aria-role/aria_avatar_role_PASS_5.html +0 -22
  418. package/tests/rules/oj-acc-combobox-aria-label/aria_combo_many_FAIL_1.html +0 -20
  419. package/tests/rules/oj-acc-combobox-aria-label/aria_combo_many_FAIL_2.html +0 -21
  420. package/tests/rules/oj-acc-combobox-aria-label/aria_combo_many_PASS_1.html +0 -20
  421. package/tests/rules/oj-acc-combobox-aria-label/aria_combo_one_FAIL_1.html +0 -21
  422. package/tests/rules/oj-acc-combobox-aria-label/aria_combo_one_FAIL_2.html +0 -22
  423. package/tests/rules/oj-acc-combobox-aria-label/aria_combo_one_PASS_1.html +0 -22
  424. package/tests/rules/oj-acc-film-strip-aria-label/aria_filmstrip_FAIL_1.html +0 -18
  425. package/tests/rules/oj-acc-film-strip-aria-label/aria_filmstrip_FAIL_2.html +0 -18
  426. package/tests/rules/oj-acc-film-strip-aria-label/aria_filmstrip_PASS_1.html +0 -18
  427. package/tests/rules/oj-acc-film-strip-aria-label/aria_filmstrip_PASS_2.html +0 -19
  428. package/tests/rules/oj-acc-film-strip-aria-label/aria_filmstrip_PASS_3.html +0 -22
  429. package/tests/rules/oj-acc-input-aria-label/oj_input_date_FAIL_1.html +0 -21
  430. package/tests/rules/oj-acc-input-aria-label/oj_input_date_FAIL_2.html +0 -22
  431. package/tests/rules/oj-acc-input-aria-label/oj_input_date_PASS_1.html +0 -16
  432. package/tests/rules/oj-acc-input-aria-label/oj_input_date_PASS_2.html +0 -17
  433. package/tests/rules/oj-acc-input-aria-label/oj_input_date_PASS_3.html +0 -26
  434. package/tests/rules/oj-acc-input-aria-label/oj_input_date_time_FAIL_1.html +0 -19
  435. package/tests/rules/oj-acc-input-aria-label/oj_input_date_time_FAIL_2.html +0 -20
  436. package/tests/rules/oj-acc-input-aria-label/oj_input_date_time_PASS_1.html +0 -19
  437. package/tests/rules/oj-acc-input-aria-label/oj_input_number_FAIL_1.html +0 -17
  438. package/tests/rules/oj-acc-input-aria-label/oj_input_number_FAIL_2.html +0 -18
  439. package/tests/rules/oj-acc-input-aria-label/oj_input_number_PASS_1.html +0 -17
  440. package/tests/rules/oj-acc-input-aria-label/oj_input_password_FAIL_1.html +0 -17
  441. package/tests/rules/oj-acc-input-aria-label/oj_input_password_FAIL_2.html +0 -17
  442. package/tests/rules/oj-acc-input-aria-label/oj_input_password_PASS_1.html +0 -17
  443. package/tests/rules/oj-acc-input-aria-label/oj_input_text_3_PASS_1.html +0 -20
  444. package/tests/rules/oj-acc-input-aria-label/oj_input_text_FAIL_1.html +0 -20
  445. package/tests/rules/oj-acc-input-aria-label/oj_input_text_FAIL_2.html +0 -21
  446. package/tests/rules/oj-acc-input-aria-label/oj_input_text_PASS_2.html +0 -62
  447. package/tests/rules/oj-acc-input-aria-label/oj_input_text_nolabel_PASS_2.html +0 -17
  448. package/tests/rules/oj-acc-input-aria-label/oj_input_time_FAIL_1.html +0 -19
  449. package/tests/rules/oj-acc-input-aria-label/oj_input_time_FAIL_2.html +0 -20
  450. package/tests/rules/oj-acc-input-aria-label/oj_input_time_PASS_1.html +0 -19
  451. package/tests/rules/oj-acc-select-aria-label/aria_selectmany_FAIL_1.html +0 -19
  452. package/tests/rules/oj-acc-select-aria-label/aria_selectmany_FAIL_2.html +0 -20
  453. package/tests/rules/oj-acc-select-aria-label/aria_selectmany_PASS_1.html +0 -19
  454. package/tests/rules/oj-acc-select-aria-label/aria_selectone_FAIL_1.html +0 -20
  455. package/tests/rules/oj-acc-select-aria-label/aria_selectone_FAIL_2.html +0 -21
  456. package/tests/rules/oj-cca-comp-zip/zip_FAIL_1.zip +0 -1
  457. package/tests/rules/oj-cca-comp-zip/zip_FAIL_2.zip +0 -0
  458. package/tests/rules/oj-cca-comp-zip/zip_FAIL_3.zip +0 -0
  459. package/tests/rules/oj-cca-comp-zip/zip_FAIL_4.zip +0 -0
  460. package/tests/rules/oj-cca-comp-zip/zip_FAIL_5.zip +0 -0
  461. package/tests/rules/oj-cca-comp-zip/zip_FAIL_6.zip +0 -0
  462. package/tests/rules/oj-cca-comp-zip/zip_FAIL_7.zip +0 -0
  463. package/tests/rules/oj-cca-comp-zip/zip_FAIL_8.zip +0 -0
  464. package/tests/rules/oj-cca-comp-zip/zip_PASS_1.zip +0 -0
  465. package/tests/rules/oj-cca-ns-reg/oj-cca-ns-FAIL_1/component.json +0 -19
  466. package/tests/rules/oj-cca-ns-reg/oj-cca-ns-PASS_1/component.json +0 -19
  467. package/tests/rules/oj-cgbu-omc_tests/html_ojevent_FAIL_1.html +0 -15
  468. package/tests/rules/oj-cgbu-omc_tests/html_ojevent_PASS_1.html +0 -17
  469. package/tests/rules/oj-compjson-syntax/ojcomp-FAIL_1/component.json +0 -16
  470. package/tests/rules/oj-compjson-syntax/ojcomp-FAIL_10/component.json +0 -103
  471. package/tests/rules/oj-compjson-syntax/ojcomp-FAIL_11/component.json +0 -24
  472. package/tests/rules/oj-compjson-syntax/ojcomp-FAIL_12/component.json +0 -17
  473. package/tests/rules/oj-compjson-syntax/ojcomp-FAIL_13/component.json +0 -17
  474. package/tests/rules/oj-compjson-syntax/ojcomp-FAIL_14/component.json +0 -40
  475. package/tests/rules/oj-compjson-syntax/ojcomp-FAIL_15/component.json +0 -24
  476. package/tests/rules/oj-compjson-syntax/ojcomp-FAIL_16/component.json +0 -44
  477. package/tests/rules/oj-compjson-syntax/ojcomp-FAIL_17/component.json +0 -8
  478. package/tests/rules/oj-compjson-syntax/ojcomp-FAIL_18/component.json +0 -8
  479. package/tests/rules/oj-compjson-syntax/ojcomp-FAIL_19/component.json +0 -8
  480. package/tests/rules/oj-compjson-syntax/ojcomp-FAIL_2/component.json +0 -15
  481. package/tests/rules/oj-compjson-syntax/ojcomp-FAIL_20/component.json +0 -18
  482. package/tests/rules/oj-compjson-syntax/ojcomp-FAIL_21/component.json +0 -16
  483. package/tests/rules/oj-compjson-syntax/ojcomp-FAIL_22/component.json +0 -19
  484. package/tests/rules/oj-compjson-syntax/ojcomp-FAIL_3/component.json +0 -15
  485. package/tests/rules/oj-compjson-syntax/ojcomp-FAIL_4/component.json +0 -16
  486. package/tests/rules/oj-compjson-syntax/ojcomp-FAIL_5/component.json +0 -16
  487. package/tests/rules/oj-compjson-syntax/ojcomp-FAIL_6/component.json +0 -18
  488. package/tests/rules/oj-compjson-syntax/ojcomp-FAIL_7/component.json +0 -15
  489. package/tests/rules/oj-compjson-syntax/ojcomp-FAIL_8/component.json +0 -15
  490. package/tests/rules/oj-compjson-syntax/ojcomp-FAIL_9/component.json +0 -52
  491. package/tests/rules/oj-compjson-syntax/ojcomp-PASS_1/component.json +0 -17
  492. package/tests/rules/oj-compjson-syntax/ojcomp-PASS_2/component.json +0 -88
  493. package/tests/rules/oj-compjson-syntax/ojcomp-PASS_3/component.json +0 -19
  494. package/tests/rules/oj-css-bp-dir-flow/dirflow_FAIL_1.html +0 -22
  495. package/tests/rules/oj-css-bp-dir-flow/dirflow_FAIL_2.html +0 -22
  496. package/tests/rules/oj-css-diagnose/css_FAIL_1.html +0 -14
  497. package/tests/rules/oj-css-diagnose/css_PASS_1.html +0 -14
  498. package/tests/rules/oj-css-var-override/varovr_FAIL_1.html +0 -8
  499. package/tests/rules/oj-html-5-attr-depr/attrdepr_FAIL_1.html +0 -16
  500. package/tests/rules/oj-html-5-attr-depr/attrdepr_PASS_1.html +0 -16
  501. package/tests/rules/oj-html-5-tag-depr/tagdepr_FAIL_1.html +0 -9
  502. package/tests/rules/oj-html-attr/attr_FAIL_1.html +0 -27
  503. package/tests/rules/oj-html-attr-$unique/attr_$unique1_FAIL_1.html +0 -19
  504. package/tests/rules/oj-html-attr-$unique/attr_$unique_FAIL_2.html +0 -25
  505. package/tests/rules/oj-html-attr-2def/attr2def_FAIL_1.html +0 -10
  506. package/tests/rules/oj-html-attr-2def/attr2def_PASS_1.html +0 -10
  507. package/tests/rules/oj-html-attr-json/attr-json_FAIL_1.html +0 -20
  508. package/tests/rules/oj-html-attr-json/attr-json_FAIL_2.html +0 -20
  509. package/tests/rules/oj-html-attr-json/attr-json_FAIL_3.html +0 -20
  510. package/tests/rules/oj-html-attr-json/attr-json_PASS_1.html +0 -20
  511. package/tests/rules/oj-html-attr-json/attr-json_PASS_2.html +0 -20
  512. package/tests/rules/oj-html-attr-json/attr-json_PASS_3.html +0 -8
  513. package/tests/rules/oj-html-attr-prefix-expr/attrprefixexpr_FAIL_1.html +0 -10
  514. package/tests/rules/oj-html-attr-prefix-expr/attrprefixexpr_PASS_1.html +0 -10
  515. package/tests/rules/oj-html-attr-prefix-ro/attrprefixro_FAIL_1.html +0 -10
  516. package/tests/rules/oj-html-attr-prefix-ro/attrprefixro_PASS_1.html +0 -10
  517. package/tests/rules/oj-html-attr-req/attrreq_FAIL_1.html +0 -17
  518. package/tests/rules/oj-html-attr-req/attrreq_FAIL_2.html +0 -13
  519. package/tests/rules/oj-html-attr-req/attrreq_FAIL_3.html +0 -8
  520. package/tests/rules/oj-html-attr-req/attrreq_FAIL_4.html +0 -13
  521. package/tests/rules/oj-html-attr-req/attrreq_FAIL_5.html +0 -17
  522. package/tests/rules/oj-html-attr-req/attrreq_PASS_1.html +0 -24
  523. package/tests/rules/oj-html-attr-req/attrreq_PASS_2.html +0 -24
  524. package/tests/rules/oj-html-attr-req/attrreq_PASS_3.html +0 -10
  525. package/tests/rules/oj-html-attr-req/attrreq_PASS_4.html +0 -11
  526. package/tests/rules/oj-html-bindforeach-data/bindforeach_data_FAIL_1.html +0 -19
  527. package/tests/rules/oj-html-bindforeach-data/bindforeach_data_PASS_1.html +0 -10
  528. package/tests/rules/oj-html-bindif-test/bindif_test_FAIL_1.html +0 -22
  529. package/tests/rules/oj-html-bindif-test/bindif_test_PASS_1.html +0 -11
  530. package/tests/rules/oj-html-binding-attr/binding-foreach_FAIL_2.html +0 -28
  531. package/tests/rules/oj-html-binding-attr/binding-if_FAIL_1.html +0 -23
  532. package/tests/rules/oj-html-binding-attr/binding-if_PASS_1.html +0 -23
  533. package/tests/rules/oj-html-cca-count/cca-count_FAIL_1.html +0 -119
  534. package/tests/rules/oj-html-cca-tagname/ccatag_FAIL_1.html +0 -7
  535. package/tests/rules/oj-html-cca-tagname/ccatag_PASS_1.html +0 -7
  536. package/tests/rules/oj-html-cca-tagname/tag_ns_FAIL_1.html +0 -8
  537. package/tests/rules/oj-html-cca-tagname/tag_ns_FAIL_2.html +0 -8
  538. package/tests/rules/oj-html-cca-tagname/tag_ns_FAIL_3.html +0 -8
  539. package/tests/rules/oj-html-cca-tagname/tag_ns_PASS_1.html +0 -10
  540. package/tests/rules/oj-html-cdn/html_cdn_FAIL_1.html +0 -18
  541. package/tests/rules/oj-html-cspexpr/cspexpr_FAIL_1.html +0 -14
  542. package/tests/rules/oj-html-cspexpr/cspexpr_FAIL_2.html +0 -10
  543. package/tests/rules/oj-html-cspexpr/cspexpr_PASS_1.html +0 -23
  544. package/tests/rules/oj-html-cspexpr/cspexpr_PASS_2.html +0 -10
  545. package/tests/rules/oj-html-cspexpr/cspexpr_PASS_3.html +0 -13
  546. package/tests/rules/oj-html-dlg-title/dlgtitle_FAIL_1.html +0 -12
  547. package/tests/rules/oj-html-dlg-title/dlgtitle_PASS_1.html +0 -12
  548. package/tests/rules/oj-html-form-noflex/noflex_FAIL_1.html +0 -10
  549. package/tests/rules/oj-html-invalid-doctype/doctype_invalid_FAIL_1.html +0 -20
  550. package/tests/rules/oj-html-invalid-doctype/doctype_invalid_FAIL_2.html +0 -13
  551. package/tests/rules/oj-html-invalid-doctype/doctype_invalid_FAIL_3.html +0 -16
  552. package/tests/rules/oj-html-invalid-doctype/doctype_invalid_FAIL_4.html +0 -13
  553. package/tests/rules/oj-html-invalid-doctype/doctype_invalid_PASS_1.html +0 -6
  554. package/tests/rules/oj-html-invalid-doctype/doctype_invalid_PASS_2.html +0 -7
  555. package/tests/rules/oj-html-invalid-doctype/doctype_invalid_PASS_3.html +0 -7
  556. package/tests/rules/oj-html-jq-databind/jq-databind_FAIL_1.html +0 -37
  557. package/tests/rules/oj-html-jq-databind/jq-databind_FAIL_2.html +0 -34
  558. package/tests/rules/oj-html-jq-databind/jq-databind_FAIL_3.html +0 -27
  559. package/tests/rules/oj-html-jq-databind/jq-databind_PASS_1.html +0 -30
  560. package/tests/rules/oj-html-ko-comment/ko-comment_FAIL_1.html +0 -47
  561. package/tests/rules/oj-html-ko-comment/ko-comment_FAIL_2.html +0 -36
  562. package/tests/rules/oj-html-ko-databind/ko-databind_FAIL_1.html +0 -24
  563. package/tests/rules/oj-html-ko-databind/ko-databind_FAIL_2.html +0 -36
  564. package/tests/rules/oj-html-ko-databind/ko-databind_FAIL_3.html +0 -29
  565. package/tests/rules/oj-html-label-for-prefix/for_FAIL_1.html +0 -8
  566. package/tests/rules/oj-html-label-for-prefix/for_PASS_1.html +0 -8
  567. package/tests/rules/oj-html-missing-doctype/doctype_missing_FAIL_1.html +0 -12
  568. package/tests/rules/oj-html-missing-doctype/doctype_missing_FAIL_2.html +0 -11
  569. package/tests/rules/oj-html-missing-doctype/doctype_missing_PASS_1.html +0 -14
  570. package/tests/rules/oj-html-missing-doctype/doctype_missing_PASS_2.html +0 -5
  571. package/tests/rules/oj-html-missing-doctype/doctype_missing_PASS_3.html +0 -12
  572. package/tests/rules/oj-html-missing-doctype/doctype_missing_PASS_5.html +0 -6
  573. package/tests/rules/oj-html-nonvoid-close/close_FAIL_1.html +0 -28
  574. package/tests/rules/oj-html-nonvoid-close/close_FAIL_2.html +0 -14
  575. package/tests/rules/oj-html-nonvoid-close/close_FAIL_3.html +0 -13
  576. package/tests/rules/oj-html-nonvoid-close/close_FAIL_5.html +0 -28
  577. package/tests/rules/oj-html-nonvoid-close/close_FAIL_6.html +0 -28
  578. package/tests/rules/oj-html-nonvoid-close/close_PASS_1.html +0 -7
  579. package/tests/rules/oj-html-oj-lib/oj_lib_FAIL_1.html +0 -15
  580. package/tests/rules/oj-html-ojattr/ojattr_PASS_1.html +0 -8
  581. package/tests/rules/oj-html-ojattr/ojattr_PASS_2.html +0 -10
  582. package/tests/rules/oj-html-ojattr/ojattr_PASS_3.html +0 -7
  583. package/tests/rules/oj-html-ojattr/ojattr_PASS_4.html +0 -7
  584. package/tests/rules/oj-html-ojattr-deprecated/ojattr-dep_FAIL1.html +0 -156
  585. package/tests/rules/oj-html-ojattr-enum-deprecated/enum_FAIL_1.html +0 -19
  586. package/tests/rules/oj-html-ojattr-enum-deprecated/enum_FAIL_2.html +0 -20
  587. package/tests/rules/oj-html-ojattr-enum-deprecated/enum_PASS_1.html +0 -25
  588. package/tests/rules/oj-html-ojattr-evt-syntax/evt-attr-syntax_FAIL_1.html +0 -6
  589. package/tests/rules/oj-html-ojattr-evt-syntax/evt-attr-syntax_PASS_1.html +0 -6
  590. package/tests/rules/oj-html-ojattr-value/attr-value_FAIL_1.html +0 -26
  591. package/tests/rules/oj-html-ojattr-value/attr-value_FAIL_2.html +0 -26
  592. package/tests/rules/oj-html-ojattr-value/attr-value_FAIL_3.html +0 -8
  593. package/tests/rules/oj-html-ojattr-value/attr-value_FAIL_4.html +0 -8
  594. package/tests/rules/oj-html-ojattr-value/attr-value_FAIL_5.html +0 -8
  595. package/tests/rules/oj-html-ojattr-value/attr-value_PASS_1.html +0 -26
  596. package/tests/rules/oj-html-ojattr-value/attr-value_PASS_2.html +0 -8
  597. package/tests/rules/oj-html-ojattr-value/attr-value_PASS_3.html +0 -7
  598. package/tests/rules/oj-html-ojattr-value/attr-value_PASS_6.html +0 -7
  599. package/tests/rules/oj-html-ojattr-value/attr-value_PASS_7.html +0 -10
  600. package/tests/rules/oj-html-ojattr-value/attr_value_PASS_4.html +0 -7
  601. package/tests/rules/oj-html-ojattr-value/attr_value_PASS_5.html +0 -9
  602. package/tests/rules/oj-html-ojslot/ojslot_FAIL_1.html +0 -11
  603. package/tests/rules/oj-html-ojslot/ojslot_PASS_1.html +0 -12
  604. package/tests/rules/oj-html-ojstyle/style_FAIL_1.html +0 -103
  605. package/tests/rules/oj-html-ojstyle/style_PASS_2.html +0 -7
  606. package/tests/rules/oj-html-ojtag-datacmd/datacmd_FAIL_1.html +0 -10
  607. package/tests/rules/oj-html-ojtag-datacmd/datacmd_FAIL_2.html +0 -18
  608. package/tests/rules/oj-html-ojtag-datacmd/datacmd_FAIL_3.html +0 -10
  609. package/tests/rules/oj-html-ojtag-datacmd/datacmd_PASS_1.html +0 -28
  610. package/tests/rules/oj-html-ojtag-datacmd/datacmd_PASS_2.html +0 -15
  611. package/tests/rules/oj-html-ojtag-datactx/datactx_FAIL_1.html +0 -14
  612. package/tests/rules/oj-html-ojtag-datactx/datactx_PASS_1.html +0 -14
  613. package/tests/rules/oj-html-ojtag-globattr-noprefix/globattr-noprefix_FAIL_1.html +0 -36
  614. package/tests/rules/oj-html-ojtag-nonglobattr-prefix/nonglobattr-prefix_FAIL_1.html +0 -26
  615. package/tests/rules/oj-html-slot-name/slot_name.FAIL_1.html +0 -24
  616. package/tests/rules/oj-html-slot-name/slot_name.FAIL_2.html +0 -46
  617. package/tests/rules/oj-html-slot-name/slot_name.FAIL_3.html +0 -10
  618. package/tests/rules/oj-html-slot-name/slot_name.PASS_1.html +0 -24
  619. package/tests/rules/oj-html-slot-name/slot_name.PASS_2.html +0 -39
  620. package/tests/rules/oj-html-slot-name/slot_name.PASS_3.html +0 -10
  621. package/tests/rules/oj-html-slot-name/slot_name_PASS_4.html +0 -16
  622. package/tests/rules/oj-html-slot-name/slot_name_PASS_5.html +0 -11
  623. package/tests/rules/oj-html-slot-name/slot_name_PASS_6.html +0 -14
  624. package/tests/rules/oj-html-slot-name/slot_name_PASS_7.html +0 -10
  625. package/tests/rules/oj-html-style/style_FAIL_1.html +0 -7
  626. package/tests/rules/oj-html-style/style_PASS_1.html +0 -12
  627. package/tests/rules/oj-html-style/style_PASS_2.html +0 -7
  628. package/tests/rules/oj-html-style-bp-color/color-FAIL_1.html +0 -17
  629. package/tests/rules/oj-html-style-bp-color/color-FAIL_2.html +0 -15
  630. package/tests/rules/oj-html-style-bp-color/color-FAIL_3.html +0 -7
  631. package/tests/rules/oj-html-style-bp-color/color-PASS_1.html +0 -7
  632. package/tests/rules/oj-html-style-bp-font-family/fam_FAIL_1.html +0 -23
  633. package/tests/rules/oj-html-tag-attr-noprefix/attr-noprefix_FAIL_1.html +0 -15
  634. package/tests/rules/oj-html-tag-attr-noprefix/attr-noprefix_FAIL_2.html +0 -9
  635. package/tests/rules/oj-html-tag-attr-noprefix/attr-noprefix_PASS_1.html +0 -9
  636. package/tests/rules/oj-html-unsup-theme/unsup_FAIL_1.html +0 -8
  637. package/tests/rules/oj-html-wctag-for/for_FAIL_1.html +0 -8
  638. package/tests/rules/oj-html-wctag-for/for_PASS_1.html +0 -8
  639. package/tests/rules/oj-js-comp-attr-deprecated/attr-del_FAIL_1.js +0 -20
  640. package/tests/rules/oj-js-comp-attr-deprecated/attr-dep_FAIL_1.js +0 -20
  641. package/tests/rules/oj-js-comp-meth-deprecated/meth-del_FAIL_1.js +0 -20
  642. package/tests/rules/oj-js-comp-meth-deprecated/meth-dep_FAIL_1.js +0 -20
  643. package/tests/rules/oj-js-define-promise/def-prom_FAIL_1.js +0 -16
  644. package/tests/rules/oj-js-define-promise/def-prom_FAIL_2.js +0 -16
  645. package/tests/rules/oj-js-diagnose/es6_PASS_1.js +0 -24
  646. package/tests/rules/oj-js-diagnose/js_FAIL_1.js +0 -12
  647. package/tests/rules/oj-js-no-ext-final/noextfinal_FAIL_1.js +0 -30
  648. package/tests/rules/oj-js-no-ext-final/noextfinal_FAIL_2.js +0 -23
  649. package/tests/rules/oj-js-no-ext-final/noextfinal_FAIL_3.js +0 -22
  650. package/tests/rules/oj-js-no-ext-final/noextfinal_FAIL_4.js +0 -20
  651. package/tests/rules/oj-js-no-ext-final/noextfinal_FAIL_5.js +0 -24
  652. package/tests/rules/oj-js-no-ext-final/noextfinal_FAIL_6.js +0 -30
  653. package/tests/rules/oj-js-no-ext-final/noextfinal_FAIL_7.js +0 -15
  654. package/tests/rules/oj-js-no-ext-final/noextfinal_FAIL_8.js +0 -16
  655. package/tests/rules/oj-js-no-ext-final/noextfinal_PASS_1.js +0 -17
  656. package/tests/rules/oj-js-no-ext-final/noextfinal_PASS_2.js +0 -17
  657. package/tests/rules/oj-js-noconsole/nocons_FAIL_1.js +0 -11
  658. package/tests/rules/oj-js-ojcomp-deprecated/jscomp_FAIL_1.js +0 -27
  659. package/tests/rules/oj-json-syntax/json_FAIL_1.json +0 -8
  660. package/tests/rules/oj-json-syntax/json_FAIL_2.json +0 -12
  661. package/tests/rules/oj-json-syntax/json_PASS_1.json +0 -25
  662. package/tests/rules/oj-json-syntax/json_PASS_2.json +0 -12
  663. package/tests/rules/oj-json-syntax/json_PASS_3.json +0 -14
  664. package/tests/rules/ojcompjson/attrreq_FAIL_1/component.json +0 -69
  665. package/tests/rules/pack-compjson/audit-pack/component-1/component-1-view.html +0 -6
  666. package/tests/rules/pack-compjson/audit-pack/component-1/component-1-viewModel.js +0 -56
  667. package/tests/rules/pack-compjson/audit-pack/component-1/component.json +0 -13
  668. package/tests/rules/pack-compjson/audit-pack/component-1/loader.js +0 -20
  669. package/tests/rules/pack-compjson/audit-pack/component-1/resources/nls/component-1-strings.js +0 -18
  670. package/tests/rules/pack-compjson/audit-pack/component-2/component-2-view.html +0 -5
  671. package/tests/rules/pack-compjson/audit-pack/component-2/component-2-viewModel.js +0 -56
  672. package/tests/rules/pack-compjson/audit-pack/component-2/component.json +0 -13
  673. package/tests/rules/pack-compjson/audit-pack/component-2/loader.js +0 -20
  674. package/tests/rules/pack-compjson/audit-pack/component-2/resources/nls/component-1-strings.js +0 -18
  675. package/tests/rules/pack-compjson/audit-pack/component.json +0 -12
  676. package/tests/rules/pack-compjson/audit-singleton-1/audit-singleton-1-view.html +0 -5
  677. package/tests/rules/pack-compjson/audit-singleton-1/audit-singleton-1-viewModel.js +0 -56
  678. package/tests/rules/pack-compjson/audit-singleton-1/component.json +0 -20
  679. package/tests/rules/pack-compjson/audit-singleton-1/loader.js +0 -20
  680. package/tests/rules/pack-compjson/audit-singleton-1/resources/nls/audit-singleton-1-strings.js +0 -18
  681. package/tests/rules/pack-compjson/audit-singleton-2/audit-singleton-2-view.html +0 -8
  682. package/tests/rules/pack-compjson/audit-singleton-2/audit-singleton-2-viewModel.js +0 -56
  683. package/tests/rules/pack-compjson/audit-singleton-2/component.json +0 -15
  684. package/tests/rules/pack-compjson/audit-singleton-2/loader.js +0 -20
  685. package/tests/rules/pack-compjson/audit-singleton-2/resources/nls/audit-singleton-2-strings.js +0 -18
  686. package/tests/rules/parse-html/proc_instr.html +0 -9
  687. package/tests/rules/spoc-dom-manip/dom-manip_FAIL_1.js +0 -113
  688. package/tests/rules/spoc-dom-manip/dom-manip_FAIL_2.js +0 -151
  689. package/tests/rules/spoc-dom-manip/dom-manip_PASS_1.js +0 -149
  690. package/tests/rules/spoc-dom-manip/dom-manip_PASS_2.js +0 -147
  691. package/tests/rules/spoc-dom-manip/dom-manip_PASS_3.js +0 -147
  692. package/tests/rules/spoc-dom-manip/dom-manip_PASS_4.js +0 -20
  693. package/tests/rules/spoc-dom-manip/dom-manip_PASS_5.js +0 -246
  694. package/tests/rules/tab-tests/tab-test_FAIL_1.html +0 -37
  695. package/tests/rules/tab-tests/tab-test_FAIL_2.html +0 -8
  696. package/tests/rules/webcomptests/jet-composites/oj-html-wctag-$props/prop_PASS_1.html +0 -8
  697. package/tests/rules/webcomptests/jet-composites/oj-html-wctag-$props/prop_PASS_2.html +0 -8
  698. package/tests/rules/webcomptests/jet-composites/oj-html-wctag-for/for_FAIL_1.html +0 -8
  699. package/tests/rules/webcomptests/jet-composites/oj-html-wctag-for/for_PASS_1.html +0 -8
  700. package/tests/src/JetTest.js +0 -1
  701. package/tests/src/server.js +0 -1
  702. package/tests/test.js +0 -1
@@ -1 +1,6 @@
1
+ /*
2
+ * Copyright (c) 2018, 2021, Oracle and/or its affiliates.
3
+ * Licensed under The Universal Permissive License (UPL), Version 1.0
4
+ * as shown at https://oss.oracle.com/licenses/upl/
5
+ */
1
6
  const RULE_NAME="oj-html-ojslot";function getName(){return RULE_NAME};function getShortDescription(){return"<oj-bind-slot> should be used instead of deprecated <oj-slot>"};function getDescription(){return"<i><oj-slot></i> has been <b>deprecated</b> since it is a binding-only element, and not a full custom "+"element with properties and methods that can be accessed. Replace with <i><oj-bind-slot></i>."};function register(){return{"ojtag":function(ruleCtx,tagName){if(tagName==="oj-slot"){var issue=new ruleCtx.Issue("<oj-slot> is deprecated. Use <oj-bind-slot>.");ruleCtx.reporter.addIssue(issue,ruleCtx)}}}};module.exports={getName,getDescription,getShortDescription,register};
@@ -1 +1,6 @@
1
+ /*
2
+ * Copyright (c) 2018, 2021, Oracle and/or its affiliates.
3
+ * Licensed under The Universal Permissive License (UPL), Version 1.0
4
+ * as shown at https://oss.oracle.com/licenses/upl/
5
+ */
1
6
  const getStyles=require("./helpers/extractStylesFromClass");const RULE_NAME="oj-html-ojstyle";const SHORT="JET component 'class' attribute styles must be valid";const LONG="JET web component 'class' attribute styles prefixed with 'oj-' must be JET defined styles, or defined in a styleset.";function Rule(){this._checkList=null;this._isAccept=false};Rule.prototype.getName=function(){return RULE_NAME};Rule.prototype.getShortDescription=function(){return SHORT};Rule.prototype.getDescription=function(){return LONG};Rule.prototype.register=function(regCtx){var i;if(regCtx.rulePack.isRuleEnabled("oj-html-stylesel")){return false}this._ignore=regCtx.ruleOpts["ignore"];if(this._ignore){for(i=0;i<this._ignore.length;i++){this._ignore[i]=new RegExp(this._ignore[i])}}return{"class":this._onClass}};Rule.prototype._onClass=function(ruleCtx,attrName,attrValue){var tagName,i,j,issue,classes,style,metaLib;metaLib=ruleCtx.utils.metaLib;tagName=ruleCtx.tag;if(!ruleCtx.ojTag||!metaLib.isJetTag(tagName)){return}classes=getStyles(attrValue);for(i=0;i<classes.length;i++){style=classes[i];if(this._ignore){for(j=0;j<this._ignore.length;j++){if(this._ignore[j].test(style)){break}}if(j<this._ignore.length){continue}}if(!metaLib.isStyle(style)){issue=new ruleCtx.Issue("<"+tagName+"> - unknown JET class style '"+style+"'");ruleCtx.reporter.addIssue(issue,ruleCtx)}}};module.exports=Rule;
@@ -1 +1,6 @@
1
- const RULE_NAME="oj-html-ojtag-datacmd";const DATA_OJ_CMD="data-oj-command";const OJ_MENU="oj-menu";const OJ_OPTION="oj-option";const OJ_PREFIX="oj-";function getName(){return RULE_NAME};function getShortDescription(){return"JET web component property 'data-oj-command' can only be used if defined for the component"};function getDescription(){return"Attribute 'data-oj-command' should not be used on JET web component elements if the component does not have a list of "+"values defined for it - refer to the JET API documentation for the component."};function register(){return{"attr":_handleAttr}};function _handleAttr(ruleCtx,attrName,attrValue){var node;if(attrName!==DATA_OJ_CMD){return}if(ruleCtx.tag!==OJ_OPTION){_emitIssue(ruleCtx,ruleCtx.tag,1);return}if(!ruleCtx.utils.DomUtils.isChildOfElem(OJ_MENU,ruleCtx.tagNode)){_emitIssue(ruleCtx,ruleCtx.tag,2);return}node=_findParentComponent(ruleCtx.tagNode);if(!node){_emitIssue(ruleCtx,ruleCtx.tag,3);return}if(!ruleCtx.utils.metaLib.isTagAttr(node.name,DATA_OJ_CMD)){_emitIssue(ruleCtx,node.name,0);return}};function _emitIssue(ruleCtx,tagName,msgNum){var issue,attrPos;if(msgNum===0){issue=new ruleCtx.Issue("Attribute 'data-oj-command' has no defined values for <"+tagName+">")}else if(msgNum===1){issue=new ruleCtx.Issue("Attribute 'data-oj-command' must appear on <oj-option> not <"+tagName+">")}else if(msgNum===2){issue=new ruleCtx.Issue("Attribute 'data-oj-command' - containing <oj-option> is not a child of <oj-menu>")}else if(msgNum===3){issue=new ruleCtx.Issue("Attribute 'data-oj-command' - unable to locate containing component of the associated <oj-menu>")}if(msgNum){issue.setMsgKey(RULE_NAME+"_"+msgNum)}attrPos=ruleCtx.utils.DomUtils.getAttrPosition(ruleCtx.data,ruleCtx.tagNode,DATA_OJ_CMD);issue.setPosition(attrPos.row,attrPos.col,attrPos.start,attrPos.end);ruleCtx.reporter.addIssue(issue,ruleCtx)};function _findParentComponent(node){var name,ret=false;while(node&&node.parent){name=node.parent.name;if(name.startsWith(OJ_PREFIX)){if(name!=="oj-bind-if"&&name!=="oj-bind-for-each"&&name!==OJ_MENU){ret=node.parent;break}}node=node.parent}return ret};module.exports={getName,getDescription,getShortDescription,register};
1
+ /*
2
+ * Copyright (c) 2018, 2021, Oracle and/or its affiliates.
3
+ * Licensed under The Universal Permissive License (UPL), Version 1.0
4
+ * as shown at https://oss.oracle.com/licenses/upl/
5
+ */
6
+ const RULE_NAME="oj-html-ojtag-datacmd";const DATA_OJ_CMD="data-oj-command";const OJ_MENU="oj-menu";const OJ_OPTION="oj-option";const OJ_PREFIX="oj-";function getName(){return RULE_NAME};function getShortDescription(){return"JET web component property 'data-oj-command' can only be used if defined for the component"};function getDescription(){return"Attribute 'data-oj-command' should not be used on JET web component elements if the component does not have a list of "+"values defined for it - refer to the JET API documentation for the component."};function register(){return{"attr":_handleAttr}};function _handleAttr(ruleCtx,attrName){var node;if(attrName!==DATA_OJ_CMD){return}if(ruleCtx.tag!==OJ_OPTION){_emitIssue(ruleCtx,ruleCtx.tag,1);return}if(!ruleCtx.utils.DomUtils.isChildOfElem(OJ_MENU,ruleCtx.tagNode)){_emitIssue(ruleCtx,ruleCtx.tag,2);return}node=_findParentComponent(ruleCtx.tagNode);if(!node){_emitIssue(ruleCtx,ruleCtx.tag,3);return}if(!ruleCtx.utils.metaLib.isTagAttr(node.name,DATA_OJ_CMD)){_emitIssue(ruleCtx,node.name,0);return}};function _emitIssue(ruleCtx,tagName,msgNum){var issue,attrPos;if(msgNum===0){issue=new ruleCtx.Issue("Attribute 'data-oj-command' has no defined values for <"+tagName+">")}else if(msgNum===1){issue=new ruleCtx.Issue("Attribute 'data-oj-command' must appear on <oj-option> not <"+tagName+">")}else if(msgNum===2){issue=new ruleCtx.Issue("Attribute 'data-oj-command' - containing <oj-option> is not a child of <oj-menu>")}else if(msgNum===3){issue=new ruleCtx.Issue("Attribute 'data-oj-command' - unable to locate containing component of the associated <oj-menu>")}if(msgNum){issue.setMsgKey(RULE_NAME+"_"+msgNum)}attrPos=ruleCtx.utils.DomUtils.getAttrPosition(ruleCtx.data,ruleCtx.tagNode,DATA_OJ_CMD);issue.setPosition(attrPos.row,attrPos.col,attrPos.start,attrPos.end);ruleCtx.reporter.addIssue(issue,ruleCtx)};function _findParentComponent(node){var name,ret=false;while(node&&node.parent){name=node.parent.name;if(name.startsWith(OJ_PREFIX)){if(name!=="oj-bind-if"&&name!=="oj-bind-for-each"&&name!==OJ_MENU){ret=node.parent;break}}node=node.parent}return ret};module.exports={getName,getDescription,getShortDescription,register};
@@ -1 +1,6 @@
1
+ /*
2
+ * Copyright (c) 2018, 2021, Oracle and/or its affiliates.
3
+ * Licensed under The Universal Permissive License (UPL), Version 1.0
4
+ * as shown at https://oss.oracle.com/licenses/upl/
5
+ */
1
6
  const RULE_NAME="oj-html-ojtag-datactx";const DATA_OJ_CTX="data-oj-context";function getName(){return RULE_NAME};function getShortDescription(){return"Attribute 'data-oj-context' should not specify an expression"};function getDescription(){return"Use of an attribute expression for 'data-oj-context' is meaningless"};function register(){return{"attrexpr":_handleAttr}};function _handleAttr(ruleCtx,attrName,attrValue){var issue;if(attrName===DATA_OJ_CTX){issue=new ruleCtx.Issue("'data-oj-context' attribute expession not expected");ruleCtx.reporter.addIssue(issue,ruleCtx)}};module.exports={getName,getDescription,getShortDescription,register};
@@ -1 +1,6 @@
1
- const RULE_NAME="oj-html-ojtag-deprecated";function getName(){return RULE_NAME};function getShortDescription(){return"Deprecated JET custom components should not be used"};function getDescription(){return"Deprecated JET custom components should not be used. Refer to the diagnostic issued for a suggested replacement."};function register(){return{"ojtag":_handleOjTag}};function _handleOjTag(ruleCtx,tagName){var issue,metaLib,deprecatedText;if(tagName==="oj-slot"){return}metaLib=ruleCtx.utils.metaLib;if(metaLib.isJetTag(tagName)){deprecatedText=metaLib.isTagDeprecated(tagName);if(deprecatedText!==null){issue=new ruleCtx.Issue("<"+tagName+"> is deprecated. "+deprecatedText);ruleCtx.reporter.addIssue(issue,ruleCtx)}}};module.exports={getName,getDescription,getShortDescription,register};
1
+ /*
2
+ * Copyright (c) 2018, 2021, Oracle and/or its affiliates.
3
+ * Licensed under The Universal Permissive License (UPL), Version 1.0
4
+ * as shown at https://oss.oracle.com/licenses/upl/
5
+ */
6
+ const RULE_NAME="oj-html-ojtag-deprecated";const SHORT="Deprecated custom components should not be used";const LONG="Deprecated custom components should not be used. Refer to the diagnostic issued for a suggested replacement.";class Rule{getName(){return RULE_NAME}getDescription(){return LONG}getShortDescription(){return SHORT}register(){return{"webcomp":this._onWC}}_onWC(ruleCtx,tag){var issue,metaLib,dep,depText,depSince;if(tag==="oj-slot"){return}metaLib=ruleCtx.utils.metaLib;dep=metaLib.isTagDeprecated(tag);if(dep){if(typeof dep==="object"){depText=dep.description?" "+dep.description:"";depSince=dep.since?" (since "+dep.since+")":null}else{depText=" "+dep;depSince=""}issue=new ruleCtx.Issue(`<${tag}> is deprecated${depSince}.${depText}`);if(!ruleCtx.ojTag){issue.setMsgKey(RULE_NAME+"_1")}ruleCtx.reporter.addIssue(issue,ruleCtx)}}}module.exports=Rule;
@@ -1 +1,6 @@
1
+ /*
2
+ * Copyright (c) 2018, 2021, Oracle and/or its affiliates.
3
+ * Licensed under The Universal Permissive License (UPL), Version 1.0
4
+ * as shown at https://oss.oracle.com/licenses/upl/
5
+ */
1
6
  const RULE_NAME="oj-html-ojtag-globattr-noprefix";function getName(){return RULE_NAME};function getShortDescription(){return"JET web component element with global attribute with an attribute expression and no ':' prefix is invalid"};function getDescription(){return"On elements that are JET web components, any use of a global attribute "+"not prefixed with <b>':'</b> and with an expression such as <b>attr=\"[[...]]\"</b> or <b>attr=\"{{...}}\"</b>, is invalid."};function register(){return{"ojtag":_handleTag}};function _handleTag(ruleCtx,tagName){var attribs,attrib,attrValue,issue,DomUtils,attrPos;attribs=ruleCtx.node.attribs;if(!attribs){return}DomUtils=ruleCtx.utils.DomUtils;for(attrib in attribs){if(DomUtils.isCommonAttr(attrib)){if(attrib.startsWith("data-")){if(ruleCtx.utils.metaLib.isTagAttr(tagName,attrib)){continue}}if(attrib.charAt(0)!==":"){attrValue=attribs[attrib];if(attrValue.startsWith("[[")||attrValue.startsWith("{{")){issue=new ruleCtx.Issue("Use of attribute expression with an unprefixed global attribute '"+attrib+"' is invalid for <"+tagName+">");attrPos=ruleCtx.utils.DomUtils.getAttrPosition(ruleCtx.data,ruleCtx.node,attrib);issue.setPosition(attrPos.row,attrPos.col,attrPos.start,attrPos.end);ruleCtx.reporter.addIssue(issue,ruleCtx)}}}}};module.exports={getName,getDescription,getShortDescription,register};
@@ -1 +1,6 @@
1
+ /*
2
+ * Copyright (c) 2018, 2021, Oracle and/or its affiliates.
3
+ * Licensed under The Universal Permissive License (UPL), Version 1.0
4
+ * as shown at https://oss.oracle.com/licenses/upl/
5
+ */
1
6
  const RULE_NAME="oj-html-ojtag-id";const SHORT_DESCRIPT="JET custom components should not used hard-coded 'id' attributes";const LONG_DESCRIPT="Hard-coded element IDs should not be used within custom components. Element IDs must be unique for each instance of the component. See context.uniqueId in the custom element documentation for information on how to derive unique IDs for elements."+"<p>If a CCA implements hard-coded IDs for HTML elements in the CCA view, e.g.<p>"+"<oj-input id=\"foo\"><p>"+"then this is guaranteed to cause issues as soon as more than one instance of "+"the component is used on the page (plus there is a significant risk of "+"collision with other IDs in the page as a whole.";function getName(){return RULE_NAME};function getShortDescription(){return SHORT_DESCRIPT};function getDescription(){return LONG_DESCRIPT};function register(){var issue,attrPos;return{"ojtag":function(ruleCtx,tagName){if(ruleCtx.utils.metaLib.isBindingTag(tagName)){return}if(ruleCtx.node.attribs&&ruleCtx.node.attribs.id){var id=ruleCtx.node.attribs.id;if(id.toLowerCase().indexOf("$unique")<0){if(!ruleCtx.ojTag){issue=new ruleCtx.Issue("<"+ruleCtx.tag+"> uses id attribute '"+id+"'. Use $UniqueId.");attrPos=ruleCtx.utils.DomUtils.getAttrPosition(ruleCtx.data,ruleCtx.node,"id");issue.setPosition(attrPos.row,attrPos.col,attrPos.start,attrPos.end);ruleCtx.reporter.addIssue(issue,ruleCtx)}}}}}};module.exports={getName,getDescription,getShortDescription,register};
@@ -1 +1,6 @@
1
+ /*
2
+ * Copyright (c) 2018, 2021, Oracle and/or its affiliates.
3
+ * Licensed under The Universal Permissive License (UPL), Version 1.0
4
+ * as shown at https://oss.oracle.com/licenses/upl/
5
+ */
1
6
  const RULE_NAME="oj-html-ojtag-nonglobattr-prefix";function getName(){return RULE_NAME};function getShortDescription(){return"JET component element with non-global attribute with an attribute expression and no ':' prefix is not recommended"};function getDescription(){return"On elements that are JET components/composites, any use of a non-global attribute "+"prefixed with ':' and with an attribute expression such as attr=\"[[...]]\" or attr=\"{{...}}\", is not recommended."};function register(){return{"ojtag":_handleTag}};function _handleTag(ruleCtx,tagName){var attribs,attrib,attrValue,DomUtils,attrPos,issue;attribs=ruleCtx.node.attribs;if(!attribs){return}DomUtils=ruleCtx.utils.DomUtils;for(attrib in attribs){if(tagName==="oj-label"&&(attrib==="for"||attrib===":for")){continue}if(!DomUtils.isCommonAttr(attrib)){if(attrib.charAt(0)===":"){attrValue=attribs[attrib];if(attrValue.startsWith("[[")||attrValue.startsWith("{{")){issue=new ruleCtx.Issue("Use of attribute expression with non-global prefixed attribute '"+attrib+"' is invalid for <"+tagName+">");attrPos=DomUtils.getAttrPosition(ruleCtx.data,ruleCtx.node,attrib);issue.setPosition(attrPos.row,attrPos.col,attrPos.start,attrPos.end);ruleCtx.reporter.addIssue(issue,ruleCtx)}}}}};module.exports={getName,getDescription,getShortDescription,register};
@@ -1 +1,6 @@
1
+ /*
2
+ * Copyright (c) 2018, 2021, Oracle and/or its affiliates.
3
+ * Licensed under The Universal Permissive License (UPL), Version 1.0
4
+ * as shown at https://oss.oracle.com/licenses/upl/
5
+ */
1
6
  const RULENAME="oj-html-ojtag-ns";const LONG="Web component namespaces starting with prefixes 'oj-' or 'ns-' must be registered. A component must not use an un-registered namespace.";const SHORT="Web component namespaces starting with prefixes 'oj-' or 'ns-' must be registered.";class Rule{getName(){return RULENAME}getDescription(){return LONG}getShortDescription(){return SHORT}register(){return{ojtag:this._onOjTag}}_onOjTag(ruleCtx,tag){var a,prefix,msg,i;if(tag.startsWith("demo-")||tag.startsWith("my-")||tag==="oj-slot"){return}if(tag.startsWith("oj-")||tag.startsWith("ns-")){a=tag.split("-");if(a.length>=2){prefix=a[0]+"-"+a[1];if(!ruleCtx.utils.metaLib.isNSRegistered(prefix)){if(!ruleCtx.utils.metaLib.isJetTag(tag)){msg=`<${tag}> : unregistered use of '${tag.substring(0,2)}' namespace`;this._emitIssue(ruleCtx,msg)}}}}else{if(a.length>=2){if(this._nameSpaces){prefix=a[0]+"-"+a[1];for(i=0;i<this._nameSpaces.length;i++){if(this._nameSpaces[i].startsWith(prefix)){return}}}let b=tag.includes("-");let s=b?"web component namespace":"tag";msg=`'${tag}' : unknown ${s}`;this._emitIssue(ruleCtx,msg,b?1:2)}}}_emitIssue(ruleCtx,msg,id){var issue;issue=new ruleCtx.Issue(msg);if(id){issue.setMsgKey(RULENAME+"_"+id)}ruleCtx.reporter.addIssue(issue,ruleCtx)}}module.exports=Rule;
@@ -0,0 +1,6 @@
1
+ /*
2
+ * Copyright (c) 2018, 2021, Oracle and/or its affiliates.
3
+ * Licensed under The Universal Permissive License (UPL), Version 1.0
4
+ * as shown at https://oss.oracle.com/licenses/upl/
5
+ */
6
+ const RULENAME="oj-html-picker-attrs";const DESCRIPTION="Attribute 'picker-attributes.style' violates the recommended Content Security Policy (CSP) which disallows inline styles, and is therefore ignored in JET 11.0.";const SHORT_DESCRIPTION="Attribute 'picker-attributes.style' is a CSP violation(no inline styles), and is ignored.";const MSG="Attribute 'picker-attributes.style' is ignored in JET 11.0.0, and is a CSP violation - use 'picker-attributes.class'";const TAGS=new Set(["oj-input-date","oj-input-date-time","oj-input-time","oj-date-picker","oj-date-time-picker","oj-select-many","oj-combobox-many","oj-combobox-one"]);const PICKER_ATTRIB="picker-attributes";const STYLE="style";class Rule{getName(){return RULENAME}getDescription(){return DESCRIPTION}getShortDescription(){return SHORT_DESCRIPTION}register(){return{ojtag:this._onOJTag}}_onOJTag(ruleCtx,tag){var attribs;if(!TAGS.has(tag)){return}if(attribs=ruleCtx.tagNode.attribs){if(attribs.hasOwnProperty(PICKER_ATTRIB)){let o=attribs[PICKER_ATTRIB];if(!_isExpr(o)&&o.charAt(0)==="{"){try{let o=JSON.parse(attribs[PICKER_ATTRIB]);if(o&&o.hasOwnProperty(STYLE)){let issue=new ruleCtx.Issue(MSG);let attrPos=ruleCtx.utils.DomUtils.getAttrPosition(ruleCtx.data,ruleCtx.tagNode,PICKER_ATTRIB);issue.setPosition(attrPos.row,attrPos.col,attrPos.start,attrPos.end);ruleCtx.reporter.addIssue(issue,ruleCtx)}}catch(e){}}}}}}function _isExpr(s){s=s.substring(0,2);return s==="[["||s==="{{"}module.exports=Rule;
@@ -0,0 +1,6 @@
1
+ /*
2
+ * Copyright (c) 2018, 2021, Oracle and/or its affiliates.
3
+ * Licensed under The Universal Permissive License (UPL), Version 1.0
4
+ * as shown at https://oss.oracle.com/licenses/upl/
5
+ */
6
+ const RULENAME="oj-html-redwood-cssnovars";const DESCRIPTION="Support for CSS files 'oj-redwood-novars.css' and 'oj-redwood-novars-min.css' will be discontinued in JET 12. Replace with 'oj-redwood.css' or 'oj-redwood-min.css'.";const SHORT_DESCRIPT=DESCRIPTION;const MSG="Support for '@' will be discontinued in JET 12. Use 'oj-redwood.css' or 'oj-redwood-min.css'.";const NOVARS="oj-redwood-novars";const NOVARS_MIN="oj-redwood-novars-min";const HREF="href";class Rule{getName(){return RULENAME}getDescription(){return DESCRIPTION}getShortDescription(){return SHORT_DESCRIPT}register(){return{link:this._onLink}}_onLink(ruleCtx){var attrPos;var attribs=ruleCtx.node.attribs;if(attribs&&attribs.href){if(attribs.href.includes(NOVARS)){let isMin=attribs.href.includes(NOVARS_MIN);let issue=new ruleCtx.Issue(MSG.replace("@",isMin?NOVARS_MIN:NOVARS));attrPos=ruleCtx.utils.DomUtils.getAttrPosition(ruleCtx.data,ruleCtx.node,HREF);issue.setPosition(attrPos.row,attrPos.col,attrPos.start,attrPos.end);ruleCtx.reporter.addIssue(issue,ruleCtx)}}}}module.exports=Rule;
@@ -0,0 +1,6 @@
1
+ /*
2
+ * Copyright (c) 2018, 2021, Oracle and/or its affiliates.
3
+ * Licensed under The Universal Permissive License (UPL), Version 1.0
4
+ * as shown at https://oss.oracle.com/licenses/upl/
5
+ */
6
+ const RULENAME="oj-html-redwood-cssvars";const SHORT_DESCRIPT="Do not use 'oj-redwood-cssvars' files. Rename files such 'oj-redwood-cssvars-min.css' to 'oj-redwood-min.css'.";const DESCRIPTION="Files starting with 'oj-redwood-cssvars should NOT be used, and the string '-cssvars' "+" should be removed from the file path. For example, rename 'oj-redwood-cssvars-min.css' to 'oj-redwood-min.css'.";const MSG="CSS filename contains 'oj-redwood-cssvars'. Rename: e.g. 'oj-redwood-cssvars-min.css' to 'oj-redwood-min.css'.";const BAD_VARS="oj-redwood-cssvars";const HREF="href";class Rule{getName(){return RULENAME}getDescription(){return DESCRIPTION}getShortDescription(){return SHORT_DESCRIPT}register(){return{link:this._onLink}}_onLink(ruleCtx){var attrPos;var attribs=ruleCtx.node.attribs;if(attribs&&attribs.href){if(attribs.href.includes(BAD_VARS)){let issue=new ruleCtx.Issue(MSG);attrPos=ruleCtx.utils.DomUtils.getAttrPosition(ruleCtx.data,ruleCtx.node,HREF);issue.setPosition(attrPos.row,attrPos.col,attrPos.start,attrPos.end);ruleCtx.reporter.addIssue(issue,ruleCtx)}}}}module.exports=Rule;
@@ -1 +1,6 @@
1
+ /*
2
+ * Copyright (c) 2018, 2021, Oracle and/or its affiliates.
3
+ * Licensed under The Universal Permissive License (UPL), Version 1.0
4
+ * as shown at https://oss.oracle.com/licenses/upl/
5
+ */
1
6
  const RULE_NAME="oj-html-self-close";const SHORT="Do not self-close non-void elements.";const DESCRIPT="Do not self-close non-void elements, e.g. &lt;div/&gt; or &lt;span/&gt;";function Rule(){};Rule.prototype.getName=function(){return RULE_NAME};Rule.prototype.getShortDescription=function(){return SHORT};Rule.prototype.getDescription=function(){return DESCRIPT};Rule.prototype.register=function(regCtx){this._utils=regCtx.utils.utils;return{elem:this._onElem}};Rule.prototype._onElem=function(ruleCtx,tag){var tag,n,issue;var DomUtils;DomUtils=ruleCtx.utils.DomUtils;n=ruleCtx.tagNode;if(!DomUtils.isSvgElem(tag)){if(!DomUtils.isCommonElem(tag)||!DomUtils.isSelfClosingTag(tag)){if(this._isClosed(ruleCtx.data.substring(n.startIndex,n.endIndex+1),n)){issue=new ruleCtx.Issue("Invalid self-closure of non-void tag '<"+tag+"/>'");ruleCtx.reporter.addIssue(issue,ruleCtx)}}}};Rule.prototype._isClosed=function(data,node){var c,x,i;data=_removeAttribs(data,node);data=data.trim();if(data.charAt(0)!=="<"){return false}x=_findClose(data);if(x>=0){data=data.substring(0,x+1)}if(data.charAt(data.length-1)===">"){for(i=data.length-2;i>1;i--){c=data.charAt(i);if(this._utils.isWhitespace(c)){continue}return c==="/"}}return false};function _findClose(data){var x;x=data.indexOf(">");return x<0?0:x};function _removeAttribs(data,node){var attrs,attr,val,re;if(!node.attribs){return data}attrs=node.attribs;for(attr in attrs){val=attrs[attr];re=new RegExp(attr);data=data.replace(re,"");val=val.replace(/[.*+\-?^${}()|[\]\\]/g,"\\$&");re=new RegExp(val);data=data.replace(re,"")}data=data.replace(/[\"\'\=\[\(\{\}\)\]\s#,_]/g,"");return data};module.exports=Rule;
@@ -0,0 +1,6 @@
1
+ /*
2
+ * Copyright (c) 2018, 2021, Oracle and/or its affiliates.
3
+ * Licensed under The Universal Permissive License (UPL), Version 1.0
4
+ * as shown at https://oss.oracle.com/licenses/upl/
5
+ */
6
+ const getParentNodeForSlot=require('./helpers/has-slot-name');const RULE_NAME='oj-html-slot-item-minmax';const DESCRIPT='Components can include a \'minItems\' or \'maxItems\' property in a slot defintion in the component metadata, to describe '+'how many child elements can be assigned to that slot. This rule applies to components that are directly allocated to a '+'slot, or which are direct children of a template allocated to that slot.';const SHORT=DESCRIPT;const TEMPLATE='template';const OJ_SWITCHER='oj-switcher';function Rule(){};Rule.prototype.getName=function(){return RULE_NAME};Rule.prototype.getShortDescription=function(){return SHORT};Rule.prototype.getDescription=function(){return DESCRIPT};Rule.prototype.register=function(){this._handled=[];return{'elem':this._onElem,'file':this._onFile}};Rule.prototype._onElem=function(ruleCtx){var slotVal;if(ruleCtx.tagNode.attribs&&(slotVal=ruleCtx.tagNode.attribs.slot)){this._onSlot(ruleCtx,slotVal)}};Rule.prototype._onSlot=function(ruleCtx,slotVal){var issue,node,smd,min,max,items;if(!(node=getParentNodeForSlot(ruleCtx,slotVal))){return}if(this._isNodeHandled(node,slotVal)){return}if(node.name!==OJ_SWITCHER){if(smd=ruleCtx.utils.metaLib.getTagSlotMetadata(node.name,slotVal)){min=typeof smd.minItems==='number'?smd.minItems:0;max=typeof smd.maxItems==='number'?smd.maxItems:0;if(min>0&&max<0){return}}if(ruleCtx.tag===TEMPLATE){items=_getTemplateChildTagCount(ruleCtx.tagNode.children)}else{items=_getChildTagCount(node.children,slotVal)}let sItems;if(items>max&&max>0){sItems=max===1?'one element can':`${max} elements may`;issue=new ruleCtx.Issue(`<${node.name}> specifies that no more than ${sItems} be assigned to the '${slotVal}' slot`);issue.setPosition(null,null,node.startIndex+1,node.startIndex+node.name.length);ruleCtx.reporter.addIssue(issue,ruleCtx);this._handleNode(node,slotVal)}if(min>0&&items<min){sItems=min===1?'one element':`${min} elements`;issue=new ruleCtx.Issue(`<${node.name}> specifies that at least ${sItems} must be assigned to the '${slotVal}' slot`);issue.setMsgKey(RULE_NAME+'_1');issue.setSeverity('major');issue.setPosition(null,null,node.startIndex+1,node.startIndex+node.name.length);ruleCtx.reporter.addIssue(issue,ruleCtx);this._handleNode(node,slotVal)}}};Rule.prototype._onFile=function(){this._handled.length=0};Rule.prototype._isNodeHandled=function(node,slot){var i,si;si=node.startIndex;for(i=0;i<this._handled.length;i+=2){if(this._handled[i]===si&&this._handled[i+1]===slot){return true}}return false};Rule.prototype._handleNode=function(node,slot){this._handled.push(node.startIndex);this._handled.push(slot)};function _getTemplateChildTagCount(childs){var n=0;if(childs){for(let i=0;i<childs.length;i++){if(childs[i].type==='tag'){n++}}}return n};function _getChildTagCount(childs,slot){var child,n=0;if(childs){for(let i=0;i<childs.length;i++){child=childs[i];if(child.type==='tag'&&child.attribs&&child.attribs.slot===slot){n++}}}return n};module.exports=Rule;
@@ -1 +1,6 @@
1
- const RULE_NAME="oj-html-slot-name";const SLOT="slot";const helper=require("./helpers/has-slot-name");function getName(){return RULE_NAME};function getShortDescription(){return"The element specifies a slot attribute value that is not defined by the parent element."};function getDescription(){return"The element specifies a slot attribute value that is not defined by the parent element."};function register(){return{"attr":function(ruleCtx,attrName,attrValue){var issue,node;if(attrName!==SLOT||ruleCtx.tag==="template"){return}node=helper(ruleCtx,attrValue);if(!node){issue=new ruleCtx.Issue("unresolved slot '"+attrValue+"' on <"+ruleCtx.tag+">");ruleCtx.reporter.addIssue(issue,ruleCtx)}}}};module.exports={getName,getDescription,getShortDescription,register};
1
+ /*
2
+ * Copyright (c) 2018, 2021, Oracle and/or its affiliates.
3
+ * Licensed under The Universal Permissive License (UPL), Version 1.0
4
+ * as shown at https://oss.oracle.com/licenses/upl/
5
+ */
6
+ const getParentNodeForSlot=require("./helpers/has-slot-name");const RULE_NAME="oj-html-slot-name";const DESCRIPT="The element specifies a slot attribute value that is not defined by the slot owning component.";const SHORT=DESCRIPT;const SLOT="slot";const TEMPLATE="template";function Rule(){};Rule.prototype.getName=function(){return RULE_NAME};Rule.prototype.getShortDescription=function(){return SHORT};Rule.prototype.getDescription=function(){return DESCRIPT};Rule.prototype.register=function(){return{"elem":this._onElem}};Rule.prototype._onElem=function(ruleCtx,tag){var slotVal;if(ruleCtx.tagNode.attribs&&(slotVal=ruleCtx.tagNode.attribs.slot)&&tag!==TEMPLATE){this._onSlot(ruleCtx,slotVal)}};Rule.prototype._onSlot=function(ruleCtx,slotVal){var issue,node;node=getParentNodeForSlot(ruleCtx,slotVal);if(!node){issue=new ruleCtx.Issue(`unresolved slot '${slotVal}' on <${ruleCtx.tag}>`);let attrPos=ruleCtx.utils.DomUtils.getAttrPosition(ruleCtx.data,ruleCtx.node,SLOT);issue.setPosition(attrPos.row,attrPos.col,attrPos.start,attrPos.end);ruleCtx.reporter.addIssue(issue,ruleCtx);return}};module.exports=Rule;
@@ -0,0 +1,6 @@
1
+ /*
2
+ * Copyright (c) 2018, 2021, Oracle and/or its affiliates.
3
+ * Licensed under The Universal Permissive License (UPL), Version 1.0
4
+ * as shown at https://oss.oracle.com/licenses/upl/
5
+ */
6
+ const getParentNodeForSlot=require('./helpers/has-slot-name');const RULE_NAME='oj-html-slot-pref-content';const DESCRIPT='When component metadata defines \'preferredContent\' for a slot, child elements placed into that slot should '+'implement one or more of the requested interfaces and document that through their \'implements\' metadata. '+'This rule applies to components that are directly allocated to a slot, or which are direct children '+'of a template allocated to that slot.';const SHORT=DESCRIPT;const TEMPLATE='template';const OJ_SWITCHER='oj-switcher';function Rule(){};Rule.prototype.getName=function(){return RULE_NAME};Rule.prototype.getShortDescription=function(){return SHORT};Rule.prototype.getDescription=function(){return DESCRIPT};Rule.prototype.register=function(){return{'elem':this._onElem}};Rule.prototype._onElem=function(ruleCtx){var slotVal;if(ruleCtx.tagNode.attribs&&(slotVal=ruleCtx.tagNode.attribs.slot)){this._onSlot(ruleCtx,slotVal)}};Rule.prototype._onSlot=function(ruleCtx,slotVal){var issue,node;if(!(node=getParentNodeForSlot(ruleCtx,slotVal))){return}if(node.name!==OJ_SWITCHER){let sc=ruleCtx.utils.metaLib.getPreferredSlotContent(node.name,slotVal);if(sc&&sc.interfaces){let ar;if(ruleCtx.tag===TEMPLATE){if(!(ar=_getChildTags(ruleCtx.tagNode.children))){return}}else{ar=[ruleCtx.tagNode]}for(let i=0;i<ar.length;i++){if(!sc.components.includes(ar[i].name)){var ifc=_list(sc.interfaces,'or');var comp=_list(sc.components,'or',true);var multi=sc.interfaces.length>1;if(multi){issue=new ruleCtx.Issue(`Slot '${slotVal}' for <${node.name}> should contain components implementing interfaces ${ifc} (e.g. ${comp})`)}else{issue=new ruleCtx.Issue(`Slot '${slotVal}' for <${node.name}> should contain a component implementing interface ${ifc} (e.g. ${comp})`)}issue.setPosition(null,null,ar[i].startIndex,ar[i].startIndex+ar[i].name.length);ruleCtx.reporter.addIssue(issue,ruleCtx)}}}}};function _getChildTags(childs){var a;if(childs){for(let i=0;i<childs.length;i++){if(childs[i].type==='tag'){if(!a){a=[]}a.push(childs[i])}}}return a};function _list(a,orand,isComp){var s='';for(let i=0;i<a.length;i++){if(i){if(i===a.length-1){s+=(isComp?'>':'\'')+' '+orand+' '}else{s+=(isComp?'<':'\'')+' '}}s+=(isComp?'<':'\'')+a[i]}return s?s+=isComp?'>':'\'':s}module.exports=Rule;
@@ -1 +1,6 @@
1
+ /*
2
+ * Copyright (c) 2018, 2021, Oracle and/or its affiliates.
3
+ * Licensed under The Universal Permissive License (UPL), Version 1.0
4
+ * as shown at https://oss.oracle.com/licenses/upl/
5
+ */
1
6
  const{LENGTH_PROP_SET}=require("./helpers/cssHelper");const RULENAME="oj-html-style-abs-units";const DESCRIPTION="In general it is preferable to use relative length units in place of absolute units. "+"Specifically, 'rem' units are recommended because they proportionately adjust to the root "+"font size. 'rem' can be used for anything that takes a length unit - e.g. font-size, line-height, "+"width, height, padding, margin, etc. However, there are cases where absolute units are "+"required. This project is configured to allow absolute units in selector names that include "+"one of the following terms: 'image, and 'picture'.";const SHORT_DESCRIPTION="In general it is preferable to use relative length units in place of absolute units.";const ABS_UNITS=["px","cm","mm","in","pt","pc","all"];const COLON=":";const ALL="all";const NUMBER="number";class Rule{getName(){return RULENAME}getDescription(){return DESCRIPTION}getShortDescription(){return SHORT_DESCRIPTION}register(regCtx){if(!this._checkRuleOptions(regCtx)){return false}return{"style":this._onStyle}}_onStyle(ruleCtx,attr,value){var prop,val,unit,s,x,i;this._CssUtils=ruleCtx.utils.CssUtils;for(i=0;i<value.length;i++){s=value[i];x=s.indexOf(COLON);if(x>=0){prop=s.substring(0,x).trimEnd();val=s.substring(x+1).trimStart();if(!LENGTH_PROP_SET.has(prop)){continue}{unit=_hasAbsUnits(val);if(unit){this._prop(ruleCtx,prop,val,unit)}}}}}_prop(ruleCtx,prop,val,unit){var m,qty,s,i;m=val.match(/[0-9]+(px|cm|mm|in|pt|pc)/g);if(m&&m.length){for(i=0;i<m.length;i++){s=m[i];unit=s.substring(s.length-2);qty=s.substring(0,s.length-unit.length);qty=parseInt(qty);if(!this._okThreshold(unit,qty)||qty===0){this._emitIssue(ruleCtx,prop,m[i],unit,qty)}}}else if(_isExpr(val)){this._emitIssue2(ruleCtx,prop,val,unit)}}_emitIssue(ruleCtx,prop,val,unit,qty){var issue,unit;if(qty){issue=new ruleCtx.Issue(`style '${prop}' value '${val}' - best practices: replace absolute unit '${unit}' with a relative unit (e.g. 'rem' or '%')`)}else{issue=new ruleCtx.Issue(`style '${prop}' value '${val}' - best practices: remove '${unit}' for zero quantity`);issue.setMsgKey(RULENAME+"_1");issue.setSeverity("minor")}if(issue){this._reportIssue(ruleCtx,issue)}}_emitIssue2(ruleCtx,prop,val,unit){var issue;issue=new ruleCtx.Issue(`style '${prop}' expression '${val}' generates a '${unit}' length - best practices: convert to a relative unit (e.g. 'rem' or '%')`);issue.setMsgKey(RULENAME+"_2");this._reportIssue(ruleCtx,issue)}_reportIssue(ruleCtx,issue){var pos;pos=ruleCtx.utils.DomUtils.getAttrPosition(ruleCtx.data,ruleCtx.tagNode,"style");issue.setPosition(pos.row,pos.col,pos.start,pos.end);ruleCtx.reporter.addIssue(issue,ruleCtx)}_okThreshold(unit,qty){var th;if(!this._unitOpts||typeof qty!==NUMBER){return true}th=this._unitOpts[unit];if(th===undefined){th=this._unitOpts[ALL]}return th?Math.abs(qty)<=th:true}_checkRuleOptions(regCtx){var units,unit,th,b;units=regCtx.ruleOpts["absunits"];if(units){if(!regCtx.utils.utils.isObject(units)){regCtx.utils.msgLib.error(`Rule ${regCtx.ruleName} : option 'absunits' is not an object`);this._fail=true;return false}for(unit in units){if(!ABS_UNITS.includes(unit)){regCtx.utils.msgLib.error(`Rule ${regCtx.ruleName} : option 'absunits' value '${unit}' is not absolute`);b=true;continue}if(units.hasOwnProperty(unit)){th=units[unit];if(typeof th!==NUMBER){regCtx.utils.msgLib.error(`Rule ${regCtx.ruleName} : option 'absunits' threshold '${th}' is not a number`);b=true}}}this._unitOpts=units}return!b}}function _hasAbsUnits(s){var expr,unit,start,end,i,x;for(i=0;i<ABS_UNITS.length;i++){unit=ABS_UNITS[i];if(unit!==ALL&&s.includes(unit)){return unit}}expr=_isExpr(s);if(!expr){return false}for(i=0;i<ABS_UNITS.length;i++){unit=ABS_UNITS[i];if(unit===ALL){continue}x=s.indexOf(unit);if(x>=0){end=s[x+1];start=s[x-1].toLowerCase();if(start==="."||start==="+"||start.match(/[a-z]/i)){continue}return unit}}return false};function _isExpr(s){return s.includes("$")};module.exports=Rule;
@@ -1 +1,6 @@
1
+ /*
2
+ * Copyright (c) 2018, 2021, Oracle and/or its affiliates.
3
+ * Licensed under The Universal Permissive License (UPL), Version 1.0
4
+ * as shown at https://oss.oracle.com/licenses/upl/
5
+ */
1
6
  const cssHelper=require("./helpers/cssHelper");const RULE_NAME="oj-html-style-bp-color";const SHORT_DESCRIPT="For best practices, CSS color values should not be used - color classes such as 'oj-text-color-primary' are preferred.";const DESCRIPT="For best practices, CSS color values should not be used - color classes such as 'oj-text-color-primary' are preferred."+" See the Colors demo category in the JET cookbook under the Framework "+"<a href='https://www.oracle.com/webfolder/technetwork/jet/jetCookbook.html?component=colors&demo=bgcolors'>Utility CSS</a> category.";function Rule(){this._checkList=null;this._isAccept=false};Rule.prototype.getName=function(){return RULE_NAME};Rule.prototype.getShortDescription=function(){return SHORT_DESCRIPT};Rule.prototype.getDescription=function(){return DESCRIPT};Rule.prototype.register=function(regCtx){if(!this._checkAcceptReject(regCtx)){return false}return{"style":this._onStyle}};Rule.prototype._onStyle=function(ruleCtx,attr,value,raw){var prop,val,s,x,i;this._CssUtils=ruleCtx.utils.CssUtils;for(i=0;i<value.length;i++){s=value[i];x=s.indexOf(":");if(x>=0){prop=s.substring(0,x).trimEnd();val=s.substring(x+1).trimStart();if(cssHelper.COLOR_PROPS.includes(prop)){if(this._isColorValFound(val)){if(this._okProp(prop)){this._emitIssue(ruleCtx,prop,val)}}}else if(cssHelper.COLOR_PROPS_MULTI.includes(prop)){if(this._okProp(prop)){this._parseMulti(ruleCtx,prop,val)}}}}};Rule.prototype._parseMulti=function(ruleCtx,prop,val){var a,v,i;a=val.split(" ");for(i=0;i<a.length;i++){v=a[i].trim();if(v.charAt(0)==="#"||_isColorFunc(v)||this._CssUtils.isColorName(v)){this._emitIssue(ruleCtx,prop,v)}}};Rule.prototype._emitIssue=function(ruleCtx,prop,val){var issue;issue=new ruleCtx.Issue("CSS color '"+val+"' - best practices: use the utility CSS selectors available (see 'Text', 'Icons', and 'Link' pages)");ruleCtx.reporter.addIssue(issue,ruleCtx)};Rule.prototype._isColorValFound=function(s){var i;s=s.toLowerCase();if(_isColorFunc(s)||this._CssUtils.isColorName(s)){return true}i=s.indexOf("#");if(i>=0){s=s.substring(i);if(/[0-9A-F]{6}/i.test(s)||/[0-9A-F]{3}/i.test(s)){return true}}return false};Rule.prototype._okProp=function(prop){var i;if(this._checkList){for(i=0;i<this._checkList.length;i++){if(this._checkList[i]===prop){return this._isAccept}}return!this._isAccept}return true};Rule.prototype._checkAcceptReject=function(regCtx){var accept=regCtx.ruleOpts["accept"];var reject=regCtx.ruleOpts["reject"];if(accept||reject){if(accept&&reject){regCtx.utils.msgLib.error("Rule "+RULE_NAME+": options 'accept' and 'reject' are mutually exclusive");return false}if(accept){this._checkList=accept;this._isAccept=true}else{this._checkList=reject}if(!Array.isArray(this._checkList)){regCtx.utils.msgLib.error("Rule "+RULE_NAME+": option '"+(accept?"accept":"reject")+"' is not an array");return false}for(let i=0;i<this._checkList.length;i++){if(typeof this._checkList[i]==="string"){this._checkList[i]=this._checkList[i].trim()}}}return true};function _isColorFunc(s){s=s.toLowerCase();return s.startsWith("rgb")||s.startsWith("hsl")};module.exports=Rule;
@@ -1 +1,6 @@
1
- const RULE_NAME="oj-html-style-bp-display";const LONG_DESCRIPT="For best practices, CSS property 'display:none' should not be used. Use of JET hide classes is recommended.";const SHORT_DESCRIPT=LONG_DESCRIPT;function getName(){return RULE_NAME};function getShortDescription(){return SHORT_DESCRIPT};function getDescription(){return LONG_DESCRIPT};function register(){return{"style":_onStyle}};function _onStyle(ruleCtx,attr,value,raw){var prop,s,x,i;for(i=0;i<value.length;i++){s=value[i];x=s.indexOf(":");if(x>=0){prop=s.substring(0,x).trimEnd();value=s.substring(x+1).trimStart();if(prop==="display"&&value==="none"){_emitIssue(ruleCtx,prop)}}}};function _emitIssue(ruleCtx,prop){var issue;issue=new ruleCtx.Issue("CSS 'display:none' - best practices, use JET hide classes");ruleCtx.reporter.addIssue(issue,ruleCtx)};module.exports={getName,getDescription,getShortDescription,register};
1
+ /*
2
+ * Copyright (c) 2018, 2021, Oracle and/or its affiliates.
3
+ * Licensed under The Universal Permissive License (UPL), Version 1.0
4
+ * as shown at https://oss.oracle.com/licenses/upl/
5
+ */
6
+ const RULE_NAME="oj-html-style-bp-display";const LONG_DESCRIPT="For best practices, CSS property 'display:none' should not be used. Use of JET <oj-bind-if> is recommended.";const SHORT_DESCRIPT=LONG_DESCRIPT;function getName(){return RULE_NAME};function getShortDescription(){return SHORT_DESCRIPT};function getDescription(){return LONG_DESCRIPT};function register(){return{"style":_onStyle}};function _onStyle(ruleCtx,attr,value,raw){var prop,s,x,i;for(i=0;i<value.length;i++){s=value[i];x=s.indexOf(":");if(x>=0){prop=s.substring(0,x).trimEnd();value=s.substring(x+1).trimStart();if(prop==="display"&&value==="none"){_emitIssue(ruleCtx,prop)}}}};function _emitIssue(ruleCtx,prop){var issue;issue=new ruleCtx.Issue("CSS 'display:none' - best practices, use <oj-bind-if>");ruleCtx.reporter.addIssue(issue,ruleCtx)};module.exports={getName,getDescription,getShortDescription,register};
@@ -1 +1,6 @@
1
+ /*
2
+ * Copyright (c) 2018, 2021, Oracle and/or its affiliates.
3
+ * Licensed under The Universal Permissive License (UPL), Version 1.0
4
+ * as shown at https://oss.oracle.com/licenses/upl/
5
+ */
1
6
  const RULENAME="oj-html-style-bp-font-family";const DESCRIPT="For best practices, the CSS 'font-family' property should not be used. Use of JET typography classes is recommended.";const SHORT_DESCRIPT=DESCRIPT;const FONT_FAMILY="font-family";class Rule{constructor(){this._checkList=null;this._isAccept=false}getName(){return RULENAME}getDescription(){return DESCRIPT}getShortDescription(){return SHORT_DESCRIPT}register(regCtx){if(!this._checkRuleOverrides(regCtx)){return false}return{"style":this._onStyle}}_onStyle(ruleCtx,attr,value){var prop,val,s,x,i;for(i=0;i<value.length;i++){s=value[i];x=s.indexOf(":");if(x>=0){prop=s.substring(0,x).trimEnd();val=s.substring(x+1).trim();if(prop===FONT_FAMILY){if(this._okProp(val)){this._emitIssue(ruleCtx,prop,val)}}}}}_emitIssue(ruleCtx,prop,val){var issue;issue=new ruleCtx.Issue(`<style> '${prop}: ${val}' - best practices: JET Typography classes preferred`);ruleCtx.reporter.addIssue(issue,ruleCtx)}_okProp(prop){var i;if(this._checkList){for(i=0;i<this._checkList.length;i++){if(prop.match(this._checkList[i])){return this._isAccept}}return!this._isAccept}return true}_checkRuleOverrides(regCtx){var accept=regCtx.ruleOpts["accept"];var ignore=regCtx.ruleOpts["ignore"];if(accept||ignore){if(accept&&ignore){regCtx.utils.msgLib.error(`Rule ${RULENAME} : options 'accept' and 'ignore' are mutually exclusive`);return false}if(accept){this._checkList=accept;this._isAccept=true}else{this._checkList=ignore}if(!Array.isArray(this._checkList)){regCtx.utils.msgLib.error(`Rule ${RULENAME} : option '${accept?"accept":"reject"}' is not an array`);return false}for(let i=0;i<this._checkList.length;i++){if(typeof this._checkList[i]==="string"){this._checkList[i]=new RegExp(this._checkList[i].trim())}}}return true}}module.exports=Rule;
@@ -1 +1,6 @@
1
+ /*
2
+ * Copyright (c) 2018, 2021, Oracle and/or its affiliates.
3
+ * Licensed under The Universal Permissive License (UPL), Version 1.0
4
+ * as shown at https://oss.oracle.com/licenses/upl/
5
+ */
1
6
  const RULE_NAME="oj-html-style-bp-font";const DESCRIPT="For best practices, CSS 'font-size' and 'font-weight' should not be used. Use of JET typography classes is recommended.";const SHORT_DESCRIPT=DESCRIPT;const FONT_PROPS=["font-size","font-weight"];function Rule(){this._checkList=null;this._isAccept=false};Rule.prototype.getName=function(){return RULE_NAME};Rule.prototype.getShortDescription=function(){return SHORT_DESCRIPT};Rule.prototype.getDescription=function(){return DESCRIPT};Rule.prototype.register=function(regCtx){if(!this._checkAcceptReject(regCtx)){return false}return{"style":this._onStyle}};Rule.prototype._onStyle=function(ruleCtx,attr,value,raw){var prop,s,x,i;for(i=0;i<value.length;i++){s=value[i];x=s.indexOf(":");if(x>=0){prop=s.substring(0,x).trimEnd();if(FONT_PROPS.includes(prop)){if(this._okProp(prop)){this._emitIssue(ruleCtx,prop)}}}}};Rule.prototype._emitIssue=function(ruleCtx,prop){var issue;issue=new ruleCtx.Issue("CSS '"+prop+"' - best practices: do not set, use the JET Typography classes");ruleCtx.reporter.addIssue(issue,ruleCtx)};Rule.prototype._okProp=function(prop){var i;if(this._checkList){for(i=0;i<this._checkList.length;i++){if(this._checkList[i]===prop){return this._isAccept}}return!this._isAccept}return true};Rule.prototype._checkAcceptReject=function(regCtx){var accept=regCtx.ruleOpts["accept"];var reject=regCtx.ruleOpts["reject"];if(accept||reject){if(accept&&reject){regCtx.utils.msgLib.error("Rule "+RULE_NAME+": options 'accept' and 'reject' are mutually exclusive");return false}if(accept){this._checkList=accept;this._isAccept=true}else{this._checkList=reject}if(!Array.isArray(this._checkList)){regCtx.utils.msgLib.error("Rule "+RULE_NAME+": option '"+(accept?"accept":"reject")+"' is not an array");return false}for(let i=0;i<this._checkList.length;i++){if(typeof this._checkList[i]==="string"){this._checkList[i]=this._checkList[i].trim()}}}return true};module.exports=Rule;
@@ -1 +1,6 @@
1
+ /*
2
+ * Copyright (c) 2018, 2021, Oracle and/or its affiliates.
3
+ * Licensed under The Universal Permissive License (UPL), Version 1.0
4
+ * as shown at https://oss.oracle.com/licenses/upl/
5
+ */
1
6
  const getStyles=require("./helpers/extractStylesFromClass");const RULE_NAME="oj-html-style-deprecated";const SHORT="Deprecated 'class' attributes with 'oj-' prefix should not be used.";const LONG="Deprecated 'class' attribute styles prefixed with 'oj-' should not be used. Refer to the diagnostic for a suggested replacement.";function Rule(){this._checkList=null;this._isAccept=false};Rule.prototype.getName=function(){return RULE_NAME};Rule.prototype.getShortDescription=function(){return SHORT};Rule.prototype.getDescription=function(){return LONG};Rule.prototype.register=function(regCtx){if(!this._checkAcceptReject(regCtx)){return false}return{"class":this._onClass}};Rule.prototype._onClass=function(ruleCtx,attrName,attrValue){var i,dataBindChecked=false,classes,style,dep,component,comps,metaLib,DomUtils,issue;metaLib=ruleCtx.utils.metaLib;DomUtils=ruleCtx.utils.DomUtils;classes=getStyles(attrValue);for(i=0;i<classes.length;i++){style=classes[i];if(!dataBindChecked){component=DomUtils.getDataBindComponent(ruleCtx);dataBindChecked=true}if(component){comps=metaLib.getClassesFromStyle(style);if(comps&&comps.length&&comps.indexOf(component)>=0){continue}}if(this._OkStyle(style)){dep=metaLib.isStyleDeprecated(style);if(dep){if(dep.description&&!dep.description.endsWith(".")){dep.description=dep.description+"."}issue=new ruleCtx.Issue("Deprecated style class '"+style+"'"+(dep.since?" (since "+dep.since+").":"")+(dep.description?" "+dep.description:""));ruleCtx.reporter.addIssue(issue,ruleCtx)}}}};Rule.prototype._OkStyle=function(style){if(this._checkList){for(let i=0;i<this._checkList.length;i++){if(this._checkList[i].test(style)){return this._isAccept}}return!this._isAccept}return true};Rule.prototype._checkAcceptReject=function(regCtx){var accept=regCtx.ruleOpts["accept"];var reject=regCtx.ruleOpts["reject"];if(accept||reject){if(accept&&reject){regCtx.utils.msgLib.error("Rule "+RULE_NAME+": options 'accept' and 'reject' are mutually exclusive");return false}if(accept){this._checkList=accept;this._isAccept=true}else{this._checkList=reject}if(!Array.isArray(this._checkList)){regCtx.utils.msgLib.error("Rule "+RULE_NAME+": option '"+(accept?"accept":"reject")+"' is not an array");return false}for(let i=0;i<this._checkList.length;i++){if(typeof this._checkList[i]==="string"){this._checkList[i]=new RegExp(this._checkList[i].trim())}}}return true};module.exports=Rule;
@@ -1 +1,6 @@
1
- const getStyles=require("./helpers/extractStylesFromClass");const StyleSelector=require("./helpers/style-selector");const RULE_NAME="oj-html-style";const SHORT="A 'class' style prefixed with 'oj-*' must be valid and applicable to the element on which it is declared";const LONG="A 'class' style prefixed with 'oj-*' must be a known JET style and applicable to the element on which it is declared, or defined in a styleset.";const ch=[">",","];class Rule{constructor(){this._ignore=null;this._metaLib=null}getName(){return RULE_NAME}getShortDescription(){return SHORT}getDescription(){return LONG}register(regCtx){var i;if(regCtx.rulePack.isRuleEnabled("oj-html-stylesel")){return false}this._ignore=regCtx.ruleOpts["ignore"];if(this._ignore){for(i=0;i<this._ignore.length;i++){this._ignore[i]=new RegExp(this._ignore[i])}}this._metaLib=regCtx.utils.metaLib;StyleSelector.setAssertMsg(regCtx.utils.msgLib.assert);return{"class":this._onClass}}_onClass(ruleCtx,attrName,attrValue){var tagName,i,j,classes,style,sType;tagName=ruleCtx.tag;classes=getStyles(attrValue);for(i=0;i<classes.length;i++){style=classes[i];if(this._ignore){for(j=0;j<this._ignore.length;j++){if(this._ignore[j].test(style)){break}}if(j<this._ignore.length){continue}}sType=this._metaLib.getStyleOrigin(style);if(!sType){if(style.startsWith("oj-")){if(!this._metaLib.isStylesetStyle(style)){this._emitIssue(1,style,tagName,ruleCtx)}continue}}this._handleStyle(ruleCtx,style,sType)}}_handleStyle(ruleCtx,style,sType){var ss,tags,tagName,i,simple;tagName=ruleCtx.tag;if(sType==="j"||sType==="b"){ss=this._metaLib.getStyleSelector(style,sType==="j"||sType==="b");if(ss){if(StyleSelector.match(ruleCtx,ss)){return true}}else{tags=this._metaLib.getNonSSStyleElems(style,true);if(tags){for(i=0;i<tags.length;i++){if(tags[i]===tagName){return true}}}}}if(sType==="j"){if(ss){simple=_isSimpleElemOrStyle(ss);simple=!simple?3:simple==="e"?5:6;this._emitIssue(simple,style,tagName,ruleCtx,ss)}else if(tags){this._emitIssue(2,style,tagName,ruleCtx,tags)}return false}tags=null;ss=this._metaLib.getStyleSelector(style,false);if(ss){if(StyleSelector.match(ruleCtx,ss)){return true}}if(ss){simple=_isSimpleElemOrStyle(ss);simple=!simple?3:simple==="e"?5:6;this._emitIssue(simple,style,tagName,ruleCtx,ss);return false}return true}_emitIssue(num,style,tag,ruleCtx,extra1,extra2){var msg;switch(num){case 1:msg=`Unknown style '${style}' found on <${tag}>`;break;case 2:msg=`'${style}' cannot be applied to <${tag}> - only ${_fmt(num,extra1)}`;break;case 3:msg=`'${style}' on <${tag}> is not matched by '${extra1}'`;break;case 5:msg=`'${style}' can only be applied to <${extra1}> - not <${tag}>`;break;case 6:msg=`'${style}' - <${tag}> must also contain style '${extra1.substring(1)}'`;break;case 7:msg=`'${style}' cannot be applied to <${tag}> : no style selector match (${extra1}) and no elem match (${_fmt(num,extra2)})`;break;}if(msg){ruleCtx.reporter.addIssue(new ruleCtx.Issue(msg),ruleCtx)}}};function _isSimpleElemOrStyle(ss){const COMMA=",";const DOT=".";const SPACE=" ";const GT=">";ss=ss.trim();if(ss.includes(COMMA)||ss.includes(DOT,1)||ss.includes(SPACE)||ss.includes(GT)){return null}return ss.startsWith(DOT)?"s":"e"};function _fmt(n,extra){if(n===2||n===7){let s="";for(let i=0;i<extra.length;i++){if(i){s+=", ";if(extra.length>=2){if(i===extra.length-1){s+="or "}}}s+="<"+extra[i]+">"}return s}return"<"+extra[0]+">"};module.exports=Rule;
1
+ /*
2
+ * Copyright (c) 2018, 2021, Oracle and/or its affiliates.
3
+ * Licensed under The Universal Permissive License (UPL), Version 1.0
4
+ * as shown at https://oss.oracle.com/licenses/upl/
5
+ */
6
+ const getStyles=require("./helpers/extractStylesFromClass");const StyleSelector=require("./helpers/style-selector");const RULE_NAME="oj-html-style";const SHORT="A 'class' style prefixed with 'oj-*' must be valid and applicable to the element on which it is declared";const LONG="A 'class' style prefixed with 'oj-*' must be a known JET style and applicable to the element on which it is declared, or defined in a styleset.";const ch=[">",","];const SS_IGNORE_WILD=["oj-ux-","oj-sample-","oj-typography-"];const SS_IGNORE_LIST=["oj-label","oj-applayout-content","oj-visited","oj-disabled","oj-enabled","oj-read-only","oj-invalid","oj-warning","oj-info","oj-confirmation","oj-required","oj-indeterminate","oj-active","oj-selected","oj-hover","oj-focus","oj-focus-only","oj-focus-highlight","oj-default","oj-draggable","oj-drag","oj-drop","oj-active-drop","oj-valid-drop","oj-invalid-drop","oj-expanded","oj-collapsed","oj-right","oj-center","oj-left","oj-start","oj-end","oj-top","oj-middle","oj-bottom","oj-full-width","oj-hicontrast","oj-component","oj-component-initnode","oj-complete","oj-animate-open","oj-animate-open-active","oj-animate-close","oj-animate-close-active","oj-animate-add","oj-animate-add-active","oj-animate-remove","oj-animate-remove-active","oj-animate-update","oj-animate-update-active"];class Rule{constructor(){this._ignore=null;this._metaLib=null}getName(){return RULE_NAME}getShortDescription(){return SHORT}getDescription(){return LONG}register(regCtx){var i;if(regCtx.rulePack.isRuleEnabled("oj-html-stylesel")){return false}this._ignore=regCtx.ruleOpts["ignore"];if(this._ignore){for(i=0;i<this._ignore.length;i++){this._ignore[i]=new RegExp(this._ignore[i])}}this._metaLib=regCtx.utils.metaLib;StyleSelector.setAssertMsg(regCtx.utils.msgLib.assert);return{"class":this._onClass}}_onClass(ruleCtx,attrName,attrValue){var tagName,i,j,classes,style,sType;tagName=ruleCtx.tag;classes=getStyles(attrValue);for(i=0;i<classes.length;i++){style=classes[i];if(this._ignore){for(j=0;j<this._ignore.length;j++){if(this._ignore[j].test(style)){break}}if(j<this._ignore.length){continue}}if(_isIgnoreListed(style)){continue}sType=this._metaLib.getStyleOrigin(style);if(!sType){if(style.startsWith("oj-")){if(!this._metaLib.isStylesetStyle(style)){this._emitIssue(1,style,tagName,ruleCtx)}continue}}if(sType==="c"){continue}this._handleStyle(ruleCtx,style,sType)}}_handleStyle(ruleCtx,style,sType){var ss,tags,tagName,i,simple;tagName=ruleCtx.tag;if(sType==="j"||sType==="b"){ss=this._metaLib.getStyleSelector(style,sType==="j"||sType==="b");if(ss){if(StyleSelector.match(ruleCtx,ss)){return true}}else{tags=this._metaLib.getNonSSStyleElems(style,true);if(tags){for(i=0;i<tags.length;i++){if(tags[i]===tagName){return true}}}}}if(sType==="j"){if(ss){simple=_isSimpleElemOrStyle(ss);simple=!simple?3:simple==="e"?5:6;this._emitIssue(simple,style,tagName,ruleCtx,ss)}else if(tags){this._emitIssue(2,style,tagName,ruleCtx,tags)}return false}tags=null;ss=this._metaLib.getStyleSelector(style,false);if(ss){if(StyleSelector.match(ruleCtx,ss)){return true}}if(ss){simple=_isSimpleElemOrStyle(ss);simple=!simple?3:simple==="e"?5:6;this._emitIssue(simple,style,tagName,ruleCtx,ss);return false}return true}_emitIssue(num,style,tag,ruleCtx,extra1,extra2){var msg,ss,i;switch(num){case 1:msg=`Unknown style '${style}' found on <${tag}>`;break;case 2:msg=`'${style}' cannot be applied to <${tag}> - only ${_fmt(num,extra1)}`;break;case 3:if(Array.isArray(extra1)){ss="";for(i=0;i<extra1.length;i++){if(i){ss+=", or "}ss+="'"+extra1[i]+"'"}}else{ss="'"+extra1+"'"}msg=`'${style}' on <${tag}> is not matched by ${ss}`;break;case 5:msg=`'${style}' can only be applied to <${extra1}> - not <${tag}>`;break;case 6:msg=`'${style}' - <${tag}> must also contain style '${extra1.substring(1)}'`;break;case 7:msg=`'${style}' cannot be applied to <${tag}> : no style selector match (${extra1}) and no elem match (${_fmt(num,extra2)})`;break;}if(msg){ruleCtx.reporter.addIssue(new ruleCtx.Issue(msg),ruleCtx)}}};function _isIgnoreListed(style){var ret=false,i;for(i=0;i<SS_IGNORE_WILD.length;i++){if(style.startsWith(SS_IGNORE_WILD[i])){ret=true;break}}if(!ret){ret=SS_IGNORE_LIST.includes(style)}return ret};function _isSimpleElemOrStyle(ss){const COMMA=",";const DOT=".";const SPACE=" ";const GT=">";if(Array.isArray(ss)){if(ss.length===1){ss=ss[0]}else{return null}}ss=ss.trim();if(ss.includes(COMMA)||ss.includes(DOT,1)||ss.includes(SPACE)||ss.includes(GT)){return null}return ss.startsWith(DOT)?"s":"e"};function _fmt(n,extra){if(n===2||n===7){let s="";for(let i=0;i<extra.length;i++){if(i){s+=", ";if(extra.length>=2){if(i===extra.length-1){s+="or "}}}s+="<"+extra[i]+">"}return s}return"<"+extra[0]+">"};module.exports=Rule;
@@ -1 +1,6 @@
1
- const getStyles=require("./helpers/extractStylesFromClass");const StyleSelector=require("./helpers/style-selector");const RULENAME="oj-html-stylesel";const SHORT="A 'class' style prefixed with 'oj-*' must be valid and applicable to the element on which it is declared";const LONG="A 'class' style prefixed with 'oj-*' must be a known JET style and applicable to the element on which it is declared, or defined in a styleset.";const SS_IGNORE_WILD=["oj-ux-","oj-sample-","oj-typography-"];const SS_IGNORE_LIST=["oj-label","oj-applayout-content","oj-visited","oj-disabled","oj-enabled","oj-read-only","oj-invalid","oj-warning","oj-info","oj-confirmation","oj-required","oj-indeterminate","oj-active","oj-selected","oj-hover","oj-focus","oj-focus-only","oj-focus-highlight","oj-default","oj-draggable","oj-drag","oj-drop","oj-active-drop","oj-valid-drop","oj-invalid-drop","oj-expanded","oj-collapsed","oj-right","oj-center","oj-left","oj-start","oj-end","oj-top","oj-middle","oj-bottom","oj-full-width","oj-hicontrast","oj-component","oj-component-initnode","oj-complete","oj-animate-open","oj-animate-open-active","oj-animate-close","oj-animate-close-active","oj-animate-add","oj-animate-add-active","oj-animate-remove","oj-animate-remove-active","oj-animate-update","oj-animate-update-active"];class Rule{constructor(){this._ignore=null;this._metaLib=null}getName(){return RULENAME}getShortDescription(){return SHORT}getDescription(){return LONG}register(regCtx){var i;this._ignore=regCtx.ruleOpts["ignore"];if(this._ignore){for(i=0;i<this._ignore.length;i++){this._ignore[i]=new RegExp(this._ignore[i])}}this._metaLib=regCtx.utils.metaLib;StyleSelector.setAssertMsg(regCtx.utils.msgLib.assert);return{"class":this._onClass}}_onClass(ruleCtx,attrName,attrValue){var tagName,i,j,dataBindChecked=false,classes,style,sType;tagName=ruleCtx.tag;classes=getStyles(attrValue);for(i=0;i<classes.length;i++){style=classes[i];if(this._ignore){for(j=0;j<this._ignore.length;j++){if(this._ignore[j].test(style)){break}}if(j<this._ignore.length){continue}}if(_isIgnoreListed(style)){continue}sType=this._metaLib.getStyleOrigin(style);if(!sType){if(style.startsWith("oj-")){if(!this._metaLib.isStylesetStyle(style)){this._emitIssue(1,style,tagName,ruleCtx)}continue}}this._handleStyle(ruleCtx,style,sType)}}_handleStyle(ruleCtx,style,sType){var ss,tags,tagName,i,simple;tagName=ruleCtx.tag;if(sType==="j"||sType==="b"){ss=this._metaLib.getStyleSelector(style,sType==="j"||sType==="b");if(ss){if(StyleSelector.match(ruleCtx,ss)){return true}}else{tags=this._metaLib.getNonSSStyleElems(style,true);if(tags){for(i=0;i<tags.length;i++){if(tags[i]===tagName){return true}}}}}if(sType==="j"){if(ss){simple=_isSimpleElemOrStyle(ss);simple=!simple?3:simple==="e"?5:6;this._emitIssue(simple,style,tagName,ruleCtx,ss)}else if(tags){this._emitIssue(2,style,tagName,ruleCtx,tags)}return false}tags=null;ss=this._metaLib.getStyleSelector(style,false);if(ss){if(StyleSelector.match(ruleCtx,ss)){return true}}if(ss){simple=_isSimpleElemOrStyle(ss);simple=!simple?3:simple==="e"?5:6;this._emitIssue(simple,style,tagName,ruleCtx,ss);return false}return true}_emitIssue(num,style,tag,ruleCtx,extra1,extra2){var msg,issue;switch(num){case 1:msg=`unknown style '${style}' found on <${tag}>`;break;case 2:msg=`style '${style}' cannot be applied to <${tag}> - only ${_fmt(num,extra1)}`;break;case 3:msg=`style '${style}' on <${tag}> is not matched by '${extra1}'`;break;case 5:msg=`style '${style}' can only be applied to <${extra1}> - not <${tag}>`;break;case 6:msg=`style '${style}' - <${tag}> must also contain style '${extra1.substring(1)}'`;break;case 7:msg=`'${style}' cannot be applied to <${tag}> : no style selector match (${extra1}) and no elem match (${_fmt(num,extra2)})`;break;}if(msg){issue=new ruleCtx.Issue(msg);ruleCtx.reporter.addIssue(issue.setMsgKey(RULENAME+(num>1?"_"+num:"")),ruleCtx)}}};function _isIgnoreListed(style){var ret=false,i;for(i=0;i<SS_IGNORE_WILD.length;i++){if(style.startsWith(SS_IGNORE_WILD[i])){ret=true;break}}if(!ret){ret=SS_IGNORE_LIST.includes(style)}return ret};function _isSimpleElemOrStyle(ss){const COMMA=",";const DOT=".";const SPACE=" ";const GT=">";ss=ss.trim();if(ss.includes(COMMA)||ss.includes(DOT,1)||ss.includes(SPACE)||ss.includes(GT)){return null}return ss.startsWith(DOT)?"s":"e"};function _fmt(n,extra){if(n===2||n===7){let s="";for(let i=0;i<extra.length;i++){if(i){s+=", ";if(extra.length>=2){if(i===extra.length-1){s+="or "}}}s+="<"+extra[i]+">"}return s}return"<"+extra[0]+">"};module.exports=Rule;
1
+ /*
2
+ * Copyright (c) 2018, 2021, Oracle and/or its affiliates.
3
+ * Licensed under The Universal Permissive License (UPL), Version 1.0
4
+ * as shown at https://oss.oracle.com/licenses/upl/
5
+ */
6
+ const getStyles=require("./helpers/extractStylesFromClass");const StyleSelector=require("./helpers/style-selector");const RULENAME="oj-html-stylesel";const SHORT="A 'class' style must be applicable to the element on which it is declared";const LONG="A 'class' style must be a known style and its placement applicable to the element on which it is declared."+" Refer to the component documentation for the style selector defining the placement rules.";const SS_IGNORE_WILD=["oj-ux-","oj-sample-","oj-typography-"];const SS_IGNORE_LIST=["oj-label","oj-applayout-content","oj-visited","oj-disabled","oj-enabled","oj-read-only","oj-invalid","oj-warning","oj-info","oj-confirmation","oj-required","oj-indeterminate","oj-active","oj-selected","oj-hover","oj-focus","oj-focus-only","oj-focus-highlight","oj-default","oj-draggable","oj-drag","oj-drop","oj-active-drop","oj-valid-drop","oj-invalid-drop","oj-expanded","oj-collapsed","oj-right","oj-center","oj-left","oj-start","oj-end","oj-top","oj-middle","oj-bottom","oj-full-width","oj-hicontrast","oj-component","oj-component-initnode","oj-complete","oj-animate-open","oj-animate-open-active","oj-animate-close","oj-animate-close-active","oj-animate-add","oj-animate-add-active","oj-animate-remove","oj-animate-remove-active","oj-animate-update","oj-animate-update-active"];class Rule{constructor(){this._ignore=null;this._metaLib=null}getName(){return RULENAME}getShortDescription(){return SHORT}getDescription(){return LONG}register(regCtx){var i;this._ignore=regCtx.ruleOpts["ignore"];if(this._ignore){for(i=0;i<this._ignore.length;i++){this._ignore[i]=new RegExp(this._ignore[i])}}this._metaLib=regCtx.utils.metaLib;StyleSelector.setAssertMsg(regCtx.utils.msgLib.assert);return{"class":this._onClass}}_onClass(ruleCtx,attrName,attrValue){var tagName,i,j,dataBindChecked=false,classes,style,sType;tagName=ruleCtx.tag;classes=getStyles(attrValue);for(i=0;i<classes.length;i++){style=classes[i];if(this._ignore){for(j=0;j<this._ignore.length;j++){if(this._ignore[j].test(style)){break}}if(j<this._ignore.length){continue}}if(_isIgnoreListed(style)){continue}sType=this._metaLib.getStyleOrigin(style);if(!sType){if(style.startsWith("oj-")){if(!this._metaLib.isStylesetStyle(style)){this._emitIssue(1,style,tagName,ruleCtx)}continue}}this._handleStyle(ruleCtx,style,sType)}}_handleStyle(ruleCtx,style,sType){var ss,tags,tagName,i;tagName=ruleCtx.tag;if(sType==="c"){if(ss=this._metaLib.getStyleSelector(style)){if(StyleSelector.match(ruleCtx,ss)){return true}this._emitIssueEx(ss,style,tagName,ruleCtx);return false}}if(sType==="j"||sType==="b"){ss=this._metaLib.getStyleSelector(style,sType==="j"||sType==="b");if(ss){if(StyleSelector.match(ruleCtx,ss)){return true}}else{tags=this._metaLib.getNonSSStyleElems(style,true);if(tags){for(i=0;i<tags.length;i++){if(tags[i]===tagName){return true}}}}}if(sType==="j"){if(ss){this._emitIssueEx(ss,style,tagName,ruleCtx)}else if(tags){this._emitIssue(2,style,tagName,ruleCtx,tags)}return false}tags=null;if(ss=this._metaLib.getStyleSelector(style,false)){if(StyleSelector.match(ruleCtx,ss)){return true}}if(ss){this._emitIssueEx(ss,style,tagName,ruleCtx);return false}return true}_emitIssue(num,style,tag,ruleCtx,extra1,extra2){var msg,issue,ss,i;switch(num){case 1:msg=`unknown style '${style}' found on <${tag}>`;break;case 2:msg=`style '${style}' cannot be applied to <${tag}> - only ${_fmt(num,extra1)}`;break;case 3:if(Array.isArray(extra1)){ss="";for(i=0;i<extra1.length;i++){if(i){ss+=", or "}ss+="'"+extra1[i]+"'"}}else{ss="'"+extra1+"'"}msg=`style '${style}' on <${tag}> is not matched by ${ss}`;break;case 5:msg=`style '${style}' can only be applied to <${extra1}> - not <${tag}>`;break;case 6:msg=`style '${style}' - <${tag}> must also contain style '${extra1.substring(1)}'`;break;case 7:msg=`'${style}' cannot be applied to <${tag}> : no style selector match (${extra1}) and no elem match (${_fmt(num,extra2)})`;break;}if(msg){issue=new ruleCtx.Issue(msg);ruleCtx.reporter.addIssue(issue.setMsgKey(RULENAME+(num>1?"_"+num:"")),ruleCtx)}}_emitIssueEx(ss,style,tagName,ruleCtx){var simple;simple=_isSimpleElemOrStyle(ss);simple=!simple?3:simple==="e"?5:6;this._emitIssue(simple,style,tagName,ruleCtx,ss)}};function _isIgnoreListed(style){var ret=false,i;for(i=0;i<SS_IGNORE_WILD.length;i++){if(style.startsWith(SS_IGNORE_WILD[i])){ret=true;break}}if(!ret){ret=SS_IGNORE_LIST.includes(style)}return ret};function _isSimpleElemOrStyle(ss){const COMMA=",";const DOT=".";const SPACE=" ";const GT=">";if(Array.isArray(ss)){if(ss.length===1){ss=ss[0]}else{return null}}ss=ss.trim();if(ss.includes(COMMA)||ss.includes(DOT,1)||ss.includes(SPACE)||ss.includes(GT)){return null}return ss.startsWith(DOT)?"s":"e"};function _fmt(n,extra){if(n===2||n===7){let s="";for(let i=0;i<extra.length;i++){if(i){s+=", ";if(extra.length>=2){if(i===extra.length-1){s+="or "}}}s+="<"+extra[i]+">"}return s}return"<"+extra[0]+">"};module.exports=Rule;
@@ -1 +1,6 @@
1
+ /*
2
+ * Copyright (c) 2018, 2021, Oracle and/or its affiliates.
3
+ * Licensed under The Universal Permissive License (UPL), Version 1.0
4
+ * as shown at https://oss.oracle.com/licenses/upl/
5
+ */
1
6
  const RULE_NAME="oj-html-tag-attr-noprefix";function getName(){return RULE_NAME};function getShortDescription(){return"Global HTML elements with an attribute expression with no ':' prefix are invalid"};function getDescription(){return"On a common HTML element (i.e. is not a custom element), any use of an attribute "+"not prefixed with ':' and with an expression (e.g. attr=\"[[...]]\" or attr=\"{{...}}\"), is invalid."};function register(){return{"tag":_handleTag}};function _handleTag(context,tagName){var attribs,attrib,attrValue,issue,attrPos;if(!context.utils.DomUtils.isCommonElem(tagName)){return}attribs=context.node.attribs;if(!attribs){return}for(attrib in attribs){if(attrib==="data-oj-context"||attrib==="data-oj-command"){continue}if(attrib.charAt(0)!==":"&&!attrib.startsWith("on-")){attrValue=attribs[attrib];if(attrValue.startsWith("[[")||attrValue.startsWith("{{")){issue=new context.Issue("Use of attribute expression with unprefixed attribute '"+attrib+"' is invalid for <"+tagName+">");attrPos=context.utils.DomUtils.getAttrPosition(context.data,context.node,attrib);issue.setPosition(attrPos.row,attrPos.col,attrPos.start,attrPos.end);context.reporter.addIssue(issue,context)}}}};module.exports={getName,getDescription,getShortDescription,register};
@@ -0,0 +1,6 @@
1
+ /*
2
+ * Copyright (c) 2018, 2021, Oracle and/or its affiliates.
3
+ * Licensed under The Universal Permissive License (UPL), Version 1.0
4
+ * as shown at https://oss.oracle.com/licenses/upl/
5
+ */
6
+ const RULENAME="oj-html-template-index";const DESCRIPTION="Due to a bug in JET 9.x <oj-list-view>, the value of ItemTemplateContext.index starts at 1 instead "+"of 0, depending on whether skeletons (when a fetch from a DataProvider "+"takes more than 50ms) are displayed or not. In JET 10.0.0, the index value always starts at 0 as intended. ";"Review use of the index value to ensure correct usage.";const SHORT_DESCRIPTION="Due to a bug in JET 9.x <oj-list-view>, the value of ItemTemplateContext.index starts at 1 instead "+"of 0, depending on whether skeletons are displayed or not.";const TEMPLATE="template";const OJ_LIST_VIEW="oj-list-view";const DATA_OJ_AS="data-oj-as";const $CURINDEX="$current.index";const DOT_INDEX=".index";const TAG="tag";const RO_EXPR="[[";const RW_EXPR="{{";class Rule{getName(){return RULENAME}getDescription(){return DESCRIPTION}getShortDescription(){return SHORT_DESCRIPTION}register(regCtx){this._utils=regCtx.utils.utils;return{tag:this._onTag}}_onTag(ruleCtx,tag){if(tag===TEMPLATE&&this._childOfListView(ruleCtx)){let val;if(val=ruleCtx.utils.DomUtils.getAttribValue(ruleCtx.node,DATA_OJ_AS)){this._processTemplateAttribs(ruleCtx,val)}}}_processTemplateAttribs(ruleCtx,find){var node;var find=find+DOT_INDEX;node=ruleCtx.node;this._processDescendants(ruleCtx,node,find)}_processDescendants(ruleCtx,node,find){var nodes,n,attrs,attr,val;nodes=node.children;if(!nodes){return}for(n in nodes){n=nodes[n];if(!n.type||n.type!==TAG){continue}attrs=n.attribs;if(attrs&&this._utils.hasAnyProps(attrs)){for(attr in attrs){val=attrs[attr];if(_isExpr(val)){if(val.includes(find)||val.includes($CURINDEX)){let issue=new ruleCtx.Issue(`Behavior change to ItemTemplateContext.index : <${n.name} ${attr}= >`);let attrPos=ruleCtx.utils.DomUtils.getAttrPosition(ruleCtx.data,n,attr);issue.setPosition(attrPos.row,attrPos.col,attrPos.start,attrPos.end);ruleCtx.reporter.addIssue(issue,ruleCtx)}}}}if(n.children){this._processDescendants(ruleCtx,n,find)}}}_childOfListView(ruleCtx){let stack=ruleCtx.elemStack;for(let i=stack.length-1;i>=0;i--){if(stack[i].name===OJ_LIST_VIEW){return true}}return false}}function _isExpr(s){return s.startsWith(RO_EXPR)||s.startsWith(RW_EXPR)};module.exports=Rule;
@@ -1 +1,6 @@
1
- const RULENAME="oj-html-unsup-theme";const DESCRIPTION="long description - can include markup";const SHORT_DESCRIPTION="short description";class Rule{getName(){return RULENAME}getDescription(){return DESCRIPTION}getShortDescription(){return SHORT_DESCRIPTION}register(regCtx){this._theme=regCtx.config.theme;this._metaLib=regCtx.utils.metaLib;return{"webcomp":this._onWebComp}}_onWebComp(ruleCtx,tag){var issue,attribs,attrib;if(!this._metaLib.isTagSupportedInTheme(tag)){issue=new ruleCtx.Issue(`<${tag}> is not supported in theme '${this._theme}'`);ruleCtx.reporter.addIssue(issue,ruleCtx)}attribs=ruleCtx.tagNode.attribs;if(attribs){for(attrib in attribs){this._fnAttrib(ruleCtx,attrib)}}}_fnAttrib(ruleCtx,attrib){if(!this._metaLib.isAttrSupportedInTheme(ruleCtx.tag,attrib)){let issue,attrPos;issue=new ruleCtx.Issue(`<${ruleCtx.tag}> attribute '${attrib}' is not supported in theme '${this._theme}'`);attrPos=ruleCtx.utils.DomUtils.getAttrPosition(ruleCtx.data,ruleCtx.node,attrib);issue.setPosition(attrPos.row,attrPos.col,attrPos.start,attrPos.end);ruleCtx.reporter.addIssue(issue,ruleCtx)}}}module.exports=Rule;
1
+ /*
2
+ * Copyright (c) 2018, 2021, Oracle and/or its affiliates.
3
+ * Licensed under The Universal Permissive License (UPL), Version 1.0
4
+ * as shown at https://oss.oracle.com/licenses/upl/
5
+ */
6
+ const RULENAME="oj-html-unsup-theme";const SHORT_DESCRIPTION="Some web component elements and/or their attributes may not be supported in the specified JET theme";const DESCRIPTION=SHORT_DESCRIPTION+". Refer to the JET API documentation for the version being audited. "+"The theme used by the audit can be set by the JAF configuration property 'theme'.";class Rule{getName(){return RULENAME}getDescription(){return DESCRIPTION}getShortDescription(){return SHORT_DESCRIPTION}register(regCtx){this._theme=regCtx.config.theme;this._metaLib=regCtx.utils.metaLib;return{"webcomp":this._onWebComp}}_onWebComp(ruleCtx,tag){var issue,attribs,attrib;if(!this._metaLib.isTagSupportedInTheme(tag)){issue=new ruleCtx.Issue(`<${tag}> is not supported in theme '${this._theme}'`);ruleCtx.reporter.addIssue(issue,ruleCtx)}attribs=ruleCtx.tagNode.attribs;if(attribs){for(attrib in attribs){this._fnAttrib(ruleCtx,attrib)}}}_fnAttrib(ruleCtx,attrib){if(!this._metaLib.isAttrSupportedInTheme(ruleCtx.tag,attrib)){let issue,attrPos;issue=new ruleCtx.Issue(`<${ruleCtx.tag}> attribute '${attrib}' is not supported in theme '${this._theme}'`);attrPos=ruleCtx.utils.DomUtils.getAttrPosition(ruleCtx.data,ruleCtx.node,attrib);issue.setPosition(attrPos.row,attrPos.col,attrPos.start,attrPos.end);ruleCtx.reporter.addIssue(issue,ruleCtx)}}}module.exports=Rule;
@@ -1 +1,6 @@
1
- const RULE_NAME="oj-html-wctag-$props";const LONG_DESCRIPT="Any use of $properties.xxx in a web component should ensure that xxx is a declared property for the web component.";const SHORT_DESCRIPT="Any use of $properties.xxx in a web component should ensure that xxx is a declared property for the web component.";const PERIOD=".";const PROPS="$properties";const RE=/\s/;const DELIMS="}]!><+-|=/%&?[,)";const COMPJSON="component.json";var curFile,tagName;var libPath,libFs;function getName(){return RULE_NAME};function getShortDescription(){return SHORT_DESCRIPT};function getDescription(){return LONG_DESCRIPT};function register(regCtx){return{"attrexpr":_handle}};function _handle(ruleCtx,attrName,attrValue){var prop,issue,attrPos,subProps,subProp,soFar,curType,remainder,len,i,x;var metaLib=ruleCtx.utils.metaLib;if(!ruleCtx.filepath.includes("jet-composites")||!attrValue.includes(PROPS)||!metaLib.isWCTag(ruleCtx.tagNode.name)){return}attrValue=attrValue.trim();x=attrValue.indexOf(PROPS);if(x<0){return}x+=PROPS.length;if(attrValue.charAt(x)!==PERIOD){return}attrValue=attrValue.substring(x+1).trim();prop=_findTerm(attrValue);if(!prop){return}if(curFile!==ruleCtx.filepath){curFile=ruleCtx.filepath;tagName=_getComponentName(curFile)}if(!tagName){return}if(metaLib.isTagCompProp(tagName,prop)){return}subProps=prop.split(PERIOD);len=subProps.length-1;if(len>=1){soFar="";curType=null;for(i=0;i<len;i++){subProp=subProps[i];soFar=soFar+(i?".":"")+subProp;curType=metaLib.getTagPropType(tagName,soFar);if(curType&&curType.toLowerCase()==="object"){if(!metaLib.hasTagCompPropSubprop(tagName,soFar)){remainder=_getRemainder(subProps,i);issue=new ruleCtx.Issue("$properties."+soFar+" is an 'object' : cannot verify that '"+remainder+"' is defined by <"+tagName+">");issue.setSeverity("info");attrPos=ruleCtx.utils.DomUtils.getAttrPosition(ruleCtx.data,ruleCtx.tagNode,attrName);issue.setPosition(attrPos.row,attrPos.col,attrPos.start,attrPos.end);ruleCtx.reporter.addIssue(issue,ruleCtx);return}}}}len=subProps.length;if(len>1&&subProps[len-1]==="length"){subProps.splice(len-1,1);soFar=subProps.join(PERIOD);curType=metaLib.getTagPropType(tagName,soFar);if(curType&&curType.toLowerCase()==="array"){return}}if(!metaLib.isTagCompProp(tagName,prop)){issue=new ruleCtx.Issue("Expression refers to $properties."+prop+" : not defined by web component <"+tagName+">");attrPos=ruleCtx.utils.DomUtils.getAttrPosition(ruleCtx.data,ruleCtx.tagNode,attrName);issue.setPosition(attrPos.row,attrPos.col,attrPos.start,attrPos.end);ruleCtx.reporter.addIssue(issue,ruleCtx)}};function _findTerm(attrValue){var x,s,inSq;for(x=0;x<attrValue.length;x++){s=attrValue.charAt(x);if(!inSq){if(s==="["){inSq=true}}if(DELIMS.includes(s)||RE.test(s)){if(inSq&&s==="]"){inSq=false;continue}s=attrValue.substring(0,x);if(s.endsWith("(")){s=s.substring(0,s.length-1)}break}}return s};function _getComponentName(file){var path,name,meta;if(!libPath){libPath=require("path");libFs=require("fs")}path=libPath.dirname(file);meta=_getCompMeta(path);if(meta){name=(meta.pack?meta.pack+"-":"")+meta.name}return name};function _getCompMeta(filepath){var metaPath,json;try{metaPath=libPath.join(filepath,COMPJSON);json=_readFile(metaPath);if(json){json=JSON.parse(json)}}catch(e){}return json};function _getRemainder(a,i){var len=a.length;var n=len-i;var s="";i++;n=i;while(i<len){s+=(i>n?PERIOD:"")+a[i];i++}return s};function _readFile(file){var data;try{data=libFs.readFileSync(file,"utf8")}catch(e){}return data};module.exports={getName,getDescription,getShortDescription,register};
1
+ /*
2
+ * Copyright (c) 2018, 2021, Oracle and/or its affiliates.
3
+ * Licensed under The Universal Permissive License (UPL), Version 1.0
4
+ * as shown at https://oss.oracle.com/licenses/upl/
5
+ */
6
+ const RULE_NAME="oj-html-wctag-$props";const LONG_DESCRIPT="Any use of $properties.xxx in a web component should ensure that xxx is a declared property for the web component.";const SHORT_DESCRIPT="Any use of $properties.xxx in a web component should ensure that xxx is a declared property for the web component.";const PERIOD=".";const PROPS="$properties";const RE=/\s/;const DELIMS="}]!><+-|=/%&?[,)";const COMPJSON="component.json";const LENGTH="length";const OBJECT="object";const ARRAY="array";const STRING="string";var curFile,tagName;var libPath,libFs;function getName(){return RULE_NAME};function getShortDescription(){return SHORT_DESCRIPT};function getDescription(){return LONG_DESCRIPT};function register(){return{"attrexpr":_handle}};function _handle(ruleCtx,attrName,attrValue){var prop,issue,attrPos,subProps,subProp,soFar,curType,remainder,len,i,x;var metaLib=ruleCtx.utils.metaLib;if(attrValue.indexOf(PROPS)<0||!ruleCtx.filepath.includes("jet-composites")||!metaLib.isWCTag(ruleCtx.tagNode.name)){return}attrValue=attrValue.trim();x=attrValue.indexOf(PROPS);x+=PROPS.length;if(attrValue.charAt(x)!==PERIOD){return}attrValue=attrValue.substring(x+1).trim();prop=_findTerm(attrValue);if(!prop){return}if(curFile!==ruleCtx.filepath){curFile=ruleCtx.filepath;tagName=_getComponentName(curFile)}if(!tagName){return}if(metaLib.isTagCompProp(tagName,prop)){return}subProps=prop.split(PERIOD);len=subProps.length-1;if(len>=1){soFar="";curType=null;for(i=0;i<len;i++){subProp=subProps[i];soFar=soFar+(i?".":"")+subProp;curType=metaLib.getTagPropType(tagName,soFar);if(curType&&curType.toLowerCase()===OBJECT){if(!metaLib.hasTagCompPropSubprop(tagName,soFar)){remainder=_getRemainder(subProps,i);issue=new ruleCtx.Issue("$properties."+soFar+" is an 'object' : cannot verify that '"+remainder+"' is defined by <"+tagName+">");issue.setSeverity("info");attrPos=ruleCtx.utils.DomUtils.getAttrPosition(ruleCtx.data,ruleCtx.tagNode,attrName);issue.setPosition(attrPos.row,attrPos.col,attrPos.start,attrPos.end);issue.setMsgKey(RULE_NAME+"_1");ruleCtx.reporter.addIssue(issue,ruleCtx);return}}}}len=subProps.length;if(len>1&&subProps[len-1]===LENGTH){subProps.splice(len-1,1);soFar=subProps.join(PERIOD);curType=metaLib.getTagPropType(tagName,soFar);curType=curType?curType.toLowerCase():curType;if(curType&&(curType.startsWith(ARRAY)||curType.startsWith(STRING))){return}}if(!metaLib.isTagCompProp(tagName,prop)){issue=new ruleCtx.Issue("Expression refers to $properties."+prop+" : not defined by web component <"+tagName+">");attrPos=ruleCtx.utils.DomUtils.getAttrPosition(ruleCtx.data,ruleCtx.tagNode,attrName);issue.setPosition(attrPos.row,attrPos.col,attrPos.start,attrPos.end);ruleCtx.reporter.addIssue(issue,ruleCtx)}};function _findTerm(attrValue){var x,s,inSq;for(x=0;x<attrValue.length;x++){s=attrValue.charAt(x);if(!inSq){if(s==="["){inSq=true}}if(DELIMS.includes(s)||RE.test(s)){if(inSq&&s==="]"){inSq=false;continue}s=attrValue.substring(0,x);if(s.endsWith("(")){s=s.substring(0,s.length-1)}break}}return s};function _getComponentName(file){var path,name,meta;if(!libPath){libPath=require("path");libFs=require("fs")}path=libPath.dirname(file);meta=_getCompMeta(path);if(meta){name=(meta.pack?meta.pack+"-":"")+meta.name}return name};function _getCompMeta(filepath){var metaPath,json;try{metaPath=libPath.join(filepath,COMPJSON);json=_readFile(metaPath);if(json){json=JSON.parse(json)}}catch(e){}return json};function _getRemainder(a,i){var len=a.length;var n=len-i;var s="";i++;n=i;while(i<len){s+=(i>n?PERIOD:"")+a[i];i++}return s};function _readFile(file){var data;try{data=libFs.readFileSync(file,"utf8")}catch(e){}return data};module.exports={getName,getDescription,getShortDescription,register};
@@ -1 +1,6 @@
1
+ /*
2
+ * Copyright (c) 2018, 2021, Oracle and/or its affiliates.
3
+ * Licensed under The Universal Permissive License (UPL), Version 1.0
4
+ * as shown at https://oss.oracle.com/licenses/upl/
5
+ */
1
6
  const RULE_NAME="oj-html-wctag-arialabelledby";const SHORT_DESCRIPT="Custom components should not used a hard-coded 'aria-labelledby' attribute and it should be set to an expression";const LONG_DESCRIPT="Hard-coded 'aria-labelledby' attributes should not be used within custom components. 'aria-labelledby' values must be unique for each instance of the component. See context.uniqueId in the custom element documentation for information on how to derive unique values for elements."+"<p>If a web component implements a hard-coded 'aria-labelledby' elements in the web component view, e.g.<p>"+"<oj-xxx aria-labelledby=\"foo\"><p>"+"then this is guaranteed to cause issues as soon as more than one instance of "+"the component is used on the page (plus there is a significant risk of "+"collision with other values in the page as a whole.";const ATTR="aria-labelledby";const COLON_ATTR=":aria-labelledby";function getName(){return RULE_NAME};function getShortDescription(){return SHORT_DESCRIPT};function getDescription(){return LONG_DESCRIPT};function register(){return{"webcomp":_handle}}function _handle(context,tagName){var attribs,attr,isAttr,isColonAttr,isExpr,msg,issue,attrPos;if(!context.ojTag||!context.filepath.includes("jet-composites")||!context.tagNode.attribs){return}if(context.utils.metaLib.isBindingTag(tagName)){return}attribs=context.tagNode.attribs;isAttr=attribs.hasOwnProperty(ATTR);isColonAttr=attribs.hasOwnProperty(COLON_ATTR);if(!isAttr&&!isColonAttr){return}attr=isAttr?ATTR:COLON_ATTR;isExpr=_isAttrExpr(attribs[attr]);if(isAttr){msg="<"+context.tag+"> 'aria-labelledby be prefixed as ':aria-labelledby'"+(!isExpr?" and set to an expression":"")}else if(!isExpr){msg="<"+context.tag+"> ':aria-labelledby' should be set to an expression"}if(msg){issue=new context.Issue(msg);attrPos=context.utils.DomUtils.getAttrPosition(context.data,context.node,attr);issue.setPosition(attrPos.row,attrPos.col,attrPos.start,attrPos.end);context.reporter.addIssue(issue,context)}};function _isAttrExpr(attrValue){var rc=false;if(typeof attrValue==="string"){attrValue=attrValue.trim();rc=attrValue.startsWith("[[")||attrValue.startsWith("{{")}return rc};module.exports={getName,getDescription,getShortDescription,register};
@@ -1 +1,6 @@
1
+ /*
2
+ * Copyright (c) 2018, 2021, Oracle and/or its affiliates.
3
+ * Licensed under The Universal Permissive License (UPL), Version 1.0
4
+ * as shown at https://oss.oracle.com/licenses/upl/
5
+ */
1
6
  const RULE_NAME="oj-html-wctag-for";const SHORT_DESCRIPT="Custom components should not used a hard-coded 'for' attribute and it should be set an expression";const LONG_DESCRIPT="Hard-coded 'for' attributes should not be used within custom components. 'for' attributes must be unique for each instance of the component and set to an expression. See context.uniqueId in the custom element documentation for information on how to derive unique values for elements."+"<p>If a webcomponent implements hard-coded 'for's for HTML elements in the web component view, e.g.<p>"+"<oj-input for=\"foo\"><p>"+"then this is guaranteed to cause issues as soon as more than one instance of "+"the component is used on the page (plus there is a significant risk of "+"collision with other attributes in the page as a whole.";const FOR="for";const COLON_FOR=":for";function getName(){return RULE_NAME};function getShortDescription(){return SHORT_DESCRIPT};function getDescription(){return LONG_DESCRIPT};function register(){return{"webcomp":_handle}}function _handle(context,tagName){var attribs,attr,isFor,isColonFor,isExpr,isOjLabel,msg,issue,attrPos;if(!context.ojTag||!context.filepath.includes("jet-composites")||!context.tagNode.attribs){return}if(context.utils.metaLib.isBindingTag(tagName)){return}isOjLabel=tagName==="oj-label";attribs=context.tagNode.attribs;isFor=attribs.hasOwnProperty(FOR);isColonFor=attribs.hasOwnProperty(COLON_FOR);if(!isFor&&!isColonFor){return}attr=isFor?FOR:COLON_FOR;isExpr=_isAttrExpr(attribs[attr]);if(isFor){if(isOjLabel){if(!isExpr){msg="<"+context.tag+"> 'for' should be set to an expression"}}else{msg="<"+context.tag+"> 'for' should be prefixed as ':for'"+(!isExpr?" and set to an expression":"")}}else{if(isOjLabel){msg="<"+context.tag+"> ':for' should be unprefixed"+(!isExpr?", and set to an expression":"")}else{msg="<"+context.tag+"> ':for' should be set to an expression"}}if(msg){issue=new context.Issue(msg);attrPos=context.utils.DomUtils.getAttrPosition(context.data,context.node,attr);issue.setPosition(attrPos.row,attrPos.col,attrPos.start,attrPos.end);context.reporter.addIssue(issue,context)}};function _isAttrExpr(attrValue){var rc=false;if(typeof attrValue==="string"){attrValue=attrValue.trim();rc=attrValue.startsWith("[[")||attrValue.startsWith("{{")}return rc};module.exports={getName,getDescription,getShortDescription,register};
@@ -1 +1,6 @@
1
+ /*
2
+ * Copyright (c) 2018, 2021, Oracle and/or its affiliates.
3
+ * Licensed under The Universal Permissive License (UPL), Version 1.0
4
+ * as shown at https://oss.oracle.com/licenses/upl/
5
+ */
1
6
  const RULE_NAME="oj-html-wctag-id";const SHORT_DESCRIPT="Custom components should not used a hard-coded 'id' attribute and should be set to an expression";const LONG_DESCRIPT="Hard-coded element IDs should not be used within custom components and should be set to an expression. Element IDs must be unique for each instance of the component. See context.uniqueId in the custom element documentation for information on how to derive unique IDs for elements."+"<p>If a CCA implements hard-coded IDs for HTML elements in the CCA view, e.g.<p>"+"<oj-input id=\"foo\"><p>"+"then this is guaranteed to cause issues as soon as more than one instance of "+"the component is used on the page (plus there is a significant risk of "+"collision with other IDs in the page as a whole.";const ID="id";const COLON_ID=":id";class Rule{getName(){return RULE_NAME}getDescription(){return LONG_DESCRIPT}getShortDescription(){return SHORT_DESCRIPT}register(){return{"webcomp":this._onTag}}_onTag(ruleCtx,tag){var attribs,attr,idAttr,isId,isColonId,isExpr,isLit,isValidId,av,val,msg,mid;if(!ruleCtx.ojTag||!ruleCtx.filepath.includes("jet-composites")||!ruleCtx.tagNode.attribs){return}if(ruleCtx.utils.metaLib.isBindingTag(tag)){return}attribs=ruleCtx.tagNode.attribs;isId=attribs.hasOwnProperty(ID);isColonId=attribs.hasOwnProperty(COLON_ID);if(!isId&&!isColonId){return}idAttr=isId?ID:COLON_ID;av=attribs[idAttr];isExpr=_isAttrExpr(av);val=isExpr?_stripExprDelims(av):av;isLit=_isLiteral(val);if(isId){msg=`<${tag}> 'id' should be prefixed as ':id'${isExpr?"":" and set to an expression"}`;mid=0}else if(!isExpr){msg=`<${tag}> ':id' should be set to an expression`;mid=1}if(msg){_emitIssue(ruleCtx,msg,idAttr,mid)}if(isExpr&&isLit){msg=`<${tag}> '${idAttr}' attribute expression returns a constant - convert to a calculated expression`;_emitIssue(ruleCtx,msg,idAttr,2)}}};function _emitIssue(ruleCtx,msg,idAttr,mid){var issue,attrPos;issue=new ruleCtx.Issue(msg);attrPos=ruleCtx.utils.DomUtils.getAttrPosition(ruleCtx.data,ruleCtx.node,idAttr);issue.setPosition(attrPos.row,attrPos.col,attrPos.start,attrPos.end);if(mid){issue.setMsgKey(RULE_NAME+"_"+mid)}ruleCtx.reporter.addIssue(issue,ruleCtx)}function _isAttrExpr(s){var rc=false;if(typeof s==="string"){s=s.trim();rc=s.startsWith("[[")||s.startsWith("{{")}return rc};function _stripExprDelims(s){return s.substring(2,s.length-2).trim()}function _isLiteral(s){return s.charAt(0)==="'"&&s.charAt(s.length-1)==="'"};function _isValidId(s){return!/\s/.test(s)};module.exports=Rule;
@@ -0,0 +1,6 @@
1
+ /*
2
+ * Copyright (c) 2018, 2021, Oracle and/or its affiliates.
3
+ * Licensed under The Universal Permissive License (UPL), Version 1.0
4
+ * as shown at https://oss.oracle.com/licenses/upl/
5
+ */
6
+ const RULENAME="oj-html-wctag-packprivate";const DESCRIPTION="Components marked as 'packPrivate' in their component.json metadata, are private base classes "+"that can be extended by other classes in the same pack. They cannot be used as application "+"'stand-alone' components.";const SHORT_DESCRIPTION="'packPrivate' components cannot be used as application 'stand-alone' components.";class Rule{getName(){return RULENAME}getDescription(){return DESCRIPTION}getShortDescription(){return SHORT_DESCRIPTION}register(){return{webcomp:this._onWebComp}}_onWebComp(ruleCtx,tag){if(ruleCtx.utils.metaLib.isTagPackPrivate(tag)){let issue=new ruleCtx.Issue(`<${tag}> is not intended for stand-alone use in an application`);ruleCtx.reporter.addIssue(issue,ruleCtx)}}}module.exports=Rule;
@@ -1 +1,6 @@
1
+ /*
2
+ * Copyright (c) 2018, 2021, Oracle and/or its affiliates.
3
+ * Licensed under The Universal Permissive License (UPL), Version 1.0
4
+ * as shown at https://oss.oracle.com/licenses/upl/
5
+ */
1
6
  const helperClass=require("./helpers/vartrack");const RULE_NAME="oj-js-comp-attr-deprecated";const _GLOBAL="_@global";const THIS="this";var nt;var depMembers;var delMembers;function Rule(){this._reset();this._scope=null};Rule.prototype.getName=function(){return RULE_NAME};Rule.prototype.getShortDescription=function(){return"JET component class deprecated members should not be referenced"};Rule.prototype.getDescription=function(){return"JET component class deprecated members should not be referenced"};Rule.prototype.register=function(regCtx){if(!this._getRuleOptions(regCtx)){return null}var ret={file:this._newFile,startscript:this._newFile,endfile:this._endFile,endscript:this._endFile};nt=regCtx.jsNodeTypes;ret[nt.FUNC_DECLARATION]=this._setup;ret[nt.FUNC_EXPR]=this._setup;ret[nt.MEMBER_EXPR]=this._handleMemberExpr;ret[nt.ASSIGNMENT_EXPR]=this._handleAssign;ret[nt.CALL_EXPR]=this._handleCall;return ret};Rule.prototype._reset=function(){this._funcVarTable=null;this._globalVars=false;this._define=false;if(this._helper){this._helper.reset()}};Rule.prototype._handleCall=function(ruleCtx,node){if(node.callee&&(node.callee.name==="define"||node.callee.name==="require")){this._funcVarTable=this._handleViewModelDefine(ruleCtx,node);return}if(!depMembers){depMembers=ruleCtx.utils.metaLib.getDeprecatedMemberList(ruleCtx)}if(!delMembers){delMembers=ruleCtx.utils.metaLib.getDeletedMemberList(ruleCtx)}};Rule.prototype._handleViewModelDefine=function(ruleCtx,node){var args,stmt,o,i;args=node.arguments;if(!args){return}for(i=0;i<args.length;i++){stmt=args[i];if(stmt.type===nt.FUNC_EXPR){o=this._helper.createFuncDeclarations(ruleCtx,stmt);this._funcVarTable=o.funcVarTable}}this._define=true;return this._funcVarTable};Rule.prototype._handleMemberExpr=function(ruleCtx,node){var component,member,objName,comment,issue,version,deleted;var thoughtToBe,emitDep,emitDel;var metaLib=ruleCtx.utils.metaLib;if(!depMembers){depMembers=metaLib.getDeprecatedMemberList(ruleCtx)}if(!delMembers){delMembers=metaLib.getDeletedMemberList(ruleCtx)}if(node.parent&&node.parent.type===nt.CALL_EXPR){return}objName=this._getVarFromMemberExpr(node);if(this._isCommonObject(ruleCtx,objName)){return}if(node.property){member=node.property.name}if(!(member&&objName)){return}if(!depMembers[member]){deleted=delMembers[member];if(!deleted){return}}component=this._findInstantiatedComponent(ruleCtx,node,objName);if(ruleCtx.utils.AstUtils.isFuncArg(node,objName)||!component){if(member!=="constructor"&&!objName.endsWith(".constructor")){if(deleted&&this._scope.deleted.unsure||!deleted&&this._scope.deprecated.unsure){issue=new ruleCtx.Issue("Possible use of "+(deleted?"deleted (in "+deleted[0]+", "+deleted[1]+")":"deprecated")+" JET member '"+member+"' on var '"+objName+"' (class cannot be determined)");issue.setMsgKey(ruleCtx.ruleName+"_1");issue.setPosition(null,null,node.property.start,node.property.end);ruleCtx.reporter.addIssue(issue,ruleCtx)}}return}if(member.startsWith("_")){return}comment=metaLib.isClassMemberDeprecated(component,member);thoughtToBe=this._isOrigVarValue(ruleCtx,node,objName)?"":"thought to be ";emitDep=thoughtToBe&&this._scope.deprecated.unsure||!thoughtToBe&&this._scope.deprecated.sure;emitDel=thoughtToBe&&this._scope.deleted.unsure||!thoughtToBe&&this._scope.deleted.sure;if(comment){if(emitDep){comment=ruleCtx.utils.utils.removeMarkup(comment);issue=new ruleCtx.Issue("Member '"+member+"' on var '"+objName+"' ("+thoughtToBe+component+")"+(comment.toLowerCase().includes("deprecated")?". ":" is deprecated. ")+comment)}}else{if(metaLib.isClassDeprecated(component)){if(emitDep){issue=new ruleCtx.Issue("Method '"+member+"' on var '"+objName+"' called on deprecated component ("+thoughtToBe+component+").")}}}if(!issue){version=metaLib.isClassMemberDeleted(component,member);if(version){if(deleted&&emitDel){issue=new ruleCtx.Issue("Member '"+member+"' on var '"+objName+"' ("+thoughtToBe+component+")"+" was removed in version "+version)}}else if(metaLib.isClassDeleted(component)){if(deleted&&emitDel){issue=new ruleCtx.Issue("Member '"+member+"' on var '"+objName+"' called on deleted class ("+thoughtToBe+component+").");issue.setSeverity("critical")}}if(issue){issue.setSeverity("critical");issue.setMsgKey(RULE_NAME+"_2")}}if(issue){ruleCtx.reporter.addIssue(issue,ruleCtx)}};Rule.prototype._handleAssign=function(ruleCtx,node){if(node.left){this._handleAssign2(ruleCtx,node,node.left,true)}if(node.right){this._handleAssign2(ruleCtx,node,node.right,false)}};Rule.prototype._handleAssign2=function(ruleCtx,exprNode,node,isSetter){var component,objName,member,comment,issue;if(node.property){if(!node.object){return}objName=node.object.name;if(!objName){if(node.object&&node.object.object){if(node.object.object.name){objName=node.object.object.name}else if(node.object.object.type===nt.THIS_EXPR){objName=THIS}}}if(!objName){if(node.object.type===nt.THIS_EXPR){objName=THIS}}if(!objName){return}if(node.property.type==="Identifier"){member=node.property.name;if(!depMembers){depMembers=ruleCtx.utils.metaLib.getDeprecatedMemberList(ruleCtx)}if(!delMembers){delMembers=ruleCtx.utils.metaLib.getDeletedMemberList(ruleCtx)}if(!depMembers[member]){return}component=this._findInstantiatedComponent(ruleCtx,exprNode,objName);if(!component&&objName!=="this"){if(member!=="constructor"&&!objName.endsWith(".constructor")){if(this._scope.deprecated.unsure){issue=new ruleCtx.Issue("Possible use of deprecated JET member '"+member+"' on var '"+objName+"' (class cannot be determined)");issue.setMsgKey(ruleCtx.ruleName+"_1");ruleCtx.reporter.addIssue(issue,ruleCtx)}}return}if(!this._scope.deprecated.unsure){return}comment=ruleCtx.utils.metaLib.isClassMemberDeprecated(component,member);if(comment){issue=new ruleCtx.Issue("Member '"+member+"' on var '"+objName+"' (thought to be "+component+")"+(comment.toLowerCase().includes("deprecated")?". ":" is deprecated. ")+comment)}else{if(ruleCtx.utils.metaLib.isClassDeprecated(component)){issue=new ruleCtx.Issue("Member '"+member+"' on var '"+objName+"' called on deprecated component (thought to be "+component+").")}}if(issue){ruleCtx.reporter.addIssue(issue,ruleCtx)}}}};Rule.prototype._newFile=function(ruleCtx,node){if(ruleCtx.type==="file"&&ruleCtx.filetype==="html"){return}if(!this._helper){this._helper=new helperClass}this._reset();if(!nt&&ruleCtx.utils.AstUtils){nt=ruleCtx.utils.AstUtils.getNodeTypes()}};Rule.prototype._endFile=function(ruleCtx){this._define=false;if(this._helper){this._helper.reset()}};Rule.prototype._setup=function(ruleCtx,node){if(!depMembers){depMembers=ruleCtx.utils.metaLib.getDeprecatedMemberList(ruleCtx)}if(!this._globalVars){this._helper.getGlobalVars(ruleCtx);this._globalVars=true}var o=this._helper.createFuncDeclarations(ruleCtx,node);if(o){this._funcVarTable=o.funcVarTable;var funcName;for(funcName in this._funcVarTable){this._handleVarAssignments(ruleCtx,node,this._funcVarTable[funcName])}}};Rule.prototype._addVarToTrackingTable=function(stmt,funcVars,global){var decls,decl,obj,i;decls=stmt.declarations;for(i=0;i<decls.length;i++){decl=decls[i];if(decl.type===nt.VAR_DECLARATOR){funcVars[decl.id.name]=obj={type:global?"globvar":"var"};if(decl.init){if(decl.init.type===nt.NEW_EXPR){obj.valType="new";if(decl.init.callee.type===nt.MEMBER_EXPR){if(decl.init.callee.object&&decl.init.callee.object.type===nt.IDENTIFIER){obj.obj=decl.init.callee.object.name;obj.class=decl.init.callee.property.name;obj.origClass=obj.class}}}else if(decl.init.type===nt.LITERAL){obj.valType="lit"}else if(decl.init.type===nt.CALL_EXPR){if(decl.init.callee.type===nt.IDENTIFIER){obj.valType="funcret";obj.func=decl.init.callee.name}}else if(decl.init.type===nt.IDENTIFIER){obj.valType="var";obj.varName=decl.init.name}}}}};Rule.prototype._findInstantiatedComponent=function(ruleCtx,node,varName){var funcName=ruleCtx.utils.AstUtils.getContainingFunctionName(node);var funcVars=funcName&&this._funcVarTable?this._funcVarTable[funcName]:null;var varDef;if(funcVars){varDef=funcVars[varName];if(!varDef){funcVars=this._funcVarTable[_GLOBAL];if(funcVars){varDef=funcVars[varName]}}if(varDef&&varDef.valType){while(varDef.valType==="var"||varDef.valType==="globvar"){varDef=funcVars[varDef.varName];if(!varDef.valType){return}}if(varDef.class){return(varDef.obj?varDef.obj+".":"")+varDef.class}}}};Rule.prototype._handleVarAssignments=function(ruleCtx,node,funcVars){var body,stmt,leftObj,rightObj,i;body=node.body.body;for(i=0;i<body.length;i++){stmt=body[i];if(stmt.type===nt.EXPR_STMT){if(stmt.expression){if(stmt.expression.type===nt.ASSIGNMENT_EXPR){if(stmt.expression.left.type===nt.IDENTIFIER){if(!funcVars[stmt.expression.left.name]){funcVars[stmt.expression.left.name]={type:"globvar"}}if(stmt.expression.right.type===nt.IDENTIFIER){if(!funcVars[stmt.expression.right.name]){funcVars[stmt.expression.right.name]={type:"globvar"}}leftObj=funcVars[stmt.expression.left.name];rightObj=funcVars[stmt.expression.right.name];leftObj.valType=rightObj.valType;leftObj.varName=rightObj.varName}}}}}}};Rule.prototype._getVarFromMemberExpr=function(me,varSoFar,level){var obj;level=typeof level==="number"?level+1:0;if(me.object){obj=me.object;if(obj.type===nt.IDENTIFIER){varSoFar=varSoFar?varSoFar+"."+obj.name:obj.name}else if(obj.type===nt.MEMBER_EXPR){varSoFar=this._getVarFromMemberExpr(obj,varSoFar,level)}else if(obj.type===nt.THIS_EXPR){varSoFar=THIS}if(me.property&&level){if(me.property.type===nt.IDENTIFIER){varSoFar=varSoFar?varSoFar+"."+me.property.name:me.property.name}else if(me.property.type===nt.MEMBER_EXPR){varSoFar=this._getVarFromMemberExpr(me.property,varSoFar,level)}}}return varSoFar};Rule.prototype._isCommonObject=function(ruleCtx,objName){return objName==="this"||objName==="self"||objName==="_self"||objName==="window"||objName==="console"||this._helper.isCommonVar(objName)};Rule.prototype._isOrigVarValue=function(ruleCtx,node,varName){var funcName,funcVars,varDef;funcName=ruleCtx.utils.AstUtils.getContainingFunctionName(node);if(funcName){funcVars=this._funcVarTable[funcName];if(funcVars){varDef=funcVars[varName]}}if(!varDef){funcVars=this._funcVarTable[_GLOBAL];if(funcVars){varDef=funcVars[varName]}}if(!varDef){return false}while(varDef.valType!=="new"){if(varDef.valType==="lit"){break}if(varDef.valType==="var"){varDef=funcVars[varDef.varName]}}return varDef&&varDef.valType==="new"&&varDef.class===varDef.origClass};Rule.prototype._getRuleOptions=function(regCtx){var scope=regCtx.ruleOpts.scope;if(scope&&typeof scope!=="object"){regCtx.error("Rule "+RULE_NAME+" : invalid config 'ruleMods.scope' property. Rule disabled.");return false}this._scope={deprecated:{sure:true,unsure:false},deleted:{sure:true,unsure:false}};if(!scope){return true}var o=scope.deprecated;if(o){if(o.hasOwnProperty("sure")){this._scope.deprecated.sure=!!scope.deprecated.sure}if(o.hasOwnProperty("unsure")){this._scope.deprecated.unsure=!!scope.deprecated.unsure}}o=scope.deleted;if(o){if(o.hasOwnProperty("sure")){this._scope.deleted.sure=!!scope.deleted.sure}if(o.hasOwnProperty("unsure")){this._scope.deleted.unsure=!!scope.deleted.unsure}}return this._scope.deprecated.sure||this._scope.deprecated.unsure||this._scope.deleted.sure||this._scope.deleted.unsure};module.exports=Rule;
@@ -1 +1,6 @@
1
+ /*
2
+ * Copyright (c) 2018, 2021, Oracle and/or its affiliates.
3
+ * Licensed under The Universal Permissive License (UPL), Version 1.0
4
+ * as shown at https://oss.oracle.com/licenses/upl/
5
+ */
1
6
  const helperClass=require("./helpers/vartrack");const RULE_NAME="oj-js-comp-meth-deprecated";const _GLOBAL="_@global";var NT;var depMethods;var delMethods;function Rule(){this._reset();this._scope=null};Rule.prototype.getName=function(){return RULE_NAME};Rule.prototype.getShortDescription=function(){return"JET component class deprecated methods should not be invoked"};Rule.prototype.getDescription=function(){return"JET component class deprecated methods should not be invoked"};Rule.prototype.register=function(regCtx){if(!this._getRuleOptions(regCtx)){return null}return{CallExpression:this._handleCall,FunctionDeclaration:this._setup,FunctionExpression:this._setup,file:this._newFile,endfile:this._endFile,startscript:this._newFile,endscript:this._endFile}};Rule.prototype._reset=function(){this._funcVarTable=null;this._globalVars=false;this._define=false;if(this._helper){this._helper.reset()}};Rule.prototype._handleCall=function(context,node){var component,method,objName,comment,version,issue;var me,prop,method,del;var thoughtToBe,emitDep,emitDel;var metaLib=context.utils.metaLib;if(!NT){NT=context.utils.AstUtils.getNodeTypes()}if(node.callee&&(node.callee.name==="define"||node.callee.name==="require")){this._funcVarTable=this._handleViewModelDefine(context,node);return}if(!depMethods){depMethods=metaLib.getDeprecatedMethodList(context)}if(!delMethods){delMethods=metaLib.getDeletedMethodList(context)}me=node.callee;if(me.name&&me.name==="$"){return}if(me.type!==NT.MEMBER_EXPR){return}objName=this._getVarFromMemberExpr(me);prop=me.property;if(prop&&prop.name){method=prop.name}if(!(method&&objName)){return}if(this._isCommonMethod(context,objName,method)){return}if(!depMethods[method]){del=delMethods[method];if(!del){return}}if(context.utils.AstUtils.isFuncArg(node,objName)){if(del&&this._scope.deleted.unsure||!del&&this._scope.deprecated.unsure){issue=new context.Issue("Possible use of "+(del?"deleted":"deprecated")+" JET method "+method+"() on var '"+objName+"' (class cannot be determined)");issue.setMsgKey(context.ruleName+"_1");context.reporter.addIssue(issue,context);return}}component=this._findInstantiatedComponent(context,node,objName);if(!component){return}comment=metaLib.isClassMethodDeprecated(component,method);thoughtToBe=this._isOrigVarValue(context,node,objName)?"":"thought to be ";emitDep=thoughtToBe&&this._scope.deprecated.unsure||!thoughtToBe&&this._scope.deprecated.sure;emitDel=thoughtToBe&&this._scope.deleted.unsure||!thoughtToBe&&this._scope.deleted.sure;if(del&&emitDel||!del&&emitDep){if(comment){comment=context.utils.utils.removeMarkup(comment);issue=new context.Issue("Method "+method+"() on var '"+objName+"' ("+thoughtToBe+component+")"+(comment.toLowerCase().includes("deprecated")?". ":" is "+(del?"deleted":"deprecated")+". ")+comment)}else{if(metaLib.isClassDeprecated(component)){issue=new context.Issue("Method "+method+"() on var '"+objName+"' called on deprecated class ("+thoughtToBe+component+").")}}}if(!issue){if(emitDel){version=metaLib.isClassMethodDeleted(component,method);if(version){issue=new context.Issue("Method "+method+"() on var '"+objName+"' ("+thoughtToBe+component+")"+" was removed in version "+version)}else if(metaLib.isClassDeleted(component)){issue=new context.Issue("Method "+method+"() on var '"+objName+"' called on deleted class ("+thoughtToBe+component+").")}if(issue){issue.setSeverity("critical");issue.setMsgKey(RULE_NAME+"_2")}}}if(issue){context.reporter.addIssue(issue,context)}};Rule.prototype._newFile=function(context){if(context.type==="file"&&context.filetype==="html"){return}if(!this._helper){this._helper=new helperClass}this._reset();if(!NT&&context.utils.AstUtils){NT=context.utils.AstUtils.getNodeTypes()}};Rule.prototype._endFile=function(context){this._define=false;if(this._helper){this._helper.reset()}};Rule.prototype._setup=function(context,node){var funcName;if(!depMethods){depMethods=context.utils.metaLib.getDeprecatedMethodList(context)}if(!delMethods){delMethods=context.utils.metaLib.getDeletedMethodList(context)}if(!NT){NT=context.utils.AstUtils.getNodeTypes()}if(!this._globalVars){this._helper.getGlobalVars(context);this._globalVars=true}if(this._define){return}var o=this._helper.createFuncDeclarations(context,node);if(o){this._funcVarTable=o.funcVarTable;for(funcName in this._funcVarTable){this._handleVarAssignments(context,node,this._funcVarTable[funcName])}}else{this._funcVarTable=null}};Rule.prototype._findInstantiatedComponent=function(context,node,varName){var funcName=this._helper.getContainingFunctionName(context,node);var funcVars=funcName&&this._funcVarTable?this._funcVarTable[funcName]:null;var varDef;if(funcVars){varDef=funcVars[varName];if(!varDef){funcVars=this._funcVarTable[_GLOBAL];if(funcVars){varDef=funcVars[varName]}}if(varDef&&varDef.valType){if(varDef.valType==="funcret"&&varDef.func==="$")return null;while(varDef.valType==="var"||varDef.valType==="globvar"){varDef=funcVars[varDef.varName];if(!varDef.valType){return}}if(varDef.class){return(varDef.obj?varDef.obj+".":"")+varDef.class}}}};Rule.prototype._handleVarAssignments=function(context,node,funcVars){var body,stmt,leftObj,rightObj,i;body=node.body.body;for(i=0;i<body.length;i++){stmt=body[i];if(stmt.type===NT.EXPR_STMT){if(stmt.expression){if(stmt.expression.type===NT.ASSIGNMENT_EXPR){if(stmt.expression.left.type===NT.IDENTIFIER){if(!funcVars[stmt.expression.left.name]){funcVars[stmt.expression.left.name]={type:"globvar"}}if(stmt.expression.right.type===NT.IDENTIFIER){if(!funcVars[stmt.expression.right.name]){funcVars[stmt.expression.right.name]={type:"globvar"}}leftObj=funcVars[stmt.expression.left.name];rightObj=funcVars[stmt.expression.right.name];leftObj.valType=rightObj.valType;leftObj.varName=rightObj.varName}}}}}}};Rule.prototype._getVarFromMemberExpr=function(me,varSoFar,level){var obj;level=typeof level==="number"?level+1:0;if(me.object){obj=me.object;if(obj.type===NT.IDENTIFIER){varSoFar=varSoFar?varSoFar+"."+obj.name:obj.name}else if(obj.type===NT.MEMBER_EXPR){varSoFar=this._getVarFromMemberExpr(obj,varSoFar,level)}if(me.property&&level){if(me.property.type===NT.IDENTIFIER){varSoFar=varSoFar?varSoFar+"."+me.property.name:me.property.name}else if(me.property.type===NT.MEMBER_EXPR){varSoFar=this._getVarFromMemberExpr(me.property,varSoFar,level)}}}return varSoFar};Rule.prototype._isOrigVarValue=function(context,node,varName){var funcName,funcVars,varDef;funcName=this._helper.getContainingFunctionName(context,node);if(funcName){funcVars=this._funcVarTable[funcName];if(funcVars){varDef=funcVars[varName]}}if(!varDef){funcVars=this._funcVarTable[_GLOBAL];if(funcVars){varDef=funcVars[varName]}}if(!varDef){return false}while(varDef.valType!=="new"){if(varDef.valType==="lit"){break}if(varDef.valType==="var"){varDef=funcVars[varDef.varName]}}return varDef&&varDef.valType==="new"&&varDef.class===varDef.origClass};Rule.prototype._handleViewModelDefine=function(context,node){var p,args,stmt,o,i;args=node.arguments;if(!args){return}for(i=0;i<args.length;i++){stmt=args[i];if(stmt.type===NT.FUNC_EXPR){o=this._helper.createFuncDeclarations(context,stmt);this._funcVarTable=o.funcVarTable}}this._define=true;return this._funcVarTable};Rule.prototype._isCommonMethod=function(context,objName,method){return method.charAt(0)==="_"||method==="observable"||method==="applyBindings"||method==="addEventListener"||method==="removeEventListener"||context.utils.AstUtils.isCommonDocApi(method)||objName==="this"||objName==="self"||objName==="_self"||objName==="window"||objName==="console"||this._helper.isCommonVar(objName)};Rule.prototype._getRuleOptions=function(regCtx){var scope=regCtx.ruleOpts.scope;if(scope&&typeof scope!=="object"){regCtx.error("Rule "+RULE_NAME+" : invalid config 'ruleMods.scope' property. Rule disabled.");return false}this._scope={deprecated:{sure:true,unsure:false},deleted:{sure:true,unsure:false}};if(!scope){return true}var o=scope.deprecated;if(o){if(o.hasOwnProperty("sure")){this._scope.deprecated.sure=!!scope.deprecated.sure}if(o.hasOwnProperty("unsure")){this._scope.deprecated.unsure=!!scope.deprecated.unsure}}o=scope.deleted;if(o){if(o.hasOwnProperty("sure")){this._scope.deleted.sure=!!scope.deleted.sure}if(o.hasOwnProperty("unsure")){this._scope.deleted.unsure=!!scope.deleted.unsure}}return this._scope.deprecated.sure||this._scope.deprecated.unsure||this._scope.deleted.sure||this._scope.deleted.unsure};module.exports=Rule;
@@ -1 +1,6 @@
1
+ /*
2
+ * Copyright (c) 2018, 2021, Oracle and/or its affiliates.
3
+ * Licensed under The Universal Permissive License (UPL), Version 1.0
4
+ * as shown at https://oss.oracle.com/licenses/upl/
5
+ */
1
6
  const RULE_NAME="oj-js-no-ext-final";const LONG_DESCR="Starting in 8.0.0, constructors for classes marked with @final in the JET JS Doc cannot be invoked without use of 'new'";const MSG_PART="' constructor without 'new' will fail in version 8.x or later";const OJ="oj";const OJDOT="oj.";var lookup;function getName(){return RULE_NAME};function getShortDescription(){return"Classes marked @final must be constructed with 'new'"};function getDescription(){return LONG_DESCR};function register(){return{CallExpression:_fnCall,MemberExpression:_fnMemExpr,file:_fnNewFile,ImportDeclaration:_fnImport}};function _fnNewFile(context){lookup={}};function _fnImport(context,node){var obj;obj=context.utils.AstUtils.parseImport(node);if(obj){_getClassNames(context,obj);for(var name in obj){obj[name]=name}Object.assign(lookup,obj)}};function _fnCall(context,node){let callee,obj,exit=false;if(!node.callee){return}callee=node.callee;if(callee){if(callee.name==="define"){obj=context.utils.AstUtils.parseDefine(node);exit=true}else if(callee.name==="require"){obj=_parseRequire(context,node);exit=true}if(obj){_getClassNames(context,obj);Object.assign(lookup,obj)}if(exit){return}}if(_specialCase(callee)){return}return _handleCall(context,node,callee)};function _handleCall(context,node,callee){var clazz,ojclazz,obj,classBase,pos,immed=false;if(callee.type==="Identifier"){clazz=callee.name;pos=callee;immed=true}else if(callee.type==="MemberExpression"&&callee.object){if(callee.object.type==="NewExpression"){return}if(callee.object.type==="Identifier"){if(callee.object.name===OJ){if(callee.property.type==="Identifier"){clazz=OJDOT+callee.property.name;pos=callee.object.property}}else{clazz=callee.object.name;pos=callee.object}}else if(callee.object.type==="MemberExpression"){if(callee.object.object&&callee.object.object.type==="Identifier"&&callee.object.object.name===OJ){classBase=callee.object.property.name;clazz=OJDOT+classBase}}}if(clazz){ojclazz=lookup[clazz];if(ojclazz){if(_checkFinal(context,ojclazz,pos)){return}}else if(!immed){ojclazz=clazz;if(context.utils.metaLib.isClass(ojclazz)){obj=_checkStatic(context,ojclazz,callee);if(obj.exists&&!obj.static){_emitIssue("uninstantiated '"+ojclazz+" : use of non-static method '"+obj.fn+"' will fail in JET 8.x or higher",context,pos)}else if(!obj.exists){if(callee.property&&callee.property.type==="Identifier"&&callee.property.name){if(clazz.substring(3)===callee.property.name||callee.property.name==="call"||callee.property.name==="apply"){_emitIssue("'"+clazz+MSG_PART,context)}}}}}}};function _emitIssue(msg,context,pos){var issue=new context.Issue(msg);if(pos){issue.setPosition(null,null,pos.start,pos.end)}context.reporter.addIssue(issue,context)}function _fnMemExpr(context,node){let ojclazz,attr;if(node.parent&&node.parent.type==="CallExpression"){return}if(node.object&&node.object.type&&node.object.type==="MemberExpression"){if(node.object.object&&node.object.object.type==="Identifier"&&node.object.property){if(node.object.property.type==="Identifier"){ojclazz=node.object.object.name+"."+node.object.property.name;attr=node.property.name;if(context.utils.metaLib.isClassMember(ojclazz,attr)&&!context.utils.metaLib.isClassMemberStatic(ojclazz,attr)){_emitIssue("uninstantiated '"+ojclazz+" : use of non-static member '"+attr+"' will fail in JET 8.x or higher",context,node.property)}}}}};function _checkFinal(context,clazz,pos){var ret=false;if(context.utils.metaLib.isClassFinal(clazz)){_emitIssue("'"+clazz+MSG_PART,context,pos);ret=true}return ret};function _getClassNames(context,obj){var clazz,module,name;if(obj){for(name in obj){module=obj[name];clazz=context.utils.metaLib.getClassFromModule(module);obj[name]=clazz}}};function _parseRequire(context,node,obj){var module,clazz,p;obj=obj||null;if(node.arguments){module=node.arguments[0];if(module&&module.type==="Literal"){module=module.value;p=node.parent;if(p.type==="VariableDeclarator"){if(p.id&&p.id.type==="Identifier"){clazz=p.id.name}}else if(p.type==="AssignmentExpression"){if(p.left.type==="Identifier"){clazz=p.left.name}}if(clazz){obj=obj||{};obj[clazz]=module}}}return obj};function _specialCase(callee){var obj;if(callee){if(callee.object&&callee.object.name){if(callee.object.object){return false}obj=callee.object.name;if(obj==="Object"){return true}}}return false};function _checkStatic(context,ojclazz,callee){var name;var ret={};if(context.utils.metaLib.isClassFinal(ojclazz)){if(callee.property&&callee.property.type==="Identifier"&&callee.property.name){name=callee.property.name;ret.fn=name;if(context.utils.metaLib.isClassMethod(ojclazz,name)){ret.exists=true;ret.static=context.utils.metaLib.isClassMethodStatic(ojclazz,name);return ret}}}ret.fn=null;return ret};module.exports={getName,getDescription,getShortDescription,register};
@@ -1 +1,6 @@
1
+ /*
2
+ * Copyright (c) 2018, 2021, Oracle and/or its affiliates.
3
+ * Licensed under The Universal Permissive License (UPL), Version 1.0
4
+ * as shown at https://oss.oracle.com/licenses/upl/
5
+ */
1
6
  const RULENAME="oj-js-noconsole";const DESCRIPTION="All uses of console.log() should be removed before general release";const SHORT_DESCRIPTION="console.log() should be removed before general release";class Rule{getName(){return RULENAME}getDescription(){return DESCRIPTION}getShortDescription(){return SHORT_DESCRIPTION}register(){return{CallExpression:this._onCall}}_onCall(ruleCtx,node){if(node.callee&&node.callee.object&&node.callee.object.name==="console"){let meth=node.callee.property&&node.callee.property.type==="Identifier"?": method "+node.callee.property.name+"()":"";let issue=new ruleCtx.Issue(`Use of console object found ${meth} - strip before shipping!`);ruleCtx.reporter.addIssue(issue,ruleCtx)}}}module.exports=Rule;
@@ -1 +1,6 @@
1
- const RULENAME="oj-js-ojcomp-deprecated";const DESCRIPTION="Deprecated JET component classes should not be instantiated";const SHORT_DESCRIPTION="Deprecated JET component classes should not be instantiated";const PERIOD=".";var nt;class Rule{getName(){return RULENAME}getDescription(){return DESCRIPTION}getShortDescription(){return SHORT_DESCRIPTION}register(regCtx){var ret={};nt=regCtx.jsNodeTypes;ret[nt.NEW_EXPR]=this._onNew;return ret}_onNew(ruleCtx,node){var component,issue,comment;var me,obj,start,pos;me=node.callee;if(me.type===nt.MEMBER_EXPR){obj=me.object;if(obj&&obj.type===nt.IDENTIFIER){if(obj.name==="oj"){if(me.property&&me.property.name){component="oj."+me.property.name;start=obj}}}}else if(me.type===nt.IDENTIFIER){component=me.name;start=me}if(component){comment=ruleCtx.utils.metaLib.isClassDeprecated(component);if(comment){issue=new ruleCtx.Issue(`Instantiation of deprecated JET class ${component}. ${comment} ${comment.endsWith(PERIOD)?"":PERIOD}`);let ft=ruleCtx.filepath.substring(ruleCtx.filepath.lastIndexOf(".")+1);start=ft==="ts"?start.range[0]:start.start;pos=ruleCtx.utils.utils.getRowColFromIndex(ruleCtx.data,start,ft);issue.setPosition(pos.row,pos.col,start,start+component.length);ruleCtx.reporter.addIssue(issue,ruleCtx)}}}}module.exports=Rule;
1
+ /*
2
+ * Copyright (c) 2018, 2021, Oracle and/or its affiliates.
3
+ * Licensed under The Universal Permissive License (UPL), Version 1.0
4
+ * as shown at https://oss.oracle.com/licenses/upl/
5
+ */
6
+ const RULENAME="oj-js-ojcomp-deprecated";const DESCRIPTION="Deprecated JET component classes should not be instantiated";const SHORT_DESCRIPTION="Deprecated JET component classes should not be instantiated";const PERIOD=".";var nt;class Rule{getName(){return RULENAME}getDescription(){return DESCRIPTION}getShortDescription(){return SHORT_DESCRIPTION}register(regCtx){var ret={};nt=regCtx.jsNodeTypes;ret[nt.NEW_EXPR]=this._onNew;return ret}_onNew(ruleCtx,node){var component,issue,comment;var me,obj,start,pos;me=node.callee;if(me.type===nt.MEMBER_EXPR){obj=me.object;if(obj&&obj.type===nt.IDENTIFIER){if(obj.name==="oj"){if(me.property&&me.property.name){component="oj."+me.property.name;start=obj}}}}else if(me.type===nt.IDENTIFIER){component=me.name;start=me}if(component){comment=ruleCtx.utils.metaLib.isClassDeprecated(component);if(comment){if(typeof comment==="object"){comment=comment.description}issue=new ruleCtx.Issue(`Instantiation of deprecated JET class ${component}. ${comment} ${comment.endsWith(PERIOD)?"":PERIOD}`);let ft=ruleCtx.filepath.substring(ruleCtx.filepath.lastIndexOf(".")+1);start=ft==="ts"?start.range[0]:start.start;pos=ruleCtx.utils.utils.getRowColFromIndex(ruleCtx.data,start,ft);issue.setPosition(pos.row,pos.col,start,start+component.length);ruleCtx.reporter.addIssue(issue,ruleCtx)}}}}module.exports=Rule;
@@ -1 +1,6 @@
1
+ /*
2
+ * Copyright (c) 2018, 2021, Oracle and/or its affiliates.
3
+ * Licensed under The Universal Permissive License (UPL), Version 1.0
4
+ * as shown at https://oss.oracle.com/licenses/upl/
5
+ */
1
6
  const RULENAME="oj-js-ojcomp-exist";const DESCRIPTION="The JET component class is unknown or has been renamed. The component class's deprecation period may have expired and it has been removed.";const SHORT_DESCRIPTION="Unknown JET component classes should not be instantiated";class Rule{getName(){return RULENAME}getDescription(){return DESCRIPTION}getShortDescription(){return SHORT_DESCRIPTION}register(regCtx){var ret={};this._nt=regCtx.jsNodeTypes;ret[this._nt.NEW_EXPR]=this._onNew;return ret}_onNew(ruleCtx,node){var clazz,issue,exists;var me,obj,start;var metaLib=ruleCtx.utils.metaLib;me=node.callee;if(me.type==="MemberExpression"){obj=me.object;if(obj&&obj.type==="Identifier"){if(obj.name==="oj"){if(me.property&&me.property.name){clazz="oj."+me.property.name}start=obj}}}else if(me.type==="Identifier"){clazz=me.name;start=me}if(clazz){exists=metaLib.isComponent(clazz);if(!exists){issue=this._isRenamed(clazz,ruleCtx);if(!issue){issue=this._isDeleted(clazz,ruleCtx)}if(issue){let ft=ruleCtx.filepath.substring(ruleCtx.filepath.lastIndexOf(".")+1);start=ft==="ts"?start.range[0]:start.start;let pos=ruleCtx.utils.utils.getRowColFromIndex(ruleCtx.data,start,ft);issue.setPosition(pos.row,pos.col,start,start+clazz.length);ruleCtx.reporter.addIssue(issue,ruleCtx,start)}}}}_isRenamed(clazz,ruleCtx){var o,issue;o=ruleCtx.utils.metaLib.isClassRenamed(clazz);if(o){issue=new ruleCtx.Issue(`Instantiation of '${clazz}' - this class was renamed to ${o.to} in ${o.since}`);issue.setMsgKey(RULENAME+"_1")}return issue}_isDeleted(clazz,ruleCtx){var ver,issue;ver=ruleCtx.utils.metaLib.isClassDeleted(clazz);if(ver){if(clazz==="oj.ojTree"){issue=new ruleCtx.Issue(`Instantiation of '${clazz}' - this class was undocumented in version 6.0.0`)}else{issue=new ruleCtx.Issue(`Instantiation of '${clazz}' - this class was removed in version ${ver}`)}}else if(clazz.startsWith("oj.")){if(clazz!=="oj.ojTree"){issue=new ruleCtx.Issue(`Instantiation of unknown JET component '${clazz}'`)}else{issue=new ruleCtx.Issue(`Instantiation of ${clazz} - this class was undocumented in version 6.0.0`)}}return issue}}module.exports=Rule;
@@ -1 +1,6 @@
1
+ /*
2
+ * Copyright (c) 2018, 2021, Oracle and/or its affiliates.
3
+ * Licensed under The Universal Permissive License (UPL), Version 1.0
4
+ * as shown at https://oss.oracle.com/licenses/upl/
5
+ */
1
6
  const RULENAME="oj-js-ojcomp-new";const DESCRIPTION="JET custom element usage should be used instead of instantiating a JET component class via 'new'.";const SHORT_DESCRIPTION="Replace Instantiation of a JET component class via \"new\" with a custom element";class Rule{getName(){return RULENAME}getDescription(){return DESCRIPTION}getShortDescription(){return SHORT_DESCRIPTION}register(){return{NewExpression:this._onNew}}_onNew(ruleCtx,node){var component,issue,elem;var me,obj,start;var metaLib=ruleCtx.utils.metaLib;me=node.callee;if(me.type==="MemberExpression"){obj=me.object;if(obj&&obj.type==="Identifier"){if(obj.name==="oj"){if(me.property&&me.property.name){component="oj."+me.property.name;start=obj}}}}else if(me.type==="Identifier"){component=me.name;start=me}if(component){if(metaLib.isClassRenamed(component)||metaLib.isClassDeleted(component)){return}if(metaLib.isComponent(component)){if(component==="oj.ojTree"){elem="oj-tree-view"}else{elem=metaLib.getTagFromClass(component)}if(elem){issue=new ruleCtx.Issue("Instantiation of JET class "+component+" found. Use web component <"+elem+">.");let ft=ruleCtx.filepath.substring(ruleCtx.filepath.lastIndexOf(".")+1);start=ft==="ts"?start.range[0]:start.start;let pos=ruleCtx.utils.utils.getRowColFromIndex(ruleCtx.data,start,ft);issue.setPosition(pos.row,pos.col,start,start+component.length);ruleCtx.reporter.addIssue(issue,ruleCtx)}}}}}module.exports=Rule;