@oracle/oraclejet-audit 15.1.9 → 16.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (151) hide show
  1. package/corePackMigrator/corePackMigrator.js +2 -2
  2. package/corePackMigrator/metadata/actionCardMetadata.json +8 -0
  3. package/corePackMigrator/metadata/avatarMetadata.json +0 -12
  4. package/corePackMigrator/metadata/drawerPopupMetadata.json +16 -0
  5. package/corePackMigrator/metadata/formLayoutMetadata.json +34 -0
  6. package/corePackMigrator/metadata/highlightTextMetadata.json +8 -0
  7. package/corePackMigrator/metadata/inputNumberMetadata.json +26 -2
  8. package/corePackMigrator/metadata/inputPasswordMetadata.json +32 -2
  9. package/corePackMigrator/metadata/inputTextMetadata.json +26 -2
  10. package/corePackMigrator/metadata/legendItemMetadata.json +1 -5
  11. package/corePackMigrator/metadata/legendMetadata.json +42 -0
  12. package/corePackMigrator/metadata/legendSectionMetadata.json +6 -4
  13. package/corePackMigrator/metadata/listviewMetadata.json +61 -2
  14. package/corePackMigrator/metadata/messageBannerMetadata.json +8 -0
  15. package/corePackMigrator/metadata/messagesMetadata.json +17 -5
  16. package/corePackMigrator/metadata/radiosetMetadata.json +86 -0
  17. package/corePackMigrator/metadata/ratingGaugeMetadata.json +29 -17
  18. package/corePackMigrator/metadata/selectManyMetadata.json +9 -3
  19. package/corePackMigrator/metadata/selectSingleMetadata.json +16 -5
  20. package/corePackMigrator/metadata/selectorMetadata.json +37 -0
  21. package/corePackMigrator/metadata/statusMeterGaugeMetadata.json +21 -9
  22. package/corePackMigrator/metadata/tagCloudMetadata.json +8 -0
  23. package/corePackMigrator/metadata/textAreaMetadata.json +8 -2
  24. package/corePackMigrator/resource/astUtils.js +1 -1
  25. package/corePackMigrator/resource/componentMigrator.js +1 -1
  26. package/corePackMigrator/resource/fileScanner.js +1 -1
  27. package/corePackMigrator/resource/htmlUtils.js +1 -1
  28. package/corePackMigrator/resource/manifest.json +25 -10
  29. package/corePackMigrator/resource/migrationConfig.json +3 -0
  30. package/corePackMigrator/templates/componentMetaData.json +18 -4
  31. package/corePackMigrator/templates/migrationConfig.json +15 -3
  32. package/corePackMigrator/utilities/logging.js +1 -1
  33. package/jaf-amd.js +1 -1
  34. package/jaf.js +1 -1
  35. package/jafapi.js +1 -1
  36. package/lib/AST_Ts.js +1 -1
  37. package/lib/AstJson.js +1 -1
  38. package/lib/AstNodeTypes.js +1 -1
  39. package/lib/Components.js +1 -1
  40. package/lib/DomUtils.js +1 -1
  41. package/lib/FsUtils.js +1 -1
  42. package/lib/HtmlUtils.js +1 -1
  43. package/lib/JafLib.js +1 -1
  44. package/lib/MetaLib.js +1 -1
  45. package/lib/OjCPack.js +1 -1
  46. package/lib/Registry.js +1 -1
  47. package/lib/RulePack.js +1 -1
  48. package/lib/RuleSet.js +1 -1
  49. package/lib/Rules.js +1 -1
  50. package/lib/Stats.js +1 -1
  51. package/lib/Ts.js +1 -1
  52. package/lib/TsUtils.js +6 -0
  53. package/lib/TsxUtils.js +1 -1
  54. package/lib/TsxUtils2.js +1 -1
  55. package/lib/Utils.js +1 -1
  56. package/lib/checkage.js +1 -1
  57. package/lib/defaults.js +1 -1
  58. package/lib/jsx.js +1 -1
  59. package/lib/migrator.js +1 -1
  60. package/lib/scaffold.js +1 -1
  61. package/lib/sublib/precomp/ComponentFinder.js +6 -0
  62. package/lib/sublib/precomp/Precompiler.js +6 -0
  63. package/lib/sublib/precomp/TsxUtils.js +6 -0
  64. package/lib/sublib/precomp/Utils.js +6 -0
  65. package/meta/15.0.0/jetauditmeta.js +1 -1
  66. package/meta/15.1.0/jetauditmeta.js +1 -1
  67. package/meta/16.0.0/jetauditmeta.js +9 -0
  68. package/meta/metaverlist.json +1 -1
  69. package/package.json +10 -7
  70. package/profiles/best-practice.json +1 -0
  71. package/rulepacks/csp/csp-json-unsafe-expr.js +1 -1
  72. package/rulepacks/jetwc/jetwc-bootstrap.js +1 -1
  73. package/rulepacks/jetwc/jetwc-require-paths.js +1 -1
  74. package/rulepacks/jetwc/jetwc-schema.js +1 -1
  75. package/rulepacks/jetwc/jetwc-well-formed-description.js +6 -0
  76. package/rulepacks/jetwc/msgid.json +1 -1
  77. package/rulepacks/jetwc/rules.json +1 -1
  78. package/rulepacks/jetwc-lib/jetwcutils-componentAuditUtils.js +1 -1
  79. package/rulepacks/jetwc-lib/jetwcutils-componentFinder.js +1 -1
  80. package/rulepacks/jetwc-lib/jetwcutils-tsxUtils.js +1 -1
  81. package/rulepacks/jetwco/jetwco-bootstrap.js +1 -1
  82. package/rulepacks/jetwco/jetwco-cacc-methodParamTypes.js +1 -1
  83. package/rulepacks/jetwco/jetwco-cacc-methodReturnType.js +1 -1
  84. package/rulepacks/jetwco/jetwco-description-standards.js +1 -1
  85. package/rulepacks/jetwco/jetwco-license-info.js +1 -1
  86. package/rulepacks/jetwco/jetwco-validate-applied-audits.js +6 -0
  87. package/rulepacks/jetwco/msgid.json +1 -1
  88. package/rulepacks/jetwco/rules.json +1 -1
  89. package/rulepacks/ojc/msgid.json +1 -1
  90. package/rulepacks/ojc/ojc-html-button-defslot.js +6 -0
  91. package/rulepacks/ojc/ojc-tsx-button-defslot.js +6 -0
  92. package/rulepacks/ojc/rules.json +1 -1
  93. package/rules/jaf/jaf-css-diagnose.js +1 -1
  94. package/rules/jaf/jaf-js-diagnose.js +1 -1
  95. package/rules/jaf/jaf-sys-dup-component.js +6 -0
  96. package/rules/jaf/jaf-sys-rule-opt.js +6 -0
  97. package/rules/jaf/jaf-ts-precompile.js +6 -0
  98. package/rules/jaf/msgid.json +1 -1
  99. package/rules/jaf/rules.json +1 -1
  100. package/rules/jet/helpers/has-slot-name.js +1 -1
  101. package/rules/jet/msgid.json +1 -1
  102. package/rules/jet/oj-cca-compjson-bp-jetver.js +1 -1
  103. package/rules/jet/oj-html-alta-deprecated.js +1 -1
  104. package/rules/jet/oj-html-attr-expr-writeback.js +6 -0
  105. package/rules/jet/oj-html-binding-as-slot-child.js +6 -0
  106. package/rules/jet/oj-html-event-focus-blur.js +6 -0
  107. package/rules/jet/oj-html-form-bindif.js +1 -1
  108. package/rules/jet/oj-html-ojattr-deprecated.js +1 -1
  109. package/rules/jet/oj-html-ojattr-enum-deprecated.js +1 -1
  110. package/rules/jet/oj-html-ojattr.js +1 -1
  111. package/rules/jet/oj-html-ojtag-deprecated.js +1 -1
  112. package/rules/jet/oj-html-ojtag-nonglobattr-prefix.js +1 -1
  113. package/rules/jet/oj-html-prop-anti-pattern.js +6 -0
  114. package/rules/jet/oj-html-slot-default.js +6 -0
  115. package/rules/jet/oj-html-slot-deprecated.js +1 -1
  116. package/rules/jet/oj-html-slot-name.js +1 -1
  117. package/rules/jet/oj-html-slot-pref-content.js +1 -1
  118. package/rules/jet/oj-html-style-deprecated.js +1 -1
  119. package/rules/jet/oj-html-treeview-actionable-content.js +6 -0
  120. package/rules/jet/oj-html-wctag-anti-pattern.js +6 -0
  121. package/rules/jet/oj-html-wctag-maintenance.js +1 -1
  122. package/rules/jet/oj-html-wctag-supersedes.js +1 -1
  123. package/rules/jet/oj-js-ojcomp-exist.js +1 -1
  124. package/rules/jet/oj-ts-ojcomp-exist.js +1 -1
  125. package/rules/jet/oj-tsx-aria-ojselector-labelledby.js +1 -1
  126. package/rules/jet/oj-tsx-aria-prop.js +1 -1
  127. package/rules/jet/oj-tsx-event.js +6 -0
  128. package/rules/jet/oj-tsx-ojattr-deprecated.js +1 -1
  129. package/rules/jet/oj-tsx-ojattr-enum-deprecated.js +1 -1
  130. package/rules/jet/oj-tsx-ojattr-value.js +1 -1
  131. package/rules/jet/oj-tsx-ojattr.js +1 -1
  132. package/rules/jet/oj-tsx-ojtag-deprecated.js +1 -1
  133. package/rules/jet/oj-tsx-pageopts-type.js +1 -1
  134. package/rules/jet/oj-tsx-picker-attrs.js +1 -1
  135. package/rules/jet/oj-tsx-popup-sibling.js +6 -0
  136. package/rules/jet/oj-tsx-prop-anti-pattern.js +6 -0
  137. package/rules/jet/oj-tsx-rating-gauge-size.js +1 -1
  138. package/rules/jet/oj-tsx-rating-gauge-track-resize.js +1 -1
  139. package/rules/jet/oj-tsx-slot-deprecated.js +1 -1
  140. package/rules/jet/oj-tsx-slot-pref-content.js +1 -1
  141. package/rules/jet/oj-tsx-treeview-actionable-content.js +6 -0
  142. package/rules/jet/oj-tsx-unsup-theme.js +1 -1
  143. package/rules/jet/oj-tsx-wctag-anti-pattern.js +6 -0
  144. package/rules/jet/oj-tsx-wctag-maintenance.js +1 -1
  145. package/rules/jet/rules.json +1 -1
  146. package/schema/component-schema.json +1 -1
  147. package/src/JafCore.js +1 -1
  148. package/types/index.d.ts +1 -0
  149. package/rulepacks/jetwc-lib/jetwcutils-preCompiler.js +0 -6
  150. package/rules/jet/oj-html-combo-converter.js +0 -6
  151. package/rules/jet/oj-tsx-combo-converter.js +0 -6
@@ -3,4 +3,4 @@
3
3
  * Licensed under The Universal Permissive License (UPL), Version 1.0
4
4
  * as shown at https://oss.oracle.com/licenses/upl/
5
5
  */
6
- const getStyles=require("./helpers/extractStylesFromClass");const StyleSelector=require("./helpers/style-selector");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}this._metaLib=regCtx.utils.metaLib;StyleSelector.setAssertMsg(regCtx.utils.msgLib.assert);return{"class":this._onClass}};Rule.prototype._onClass=function(ruleCtx,attrName,attrValue){var i,dataBindChecked=false,classes,style,deps,dep,component,comps;if(!this._domUtils){this._domUtils=ruleCtx.utils.DomUtils}classes=getStyles(attrValue);for(i=0;i<classes.length;i++){style=classes[i];if(!dataBindChecked){component=this._domUtils.getDataBindComponent(ruleCtx);dataBindChecked=true}if(component){comps=this._metaLib.getClassesFromStyle(style);if(comps&&comps.length&&comps.indexOf(component)>=0){continue}}if(!this._OkStyle(style)){continue}if(!(deps=this._metaLib.isStyleDeprecatedEx(style))){continue}let sType=this._metaLib.getStyleOrigin(style);if(!sType){continue}for(let j=0;j<deps.length;j++){dep=deps[j];if(dep.styleselector){if(!this._handleStyleSelector(ruleCtx,style,sType,dep.styleselector)){continue}}this._emitIssue(ruleCtx,dep.dep,style)}}};Rule.prototype._handleStyleSelector=function(ruleCtx,style,sType,ss){var ss,tags,tagName,i;tagName=ruleCtx.tag;if(sType==="c"){return StyleSelector.match(ruleCtx,ss)}if(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"){return false}if(ss=this._metaLib.getStyleSelector(style,false)){if(StyleSelector.match(ruleCtx,ss)){return true}}return ss?false:true};Rule.prototype._emitIssue=function(ruleCtx,dep,style){if(dep.description&&!dep.description.endsWith(".")){dep.description=dep.description+"."}var 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 customOpts,accept,reject;if(!(customOpts=regCtx.ruleOpts.customOpts)){return true}accept=customOpts.accept;reject=customOpts.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;
6
+ const getStyles=require("./helpers/extractStylesFromClass");const StyleSelector=require("./helpers/style-selector");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}this._metaLib=regCtx.utils.metaLib;StyleSelector.setAssertMsg(regCtx.utils.msgLib.assert);return{"class":this._onClass}};Rule.prototype._onClass=function(ruleCtx,attrName,attrValue){var i,dataBindChecked=false,classes,style,deps,dep,component,comps,styleSelMatched;if(!this._domUtils){this._domUtils=ruleCtx.utils.DomUtils}classes=getStyles(attrValue);for(i=0;i<classes.length;i++){style=classes[i];if(!dataBindChecked){component=this._domUtils.getDataBindComponent(ruleCtx);dataBindChecked=true}if(component){comps=this._metaLib.getClassesFromStyle(style);if(comps&&comps.length&&comps.indexOf(component)>=0){continue}}if(!this._OkStyle(style)){continue}if(!(deps=this._metaLib.isStyleDeprecatedEx(style))){continue}let sType=this._metaLib.getStyleOrigin(style);if(!sType){continue}for(let j=0;j<deps.length;j++){dep=deps[j];if(dep.styleselector){if(!(styleSelMatched=this._handleStyleSelector(ruleCtx,style,sType,dep.styleselector))){continue}if(dep.styleselector!==styleSelMatched){continue}}this._emitIssue(ruleCtx,dep.dep,style)}}};Rule.prototype._handleStyleSelector=function(ruleCtx,style,sType,ss){var ss,tags,tagName,i;tagName=ruleCtx.tag;if(sType==="c"){return StyleSelector.match(ruleCtx,ss)?ss:false}if(sType==="j"||sType==="b"){if(ss){if(StyleSelector.match(ruleCtx,ss)){return ss}}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"){return false}if(ss=this._metaLib.getStyleSelector(style,false)){if(StyleSelector.match(ruleCtx,ss)){return ss}}return ss?false:true};Rule.prototype._emitIssue=function(ruleCtx,dep,style){if(dep.description&&!dep.description.endsWith(".")){dep.description=dep.description+"."}var 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 customOpts,accept,reject;if(!(customOpts=regCtx.ruleOpts.customOpts)){return true}accept=customOpts.accept;reject=customOpts.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;
@@ -0,0 +1,6 @@
1
+ /*
2
+ * Copyright (c) 2018, 2024, 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-treeview-actionable-content";const DESCRIPTION="<oj-tree-view> does not support actionable/interactive content (i.e. buttons, links, Inputs, etc) "+"inside templated content.";const SHORT_DESCRIPTION=DESCRIPTION;const TAG_START=["oj-input-","oj-select-","oj-color-","oj-radioset-","oj-combobox-","oj-slider-","oj-switch-","oj-text-area-"];const TAGS=["a","button","input","select","textarea"];class Rule{getName(){return RULENAME}getDescription(){return DESCRIPTION}getShortDescription(){return SHORT_DESCRIPTION}register(){return{"<oj-tree-view>":this._onTreeView}}_onTreeView(ruleCtx){if(ruleCtx.tagNode.children){this._findTemplates(ruleCtx,ruleCtx.tagNode.children)}}_findTemplates(ruleCtx,content){content.forEach(node=>{if(node.type==="tag"&&node.name==="template"){this._onTemplate(ruleCtx,node)}if(node.children){this._findTemplates(ruleCtx,node.children)}})}_onTemplate(ruleCtx,template){var content;if(content=template.children){content.forEach(node=>{if(node.type==="tag"){if(_isActionable(node.name)){this._emitIssue(ruleCtx,node)}}})}}_emitIssue(ruleCtx,node){var issue,pos;issue=new ruleCtx.Issue(`Actionable templated content <${node.name}> is not permitted in <oj-tree-view>`);pos=ruleCtx.utils.DomUtils.getLineCol(ruleCtx.data,node.startIndex);issue.setPosition(pos.row,pos.col,node.startIndex,node.startIndex+node.name.length+1);ruleCtx.reporter.addIssue(issue,ruleCtx)}}function _isActionable(tagName){var i;for(i=0;i<TAG_START.length;i++){if(tagName.startsWith(TAG_START[i])){return true}}for(i=0;i<TAGS.length;i++){if(TAGS.includes(tagName)){return true}}return false}module.exports=Rule;
@@ -0,0 +1,6 @@
1
+ /*
2
+ * Copyright (c) 2018, 2024, 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-anti-pattern";const DESCRIPTION="Some components, or component features, may be present but are not applicable for "+"use in all design systems and as such may be flagged as anti-patterns in the content "+"of a particular theme. In these cases, the feature should not be used if targeting the "+"design system in question.";const SHORT_DESCRIPTION="The specified component is an anti pattern for code written for the designated theme.";const ANTIPATTERN="antiPattern";class Rule{getName(){return RULENAME}getDescription(){return DESCRIPTION}getShortDescription(){return SHORT_DESCRIPTION}register(regCtx){this._metaLib=regCtx.utils.metaLib;this._theme=regCtx.config.theme;return{webcomp:this._onWebComp}}_onWebComp(ruleCtx,tagName){var stats,stat;if((stats=this._metaLib.getTagStatus(tagName,ANTIPATTERN))&&stats.length){stat=stats[0];if(stat.themes&&this._themeMatches(stat.themes)){this._emitIssue(ruleCtx,tagName,stat)}}}_emitIssue(ruleCtx,tagName,stat){var issue,since,descript,themes,multi;since=stat.since?` (since ${stat.since})`:"";descript=stat.description;descript=descript?` ${descript}`:"";descript=descript&&!descript.endsWith(".")?descript+".":descript;themes="'"+stat.themes.join("', '")+"'";if(multi=stat.themes.length>1){let x;if((x=themes.lastIndexOf(","))>=0){themes=themes.substring(0,x)+" and"+themes.substring(x+1)}}themes=`${multi?"s":""} ${themes}`;issue=new ruleCtx.Issue(`<${tagName}> is an anti-pattern in theme${themes}${since}.${descript}`);ruleCtx.reporter.addIssue(issue,ruleCtx)}_themeMatches(themes){return themes.includes(this._theme)}}module.exports=Rule;
@@ -3,4 +3,4 @@
3
3
  * Licensed under The Universal Permissive License (UPL), Version 1.0
4
4
  * as shown at https://oss.oracle.com/licenses/upl/
5
5
  */
6
- const RULENAME="oj-html-wctag-maintenance";const DESCRIPTION="A notification that the component is in 'maintenance' status. This indicates "+"that the component is fully supported, but will be deprecated in a future release "+"and has no new features planned for it.";const SHORT_DESCRIPTION="The component is in 'maintenance' status and will be deprecated in a future release.";const MSG="<%c> is in 'maintenance' status%s.%d";const MAINTENANCE="maintenance";class Rule{getName(){return RULENAME}getDescription(){return DESCRIPTION}getShortDescription(){return SHORT_DESCRIPTION}register(regCtx){this._metaLib=regCtx.utils.metaLib;return{ojtag:this._onTag}}_onTag(ruleCtx,tag){var status;if(status=this._metaLib.getTagStatus(tag,MAINTENANCE)){let msg=MSG.replace("%c",tag);if(status.since){msg=msg.replace("%s",` (since ${status.since})`)}if(status.description){msg=msg.replace("%d",` ${status.description}`);if(!msg.endsWith(".")){msg+="."}}else{msg=msg.replace("%d","")}if(status.value?.length){let repl="<"+status.value.join(">, <")+">";msg+=` Superseded by ${repl}.`}let issue=new ruleCtx.Issue(msg);ruleCtx.reporter.addIssue(issue,ruleCtx)}}}module.exports=Rule;
6
+ const RULE="oj-html-wctag-maintenance";const DESCRIPTION="A notification that the component is in 'maintenance' status. This indicates "+"that the component is fully supported, but will be deprecated in a future release "+"and has no new features planned for it.";const SHORT_DESCRIPTION="The component is in 'maintenance' status and will be deprecated in a future release.";const MSG="<%c> is in 'maintenance' status%s.%d";const MAINTENANCE="maintenance";class Rule{getName(){return RULE}getDescription(){return DESCRIPTION}getShortDescription(){return SHORT_DESCRIPTION}register(regCtx){if(!this._getOverrides(regCtx)){return false}this._metaLib=regCtx.utils.metaLib;return{ojtag:this._onTag}}_onTag(ruleCtx,tag){var stats,status;if(this._isIgnoreFile(ruleCtx.filepath)){return}if((stats=this._metaLib.getTagStatus(tag,MAINTENANCE))&&stats.length){let msg=MSG.replace("%c",tag);status=stats[0];if(status.since){msg=msg.replace("%s",` (since ${status.since})`)}if(status.description){msg=msg.replace("%d",` ${status.description}`);if(!msg.endsWith(".")){msg+="."}}else{msg=msg.replace("%d","")}if(status.value?.length){let repl="<"+status.value.join(">, <")+">";msg+=` Superseded by ${repl}.`}let issue=new ruleCtx.Issue(msg);ruleCtx.reporter.addIssue(issue,ruleCtx)}}_isIgnoreFile(file){if(this._ignoreFiles){for(let i=0;i<this._ignoreFiles.length;i++){if(this._ignoreFiles[i].test(file)){return true}}}return false}_getOverrides(regCtx){var files,custOpts,files;if(!(custOpts=regCtx.ruleOpts.customOpts)){return true}if(!(files=custOpts.files)){return true}if(!Array.isArray(files)){regCtx.utils.msgLib.error(`Rule ${RULE} : config option 'files' is not an array`);return false}let ignoreFiles=[];for(let i=0;i<files.length;i++){if(typeof files[i]==="string"){try{ignoreFiles[i]=new RegExp(files[i].trim())}catch(e){regCtx.utils.msgLib.error(`Config 'ruleMods' ${RULE} 'files' entry [${i}]: ${e.message}`);return false}}}if(ignoreFiles.length){this._ignoreFiles=ignoreFiles}return true}}module.exports=Rule;
@@ -3,4 +3,4 @@
3
3
  * Licensed under The Universal Permissive License (UPL), Version 1.0
4
4
  * as shown at https://oss.oracle.com/licenses/upl/
5
5
  */
6
- const RULENAME="oj-html-wctag-supersedes";const DESCRIPTION="A notification that the component has 'supersedes' status. This indicates "+"that the component is the current focus of new related work, and will supersede one or "+"more (currently) fully supported components that will be deprecated in a future release.";const SHORT_DESCRIPTION="The component is in 'supersedes' status and will replace one or more components that will be deprecated in a future release.";const MSG="<%c> has 'supersedes' status%s.%d";const SUPERSEDES="supersedes";class Rule{getName(){return RULENAME}getDescription(){return DESCRIPTION}getShortDescription(){return SHORT_DESCRIPTION}register(regCtx){this._metaLib=regCtx.utils.metaLib;return{ojtag:this._onTag}}_onTag(ruleCtx,tag){var status;if(status=this._metaLib.getTagStatus(tag,SUPERSEDES)){let msg=MSG.replace("%c",tag);;if(status.since){msg=msg.replace("%s",` (since ${status.since})`)}if(status.description){msg=msg.replace("%d",` ${status.description}`);if(!msg.endsWith(".")){msg+="."}}else{msg=msg.replace("%d","")}if(status.value?.length){let targ=`<${status.value.join(">, <")}>`;msg+=` Supersedes ${targ}.`}let issue=new ruleCtx.Issue(msg);ruleCtx.reporter.addIssue(issue,ruleCtx)}}}module.exports=Rule;
6
+ const RULENAME="oj-html-wctag-supersedes";const DESCRIPTION="A notification that the component has 'supersedes' status. This indicates "+"that the component is the current focus of new related work, and will supersede one or "+"more (currently) fully supported components that will be deprecated in a future release.";const SHORT_DESCRIPTION="The component is in 'supersedes' status and will replace one or more components that will be deprecated in a future release.";const MSG="<%c> has 'supersedes' status%s.%d";const SUPERSEDES="supersedes";class Rule{getName(){return RULENAME}getDescription(){return DESCRIPTION}getShortDescription(){return SHORT_DESCRIPTION}register(regCtx){this._metaLib=regCtx.utils.metaLib;return{ojtag:this._onTag}}_onTag(ruleCtx,tag){var stats,status;if((stats=this._metaLib.getTagStatus(tag,SUPERSEDES))&&stats.length){let msg=MSG.replace("%c",tag);;status=stats[0];if(status.since){msg=msg.replace("%s",` (since ${status.since})`)}if(status.description){msg=msg.replace("%d",` ${status.description}`);if(!msg.endsWith(".")){msg+="."}}else{msg=msg.replace("%d","")}if(status.value?.length){let targ=`<${status.value.join(">, <")}>`;msg+=` Supersedes ${targ}.`}let issue=new ruleCtx.Issue(msg);ruleCtx.reporter.addIssue(issue,ruleCtx)}}}module.exports=Rule;
@@ -3,4 +3,4 @@
3
3
  * Licensed under The Universal Permissive License (UPL), Version 1.0
4
4
  * as shown at https://oss.oracle.com/licenses/upl/
5
5
  */
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;
6
+ const RULENAME="oj-js-ojcomp-exist";const DESCRIPTION="The JET component class is either unknown, or is being referenced via the global 'oj' object which was deprecated in JET 6.0.0.<br>"+"It is recommended that you should import the APIs needed and reference them directly. e.g. 'oj.ArrayDataProvider' should be referenced as 'arrayDataProvider'.<br>"+"If the class is unknown, the component class's deprecation period may have expired and has been removed.";const SHORT_DESCRIPTION="Unknown JET component classes should not be instantiated nor accessed via the global 'oj' object.";const DEPMSG="via deprecated (since 6.0.0) global object 'oj'";class Rule{getName(){return RULENAME}getDescription(){return DESCRIPTION}getShortDescription(){return SHORT_DESCRIPTION}register(regCtx){this._metaLib=regCtx.utils.metaLib;let ret={};this._nt=regCtx.jsNodeTypes;ret[this._nt.NEW_EXPR]=this._onNew;return ret}_onNew(ruleCtx,node){var clazz;var me,obj,start;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){let exists;if(!(exists=this._metaLib.isComponent(clazz))){let 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;if(o=this._metaLib.isClassRenamed(clazz)){issue=new ruleCtx.Issue(`'${o.to}' should be accessed directly rather than '${clazz}' ${DEPMSG}.`);issue.setMsgKey(RULENAME+"_1")}return issue}_isDeleted(clazz,ruleCtx){var ver,issue;if(ver=this._metaLib.isClassDeleted(clazz)){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 removed (in ${ver}) class '${clazz}' ${DEPMSG}`)}issue.setSeverity("critical")}else if(clazz.startsWith("oj.")){issue=new ruleCtx.Issue(`Instantiation of ${clazz.startsWith("oj.ojTree")?"obsolete":"unknown"} class '${clazz}' ${DEPMSG}.`);issue.setSeverity("critical")}return issue}}module.exports=Rule;
@@ -3,4 +3,4 @@
3
3
  * Licensed under The Universal Permissive License (UPL), Version 1.0
4
4
  * as shown at https://oss.oracle.com/licenses/upl/
5
5
  */
6
- const RULENAME="oj-ts-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.tsNodeTypes;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){start=start.range[0];issue.setPosition(null,null,start,start+clazz.length);ruleCtx.reporter.addIssue(issue,ruleCtx)}}}}_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;
6
+ const RULENAME="oj-ts-ojcomp-exist";const DESCRIPTION="The JET component class is either unknown, or is being referenced via the global 'oj' object which was deprecated in JET 6.0.0.<br>"+"It is recommended that you should import the APIs needed and reference them directly. e.g. 'oj.ArrayDataProvider' should be referenced as 'arrayDataProvider'.<br>"+"If the class is unknown, the component class's deprecation period may have expired and has been removed.";const SHORT_DESCRIPTION="Unknown JET component classes should not be instantiated nor accessed via the global 'oj' object.";const DEPMSG="via deprecated (since 6.0.0) global object 'oj'";class Rule{getName(){return RULENAME}getDescription(){return DESCRIPTION}getShortDescription(){return SHORT_DESCRIPTION}register(regCtx){this._metaLib=regCtx.utils.metaLib;let ret={};this._nt=regCtx.tsNodeTypes;ret[this._nt.NEW_EXPR]=this._onNew;return ret}_onNew(ruleCtx,node){var clazz;var me,obj,start;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){let exists;if(!(exists=this._metaLib.isComponent(clazz))){let issue=this._isRenamed(clazz,ruleCtx);if(!issue){issue=this._isDeleted(clazz,ruleCtx)}if(issue){start=start.range[0];issue.setPosition(null,null,start,start+clazz.length);ruleCtx.reporter.addIssue(issue,ruleCtx)}}}}_isRenamed(clazz,ruleCtx){var o,issue;if(o=this._metaLib.isClassRenamed(clazz)){issue=new ruleCtx.Issue(`'${o.to}' should be accessed directly rather than '${clazz}' ${DEPMSG}.`);issue.setMsgKey(RULENAME+"_1")}return issue}_isDeleted(clazz,ruleCtx){var ver,issue;if(ver=this._metaLib.isClassDeleted(clazz)){if(clazz==="oj.ojTree"){issue=new ruleCtx.Issue(`Instantiation of obsolete '${clazz}' - this class was undocumented in version 6.0.0.`)}else{issue=new ruleCtx.Issue(`Instantiation of removed (in ${ver}) class '${clazz}' ${DEPMSG}`)}}else if(clazz.startsWith("oj.")){issue=new ruleCtx.Issue(`Instantiation of ${clazz.startsWith("oj.ojTree")?"obsolete":"unknown"} class '${clazz}' ${DEPMSG}.`)}return issue}}module.exports=Rule;
@@ -3,4 +3,4 @@
3
3
  * Licensed under The Universal Permissive License (UPL), Version 1.0
4
4
  * as shown at https://oss.oracle.com/licenses/upl/
5
5
  */
6
- const RULE="oj-tsx-aria-ojselector-labelledby";const LONG="As of JET 13.0.0, <oj-selector> no longer generates a default aria-labelledby attribute for a screen reader. "+"Applications must specify an aria-labelledby or aria-label attribute explicitly.";const SHORT="As of JET 13.0.0, applications must specify an aria-labelledby/aria-label attribute explicitly on <oj-selector.";const ARIA_LABELLEDBY="aria-labelledby";const ARIA_LABEL="aria-label";class Rule{getName(){return RULE}getDescription(){return LONG}getShortDescription(){return SHORT}register(regCtx){this._tsxUtils=regCtx.utils.tsxUtils;return{"Tsx<oj-selector>":this._onSelector}}_onSelector(ruleCtx,tsxComp){var props;if(props=tsxComp.properties){let propName,i;for(i=0;i<props.length;i++){propName=props[i].name;if(!propName||propName===ARIA_LABELLEDBY||propName===ARIA_LABEL){return}}let issue=new ruleCtx.Issue("Missing 'aria-labelledby' or 'aria-label' attribute on <oj-selector>");this._tsxUtils.setIssuePosition(issue,tsxComp);ruleCtx.reporter.addIssue(issue,ruleCtx)}}}module.exports=Rule;
6
+ const RULE="oj-tsx-aria-ojselector-labelledby";const LONG="As of JET 13.0.0, <oj-selector> no longer generates a default aria-labelledby attribute for a screen reader. "+"Applications must specify an aria-labelledby or aria-label attribute explicitly.";const SHORT="As of JET 13.0.0, applications must specify an aria-labelledby/aria-label attribute explicitly on <oj-selector.";const ARIA_LABELLEDBY="aria-labelledby";const ARIA_LABEL="aria-label";const JSX_SPREAD_ATTRIBUTE="JSXSpreadAttribute";class Rule{getName(){return RULE}getDescription(){return LONG}getShortDescription(){return SHORT}register(regCtx){this._tsxUtils=regCtx.utils.tsxUtils;return{"Tsx<oj-selector>":this._onSelector}}_onSelector(ruleCtx,tsxComp){var props,tsxProp;if(props=tsxComp.properties){let propName,i;for(i=0;i<props.length;i++){tsxProp=props[i];if(tsxProp.node.type===JSX_SPREAD_ATTRIBUTE){continue}propName=tsxProp.name;if(!propName||propName===ARIA_LABELLEDBY||propName===ARIA_LABEL){return}}let issue=new ruleCtx.Issue("Missing 'aria-labelledby' or 'aria-label' attribute on <oj-selector>");this._tsxUtils.setIssuePosition(issue,tsxComp);ruleCtx.reporter.addIssue(issue,ruleCtx)}}}module.exports=Rule;
@@ -3,4 +3,4 @@
3
3
  * Licensed under The Universal Permissive License (UPL), Version 1.0
4
4
  * as shown at https://oss.oracle.com/licenses/upl/
5
5
  */
6
- const RULE="oj-tsx-aria-prop";const LONG="Attributes beginning with <i>'aria-'</i> must be valid WAI-ARIA definitions.";const ARIA="aria-";function Rule(){};Rule.prototype.getName=function(){return RULE};Rule.prototype.getShortDescription=function(){return LONG};Rule.prototype.getDescription=function(){return LONG};Rule.prototype.register=function(regCtx){this._tsxUtils=regCtx.utils.tsxUtils;return{"TsxRenderComponent":this._onTsxRC}};Rule.prototype._onTsxRC=function(ruleCtx,tsxRC){this._tsxUtils.extractTsxProperties(ruleCtx,tsxRC,this._onProp.bind(this))};Rule.prototype._onProp=function(ruleCtx,tsxProp){var propName;if(tsxProp===null||tsxProp.parent.isPreact){return}if(!(propName=tsxProp.name)){return}if(propName.startsWith(ARIA)&&!this._tsxUtils.isAriaAttr(propName)){let issue=new ruleCtx.Issue(`<${tsxProp.parent.name}> attribute '${propName}' is not a valid WAI-ARIA definition`);this._tsxUtils.setIssuePosition(issue,tsxProp);ruleCtx.reporter.addIssue(issue,ruleCtx)}};module.exports=Rule;
6
+ const RULE="oj-tsx-aria-prop";const LONG="Attributes beginning with <i>'aria-'</i> must be valid WAI-ARIA definitions.";const ARIA="aria-";const JSX_SPREAD_ATTRIBUTE="JSXSpreadAttribute";function Rule(){};Rule.prototype.getName=function(){return RULE};Rule.prototype.getShortDescription=function(){return LONG};Rule.prototype.getDescription=function(){return LONG};Rule.prototype.register=function(regCtx){this._tsxUtils=regCtx.utils.tsxUtils;return{"TsxRenderComponent":this._onTsxRC}};Rule.prototype._onTsxRC=function(ruleCtx,tsxRC){this._tsxUtils.extractTsxProperties(ruleCtx,tsxRC,this._onProp.bind(this))};Rule.prototype._onProp=function(ruleCtx,tsxProp){var propName;if(tsxProp===null||tsxProp.parent.isPreact||tsxProp.node.type===JSX_SPREAD_ATTRIBUTE){return}if(!(propName=tsxProp.name)){return}if(propName.startsWith(ARIA)&&!this._tsxUtils.isAriaAttr(propName)){let issue=new ruleCtx.Issue(`<${tsxProp.parent.name}> attribute '${propName}' is not a valid WAI-ARIA definition`);this._tsxUtils.setIssuePosition(issue,tsxProp);ruleCtx.reporter.addIssue(issue,ruleCtx)}};module.exports=Rule;
@@ -0,0 +1,6 @@
1
+ /*
2
+ * Copyright (c) 2018, 2024, 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-tsx-event";const DESCRIPT="JSX component event attributes (e.g. \"onojXxx\" or onYyyChanged) must be defined events for the component.";const SHORT_DESCRIPT="Web component event attributes must be valid";function Rule(){};Rule.prototype.getName=function(){return RULE_NAME};Rule.prototype.getDescription=function(){return DESCRIPT};Rule.prototype.getShortDescription=function(){return SHORT_DESCRIPT};Rule.prototype.register=function(regCtx){this._metaLib=regCtx.utils.metaLib;this._tsxUtils=regCtx.utils.tsxUtils;return{"TsxEvent":this._onEvent}};Rule.prototype._onEvent=function(ruleCtx,tsxProp){var tagName,evName,evKebab;tagName=tsxProp.parent?.name;if(!this._metaLib.isWCTag(tagName)){return}evName=tsxProp.name;if(this._metaLib.isTagEvent(tagName,evName)||this._tsxUtils.isCommonAttr(evName)||this._tsxUtils.isCommonEventAttr(evName)){return}if(!this._specialCase(tagName,evName)){let issue=new ruleCtx.Issue(`<${tagName}> event '${evName}' is unknown`);ruleCtx.reporter.addIssue(issue,ruleCtx)}};Rule.prototype._specialCase=function(tagName,attrName){if(tagName==="oj-messages"&&attrName==="on-oj-close"){return true}return this._metaLib.isRuleIgnored(tagName,RULE_NAME)};module.exports=Rule;
@@ -3,4 +3,4 @@
3
3
  * Licensed under The Universal Permissive License (UPL), Version 1.0
4
4
  * as shown at https://oss.oracle.com/licenses/upl/
5
5
  */
6
- const RULE="oj-tsx-ojattr-deprecated";const SHORT="Deprecated web component attributes or deprecated event attributes should not be used";const LONG="Deprecated web component attributes, or event attributes referring to a deprecated attribute, "+"should not be used. Refer to the API doc for potential removal date.";const DASH_CHANGED="-changed";const DATA_DASH="data-";const STATUS_PROP_TYPE="propertyType";const STATUS_PROP_VALUE="propertyValue";const STATUS_PROPERTY="property";const OBJECT="object";const STRING="string";const ARRAY_DOT_STRING="array.<string>";const ARRAY_STRING="array<string>";const JET_RELS=2;const SEV_BLOCKER="blocker";const MSG_ID_AGED="_aged";const OR="|";function Rule(){}Rule.prototype.getName=function(){return RULE};Rule.prototype.getShortDescription=function(){return SHORT};Rule.prototype.getDescription=function(){return LONG};Rule.prototype.register=function(regCtx){this._tsxUtils=regCtx.utils.tsxUtils;this._metaLib=regCtx.utils.metaLib;return{"TsxWebComponent":this._onWComp}};Rule.prototype._onWComp=function(ruleCtx,tsxComp){var props,tsxProp,propName,i;if(props=tsxComp.properties){for(i=0;i<props.length;i++){tsxProp=props[i];if(!(propName=tsxProp.name)){continue}if(this._tsxUtils.isAriaAttr(propName)||this._tsxUtils.isCommonAttr(propName)||this._tsxUtils.isCommonEventAttr(propName)||propName.startsWith(DATA_DASH)){continue}this._checkAttr(ruleCtx,tsxProp)}}};Rule.prototype._checkAttr=function(ruleCtx,tsxProp){var deps,status,metaLib;var tagName,propType,propName,pName,attrValType;var exprObj;var emitted=false;metaLib=ruleCtx.utils.metaLib;propName=pName=tsxProp.name;tagName=tsxProp.parent.name;if(_isEventProp(propName)){if(deps=metaLib.isTagEventDeprecated(tagName,propName)){this._emitEventIssues(ruleCtx,deps,tagName,tsxProp,pName)}return}deps=metaLib.isTagAttrDeprecated(tagName,pName);if(!deps&&!(exprObj=this._tsxUtils.getExpressionObject(tsxProp))){return}this._checkObjectProps(ruleCtx,tagName,tsxProp,exprObj);return;propType=metaLib.getTagAttrType(tagName,pName);if(!deps&&!isEvent&&propType){if(!_isObjectType(propType)){return}_checkObjectProps(ruleCtx,tagName,propName,attrVal);return}if(!deps){return}attrValType=_getValueType(attrVal);for(status of deps){if(status.target===STATUS_PROPERTY){if(isEvent){return}}else if(status.target===STATUS_PROP_TYPE||status.target===STATUS_PROP_VALUE){if(attrValType==="expr"||attrValType==="Object"){continue}if(status.value){if(status.target===STATUS_PROP_VALUE){emitted=_doPropValue(ruleCtx,attrValType,tagName,propName,attrVal,status,isEvent)}else{emitted=_doPropType(ruleCtx,propType,attrValType,tagName,propName,attrVal,status,isEvent)}}else{_emitIssue(ruleCtx,tagName,propName,attrVal,status,isEvent?"event":"attr");emitted=true}}else if(!status.value){_emitIssue(ruleCtx,tagName,propName,attrVal,status,isEvent?"event":"attr");emitted=true}if(emitted){break}}};Rule.prototype._emitEventIssues=function(ruleCtx,deps,tagName,tsxProp,propName){var status,issue,since,descript;for(status of deps){if(status.target!==STATUS_PROPERTY){since=status.since?" (since "+status.since+")":"";descript=status.description?" "+status.description:"";issue=new ruleCtx.Issue(`Event '${tsxProp.name}' is deprecated${since} for <${tagName}>.${descript}`);this._tsxUtils.setIssuePosition(issue,tsxProp);issue.setMsgKey(RULE+"_1");ruleCtx.reporter.addIssue(issue,ruleCtx)}}};function _isEventProp(propName){return propName.startsWith("on")&&propName.length>2};function _emitIssue(ruleCtx,tag,tsxProp,attrVal,status,scope,key){var issue;issue=_makeIssue(ruleCtx,tag,tsxProp,attrVal,status,scope,key);issue.setPosition(tsxProp.loc.start.row,tsxProp.loc.start.column,tsxProp.range[0],tsxProp.range[1]);ruleCtx.reporter.addIssue(issue,ruleCtx)};function _makeIssue(ruleCtx,tag,tsxProp,attrVal,status,scope,key){var issue,msgKey,since,descript;since=status.since?" (since "+status.since+")":"";descript=status.description?" "+status.description:"";if(scope==="val"){issue=new ruleCtx.Issue(`<${tag}> attribute '${tsxProp.name}' value '${attrVal}' is deprecated${since}!${descript}`);msgKey="_2"}else if(scope==="type"){issue=new ruleCtx.Issue(`<${tag}> attribute '${tsxProp.name}' value type '${attrVal}' is deprecated${since}!${descript}`);msgKey="_3"}else if(scope==="attr"){issue=new ruleCtx.Issue(`<${tag}> attribute '${tsxProp.name}' is deprecated${since}!${descript}`)}else if(scope==="attrprop"){issue=new ruleCtx.Issue(`<${tag}> attribute '${tsxProp.name}' property '${key}' is deprecated${since}!${descript}`)}else if(scope==="attrpropval"){issue=new ruleCtx.Issue(`<${tag}> attribute '${tsxProp.name}' property '${key}' value '${attrVal}' is deprecated${since}!${descript}`)}if(msgKey){issue.setMsgKey(RULE+msgKey)}if(ruleCtx.utils.jafLib.getJetReleaseCount()>JET_RELS){issue.setSeverity(SEV_BLOCKER);issue.setMsgKey(RULE+(msgKey?msgKey:"")+MSG_ID_AGED)}return issue};Rule.prototype._checkObjectProps=function(ruleCtx,tag,tsxProp,exprObj){var key,deps,dep,propVal;for(key in exprObj){let prop=tsxProp.name+"."+key;if(deps=this._metaLib.isTagAttrDeprecated(tag,prop)){let propType=this._metaLib.getTagAttrTypeEx(tag,prop);for(dep of deps){if(!dep.target||!dep.value){_emitIssue(ruleCtx,tag,tsxProp,null,dep,"attrprop",key);return true}if(!Array.isArray(dep.value)){return}if(dep.target===STATUS_PROP_VALUE&&dep.value){if(_isStringType(propType)){propVal=this._tsxUtils.getPropertyStringValue(tsxProp);if(dep.value.includes(propVal)){_emitIssue(ruleCtx,tag,tsxProp,propVal,dep,"attrpropval",key);return true}}return false}else if(dep.target===STATUS_PROP_TYPE&&dep.value){}}}}};function _getStringValsFromType(ar){var val,ret=[];for(val of ar){if(!val.startsWith("Array<")){if(val.startsWith("'")&&val.endsWith("'")){val=val.substring(1,val.length-1)}ret.push(val)}else{let s=val.substring(6,val.length-1);let elems=s.split(OR);elems.forEach(val=>{val=val.trim();if(val.charAt(0)==="'"){val=val.substring(1,val.length-1)}ret.push(val.trim())})}}return ret};function _getStringValsFromAttr(s){var ret=[];if(s.startsWith("[")){s=s.substring(1,s.length-1);let elems=s.split(",");elems.forEach(val=>{if(val.charAt(0)==="'"){val=val.substring(1,val.length-1)}ret.push(val.trim())})}return ret};function _getValueType(v){var ret;if(v.startsWith("{{")||v.startsWith("[[")){ret="expr"}else{let s=v.charAt(0);if(s==="{"){ret="Object"}else if(s==="["){ret="Array"}else if(!isNaN(parseInt(v))){ret="number"}s=v.toLowerCase();if(s==="true"||s==="false"){ret="boolean"}else if(s==="null"){ret="null"}else if(!ret){ret="string"}}if(ret==="Array"){ret="Array<string>"}return ret};function _isStringArrayType(s){s=s.toLowerCase();return s===ARRAY_STRING||s===ARRAY_DOT_STRING};function _isStringType(propType){return propType.types.includes(STRING)};function _isObjectType(s){return s&&s.toLowerCase()===OBJECT};function _getPropFromEvent(ruleCtx,tag,attr){return ruleCtx.utils.metaLib.getTagPropertyFromEvent(tag,attr)};module.exports=Rule;
6
+ const RULE="oj-tsx-ojattr-deprecated";const SHORT="Deprecated web component attributes or deprecated event attributes should not be used";const LONG="Deprecated web component attributes, or event attributes referring to a deprecated attribute, "+"should not be used. Refer to the API doc for potential removal date.";const DASH_CHANGED="-changed";const DATA_DASH="data-";const STATUS_PROP_TYPE="propertyType";const STATUS_PROP_VALUE="propertyValue";const STATUS_PROPERTY="property";const OBJECT="object";const STRING="string";const ARRAY_DOT_STRING="array.<string>";const ARRAY_STRING="array<string>";const JSX_SPREAD_ATTRIBUTE="JSXSpreadAttribute";const OJ_DYNAMIC="oj-dynamic";const OJ_DYN="oj-dyn";const JET_RELS=2;const SEV_BLOCKER="blocker";const MSG_ID_AGED="_aged";const MSG_ID_USER="_user";const OR="|";function Rule(){}Rule.prototype.getName=function(){return RULE};Rule.prototype.getShortDescription=function(){return SHORT};Rule.prototype.getDescription=function(){return LONG};Rule.prototype.register=function(regCtx){this._tsxUtils=regCtx.utils.tsxUtils;this._metaLib=regCtx.utils.metaLib;return{"TsxWebComponent":this._onWComp}};Rule.prototype._onWComp=function(ruleCtx,tsxComp){var props,tsxProp,propName,i;if(props=tsxComp.properties){for(i=0;i<props.length;i++){tsxProp=props[i];if(!(propName=tsxProp.name)||tsxProp.node.type===JSX_SPREAD_ATTRIBUTE){continue}if(this._tsxUtils.isAriaAttr(propName)||this._tsxUtils.isCommonAttr(propName)||this._tsxUtils.isCommonEventAttr(propName)||propName.startsWith(DATA_DASH)){continue}this._checkAttr(ruleCtx,tsxProp)}}};Rule.prototype._checkAttr=function(ruleCtx,tsxProp){var deps,status,metaLib;var tagName,propType,propName,pName,attrValType;var exprObj;var emitted=false;metaLib=ruleCtx.utils.metaLib;propName=pName=tsxProp.name;tagName=tsxProp.parent.name;if(_isEventProp(propName)){if(deps=metaLib.isTagEventDeprecated(tagName,propName)){this._emitEventIssues(ruleCtx,deps,tagName,tsxProp)}return}deps=metaLib.isTagAttrDeprecated(tagName,pName);if(!deps&&!(exprObj=this._tsxUtils.getExpressionObject(tsxProp))){return}this._checkObjectProps(ruleCtx,tagName,tsxProp,exprObj);return;propType=metaLib.getTagAttrType(tagName,pName);if(!deps&&!isEvent&&propType){if(!_isObjectType(propType)){return}_checkObjectProps(ruleCtx,tagName,propName,attrVal);return}if(!deps){return}attrValType=_getValueType(attrVal);for(status of deps){if(status.target===STATUS_PROPERTY){if(isEvent){return}}else if(status.target===STATUS_PROP_TYPE||status.target===STATUS_PROP_VALUE){if(attrValType==="expr"||attrValType==="Object"){continue}if(status.value){if(status.target===STATUS_PROP_VALUE){emitted=_doPropValue(ruleCtx,attrValType,tagName,propName,attrVal,status,isEvent)}else{emitted=_doPropType(ruleCtx,propType,attrValType,tagName,propName,attrVal,status,isEvent)}}else{_emitIssue(ruleCtx,tagName,propName,attrVal,status,isEvent?"event":"attr");emitted=true}}else if(!status.value){_emitIssue(ruleCtx,tagName,propName,attrVal,status,isEvent?"event":"attr");emitted=true}if(emitted){break}}};Rule.prototype._emitEventIssues=function(ruleCtx,deps,tagName,tsxProp){var status,issue,msgKey,since,descript;for(status of deps){if(status.target!==STATUS_PROPERTY){since=status.since?" (since "+status.since+")":"";descript=status.description?" "+status.description:"";issue=new ruleCtx.Issue(`Event '${tsxProp.name}' is deprecated${since} for <${tagName}>.${descript}`);this._tsxUtils.setIssuePosition(issue,tsxProp);msgKey=RULE+"_1";if(this._metaLib.isJetTag(tagName)||tagName===OJ_DYNAMIC||tagName===OJ_DYN){if(status.since&&ruleCtx.utils.jafLib.getMajorReleaseCount(status.since)>JET_RELS){issue.setSeverity(SEV_BLOCKER);msgKey+=MSG_ID_AGED}}else{msgKey+=MSG_ID_USER}issue.setMsgKey(msgKey);ruleCtx.reporter.addIssue(issue,ruleCtx)}}};function _isEventProp(propName){return propName.startsWith("on")&&propName.length>2};function _emitIssue(ruleCtx,tag,tsxProp,attrVal,status,scope,key){var issue;issue=_makeIssue(ruleCtx,tag,tsxProp,attrVal,status,scope,key);issue.setPosition(tsxProp.loc.start.row,tsxProp.loc.start.column,tsxProp.range[0],tsxProp.range[1]);ruleCtx.reporter.addIssue(issue,ruleCtx)};function _makeIssue(ruleCtx,tag,tsxProp,attrVal,status,scope,key){var issue,msgKey,since,descript;since=status.since?" (since "+status.since+")":"";descript=status.description?" "+status.description:"";if(scope==="val"){issue=new ruleCtx.Issue(`<${tag}> attribute '${tsxProp.name}' value '${attrVal}' is deprecated${since}!${descript}`);msgKey="_2"}else if(scope==="type"){issue=new ruleCtx.Issue(`<${tag}> attribute '${tsxProp.name}' value type '${attrVal}' is deprecated${since}!${descript}`);msgKey="_3"}else if(scope==="attr"){issue=new ruleCtx.Issue(`<${tag}> attribute '${tsxProp.name}' is deprecated${since}!${descript}`)}else if(scope==="attrprop"){issue=new ruleCtx.Issue(`<${tag}> attribute '${tsxProp.name}' property '${key}' is deprecated${since}!${descript}`)}else if(scope==="attrpropval"){issue=new ruleCtx.Issue(`<${tag}> attribute '${tsxProp.name}' property '${key}' value '${attrVal}' is deprecated${since}!${descript}`)}msgKey=RULE+(msgKey?msgKey:"");if(status.since&&(ruleCtx.utils.metaLib.isJetTag(tag)||tag===OJ_DYNAMIC||tag===OJ_DYN)){if(ruleCtx.utils.jafLib.getMajorReleaseCount(status.since)>JET_RELS){issue.setSeverity(SEV_BLOCKER);msgKey+=MSG_ID_AGED}}else{msgKey+=MSG_ID_USER}issue.setMsgKey(msgKey);return issue};Rule.prototype._checkObjectProps=function(ruleCtx,tag,tsxProp,exprObj){var key,deps,dep,propVal;for(key in exprObj){let prop=tsxProp.name+"."+key;if(deps=this._metaLib.isTagAttrDeprecated(tag,prop)){let propType=this._metaLib.getTagAttrTypeEx(tag,prop);for(dep of deps){if(!dep.target||!dep.value){_emitIssue(ruleCtx,tag,tsxProp,null,dep,"attrprop",key);return true}if(!Array.isArray(dep.value)){return}if(dep.target===STATUS_PROP_VALUE&&dep.value){if(_isStringType(propType)){propVal=this._tsxUtils.getPropertyStringValue(tsxProp);if(dep.value.includes(propVal)){_emitIssue(ruleCtx,tag,tsxProp,propVal,dep,"attrpropval",key);return true}}return false}else if(dep.target===STATUS_PROP_TYPE&&dep.value){}}}}};function _getStringValsFromType(ar){var val,ret=[];for(val of ar){if(!val.startsWith("Array<")){if(val.startsWith("'")&&val.endsWith("'")){val=val.substring(1,val.length-1)}ret.push(val)}else{let s=val.substring(6,val.length-1);let elems=s.split(OR);elems.forEach(val=>{val=val.trim();if(val.charAt(0)==="'"){val=val.substring(1,val.length-1)}ret.push(val.trim())})}}return ret};function _getStringValsFromAttr(s){var ret=[];if(s.startsWith("[")){s=s.substring(1,s.length-1);let elems=s.split(",");elems.forEach(val=>{if(val.charAt(0)==="'"){val=val.substring(1,val.length-1)}ret.push(val.trim())})}return ret};function _getValueType(v){var ret;if(v.startsWith("{{")||v.startsWith("[[")){ret="expr"}else{let s=v.charAt(0);if(s==="{"){ret="Object"}else if(s==="["){ret="Array"}else if(!isNaN(parseInt(v))){ret="number"}s=v.toLowerCase();if(s==="true"||s==="false"){ret="boolean"}else if(s==="null"){ret="null"}else if(!ret){ret="string"}}if(ret==="Array"){ret="Array<string>"}return ret};function _isStringArrayType(s){s=s.toLowerCase();return s===ARRAY_STRING||s===ARRAY_DOT_STRING};function _isStringType(propType){return propType.types.includes(STRING)};function _isObjectType(s){return s&&s.toLowerCase()===OBJECT};module.exports=Rule;
@@ -3,4 +3,4 @@
3
3
  * Licensed under The Universal Permissive License (UPL), Version 1.0
4
4
  * as shown at https://oss.oracle.com/licenses/upl/
5
5
  */
6
- const RULE_NAME="oj-tsx-ojattr-enum-deprecated";const LONG="Web component attributes that are assigned a deprecated enumerated value should not be used.";const SHORT="Deprecated enumerated attribute values should not be used.";const JET_RELS=2;const SEV_BLOCKER="blocker";const MSG_ID_AGED="_aged";function getName(){return RULE_NAME};function getShortDescription(){return SHORT};function getDescription(){return LONG};function register(){return{"TsxWebComponent":_onWc}};function _onWc(ruleCtx,tsxComp){var props,tsxProp,propName,val,enumValue,issue,metaLib,o,since,help;metaLib=ruleCtx.utils.metaLib;if(!(props=tsxComp.properties)){return}for(let i=0;i<props.length;i++){issue=null;tsxProp=props[i];if(!(propName=tsxProp.name)){continue}if(!(val=tsxProp.node.value)){continue}if(val.type==="Literal"){enumValue=val.value}else{continue}if(propName.startsWith("data-")||propName.startsWith("aria-")||propName==="class"||propName==="style"){continue}if(o=metaLib.isTagAttrEnumValueDeprecated(tsxComp.name,propName,enumValue)){help=o.description?" "+o.description.trim():"";since=o.since?" (since "+o.since+")":"";issue=new ruleCtx.Issue(`<${tsxComp.name}> property '${propName}' enumerated value '${enumValue}' is deprecated${since}.${help}`);ruleCtx.utils.tsxUtils.setIssuePropValuePosition(issue,tsxProp);if(ruleCtx.utils.jafLib.getJetReleaseCount()>JET_RELS){issue.setSeverity(SEV_BLOCKER);issue.setMsgKey(RULE_NAME+MSG_ID_AGED)}ruleCtx.reporter.addIssue(issue,ruleCtx)}}};module.exports={getName,getDescription,getShortDescription,register};
6
+ const RULE_NAME="oj-tsx-ojattr-enum-deprecated";const LONG="Web component attributes that are assigned a deprecated enumerated value should not be used.";const SHORT="Deprecated enumerated attribute values should not be used.";const JSX_SPREAD_ATTRIBUTE="JSXSpreadAttribute";const JET_RELS=2;const SEV_BLOCKER="blocker";const MSG_ID_AGED="_aged";const MSG_ID_USER="_user";const OJ_DYNAMIC="oj-dynamic";const OJ_DYN="oj-dyn";function getName(){return RULE_NAME};function getShortDescription(){return SHORT};function getDescription(){return LONG};function register(){return{"TsxWebComponent":_onWc}};function _onWc(ruleCtx,tsxComp){var props,tsxProp,propName,val,enumValue,issue,metaLib,o,since,help;metaLib=ruleCtx.utils.metaLib;if(!(props=tsxComp.properties)){return}let tag=tsxComp.name;for(let i=0;i<props.length;i++){issue=null;tsxProp=props[i];if(!(propName=tsxProp.name)||tsxProp.node.type===JSX_SPREAD_ATTRIBUTE){continue}if(!(val=tsxProp.node.value)){continue}if(val.type==="Literal"){enumValue=val.value}else{continue;let obj;if(obj=ruleCtx.utils.tsxUtils.getExpressionObject(tsxProp)){var jj=42}}if(propName.startsWith("data-")||propName.startsWith("aria-")||propName==="class"||propName==="style"){continue}if(o=metaLib.isTagAttrEnumValueDeprecated(tsxComp.name,propName,enumValue)){help=o.description?" "+o.description.trim():"";since=o.since?" (since "+o.since+")":"";issue=new ruleCtx.Issue(`<${tsxComp.name}> property '${propName}' enumerated value '${enumValue}' is deprecated${since}.${help}`);ruleCtx.utils.tsxUtils.setIssuePropValuePosition(issue,tsxProp);if(metaLib.isJetTag(tag)||tag===OJ_DYNAMIC||tag===OJ_DYN){if(o.since&&ruleCtx.utils.jafLib.getMajorReleaseCount(o.since)>JET_RELS){issue.setSeverity(SEV_BLOCKER);issue.setMsgKey(RULE_NAME+MSG_ID_AGED)}}else{issue.setMsgKey(RULE_NAME+MSG_ID_USER)}ruleCtx.reporter.addIssue(issue,ruleCtx)}}};module.exports={getName,getDescription,getShortDescription,register};
@@ -3,4 +3,4 @@
3
3
  * Licensed under The Universal Permissive License (UPL), Version 1.0
4
4
  * as shown at https://oss.oracle.com/licenses/upl/
5
5
  */
6
- const RULE_NAME="oj-tsx-ojattr-value";const SHORT="Custom component attribute value must be a defined value";const LONG="Custom component attribute value must be a defined value for the component";const DATABIND="data-bind";function Rule(){};Rule.prototype.getName=function(){return RULE_NAME};Rule.prototype.getShortDescription=function(){return SHORT};Rule.prototype.getDescription=function(){return LONG};Rule.prototype.register=function(regCtx){this._tsxUtils=regCtx.utils.tsxUtils;this._metaLib=regCtx.utils.metaLib;return{"TsxRenderComponent":this._onTsxRC}};Rule.prototype._onTsxRC=function(ruleCtx,tsxRC){this._tsxUtils.extractTsxProperties(ruleCtx,tsxRC,this._onProp.bind(this))};Rule.prototype._onProp=function(ruleCtx,tsxProp){var val;if(tsxProp===null){return}if(!(val=tsxProp.node.value)){return}if(val.type==="Literal"){val=val.value}else{val=tsxProp.valueRaw;val=val.startsWith("\"")?val.substring(1,val.length-1):val}if(val.startsWith("{{")||val.startsWith("[[")){return}this._checkAttr(ruleCtx,tsxProp.parent.name,tsxProp,val)};Rule.prototype._checkAttr=function(ruleCtx,tagName,tsxProp,val){var attrName,aVals,aVal,jsonChar,i;attrName=tsxProp.name;if(this._tsxUtils.isCommonAttr(attrName)||this._tsxUtils.isCommonEventAttr(attrName)||attrName===DATABIND||!this._metaLib.isTagAttr(tagName,attrName)){return}try{jsonChar=val.charAt(0);if(jsonChar==="{"){return}else if(val.charAt(0)==="["){aVals=JSON.parse(val)}else{aVals=[val]}}catch(e){}if(!aVals){return true}if(!this._metaLib.hasTagAttrValues(tagName,attrName)){return}for(i=0;i<aVals.length;i++){aVal=aVals[i];if(!this._metaLib.isTagAttrValue(tagName,attrName,aVal)){if(!this._checkSpecialCases(tagName,attrName,aVal)){let issue=new ruleCtx.Issue(`<${tagName}> attribute '${attrName}' refers to undefined value '${aVal}'`);this._tsxUtils.setIssuePosition(issue,tsxProp);ruleCtx.reporter.addIssue(issue,ruleCtx)}}}};Rule.prototype._checkSpecialCases=function(tagName,attrName,attrValue){if(tagName==="oj-led-gauge"&&attrName==="type"){return this._tsxUtils.isSvgPath(attrValue)}return false};module.exports=Rule;
6
+ const RULE_NAME="oj-tsx-ojattr-value";const SHORT="Custom component attribute value must be a defined value";const LONG="Custom component attribute value must be a defined value for the component";const JSX_SPREAD_ATTRIBUTE="JSXSpreadAttribute";const DATABIND="data-bind";function Rule(){};Rule.prototype.getName=function(){return RULE_NAME};Rule.prototype.getShortDescription=function(){return SHORT};Rule.prototype.getDescription=function(){return LONG};Rule.prototype.register=function(regCtx){this._tsxUtils=regCtx.utils.tsxUtils;this._metaLib=regCtx.utils.metaLib;return{"TsxRenderComponent":this._onTsxRC}};Rule.prototype._onTsxRC=function(ruleCtx,tsxRC){this._tsxUtils.extractTsxProperties(ruleCtx,tsxRC,this._onProp.bind(this))};Rule.prototype._onProp=function(ruleCtx,tsxProp){var val;if(tsxProp===null||tsxProp.node.type===JSX_SPREAD_ATTRIBUTE){return}if(!(val=tsxProp.node.value)){return}if(val.type==="Literal"){val=val.value}else{val=tsxProp.valueRaw;val=val.startsWith("\"")?val.substring(1,val.length-1):val}if(val.startsWith("{{")||val.startsWith("[[")){return}this._checkAttr(ruleCtx,tsxProp.parent.name,tsxProp,val)};Rule.prototype._checkAttr=function(ruleCtx,tagName,tsxProp,val){var attrName,aVals,aVal,jsonChar,i;attrName=tsxProp.name;if(this._tsxUtils.isCommonAttr(attrName)||this._tsxUtils.isCommonEventAttr(attrName)||attrName===DATABIND||!this._metaLib.isTagAttr(tagName,attrName)){return}try{jsonChar=val.charAt(0);if(jsonChar==="{"){return}else if(val.charAt(0)==="["){aVals=JSON.parse(val)}else{aVals=[val]}}catch(e){}if(!aVals){return true}if(!this._metaLib.hasTagAttrValues(tagName,attrName)){return}for(i=0;i<aVals.length;i++){aVal=aVals[i];if(!this._metaLib.isTagAttrValue(tagName,attrName,aVal)){if(!this._checkSpecialCases(tagName,attrName,aVal)){let issue=new ruleCtx.Issue(`<${tagName}> attribute '${attrName}' refers to undefined value '${aVal}'`);this._tsxUtils.setIssuePosition(issue,tsxProp);ruleCtx.reporter.addIssue(issue,ruleCtx)}}}};Rule.prototype._checkSpecialCases=function(tagName,attrName,attrValue){if(tagName==="oj-led-gauge"&&attrName==="type"){return this._tsxUtils.isSvgPath(attrValue)}return false};module.exports=Rule;
@@ -3,4 +3,4 @@
3
3
  * Licensed under The Universal Permissive License (UPL), Version 1.0
4
4
  * as shown at https://oss.oracle.com/licenses/upl/
5
5
  */
6
- const isValidAttr=require("./helpers/valid-attr");const RULE_NAME="oj-tsx-ojattr";const SHORT_DESCR="JET component attribute must be defined";const LONG_DESCR="JET component attribute must be a defined attribute for the component";const OJ_EVENT_PREFIX="onOj";const EVENT_PREFIX="on";const SLOT="slot";const ARIA_DASH="aria-";const DATA_DASH="data-";const KEY="key";const REF="ref";function Rule(){}Rule.prototype.getName=function(){return RULE_NAME};Rule.prototype.getShortDescription=function(){return SHORT_DESCR};Rule.prototype.getDescription=function(){return LONG_DESCR};Rule.prototype.register=function(regCtx){this._metaLib=regCtx.utils.metaLib;this._tsxUtils=regCtx.utils.tsxUtils;return{TsxWebComponent:this._onWebComp}};Rule.prototype._onWebComp=function(ruleCtx,tsxComp){var props;if(props=tsxComp.properties){props.forEach(prop=>{this._checkProp(ruleCtx,tsxComp,prop)})}};Rule.prototype._checkProp=function(ruleCtx,tsxComp,tsxProp){let propName=tsxProp.name;let tagName=tsxComp.name;let origPropName,camelName;if(!propName){return}if(!isValidAttr(propName)){let issue=new ruleCtx.Issue(`<${tagName}> - invalid '${propName}' property`);this._tsxUtils.setIssuePosition(issue,tsxProp);issue.setMsgKey(RULE_NAME+"_1");ruleCtx.reporter.addIssue(issue,ruleCtx);return}if(_isPropAriaOrData(propName)){return}if(propName.includes("-")){camelName=this._tsxUtils.toCamelCase(propName);let issue=new ruleCtx.Issue(`For optimum performance, it is recommended that the <${tagName}> property '${camelName}' is set using that property name in vdom, rather than using the attribute form of the name '${propName}'`);this._tsxUtils.setIssuePosition(issue,tsxProp);issue.setSeverity("info");issue.setMsgKey(RULE_NAME+"_2");ruleCtx.reporter.addIssue(issue,ruleCtx)}if(this._tsxUtils.isCommonAttr(propName)||this._tsxUtils.isCommonEventAttr(propName)||propName===SLOT||propName===KEY||propName===REF||propName.startsWith(OJ_EVENT_PREFIX)||propName.startsWith(EVENT_PREFIX)){return}origPropName=propName;propName=camelName?camelName:propName;if(!this._metaLib.isTagAttr(tagName,propName)){if(!this._metaLib.isTagEvent(tagName,propName)){let issue=new ruleCtx.Issue(`<${tagName}> property '${origPropName}' is unknown`);this._tsxUtils.setIssuePosition(issue,tsxProp);ruleCtx.reporter.addIssue(issue,ruleCtx)}}};function _isPropAriaOrData(s){return s.startsWith(ARIA_DASH)||s.startsWith(DATA_DASH)}module.exports=Rule;
6
+ const isValidAttr=require("./helpers/valid-attr");const RULE_NAME="oj-tsx-ojattr";const SHORT_DESCR="JET component attribute must be defined";const LONG_DESCR="JET component attribute must be a defined attribute for the component";const OJ_EVENT_PREFIX="onOj";const EVENT_PREFIX="on";const SLOT="slot";const ARIA_DASH="aria-";const DATA_DASH="data-";const KEY="key";const REF="ref";function Rule(){}Rule.prototype.getName=function(){return RULE_NAME};Rule.prototype.getShortDescription=function(){return SHORT_DESCR};Rule.prototype.getDescription=function(){return LONG_DESCR};Rule.prototype.register=function(regCtx){this._metaLib=regCtx.utils.metaLib;this._tsxUtils=regCtx.utils.tsxUtils;return{TsxWebComponent:this._onWebComp}};Rule.prototype._onWebComp=function(ruleCtx,tsxComp){var props;if(props=tsxComp.properties){props.forEach(prop=>{this._checkProp(ruleCtx,tsxComp,prop)})}};Rule.prototype._checkProp=function(ruleCtx,tsxComp,tsxProp){let propName=tsxProp.name;let tagName=tsxComp.name;let origPropName,camelName;if(!propName||tsxProp.node.type==="JSXSpreadAttribute"){return}if(!isValidAttr(propName)){let issue=new ruleCtx.Issue(`<${tagName}> - invalid '${propName}' property`);this._tsxUtils.setIssuePosition(issue,tsxProp);issue.setMsgKey(RULE_NAME+"_1");ruleCtx.reporter.addIssue(issue,ruleCtx);return}if(_isPropAriaOrData(propName)){return}if(propName.includes("-")){camelName=this._tsxUtils.toCamelCase(propName);let issue=new ruleCtx.Issue(`For optimum performance, it is recommended that the <${tagName}> property '${camelName}' is set using that property name in vdom, rather than using the attribute form of the name '${propName}'`);this._tsxUtils.setIssuePosition(issue,tsxProp);issue.setSeverity("info");issue.setMsgKey(RULE_NAME+"_2");ruleCtx.reporter.addIssue(issue,ruleCtx)}if(this._tsxUtils.isCommonAttr(propName)||this._tsxUtils.isCommonEventAttr(propName)||propName===SLOT||propName===KEY||propName===REF||propName.startsWith(OJ_EVENT_PREFIX)||propName.startsWith(EVENT_PREFIX)){return}origPropName=propName;propName=camelName?camelName:propName;if(!this._metaLib.isTagAttr(tagName,propName)){if(!this._metaLib.isTagEvent(tagName,propName)){let issue=new ruleCtx.Issue(`<${tagName}> property '${origPropName}' is unknown`);this._tsxUtils.setIssuePosition(issue,tsxProp);ruleCtx.reporter.addIssue(issue,ruleCtx)}}};function _isPropAriaOrData(s){return s.startsWith(ARIA_DASH)||s.startsWith(DATA_DASH)}module.exports=Rule;
@@ -3,4 +3,4 @@
3
3
  * Licensed under The Universal Permissive License (UPL), Version 1.0
4
4
  * as shown at https://oss.oracle.com/licenses/upl/
5
5
  */
6
- const RULE_NAME="oj-tsx-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.";const JET_RELS=2;const SEV_BLOCKER="blocker";const MSG_ID_AGED="_aged";const DOT=".";const ID_PLUS_1="_1";class Rule{getName(){return RULE_NAME}getDescription(){return LONG}getShortDescription(){return SHORT}register(regCtx){this._metaLib=regCtx.utils.metaLib;return{"TsxRenderComponent":this._onTsxRC}}_onTsxRC(ruleCtx,tsxRC){tsxRC.components.forEach(tsxComp=>{this._checkDeprecatedTags(ruleCtx,tsxComp)})}_checkDeprecatedTags(ruleCtx,tsxComp){var tagName,status;if(tsxComp.isWCTag){tagName=tsxComp.name;if(tagName!=="oj-slot"){if(status=this._metaLib.isTagDeprecated(tagName)){this._emitIssue(ruleCtx,tsxComp,status)}}}if(tsxComp.children){tsxComp.children.forEach(child=>{if(child.name!=="oj-slot"){if(status=this._checkDeprecatedTags(ruleCtx,child)){this._emitIssue(ruleCtx,child,status)}}})}}_emitIssue(ruleCtx,tsxTag,status){var descript=status.description?` ${status.description}`:"";var since=status.since?" (since "+status.since+")":null;var value="";var tagName=tsxTag.name;var b;if(descript&&!descript.endsWith(DOT)){descript+=DOT}if(status.value&&status.value.length){value=` Available alternative${status.value.length===1?" is":"s are"}`;value+=`: <${status.value.join(">, ")}>.`}let issue=new ruleCtx.Issue(`<${tagName}> is deprecated${since}.${descript}${value}`);if(this._metaLib.isComponentTag(tagName)){issue.setMsgKey(RULE_NAME+ID_PLUS_1);b=true}if(ruleCtx.utils.jafLib.getJetReleaseCount()>JET_RELS){issue.setSeverity(SEV_BLOCKER);issue.setMsgKey(RULE_NAME+(b?ID_PLUS_1:"")+MSG_ID_AGED)}issue.setPosition(tsxTag.loc.start.line,tsxTag.loc.start.column,tsxTag.range[0],tsxTag.range[1]);ruleCtx.reporter.addIssue(issue,ruleCtx)}};module.exports=Rule;
6
+ const RULE_NAME="oj-tsx-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.";const JET_RELS=2;const SEV_BLOCKER="blocker";const MSG_ID_AGED="_aged";const MSG_ID_USER="_user";const DOT=".";const OJ_DYNAMIC="oj-dynamic";const OJ_DYN="oj-dyn";class Rule{getName(){return RULE_NAME}getDescription(){return LONG}getShortDescription(){return SHORT}register(regCtx){this._metaLib=regCtx.utils.metaLib;return{"TsxRenderComponent":this._onTsxRC}}_onTsxRC(ruleCtx,tsxRC){tsxRC.components.forEach(tsxComp=>{this._checkDeprecatedTags(ruleCtx,tsxComp)})}_checkDeprecatedTags(ruleCtx,tsxComp){var tagName,status;if(tsxComp.isWCTag){tagName=tsxComp.name;if(tagName!=="oj-slot"){if(status=this._metaLib.isTagDeprecated(tagName)){this._emitIssue(ruleCtx,tsxComp,status)}}}if(tsxComp.children){tsxComp.children.forEach(child=>{if(child.name!=="oj-slot"){if(status=this._checkDeprecatedTags(ruleCtx,child)){this._emitIssue(ruleCtx,child,status)}}})}}_emitIssue(ruleCtx,tsxTag,status){var descript=status.description?` ${status.description}`:"";var since=status.since?" (since "+status.since+")":null;var value="";var tagName=tsxTag.name;if(descript&&!descript.endsWith(DOT)){descript+=DOT}if(status.value&&status.value.length){value=` Available alternative${status.value.length===1?" is":"s are"}`;value+=`: <${status.value.join(">, ")}>.`}let issue=new ruleCtx.Issue(`<${tagName}> is deprecated${since}.${descript}${value}`);if(this._metaLib.isJetTag(tagName)||tagName===OJ_DYNAMIC||tagName===OJ_DYN){if(status.since&&ruleCtx.utils.jafLib.getMajorReleaseCount(status.since)>JET_RELS){issue.setSeverity(SEV_BLOCKER);issue.setMsgKey(RULE_NAME+MSG_ID_AGED)}}else if(this._metaLib.isComponentTag(tagName)){issue.setMsgKey(RULE_NAME+MSG_ID_USER)}issue.setPosition(tsxTag.loc.start.line,tsxTag.loc.start.column,tsxTag.range[0],tsxTag.range[1]);ruleCtx.reporter.addIssue(issue,ruleCtx)}};module.exports=Rule;
@@ -3,4 +3,4 @@
3
3
  * Licensed under The Universal Permissive License (UPL), Version 1.0
4
4
  * as shown at https://oss.oracle.com/licenses/upl/
5
5
  */
6
- const RULENAME="oj-tsx-pageopts-type";const DESCRIPTION="Paging Control with numbers is an antipattern in Redwood. Instead the UX recommendation "+"is to use high-water mark scrolling patterns on pages and collections. The JET collections "+"all support high-water mark scrolling natively without the need for a paging control via "+"the scroll-policy attribute. For teams using paging control in Alta we recommend to begin "+"changing the behavior as it will not be supported in Redwood. The only supported use of "+"<oj-paging-control> is to use page-options={type:\"dots\"}.";const SHORT_DESCRIPTION="Paging Control with numbers is an anti pattern in Redwood";const PAGE_OPTIONS="pageOptions";const DOTS="dots";const NUMBERS="numbers";const SCROLL="Use the scroll property 'loadMoreOnScroll' on the collection";class Rule{getName(){return RULENAME}getDescription(){return DESCRIPTION}getShortDescription(){return SHORT_DESCRIPTION}register(regCtx){this._tsxUtils=regCtx.utils.tsxUtils;return{"Tsx<oj-paging-control>":this._onComp}}_onComp(ruleCtx,tsxComp){let attribs,attrib,found,i;attribs=tsxComp.properties;for(i=0;i<attribs.length;i++){attrib=attribs[i];if(attrib.name.startsWith(PAGE_OPTIONS)){found=true;let obj=this._tsxUtils.getExpressionObject(attrib);if(obj&&obj.type){if(obj.type===DOTS){return}else if(obj.type!==NUMBERS){this._emit(ruleCtx,1,obj.type,attrib)}else if(obj.type===NUMBERS){this._emit(ruleCtx,2,null,attrib)}}else{this._emit(ruleCtx,3,null,attrib)}}}if(!found){this._emit(ruleCtx,4)}}_emit(ruleCtx,id,extra,attrib){var msg;switch(id){case 1:msg=`'page-options' - 'type' sub-property '${extra}' is invalid`;break;case 2:msg="'page-options' - 'type' sub-property 'numbers' is deprecated and an anti-pattern in Redwood theme";break;case 3:msg="'page-options' - 'type' sub-property omitted and default value 'numbers' is deprecated and an anti-pattern in Redwood theme";break;case 4:msg="'page-options' omitted and default sub-property type' value 'numbers' is deprecated and an anti-pattern in Redwood theme";break}let issue=new ruleCtx.Issue(`<oj-paging-control>: ${msg}. ${SCROLL}.`);if(id<4){this._tsxUtils.setIssuePropValuePosition(issue,attrib);issue.setMsgKey(RULENAME+(id-1?"_"+(id-1):""))}ruleCtx.reporter.addIssue(issue,ruleCtx)}}module.exports=Rule;
6
+ const RULENAME="oj-tsx-pageopts-type";const DESCRIPTION="Paging Control with numbers is an antipattern in Redwood. Instead the UX recommendation "+"is to use high-water mark scrolling patterns on pages and collections. The JET collections "+"all support high-water mark scrolling natively without the need for a paging control via "+"the scroll-policy attribute. For teams using paging control in Alta we recommend to begin "+"changing the behavior as it will not be supported in Redwood. The only supported use of "+"<oj-paging-control> is to use page-options={type:\"dots\"}.";const SHORT_DESCRIPTION="Paging Control with numbers is an anti pattern in Redwood";const PAGE_OPTIONS="pageOptions";const DOTS="dots";const NUMBERS="numbers";const JSX_SPREAD_ATTRIBUTE="JSXSpreadAttribute";const SCROLL="Use the scroll property 'loadMoreOnScroll' on the collection";class Rule{getName(){return RULENAME}getDescription(){return DESCRIPTION}getShortDescription(){return SHORT_DESCRIPTION}register(regCtx){this._tsxUtils=regCtx.utils.tsxUtils;return{"Tsx<oj-paging-control>":this._onComp}}_onComp(ruleCtx,tsxComp){let tsxProps,tsxProp,found,i;tsxProps=tsxComp.properties;for(i=0;i<tsxProps.length;i++){tsxProp=tsxProps[i];if(tsxProp.node.type===JSX_SPREAD_ATTRIBUTE){continue}if(tsxProp.name.startsWith(PAGE_OPTIONS)){found=true;let obj=this._tsxUtils.getExpressionObject(tsxProp);if(obj&&obj.type){if(obj.type===DOTS){return}else if(obj.type!==NUMBERS){this._emit(ruleCtx,1,obj.type,tsxProp)}else if(obj.type===NUMBERS){this._emit(ruleCtx,2,null,tsxProp)}}else{this._emit(ruleCtx,3,null,tsxProp)}}}if(!found){this._emit(ruleCtx,4)}}_emit(ruleCtx,id,extra,tsxProp){var msg;switch(id){case 1:msg=`'page-options' - 'type' sub-property '${extra}' is invalid`;break;case 2:msg="'page-options' - 'type' sub-property 'numbers' is deprecated and an anti-pattern in Redwood theme";break;case 3:msg="'page-options' - 'type' sub-property omitted and default value 'numbers' is deprecated and an anti-pattern in Redwood theme";break;case 4:msg="'page-options' omitted and default sub-property type' value 'numbers' is deprecated and an anti-pattern in Redwood theme";break}let issue=new ruleCtx.Issue(`<oj-paging-control>: ${msg}. ${SCROLL}.`);if(id<4){this._tsxUtils.setIssuePropValuePosition(issue,tsxProp);issue.setMsgKey(RULENAME+(id-1?"_"+(id-1):""))}ruleCtx.reporter.addIssue(issue,ruleCtx)}}module.exports=Rule;
@@ -3,4 +3,4 @@
3
3
  * Licensed under The Universal Permissive License (UPL), Version 1.0
4
4
  * as shown at https://oss.oracle.com/licenses/upl/
5
5
  */
6
- const RULENAME="oj-tsx-picker-attrs";const DESCRIPTION="Property 'pickerAttributes' sub-property 'style' violates the recommended Content Security Policy (CSP) which disallows inline styles, and is therefore ignored in JET 11.0.";const SHORT_DESCRIPTION="Property 'pickerAttributes' sub-property 'style' is a CSP violation (no inline styles), and is ignored.";const MSG="'pickerAttributes' sub-property 'style' is ignored in JET 11.0.0, and is a CSP violation - use sub-property 'class'";const PICKER_ATTRIB="pickerAttributes";class Rule{getName(){return RULENAME}getDescription(){return DESCRIPTION}getShortDescription(){return SHORT_DESCRIPTION}register(regCtx){this._tsxUtils=regCtx.utils.tsxUtils;return{"Tsx<oj-input-date>":this._onTag,"Tsx<oj-input-date-time>":this._onTag,"Tsx<oj-input-time>":this._onTag,"Tsx<oj-date-picker>":this._onTag,"Tsx<oj-date-time-picker>":this._onTag,"Tsx<oj-select-many>":this._onTag,"Tsx<oj-combobox-many>":this._onTag,"Tsx<oj-combobox-one>":this._onTag}}_onTag(ruleCtx,tsxComp){var attribs,attrib,i;if(attribs=tsxComp.properties){for(i=0;i<attribs.length;i++){attrib=attribs[i];if(attrib.name.startsWith(PICKER_ATTRIB)){let obj=this._tsxUtils.getExpressionObject(attrib);if(obj&&obj.style){let issue=new ruleCtx.Issue(MSG);this._tsxUtils.setIssuePosition(issue,attrib);ruleCtx.reporter.addIssue(issue,ruleCtx)}}}}}}module.exports=Rule;
6
+ const RULENAME="oj-tsx-picker-attrs";const DESCRIPTION="Property 'pickerAttributes' sub-property 'style' violates the recommended Content Security Policy (CSP) which disallows inline styles, and is therefore ignored in JET 11.0.";const SHORT_DESCRIPTION="Property 'pickerAttributes' sub-property 'style' is a CSP violation (no inline styles), and is ignored.";const MSG="'pickerAttributes' sub-property 'style' is ignored in JET 11.0.0, and is a CSP violation - use sub-property 'class'";const PICKER_ATTRIB="pickerAttributes";const JSX_SPREAD_ATTRIBUTE="JSXSpreadAttribute";class Rule{getName(){return RULENAME}getDescription(){return DESCRIPTION}getShortDescription(){return SHORT_DESCRIPTION}register(regCtx){this._tsxUtils=regCtx.utils.tsxUtils;return{"Tsx<oj-input-date>":this._onTag,"Tsx<oj-input-date-time>":this._onTag,"Tsx<oj-input-time>":this._onTag,"Tsx<oj-date-picker>":this._onTag,"Tsx<oj-date-time-picker>":this._onTag,"Tsx<oj-select-many>":this._onTag,"Tsx<oj-combobox-many>":this._onTag,"Tsx<oj-combobox-one>":this._onTag}}_onTag(ruleCtx,tsxComp){var tsxProps,tsxProp,i;if(tsxProps=tsxComp.properties){for(i=0;i<tsxProps.length;i++){tsxProp=tsxProps[i];if(tsxProp.node.type===JSX_SPREAD_ATTRIBUTE){continue}if(tsxProp.name.startsWith(PICKER_ATTRIB)){let obj=this._tsxUtils.getExpressionObject(tsxProp);if(obj&&obj.style){let issue=new ruleCtx.Issue(MSG);this._tsxUtils.setIssuePosition(issue,tsxProp);ruleCtx.reporter.addIssue(issue,ruleCtx)}}}}}}module.exports=Rule;
@@ -0,0 +1,6 @@
1
+ /*
2
+ * Copyright (c) 2018, 2024, 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-tsx-popup-sibling";const LONG="Due to an integration issue between Preact and the JET popup components (such as <oj-popup>, <oj-dialog> and <oj-drawer-popup>) "+"where both Preact and the components themselves perform reparenting of the popup DOM, the popup component should be wrapped "+"in its own wrapper element. e.g. replace<br><br>"+"<div><br>"+" &nbsp;&nbsp;<oj-dialog>Hello</oj-dialog><br>"+" &nbsp;&nbsp;<oj-button>Open Popup</oj-button><br>"+"</div><br><br>"+"with:"+"<br><br><div><br>"+"&nbsp;&nbsp;<div><br>"+"&nbsp;&nbsp;&nbsp;&nbsp;<oj-dialog>Hello</oj-dialog><br>"+"&nbsp;&nbsp;</div><br>"+"&nbsp;&nbsp;<oj-button>Open Popup</oj-button><br>"+"</div>";const SHORT="Pop-up components should not have siblings.";class Rule{getName(){return RULENAME}getDescription(){return LONG}getShortDescription(){return SHORT}register(){return{"Tsx<oj-popup>":this._onPopup,"Tsx<oj-dialog>":this._onPopup,"Tsx<oj-drawer-popup>":this._onPopup}}_onPopup(ruleCtx,tsxComp){var parent=tsxComp.parent;if(parent?.children&&parent.children.length>1){let issue=new ruleCtx.Issue(`<${tsxComp.name}> has a sibling in parent <${parent.name}>. Pop-up components should have no siblings.`);ruleCtx.reporter.addIssue(issue,ruleCtx)}}}module.exports=Rule;
@@ -0,0 +1,6 @@
1
+ /*
2
+ * Copyright (c) 2018, 2024, 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-tsx-prop-anti-pattern";const DESCRIPTION="Some components, or component features, may be present but are not applicable for "+"use in all design systems and as such may be flagged as anti-patterns in the content "+"of a particular theme. In these cases, the feature should not be used if targeting the "+"design system in question.";const SHORT_DESCRIPTION="A component property is an anti pattern for code written for the designated theme.";const ANTIPATTERN="antiPattern";class Rule{getName(){return RULENAME}getDescription(){return DESCRIPTION}getShortDescription(){return SHORT_DESCRIPTION}register(regCtx){this._metaLib=regCtx.utils.metaLib;this._tsxUtils=regCtx.utils.tsxUtils;this._theme=regCtx.config.theme;return{"TsxRenderComponent":this._onTsxRC}}_onTsxRC(ruleCtx,tsxRC){tsxRC.components.forEach(tsxComp=>{this._checkComp(ruleCtx,tsxComp)})}_checkComp(ruleCtx,tsxComp){var tagName=tsxComp.name;if(tagName.includes("-")&&ruleCtx.utils.metaLib.isWCTag(tagName)){let props,tsxProp,aStat,i;if(props=tsxComp.properties){for(i=0;i<props.length;i++){tsxProp=props[i];if(tsxProp.node.type==="JSXSpreadAttribute"){continue}if(aStat=this._metaLib.getPropStatus(tagName,tsxProp.name,ANTIPATTERN)){let stat,themes,i;for(i=0;i<aStat.length;i++){stat=aStat[i];if(!(themes=stat.themes)){continue}if(!stat.hasOwnProperty("target")){if(themes.includes(this._theme)){this._emitIssue(1,ruleCtx,tagName,tsxProp,stat)}}else if(stat.target==="propertyValue"){let propValue;if(propValue=this._tsxUtils.getPropertyStringValue(tsxProp)){if(!_isExpr(propValue)&&!propValue.startsWith("{")){if(stat.value&&stat.value.includes(propValue)){this._emitIssue(2,ruleCtx,tagName,tsxProp,stat,propValue)}}}}}}}}}if(tsxComp.children)tsxComp.children.forEach(child=>{this._checkComp(ruleCtx,child)})}_emitIssue(issueType,ruleCtx,tagName,tsxProp,stat,propValue){var issue,since,descript,themes,multi;since=stat.since?` (since ${stat.since})`:"";descript=stat.description;descript=descript?` ${descript}`:"";descript=descript&&!descript.endsWith(".")?descript+".":descript;themes="'"+stat.themes.join("', '")+"'";if(multi=stat.themes.length>1){let x;if((x=themes.lastIndexOf(","))>=0){themes=themes.substring(0,x)+" and"+themes.substring(x+1)}}themes=`${multi?"s":""} ${themes}`;if(issueType===1){issue=new ruleCtx.Issue(`<${tagName}> property '${tsxProp.name}' is an antipattern in theme${themes}${since}.${descript} `)}else{issue=new ruleCtx.Issue(`<${tagName}> property '${tsxProp.name}' value '${propValue}' is an antipattern in theme ${themes}${since}.${descript} `);issue.setMsgKey(RULENAME+"_1")}this._tsxUtils.setIssuePosition(issue,tsxProp);ruleCtx.reporter.addIssue(issue,ruleCtx)}}function _isExpr(s){return /[(}{}+*\/]/.test(s)};module.exports=Rule;
@@ -3,4 +3,4 @@
3
3
  * Licensed under The Universal Permissive License (UPL), Version 1.0
4
4
  * as shown at https://oss.oracle.com/licenses/upl/
5
5
  */
6
- const RULENAME="oj-tsx-rating-gauge-size";const DESCRIPTION="The use of the <oj-rating-gauge> 'size' property set to enumerated value 'fit' is a "+"Redwood theme anti-pattern. The UX recommendation is to use an 'sm', 'md', or 'lg' value instead. "+"For interactive gauges, 'sm' and 'md' sizes are not recommended, since the touch target sizes are not "+"large enough to meet the accessibility guidelines.";const SHORT_DESCRIPTION="Do not use <oj-rating-gauge> with the 'size' property set to 'fit' in Redwood";const MSG="<oj-rating-gauge> property 'size' value of 'fit' is an anti-pattern in Redwood.";const FIT="fit";class Rule{getName(){return RULENAME}getDescription(){return DESCRIPTION}getShortDescription(){return SHORT_DESCRIPTION}register(regCtx){this._tsxUtils=regCtx.utils.tsxUtils;return{"Tsx<oj-rating-gauge size=>":this._onSize}}_onSize(ruleCtx,tsxProp){if(this._tsxUtils.isPropertyString(tsxProp)){let propVal=tsxProp.valueRaw;if(propVal.substring(1).startsWith(FIT)){let issue=new ruleCtx.Issue(MSG);this._tsxUtils.setIssuePropValuePosition(issue,tsxProp);ruleCtx.reporter.addIssue(issue,ruleCtx)}}}}module.exports=Rule;
6
+ const RULENAME="oj-tsx-rating-gauge-size";const DESCRIPTION="The use of the <oj-rating-gauge> 'size' property set to enumerated value 'fit' is a "+"Redwood theme anti-pattern. The UX recommendation is to use an 'sm', 'md', or 'lg' value instead. "+"For interactive gauges, 'sm' and 'md' sizes are not recommended, since the touch target sizes are not "+"large enough to meet the accessibility guidelines.";const SHORT_DESCRIPTION="Do not use <oj-rating-gauge> with the 'size' property set to 'fit' in Redwood";const MSG="<oj-rating-gauge> property 'size' value of 'fit' is an anti-pattern in Redwood.";const FIT="fit";const JSX_SPREAD_ATTRIBUTE="JSXSpreadAttribute";class Rule{getName(){return RULENAME}getDescription(){return DESCRIPTION}getShortDescription(){return SHORT_DESCRIPTION}register(regCtx){this._tsxUtils=regCtx.utils.tsxUtils;return{"Tsx<oj-rating-gauge size=>":this._onSize}}_onSize(ruleCtx,tsxProp){if(tsxProp.node.type===JSX_SPREAD_ATTRIBUTE){return}if(this._tsxUtils.isPropertyString(tsxProp)){let propVal=tsxProp.valueRaw;if(propVal.substring(1).startsWith(FIT)){let issue=new ruleCtx.Issue(MSG);this._tsxUtils.setIssuePropValuePosition(issue,tsxProp);ruleCtx.reporter.addIssue(issue,ruleCtx)}}}}module.exports=Rule;
@@ -3,4 +3,4 @@
3
3
  * Licensed under The Universal Permissive License (UPL), Version 1.0
4
4
  * as shown at https://oss.oracle.com/licenses/upl/
5
5
  */
6
- const RULENAME="oj-tsx-rating-gauge-track-resize";const DESCRIPTION="The use of the <oj-rating-gauge> 'track-resize' attribute is a Redwood theme anti-pattern. "+"This attribute is only needed if the 'size' attribute is set to 'fit', however, 'fit' is a "+"Redwood theme anti-pattern.";const SHORT_DESCRIPTION="Do not use <oj-rating-gauge> with the 'trackResize' property set to 'on' in Redwood";class Rule{getName(){return RULENAME}getDescription(){return DESCRIPTION}getShortDescription(){return SHORT_DESCRIPTION}register(regCtx){this._tsxUtils=regCtx.utils.tsxUtils;return{"Tsx<oj-rating-gauge trackResize=>":this._onTrackResize}}_onTrackResize(ruleCtx,tsxProp){let propVal=tsxProp.valueRaw;if(propVal.substring(1,propVal.length-1)==="on"){let issue=new ruleCtx.Issue(`<oj-rating-gauge> property 'trackResize' value of 'on' is an anti-pattern in Redwood.`);this._tsxUtils.setIssuePropValuePosition(issue,tsxProp);ruleCtx.reporter.addIssue(issue,ruleCtx)}}}module.exports=Rule;
6
+ const RULENAME="oj-tsx-rating-gauge-track-resize";const DESCRIPTION="The use of the <oj-rating-gauge> 'track-resize' attribute is a Redwood theme anti-pattern. "+"This attribute is only needed if the 'size' attribute is set to 'fit', however, 'fit' is a "+"Redwood theme anti-pattern.";const SHORT_DESCRIPTION="Do not use <oj-rating-gauge> with the 'trackResize' property set to 'on' in Redwood";const JSX_SPREAD_ATTRIBUTE="JSXSpreadAttribute";class Rule{getName(){return RULENAME}getDescription(){return DESCRIPTION}getShortDescription(){return SHORT_DESCRIPTION}register(regCtx){this._tsxUtils=regCtx.utils.tsxUtils;return{"Tsx<oj-rating-gauge trackResize=>":this._onTrackResize}}_onTrackResize(ruleCtx,tsxProp){if(tsxProp.node.type===JSX_SPREAD_ATTRIBUTE){return}let propVal=tsxProp.valueRaw;if(propVal.substring(1,propVal.length-1)==="on"){let issue=new ruleCtx.Issue(`<oj-rating-gauge> property 'trackResize' value of 'on' is an anti-pattern in Redwood.`);this._tsxUtils.setIssuePropValuePosition(issue,tsxProp);ruleCtx.reporter.addIssue(issue,ruleCtx)}}}module.exports=Rule;
@@ -3,4 +3,4 @@
3
3
  * Licensed under The Universal Permissive License (UPL), Version 1.0
4
4
  * as shown at https://oss.oracle.com/licenses/upl/
5
5
  */
6
- const RULE_NAME="oj-tsx-slot-deprecated";const DESCRIPT="The slot has been deprecated, and is subject to removal or non-active support in the future.";const SHORT="A deprecated slot has been found.";const TEMPLATE="template";const DOT=".";const JET_RELS=2;const SEV_BLOCKER="blocker";const MSG_ID_AGED="_aged";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._tsxUtils=regCtx.utils.tsxUtils;this._metaLib=regCtx.utils.metaLib;return{"Tsx<slot=>":this._onSlot}};Rule.prototype._onSlot=function(ruleCtx,tsxProp){var slotName;if(slotName=_getSlotName(tsxProp)){if(tsxProp.parent.name!==TEMPLATE){this._checkSlot(ruleCtx,tsxProp,slotName)}}};Rule.prototype._checkSlot=function(ruleCtx,tsxProp,slotName){var issue,tsxParent,status,slotName;if(!(tsxParent=this._tsxUtils.getSlotParent(ruleCtx,tsxProp,slotName))){return}if(status=this._metaLib.isTagSlotDeprecated(tsxParent.name,slotName)){let since=status.since?` (since ${status.since})`:"";let descript=(status.description?` ${status.description}`:"").trimRight();if(descript&&!descript.endsWith(DOT)){descript+=DOT}issue=new ruleCtx.Issue(`slot '${slotName}' on <${tsxProp.parent.name}> for <${tsxParent.name}> is deprecated${since}.${descript}`);this._tsxUtils.setIssuePosition(issue,tsxProp);if(ruleCtx.utils.jafLib.getJetReleaseCount()>JET_RELS){issue.setSeverity(SEV_BLOCKER);issue.setMsgKey(RULE_NAME+MSG_ID_AGED)}ruleCtx.reporter.addIssue(issue,ruleCtx)}};function _getSlotName(tsxProp){return tsxProp.node.value.type==="Literal"?tsxProp.node.value.value:null};module.exports=Rule;
6
+ const RULE_NAME="oj-tsx-slot-deprecated";const DESCRIPT="The slot has been deprecated, and is subject to removal or non-active support in the future.";const SHORT="A deprecated slot has been found.";const OJ_DYNAMIC="oj-dynamic";const OJ_DYN="oj-dyn";const TEMPLATE="template";const DOT=".";const JET_RELS=2;const SEV_BLOCKER="blocker";const MSG_ID_AGED="_aged";const MSG_ID_USER="_user";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._tsxUtils=regCtx.utils.tsxUtils;this._metaLib=regCtx.utils.metaLib;return{"Tsx<slot=>":this._onSlot}};Rule.prototype._onSlot=function(ruleCtx,tsxProp){var slotName;if(slotName=_getSlotName(tsxProp)){if(tsxProp.parent.name!==TEMPLATE){this._checkSlot(ruleCtx,tsxProp,slotName)}}};Rule.prototype._checkSlot=function(ruleCtx,tsxProp,slotName){var tsxParent;if(!(tsxParent=this._tsxUtils.getSlotParent(ruleCtx,tsxProp,slotName))){return}let parentTag=tsxParent.name;let status;if(status=this._metaLib.isTagSlotDeprecated(parentTag,slotName)){let since=status.since?` (since ${status.since})`:"";let descript=(status.description?` ${status.description}`:"").trimRight();if(descript&&!descript.endsWith(DOT)){descript+=DOT}let issue=new ruleCtx.Issue(`slot '${slotName}' on <${tsxProp.parent.name}> for <${parentTag}> is deprecated${since}.${descript}`);this._tsxUtils.setIssuePosition(issue,tsxProp);if(this._metaLib.isJetTag(parentTag)||parentTag===OJ_DYNAMIC||parentTag===OJ_DYN){if(status.since&&ruleCtx.utils.jafLib.getMajorReleaseCount(status.since)>JET_RELS){issue.setSeverity(SEV_BLOCKER);issue.setMsgKey(RULE_NAME+MSG_ID_AGED)}}else{issue.setMsgKey(RULE_NAME+MSG_ID_USER)}ruleCtx.reporter.addIssue(issue,ruleCtx)}};function _getSlotName(tsxProp){return tsxProp.node.value.type==="Literal"?tsxProp.node.value.value:null};module.exports=Rule;
@@ -3,4 +3,4 @@
3
3
  * Licensed under The Universal Permissive License (UPL), Version 1.0
4
4
  * as shown at https://oss.oracle.com/licenses/upl/
5
5
  */
6
- const getParentNodeForSlot=require("./helpers/tsx/has-slot-name");const RULE_NAME="oj-tsx-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 IGNORE_TAG=["oj-defer","html","head","body","script"];const TEMPLATE="template";const OJ_SWITCHER="oj-switcher";const OJ_DEFER="oj-defer";const OJ_BIND="oj-bind";const OJ_TOOLBAR="oj-toolbar";const OJ_LABEL="oj-label";const OJ_BIND_SLOT="oj-bind-slot";const DIV="div";const SPAN="span";const TAG="tag";const SLOT="slot";const _isBindTag=tagName=>{return tagName.startsWith("oj-bind")};const _ignoreTag=tagName=>{return IGNORE_TAG.includes(tagName)||tagName.startsWith("oj-bind")};class Rule{getName(){return RULE_NAME}getDescription(){return DESCRIPT}getShortDescription(){return SHORT}register(regCtx){this._utils=regCtx.utils.utils;this._metaLib=regCtx.utils.metaLib;this._tsxUtils=regCtx.utils.tsxUtils;this._hasJetWCInterfaces=this._metaLib.hasJetWCInterfaces();return{"TsxRenderComponent":this._onTsxRC}}_onTsxRC(ruleCtx,tsxRC){tsxRC.components.forEach(tsxComp=>{this._checkComp(ruleCtx,tsxComp)})}_checkComp(ruleCtx,tsxComp){var tagName=tsxComp.name;var isTag;if(!(isTag=this._metaLib.isWCTag(tagName))){if(isTag=this._tsxUtils.isCommonElem(tagName)||tagName==="template"){isTag=!_ignoreTag(tagName)}}if(isTag){this._checkTag(ruleCtx,tsxComp)}if(tsxComp.children){tsxComp.children.forEach(child=>{this._checkComp(ruleCtx,child)})}}_checkTag(ruleCtx,tsxComp){var tsxProp,slotx,slotName="";this._slotDefined=false;if(tsxProp=this._tsxUtils.getProperty(tsxComp,SLOT)){if(this._tsxUtils.isPropertyString(tsxProp)){slotx=this._tsxUtils.getPropertyRawValue(tsxComp,SLOT,true)}}if(slotx||slotx===""){slotName=slotx;this._slotDefined=true}this._onSlot(ruleCtx,tsxComp,SLOT,slotName)}_onSlot(ruleCtx,tsxComp,slotAttr,slotName){var pnode,psc;var slotTag=tsxComp.name;if(slotName&&tsxComp.name===OJ_BIND_SLOT){return}if(!(pnode=getParentNodeForSlot(ruleCtx,tsxComp,slotName))){return}if(pnode.name===OJ_SWITCHER||!this._metaLib.isWCTag(pnode.name)){return}if(this._metaLib.isJetTag(pnode.name)&&!this._hasJetWCInterfaces){return}psc=this._metaLib.getPreferredSlotContentEx(pnode.name,slotName);if(!(psc&&psc.interfaces)){return}if(slotTag==="oj-vb-fragment"||slotTag==="oj-module"){return}if(slotTag.startsWith(OJ_BIND)||slotTag===OJ_DEFER||slotTag===TEMPLATE||slotTag===DIV){let child;if(!(child=this._getFirstChildTag(tsxComp.children))||!this._isSlotInterfaceSupported(child,psc)){if(child?.name!==SPAN){this._emitIssue(ruleCtx,tsxComp,slotName,pnode.name,psc,2)}}return}if(this._tsxUtils.isCommonElem(slotTag)){if(pnode.name!==OJ_TOOLBAR&&slotName!==SPAN){this._emitIssue(ruleCtx,tsxComp,slotName,pnode.name,psc,3)}return}if(this._metaLib.isWCTag(slotTag)){if(!_isBindTag(slotTag)&&slotTag!==OJ_DEFER&&slotTag!==TEMPLATE){if(!this._isSlotInterfaceSupported(tsxComp,psc)){this._emitIssue(ruleCtx,tsxComp,slotName,pnode.name,psc,1)}}}}_isSlotInterfaceSupported(tsxComp,psc){var ret,aIfc;if(aIfc=this._metaLib.getInterfaces(tsxComp.name)){for(let ifc of aIfc){if(psc.interfaces.includes(ifc)){ret=true;break}}}return ret}_emitIssue(ruleCtx,tsxComp,slotName,slotOwner,psci,issueType){var ifc=_list(psci.interfaces,"or");var comp=psci.components?` (e.g. ${_list(psci.components,"or",true)})`:"";var multi=psci.interfaces.length>1;var actualSlot=slotName;var slotName=slotName?`slot '${slotName}'`:"default slot";var tagName=tsxComp.name;var isDefSlot=!slotName;var issue,msg;if(issueType===1){msg=`<${tagName}> is in${isDefSlot?" the":""} ${slotName} of <${slotOwner}> but does not implement interface${multi?"s":""} ${ifc}${comp}`}else if(issueType===2){msg=`<${tagName}> is in${isDefSlot?" the":""} ${slotName} of <${slotOwner}> but its first child does not implement interface${multi?"s":""} ${ifc}${comp}`}else if(issueType===3){msg=`${slotName} on <${tagName}> for <${slotOwner}> cannot provide ${multi?"interfaces":"an interface"} of type ${ifc}${comp}`}else{return}issue=new ruleCtx.Issue(msg);if(this._slotDefined){let tsxProp=this._tsxUtils.getProperty(tsxComp,SLOT);this._tsxUtils.setIssuePosition(issue,tsxProp)}issue.setMsgEx({slotName:actualSlot,slotElem:tagName.name,slotOwner:slotOwner});ruleCtx.reporter.addIssue(issue,ruleCtx)}_getFirstChildTag(childs){var ret,childs,child;if(childs){for(let i=0;i<childs.length;i++){child=childs[i];if(child.name.startsWith("oj-bind-")||child.name===OJ_DEFER||child.name===TEMPLATE){return this._getFirstChildTag(child.children)}ret=child;break}}return ret}}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;
6
+ const getParentNodeForSlot=require("./helpers/tsx/has-slot-name");const RULE_NAME="oj-tsx-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 IGNORE_TAG=["oj-defer","html","head","body","script"];const TEMPLATE="template";const OJ_SWITCHER="oj-switcher";const OJ_DEFER="oj-defer";const OJ_BIND="oj-bind";const OJ_TOOLBAR="oj-toolbar";const OJ_LABEL="oj-label";const OJ_BIND_SLOT="oj-bind-slot";const DIV="div";const SPAN="span";const TAG="tag";const SLOT="slot";const _isBindTag=tagName=>{return tagName.startsWith("oj-bind")};const _ignoreTag=tagName=>{return IGNORE_TAG.includes(tagName)||tagName.startsWith("oj-bind")};class Rule{getName(){return RULE_NAME}getDescription(){return DESCRIPT}getShortDescription(){return SHORT}register(regCtx){this._utils=regCtx.utils.utils;this._metaLib=regCtx.utils.metaLib;this._tsxUtils=regCtx.utils.tsxUtils;this._hasJetWCInterfaces=this._metaLib.hasJetWCInterfaces();return{"TsxRenderComponent":this._onTsxRC,"TsxFunction":this._noteFunc}}_noteFunc(ruleCtx,tsxFunc){if(!this._tsxFuncs){this._tsxFuncs={}}this._tsxFuncs[tsxFunc.name]=tsxFunc}_onTsxRC(ruleCtx,tsxRC){tsxRC.components.forEach(tsxComp=>{this._checkComp(ruleCtx,tsxComp)})}_checkComp(ruleCtx,tsxComp){var tagName=tsxComp.name;var isTag;if(!(isTag=this._metaLib.isWCTag(tagName))){if(isTag=this._tsxUtils.isCommonElem(tagName)||tagName==="template"){isTag=!_ignoreTag(tagName)}}if(isTag){this._checkTag(ruleCtx,tsxComp)}if(tsxComp.children){tsxComp.children.forEach(child=>{this._checkComp(ruleCtx,child)})}}_checkTag(ruleCtx,tsxComp){var tsxProp,slotx,slotName="";this._slotDefined=false;if(tsxProp=this._tsxUtils.getProperty(tsxComp,SLOT)){if(this._tsxUtils.isPropertyString(tsxProp)){slotx=this._tsxUtils.getPropertyRawValue(tsxComp,SLOT,true)}}if(slotx||slotx===""){slotName=slotx;this._slotDefined=true}this._onSlot(ruleCtx,tsxComp,SLOT,slotName)}_onSlot(ruleCtx,tsxComp,slotAttr,slotName){var pnode,psc;var slotTag=tsxComp.name;var tsxProp;if(slotName&&tsxComp.name===OJ_BIND_SLOT){return}if(!(pnode=getParentNodeForSlot(ruleCtx,tsxComp,slotName))){return}if(pnode.name===OJ_SWITCHER||!this._metaLib.isWCTag(pnode.name)){return}if(this._metaLib.isJetTag(pnode.name)&&!this._hasJetWCInterfaces){return}psc=this._metaLib.getPreferredSlotContentEx(pnode.name,slotName);if(!(psc&&psc.interfaces)){return}if(slotTag==="oj-vb-fragment"||slotTag==="oj-module"){return}if(slotTag.startsWith(OJ_BIND)||slotTag===OJ_DEFER||slotTag===TEMPLATE||slotTag===DIV){let child;if(!(child=this._getFirstChildTag(tsxComp.children))||!this._isSlotInterfaceSupported(child,psc)){if(slotTag===TEMPLATE){if(tsxProp=this._tsxUtils.getProperty(tsxComp,"render")){let handlerFunc;if(handlerFunc=this._getRenderHandlerFunc(tsxProp)){if(!this._renderHandlerSupportsInterface(tsxProp,handlerFunc,psc)){this._emitIssue(ruleCtx,tsxComp,slotName,pnode.name,psc,4)}return}}}if(child?.name!==SPAN){this._emitIssue(ruleCtx,tsxComp,slotName,pnode.name,psc,2)}}return}if(this._tsxUtils.isCommonElem(slotTag)){if(pnode.name!==OJ_TOOLBAR&&slotName!==SPAN){this._emitIssue(ruleCtx,tsxComp,slotName,pnode.name,psc,3)}return}if(this._metaLib.isWCTag(slotTag)){if(!_isBindTag(slotTag)&&slotTag!==OJ_DEFER&&slotTag!==TEMPLATE){if(!this._isSlotInterfaceSupported(tsxComp,psc)){this._emitIssue(ruleCtx,tsxComp,slotName,pnode.name,psc,1)}}}}_renderHandlerSupportsInterface(tsxProp,handlerFunc,psc){if(this._tsxFuncs&&handlerFunc){let tsxComp;let tsxFunc=this._tsxFuncs[handlerFunc];if(tsxFunc&&tsxFunc.returns){for(let i=0;i<tsxFunc.returns.length;i++){if(tsxComp=tsxFunc.returns[i].tsxComponent){let retComp=tsxComp.name;if(this._isSlotInterfaceSupported(tsxComp,psc)){return true}}}}}return false}_isSlotInterfaceSupported(tsxComp,psc){var ret,aIfc;if(aIfc=this._metaLib.getInterfaces(tsxComp.name)){for(let ifc of aIfc){if(psc.interfaces.includes(ifc)){ret=true;break}}}return ret}_getRenderHandlerFunc(tsxProp){var func;var value=tsxProp.node.value;if(value.type==="JSXExpressionContainer"){if(value?.expression?.type==="Identifier"){func=value.expression.name}}return func}_emitIssue(ruleCtx,tsxComp,slotName,slotOwner,psci,issueType){var ifc=_list(psci.interfaces,"or");var comp=psci.components?` (e.g. ${_list(psci.components,"or",true)})`:"";var multi=psci.interfaces.length>1;var actualSlot=slotName;var slotName=slotName?`slot '${slotName}'`:"default slot";var tagName=tsxComp.name;var isDefSlot=!slotName;var issue,msg;if(issueType===1){msg=`<${tagName}> is in${isDefSlot?" the":""} ${slotName} of <${slotOwner}> but does not implement interface${multi?"s":""} ${ifc}${comp}`}else if(issueType===2){msg=`<${tagName}> is in${isDefSlot?" the":""} ${slotName} of <${slotOwner}> but its first child does not implement interface${multi?"s":""} ${ifc}${comp}`}else if(issueType===3){msg=`${slotName} on <${tagName}> for <${slotOwner}> cannot provide ${multi?"interfaces":"an interface"} of type ${ifc}${comp}`}else if(issueType===4){msg=`<${tagName}> is in${isDefSlot?" the":""} ${slotName} of <${slotOwner}> but its render attribute does not implement interface${multi?"s":""} ${ifc}${comp}`}else{return}issue=new ruleCtx.Issue(msg);if(issueType===4){issue.setMsgKey(RULE_NAME+"_1")}if(this._slotDefined){let tsxProp=this._tsxUtils.getProperty(tsxComp,SLOT);this._tsxUtils.setIssuePosition(issue,tsxProp)}issue.setMsgEx({slotName:actualSlot,slotElem:tagName.name,slotOwner:slotOwner});ruleCtx.reporter.addIssue(issue,ruleCtx)}_getFirstChildTag(childs){var ret,childs,child;if(childs){for(let i=0;i<childs.length;i++){child=childs[i];if(child.name.startsWith("oj-bind-")||child.name===OJ_DEFER||child.name===TEMPLATE){return this._getFirstChildTag(child.children)}ret=child;break}}return ret}}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;
@@ -0,0 +1,6 @@
1
+ /*
2
+ * Copyright (c) 2018, 2024, 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-tsx-treeview-actionable-content";const DESCRIPTION="<oj-tree-view> does not support actionable/interactive content (i.e. buttons, links, Inputs, etc) "+"inside templated content.";const SHORT_DESCRIPTION=DESCRIPTION;const TAG_START=["oj-input-","oj-select-","oj-color-","oj-radioset-","oj-combobox-","oj-slider-","oj-switch-","oj-text-area-"];const TAGS=["a","button","input","select","textarea"];class Rule{getName(){return RULENAME}getDescription(){return DESCRIPTION}getShortDescription(){return SHORT_DESCRIPTION}register(){return{"Tsx<oj-tree-view>":this._onTreeView}}_onTreeView(ruleCtx,tsxComp){if(tsxComp.children){this._findTemplates(ruleCtx,tsxComp.children)}}_findTemplates(ruleCtx,content){content.forEach(node=>{if(node.name==="template"){this._onTemplate(ruleCtx,node)}if(node.children){this._findTemplates(ruleCtx,node.children)}})}_onTemplate(ruleCtx,template){var content;if(content=template.children){content.forEach(node=>{if(_isActionable(node.name)){this._emitIssue(ruleCtx,node)}})}}_emitIssue(ruleCtx,node){var issue;issue=new ruleCtx.Issue(`Actionable templated content <${node.name}> is not permitted in <oj-tree-view>`);ruleCtx.utils.tsxUtils.setIssuePosition(issue,node);ruleCtx.reporter.addIssue(issue,ruleCtx)}}function _isActionable(tagName){var i;for(i=0;i<TAG_START.length;i++){if(tagName.startsWith(TAG_START[i])){return true}}for(i=0;i<TAGS.length;i++){if(TAGS.includes(tagName)){return true}}return false}module.exports=Rule;
@@ -3,4 +3,4 @@
3
3
  * Licensed under The Universal Permissive License (UPL), Version 1.0
4
4
  * as shown at https://oss.oracle.com/licenses/upl/
5
5
  */
6
- const RULENAME="oj-tsx-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._tsxUtils=regCtx.utils.tsxUtils;this._metaLib=regCtx.utils.metaLib;return{"TsxWebComponent":this._onWebComp}}_onWebComp(ruleCtx,tsxComp){var issue,attribs;if(!this._metaLib.isTagSupportedInTheme(tsxComp.name)){issue=new ruleCtx.Issue(`<${tsxComp.name}> is not supported in theme '${this._theme}'`);this._tsxUtils.setIssuePosition(issue,tsxComp);ruleCtx.reporter.addIssue(issue,ruleCtx)}if(attribs=tsxComp.properties){attribs.forEach(attrib=>{this._fnAttrib(ruleCtx,attrib)})}}_fnAttrib(ruleCtx,attrib){if(!attrib.name){return}if(!this._metaLib.isAttrSupportedInTheme(attrib.parent.name,attrib.name)){let issue=new ruleCtx.Issue(`<${attrib.parent.name}> attribute '${attrib.name}' is not supported in theme '${this._theme}'`);this._tsxUtils.setIssuePosition(issue,attrib);issue.setMsgKey(RULENAME+"_1");ruleCtx.reporter.addIssue(issue,ruleCtx)}}}module.exports=Rule;
6
+ const RULENAME="oj-tsx-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'.";const JSX_SPREAD_ATTRIBUTE="JSXSpreadAttribute";class Rule{getName(){return RULENAME}getDescription(){return DESCRIPTION}getShortDescription(){return SHORT_DESCRIPTION}register(regCtx){this._theme=regCtx.config.theme;this._tsxUtils=regCtx.utils.tsxUtils;this._metaLib=regCtx.utils.metaLib;return{"TsxWebComponent":this._onWebComp}}_onWebComp(ruleCtx,tsxComp){var issue,tsxProps;if(!this._metaLib.isTagSupportedInTheme(tsxComp.name)){issue=new ruleCtx.Issue(`<${tsxComp.name}> is not supported in theme '${this._theme}'`);this._tsxUtils.setIssuePosition(issue,tsxComp);ruleCtx.reporter.addIssue(issue,ruleCtx)}if(tsxProps=tsxComp.properties){tsxProps.forEach(tsxProp=>{this._fnAttrib(ruleCtx,tsxProp)})}}_fnAttrib(ruleCtx,tsxProp){if(!tsxProp.name||tsxProp.node.type===JSX_SPREAD_ATTRIBUTE){return}if(!this._metaLib.isAttrSupportedInTheme(tsxProp.parent.name,tsxProp.name)){let issue=new ruleCtx.Issue(`<${tsxProp.parent.name}> attribute '${tsxProp.name}' is not supported in theme '${this._theme}'`);this._tsxUtils.setIssuePosition(issue,tsxProp);issue.setMsgKey(RULENAME+"_1");ruleCtx.reporter.addIssue(issue,ruleCtx)}}}module.exports=Rule;
@@ -0,0 +1,6 @@
1
+ /*
2
+ * Copyright (c) 2018, 2024, 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-tsx-wctag-anti-pattern";const DESCRIPTION="Some components, or component features, may be present but are not applicable for "+"use in all design systems and as such may be flagged as anti-patterns in the content "+"of a particular theme. In these cases, the feature should not be used if targeting the "+"design system in question.";const SHORT_DESCRIPTION="The specified component is an anti pattern for code written for the designated theme.";const ANTIPATTERN="antiPattern";class Rule{getName(){return RULENAME}getDescription(){return DESCRIPTION}getShortDescription(){return SHORT_DESCRIPTION}register(regCtx){this._metaLib=regCtx.utils.metaLib;this._tsxUtils=regCtx.utils.tsxUtils;this._theme=regCtx.config.theme;return{"TsxRenderComponent":this._onTsxRC}}_onTsxRC(ruleCtx,tsxRC){tsxRC.components.forEach(tsxComp=>{this._checkComp(ruleCtx,tsxComp)})}_checkComp(ruleCtx,tsxComp){var tagName=tsxComp.name;if(tagName.includes("-")&&ruleCtx.utils.metaLib.isWCTag(tagName)){let stats,stat;if((stats=this._metaLib.getTagStatus(tagName,ANTIPATTERN))&&stats.length){stat=stats[0];if(stat.themes&&this._themeMatches(stat.themes)){this._emitIssue(ruleCtx,tsxComp,stat)}}}if(tsxComp.children){tsxComp.children.forEach(child=>{this._checkComp(ruleCtx,child)})}}_emitIssue(ruleCtx,tsxComp,stat){var issue,since,descript,themes,multi;since=stat.since?` (since ${stat.since})`:"";descript=stat.description;descript=descript?` ${descript}`:"";descript=descript&&!descript.endsWith(".")?descript+".":descript;themes="'"+stat.themes.join("', '")+"'";if(multi=stat.themes.length>1){let x;if((x=themes.lastIndexOf(","))>=0){themes=themes.substring(0,x)+" and"+themes.substring(x+1)}}themes=`${multi?"s":""} ${themes}`;issue=new ruleCtx.Issue(`<${tsxComp.name}> is an anti-pattern in theme${themes}${since}.${descript}`);this._tsxUtils.setIssuePosition(issue,tsxComp);ruleCtx.reporter.addIssue(issue,ruleCtx)}_themeMatches(themes){return themes.includes(this._theme)}}module.exports=Rule;
@@ -3,4 +3,4 @@
3
3
  * Licensed under The Universal Permissive License (UPL), Version 1.0
4
4
  * as shown at https://oss.oracle.com/licenses/upl/
5
5
  */
6
- const RULENAME="oj-tsx-wctag-maintenance";const DESCRIPTION="A notification that the component is in 'maintenance' status. This indicates "+"that the component is fully supported, but will be deprecated in a future release "+"and has no new features planned for it.";const SHORT_DESCRIPTION="The component is in 'maintenance' status and will be deprecated in a future release.";const MSG="<%c> is in 'maintenance' status%s.%d";const MAINTENANCE="maintenance";class Rule{getName(){return RULENAME}getDescription(){return DESCRIPTION}getShortDescription(){return SHORT_DESCRIPTION}register(regCtx){this._metaLib=regCtx.utils.metaLib;return{TsxWebComponent:this._onTag}}_onTag(ruleCtx,tsxComp){var status,tagName;tagName=tsxComp.name;if(status=this._metaLib.getTagStatus(tagName,MAINTENANCE)){let msg=MSG.replace("%c",tagName);;if(status.since){msg=msg.replace("%s",` (since ${status.since})`)}if(status.description){msg=msg.replace("%d",` ${status.description}`);if(!msg.endsWith(".")){msg+="."}}else{msg=msg.replace("%d","")}if(status.value?.length){let repl="<"+status.value.join(">, <")+">";msg+=` Superseded by ${repl}.`}let issue=new ruleCtx.Issue(msg);ruleCtx.reporter.addIssue(issue,ruleCtx)}}}module.exports=Rule;
6
+ const RULE="oj-tsx-wctag-maintenance";const DESCRIPTION="A notification that the component is in 'maintenance' status. This indicates "+"that the component is fully supported, but will be deprecated in a future release "+"and has no new features planned for it.";const SHORT_DESCRIPTION="The component is in 'maintenance' status and will be deprecated in a future release.";const MSG="<%c> is in 'maintenance' status%s.%d";const MAINTENANCE="maintenance";class Rule{getName(){return RULE}getDescription(){return DESCRIPTION}getShortDescription(){return SHORT_DESCRIPTION}register(regCtx){if(!this._getOverrides(regCtx)){return false}this._metaLib=regCtx.utils.metaLib;return{TsxWebComponent:this._onTag}}_onTag(ruleCtx,tsxComp){var stats,status,tagName;if(this._isIgnoreFile(ruleCtx.filepath)){return}tagName=tsxComp.name;if((stats=this._metaLib.getTagStatus(tagName,MAINTENANCE))&&stats.length){let msg=MSG.replace("%c",tagName);;status=stats[0];if(status.since){msg=msg.replace("%s",` (since ${status.since})`)}if(status.description){msg=msg.replace("%d",` ${status.description}`);if(!msg.endsWith(".")){msg+="."}}else{msg=msg.replace("%d","")}if(status.value?.length){let repl="<"+status.value.join(">, <")+">";msg+=` Superseded by ${repl}.`}let issue=new ruleCtx.Issue(msg);ruleCtx.reporter.addIssue(issue,ruleCtx)}}_isIgnoreFile(file){if(this._ignoreFiles){for(let i=0;i<this._ignoreFiles.length;i++){if(this._ignoreFiles[i].test(file)){return true}}}return false}_getOverrides(regCtx){var files,custOpts,files;if(!(custOpts=regCtx.ruleOpts.customOpts)){return true}if(!(files=custOpts.files)){return true}if(!Array.isArray(files)){regCtx.utils.msgLib.error(`Rule ${RULE} : config option 'files' is not an array`);return false}let ignoreFiles=[];for(let i=0;i<files.length;i++){if(typeof files[i]==="string"){try{ignoreFiles[i]=new RegExp(files[i].trim())}catch(e){regCtx.utils.msgLib.error(`Config 'ruleMods' ${RULE} 'files' entry [${i}]: ${e.message}`);return false}}}if(ignoreFiles.length){this._ignoreFiles=ignoreFiles}return true}}module.exports=Rule;