@oracle/oraclejet-audit 14.1.5 → 15.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.
- package/corePackMigrator/cli.js +6 -0
- package/corePackMigrator/corePackMigrator.js +10 -0
- package/corePackMigrator/metadata/avatarMetadata.json +40 -0
- package/corePackMigrator/metadata/buttonMetadata.json +55 -0
- package/corePackMigrator/metadata/collapsibleMetadata.json +15 -0
- package/corePackMigrator/metadata/filePickerMetadata.json +8 -0
- package/corePackMigrator/metadata/inputNumberMetadata.json +56 -0
- package/corePackMigrator/metadata/inputPasswordMetadata.json +50 -0
- package/corePackMigrator/metadata/inputTextMetadata.json +62 -0
- package/corePackMigrator/metadata/legendItemMetadata.json +8 -0
- package/corePackMigrator/metadata/legendMetadata.json +18 -0
- package/corePackMigrator/metadata/legendSectionMetadata.json +8 -0
- package/corePackMigrator/metadata/listItemLayoutMetadata.json +15 -0
- package/corePackMigrator/metadata/listviewMetadata.json +8 -0
- package/corePackMigrator/metadata/messagesMetadata.json +35 -0
- package/corePackMigrator/metadata/progressBarMetadata.json +15 -0
- package/corePackMigrator/metadata/progressCircleMetadata.json +8 -0
- package/corePackMigrator/metadata/ratingGaugeMetadata.json +78 -0
- package/corePackMigrator/metadata/selectManyMetadata.json +39 -0
- package/corePackMigrator/metadata/selectSingleMetadata.json +39 -0
- package/corePackMigrator/metadata/statusMeterGaugeMetadata.json +99 -0
- package/corePackMigrator/metadata/textAreaMetadata.json +44 -0
- package/corePackMigrator/resource/astUtils.js +6 -0
- package/corePackMigrator/resource/componentMigrator.js +6 -0
- package/corePackMigrator/resource/fileScanner.js +6 -0
- package/corePackMigrator/resource/htmlUtils.js +6 -0
- package/corePackMigrator/resource/manifest.json +102 -0
- package/corePackMigrator/resource/migrationConfig.json +21 -0
- package/corePackMigrator/templates/componentMetaData.json +119 -0
- package/corePackMigrator/templates/migrationConfig.json +17 -0
- package/corePackMigrator/utilities/logging.js +6 -0
- package/jaf-amd.js +1 -1
- package/lib/AST_Ts.js +1 -1
- package/lib/Cli.js +1 -1
- package/lib/Components.js +1 -1
- package/lib/Config.js +1 -1
- package/lib/ConfigLib.js +1 -1
- package/lib/DomUtils.js +1 -1
- package/lib/FileIndex.js +1 -1
- package/lib/FileSet.js +1 -1
- package/lib/FsUtils.js +1 -1
- package/lib/HtmlUtils.js +1 -1
- package/lib/JsonLoader.js +1 -1
- package/lib/MetaLib.js +1 -1
- package/lib/NetUtils.js +1 -1
- package/lib/Parser.js +1 -1
- package/lib/RegTypes.js +1 -1
- package/lib/Registry.js +1 -1
- package/lib/Reporter.js +1 -1
- package/lib/RulePack.js +1 -1
- package/lib/RuleSet.js +1 -1
- package/lib/Rules.js +1 -1
- package/lib/Scope.js +1 -1
- package/lib/Ts.js +1 -1
- package/lib/TsxUtils.js +1 -1
- package/lib/TsxUtils2.js +6 -0
- package/lib/Utils.js +1 -1
- package/lib/ZipUtils.js +1 -1
- package/lib/checkage.js +1 -1
- package/lib/cmdline.js +1 -1
- package/lib/defaults.js +1 -1
- package/lib/exportRules.js +1 -1
- package/lib/filetypes.js +1 -1
- package/lib/groups.js +1 -1
- package/lib/help.js +1 -1
- package/lib/jetver.js +1 -1
- package/lib/jsx.js +1 -1
- package/lib/maint.js +6 -0
- package/lib/manpage.js +1 -1
- package/lib/manual.js +1 -1
- package/lib/migrator.js +6 -0
- package/lib/msgidLoader.js +1 -1
- package/lib/ns.js +1 -1
- package/lib/outfile.js +1 -1
- package/lib/schema.js +1 -1
- package/lib/scopewalker.js +1 -1
- package/libext/expparser.js +1 -1
- package/meta/14.0.0/jetauditmeta.js +1 -1
- package/meta/14.1.0/jetauditmeta.js +1 -1
- package/meta/15.0.0/jetauditmeta.js +9 -0
- package/meta/metaverlist.json +1 -1
- package/package.json +16 -8
- package/profiles/redwood-strict.json +2 -1
- package/rulepacks/csp/csp-html-script-unsafe-inline.js +1 -1
- package/rulepacks/csp/csp-html-unsafe-expr.js +1 -1
- package/rulepacks/csp/csp-js-script-unsafe-eval.js +1 -1
- package/rulepacks/csp/csp-js-style-unsafe-inline.js +1 -1
- package/rulepacks/csp/csp-json-unsafe-expr.js +6 -0
- package/rulepacks/csp/msgid.json +1 -1
- package/rulepacks/csp/rules.json +1 -1
- package/rulepacks/jetwc/jetwc-absolute-jetversion.js +1 -1
- package/rulepacks/jetwc/jetwc-aria-redefinition.js +1 -1
- package/rulepacks/jetwc/jetwc-bootstrap.js +1 -1
- package/rulepacks/jetwc/jetwc-compjson-bp-ar.js +1 -1
- package/rulepacks/jetwc/jetwc-compjson-bp-obj.js +1 -1
- package/rulepacks/jetwc/jetwc-component-dependencies.js +1 -1
- package/rulepacks/jetwc/jetwc-component-displayname.js +1 -1
- package/rulepacks/jetwc/jetwc-component-foldername.js +1 -1
- package/rulepacks/jetwc/jetwc-component-location.js +1 -1
- package/rulepacks/jetwc/jetwc-component-type.js +1 -1
- package/rulepacks/jetwc/jetwc-css-oj-complete.js +1 -1
- package/rulepacks/jetwc/jetwc-css-pack-load-path.js +6 -0
- package/rulepacks/jetwc/jetwc-css-scoping.js +1 -1
- package/rulepacks/jetwc/jetwc-data-property-prefix.js +1 -1
- package/rulepacks/jetwc/jetwc-deprecated-lifecycle.js +1 -1
- package/rulepacks/jetwc/jetwc-disabled-property.js +1 -1
- package/rulepacks/jetwc/jetwc-displayname.js +1 -1
- package/rulepacks/jetwc/jetwc-dynamic-slot-context.js +1 -1
- package/rulepacks/jetwc/jetwc-event-displayname.js +1 -1
- package/rulepacks/jetwc/jetwc-events.js +1 -1
- package/rulepacks/jetwc/jetwc-exchange-images.js +1 -1
- package/rulepacks/jetwc/jetwc-jet-version.js +1 -1
- package/rulepacks/jetwc/jetwc-loader-file.js +1 -1
- package/rulepacks/jetwc/jetwc-markdown-link.js +1 -1
- package/rulepacks/jetwc/jetwc-method-displayname.js +1 -1
- package/rulepacks/jetwc/jetwc-methods.js +1 -1
- package/rulepacks/jetwc/jetwc-namespace.js +1 -1
- package/rulepacks/jetwc/jetwc-nested-defaults.js +1 -1
- package/rulepacks/jetwc/jetwc-nls-languages.js +1 -1
- package/rulepacks/jetwc/jetwc-nls-root.js +1 -1
- package/rulepacks/jetwc/jetwc-oj-register.js +1 -1
- package/rulepacks/jetwc/jetwc-ojcss.js +1 -1
- package/rulepacks/jetwc/jetwc-pack-children.js +1 -1
- package/rulepacks/jetwc/jetwc-packable-components.js +1 -1
- package/rulepacks/jetwc/jetwc-prerelease-dependencies.js +1 -1
- package/rulepacks/jetwc/jetwc-prerelease-pattern.js +1 -1
- package/rulepacks/jetwc/jetwc-prerelease-version.js +1 -1
- package/rulepacks/jetwc/jetwc-property-changed.js +1 -1
- package/rulepacks/jetwc/jetwc-property-displayname.js +1 -1
- package/rulepacks/jetwc/jetwc-property-nesting.js +1 -1
- package/rulepacks/jetwc/jetwc-property-translatable.js +1 -1
- package/rulepacks/jetwc/jetwc-public-modules.js +1 -1
- package/rulepacks/jetwc/jetwc-reference-npm-path.js +6 -0
- package/rulepacks/jetwc/jetwc-register-css.js +1 -1
- package/rulepacks/jetwc/jetwc-register-with-promises.js +1 -1
- package/rulepacks/jetwc/jetwc-require-paths.js +1 -1
- package/rulepacks/jetwc/jetwc-required-subproperty.js +1 -1
- package/rulepacks/jetwc/jetwc-reserved-property.js +1 -1
- package/rulepacks/jetwc/jetwc-schema.js +1 -1
- package/rulepacks/jetwc/jetwc-semantic-version.js +1 -1
- package/rulepacks/jetwc/jetwc-slot-displayname.js +1 -1
- package/rulepacks/jetwc/jetwc-slots.js +1 -1
- package/rulepacks/jetwc/jetwc-standard-files.js +1 -1
- package/rulepacks/jetwc/jetwc-status-since.js +6 -0
- package/rulepacks/jetwc/jetwc-unused-events.js +1 -1
- package/rulepacks/jetwc/jetwc-unused-slots.js +1 -1
- package/rulepacks/jetwc/jetwc-vb-category.js +1 -1
- package/rulepacks/jetwc/jetwc-vb-icon.js +1 -1
- package/rulepacks/jetwc/jetwc-vcomponent-jetversion.js +1 -1
- package/rulepacks/jetwc/jetwc-vcomponent-loader.js +1 -1
- package/rulepacks/jetwc/jetwc-vcomponent-version.js +1 -1
- package/rulepacks/jetwc/jetwc-version-openrange.js +1 -1
- package/rulepacks/jetwc/jetwc-writeback-required.js +1 -1
- package/rulepacks/jetwc/msgid.json +1 -1
- package/rulepacks/jetwc/rules.json +1 -1
- package/rulepacks/jetwc-lib/jetwcutils-auditComponentCacheManager.js +1 -1
- package/rulepacks/jetwc-lib/jetwcutils-commonListenerImpls.js +1 -1
- package/rulepacks/jetwc-lib/jetwcutils-componentAuditUtils.js +1 -1
- package/rulepacks/jetwc-lib/jetwcutils-componentFinder.js +1 -1
- package/rulepacks/jetwc-lib/jetwcutils-preCompiler.js +1 -1
- package/rulepacks/jetwc-lib/jetwcutils-tsxUtils.js +1 -1
- package/rulepacks/jetwco/jetwco-bootstrap.js +1 -1
- package/rulepacks/jetwco/jetwco-cacc-componentType.js +1 -1
- package/rulepacks/jetwco/jetwco-cacc-dependencies.js +1 -1
- package/rulepacks/jetwco/jetwco-cacc-dynamicSlots.js +1 -1
- package/rulepacks/jetwco/jetwco-cacc-eventBubbles.js +1 -1
- package/rulepacks/jetwco/jetwco-cacc-eventCancelable.js +1 -1
- package/rulepacks/jetwco/jetwco-cacc-eventPayload.js +1 -1
- package/rulepacks/jetwco/jetwco-cacc-events.js +1 -1
- package/rulepacks/jetwco/jetwco-cacc-helpers.js +1 -1
- package/rulepacks/jetwco/jetwco-cacc-jetVer.js +1 -1
- package/rulepacks/jetwco/jetwco-cacc-methodParamTypes.js +1 -1
- package/rulepacks/jetwco/jetwco-cacc-methodParams.js +1 -1
- package/rulepacks/jetwco/jetwco-cacc-methodReturnType.js +1 -1
- package/rulepacks/jetwco/jetwco-cacc-methods.js +1 -1
- package/rulepacks/jetwco/jetwco-cacc-packBundle.js +1 -1
- package/rulepacks/jetwco/jetwco-cacc-packBundleContent.js +1 -1
- package/rulepacks/jetwco/jetwco-cacc-packContent.js +1 -1
- package/rulepacks/jetwco/jetwco-cacc-properties.js +1 -1
- package/rulepacks/jetwco/jetwco-cacc-propertyDefault.js +1 -1
- package/rulepacks/jetwco/jetwco-cacc-propertyEnumeration.js +1 -1
- package/rulepacks/jetwco/jetwco-cacc-propertyReadOnly.js +1 -1
- package/rulepacks/jetwco/jetwco-cacc-propertyRequired.js +1 -1
- package/rulepacks/jetwco/jetwco-cacc-propertyType.js +1 -1
- package/rulepacks/jetwco/jetwco-cacc-propertyWriteback.js +1 -1
- package/rulepacks/jetwco/jetwco-cacc-publicModules.js +1 -1
- package/rulepacks/jetwco/jetwco-cacc-slotDataVariable.js +1 -1
- package/rulepacks/jetwco/jetwco-cacc-slotDataVariableType.js +1 -1
- package/rulepacks/jetwco/jetwco-cacc-slots.js +1 -1
- package/rulepacks/jetwco/jetwco-cacc-styleClasses.js +1 -1
- package/rulepacks/jetwco/jetwco-cacc-styleVariables.js +1 -1
- package/rulepacks/jetwco/jetwco-cacc-typeMappingOverrides.js +6 -0
- package/rulepacks/jetwco/jetwco-compjson-ns-reg.js +1 -1
- package/rulepacks/jetwco/jetwco-component-api-baseline-changes.js +1 -1
- package/rulepacks/jetwco/jetwco-component-api-changes.js +1 -1
- package/rulepacks/jetwco/jetwco-component-api-controlled-changes.js +1 -1
- package/rulepacks/jetwco/jetwco-component-cdn.js +1 -1
- package/rulepacks/jetwco/jetwco-description-standards.js +1 -1
- package/rulepacks/jetwco/jetwco-displayname-standards.js +1 -1
- package/rulepacks/jetwco/jetwco-exchange-version-check.js +1 -1
- package/rulepacks/jetwco/jetwco-license-info.js +1 -1
- package/rulepacks/jetwco/jetwco-prerelease-cdn.js +1 -1
- package/rulepacks/jetwco/jetwco-thirdparty-ba.js +1 -1
- package/rulepacks/jetwco/msgid.json +1 -1
- package/rulepacks/jetwco/rules.json +1 -1
- package/rules/jaf/jaf-ts-noparser.js +6 -0
- package/rules/jaf/msgid.json +1 -1
- package/rules/jaf/rules.json +1 -1
- package/rules/jet/helpers/has-slot-name.js +1 -1
- package/rules/jet/helpers/style-selector.js +1 -1
- package/rules/jet/helpers/tsx/has-slot-name.js +6 -0
- package/rules/jet/msgid.json +1 -1
- package/rules/jet/oj-acc-aria-labelledby.js +1 -1
- package/rules/jet/oj-cca-compjson-bp-ar.js +1 -1
- package/rules/jet/oj-cca-compjson-bp-obj.js +1 -1
- package/rules/jet/oj-css-bp-dir-flow.js +1 -1
- package/rules/jet/oj-html-attr-$unique.js +1 -1
- package/rules/jet/oj-html-attr-expr-delims.js +6 -0
- package/rules/jet/oj-html-combo-converter.js +1 -1
- package/rules/jet/oj-html-file-pick-accept.js +1 -1
- package/rules/jet/oj-html-form-bindif.js +1 -1
- package/rules/jet/oj-html-input-isodate.js +1 -1
- package/rules/jet/oj-html-invalid-doctype.js +1 -1
- package/rules/jet/oj-html-msgs-cat-text.js +1 -1
- package/rules/jet/oj-html-ojattr-deprecated.js +1 -1
- package/rules/jet/oj-html-ojattr-enum-deprecated.js +1 -1
- package/rules/jet/oj-html-ojtag-deprecated.js +1 -1
- package/rules/jet/oj-html-ojtag-ns.js +1 -1
- package/rules/jet/oj-html-rating-gauge-track-resize.js +6 -0
- package/rules/jet/oj-html-self-close.js +1 -1
- package/rules/jet/oj-html-slot-deprecated.js +1 -1
- package/rules/jet/oj-html-slot-item-minmax.js +1 -1
- package/rules/jet/oj-html-slot-name.js +1 -1
- package/rules/jet/oj-html-slot-pref-content.js +1 -1
- package/rules/jet/oj-html-style.js +1 -1
- package/rules/jet/oj-html-stylesel.js +1 -1
- package/rules/jet/oj-html-tabbar-edge.js +6 -0
- package/rules/jet/oj-html-unsup-theme.js +1 -1
- package/rules/jet/oj-html-wctag-maintenance.js +1 -1
- package/rules/jet/oj-html-wctag-nested.js +1 -1
- package/rules/jet/oj-html-wctag-supersedes.js +6 -0
- package/rules/jet/oj-js-numconv-pattern.js +6 -0
- package/rules/jet/oj-ts-numconv-pattern.js +6 -0
- package/rules/jet/oj-tsx-5-tag-obs.js +1 -1
- package/rules/jet/oj-tsx-acc-avatar-aria-role.js +6 -0
- package/rules/jet/oj-tsx-acc-button-onclick.js +1 -1
- package/rules/jet/oj-tsx-aria-ojselector-labelledby.js +1 -1
- package/rules/jet/oj-tsx-aria-prop.js +1 -1
- package/rules/jet/oj-tsx-attr-req.js +1 -1
- package/rules/jet/oj-tsx-cca-tagname.js +1 -1
- package/rules/jet/oj-tsx-combo-converter.js +1 -1
- package/rules/jet/oj-tsx-databind-all.js +1 -1
- package/rules/jet/oj-tsx-dlg-title.js +1 -1
- package/rules/jet/oj-tsx-form-bindif.js +6 -0
- package/rules/jet/oj-tsx-form-noflex.js +6 -0
- package/rules/jet/oj-tsx-input-isodate.js +1 -1
- package/rules/jet/oj-tsx-ojattr-deprecated.js +6 -0
- package/rules/jet/oj-tsx-ojattr-enum-deprecated.js +6 -0
- package/rules/jet/oj-tsx-ojattr-value.js +1 -1
- package/rules/jet/oj-tsx-ojattr.js +1 -1
- package/rules/jet/oj-tsx-ojtag-deprecated.js +1 -1
- package/rules/jet/oj-tsx-ojtag-ns.js +6 -0
- package/rules/jet/oj-tsx-pageopts-type.js +1 -1
- package/rules/jet/oj-tsx-picker-attrs.js +1 -1
- package/rules/jet/oj-tsx-prop-inline-definition.js +1 -1
- package/rules/jet/oj-tsx-rating-gauge-size.js +1 -1
- package/rules/jet/oj-tsx-rating-gauge-track-resize.js +6 -0
- package/rules/jet/oj-tsx-slot-deprecated.js +6 -0
- package/rules/jet/oj-tsx-slot-pref-content.js +6 -0
- package/rules/jet/oj-tsx-tabbar-edge.js +6 -0
- package/rules/jet/oj-tsx-unsup-theme.js +1 -1
- package/rules/jet/oj-tsx-wctag-maintenance.js +1 -1
- package/rules/jet/oj-tsx-wctag-nested.js +1 -1
- package/rules/jet/rules.json +1 -1
- package/schema/component-schema.json +1 -1
- package/src/JafCore.js +1 -1
- package/types/index.d.ts +6 -4
- package/rules/jet/oj-html-cspexpr.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 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+="."}}let issue=new ruleCtx.Issue(msg);ruleCtx.reporter.addIssue(issue,ruleCtx)}}}module.exports=Rule;
|
|
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;
|
|
@@ -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-nested";const DESCRIPTION="The following JET components cannot be nested: <oj-data-grid>, <oj-list-view>, <oj-table>, <oj-tree-view>, <oj-stream-list>, and <oj-waterfall-layout>";const SHORT_DESCRIPTION="Cannot nest <oj-data-grid>, <oj-list-view>, <oj-table>, <oj-tree-view>, <oj-stream-list>, and <oj-waterfall-layout>";const COMP_LIST=["oj-list-view","oj-table","oj-stream-list","oj-waterfall-layout","oj-tree-view","oj-data-grid"];const TAG="tag";const BODY="body";const OJ_SELECT_SINGLE="oj-select-single";class Rule{getName(){return RULENAME}getDescription(){return DESCRIPTION}getShortDescription(){return SHORT_DESCRIPTION}register(){return{webcomp:this._onWC}}_onWC(ruleCtx,tag){var ar,node,issue,i;if(ruleCtx.ojTag&&COMP_LIST.includes(tag)){ar=ruleCtx.elemStack;for(i=ar.length-2;i>=0;i--){node=ar[i];if(node.type!==TAG){continue}if(node.name===OJ_SELECT_SINGLE){break}if(node.name===tag){issue=new ruleCtx.Issue(`Nesting of <${tag}> is not supported`);ruleCtx.reporter.addIssue(issue,ruleCtx);break}else if(node.name===BODY){break}}}}};module.exports=Rule;
|
|
6
|
+
const RULENAME="oj-html-wctag-nested";const DESCRIPTION="The following JET components cannot be nested: <oj-data-grid>, <oj-list-view>, <oj-table>, <oj-tree-view>, <oj-stream-list>, and <oj-waterfall-layout>";const SHORT_DESCRIPTION="Cannot nest <oj-data-grid>, <oj-list-view>, <oj-table>, <oj-tree-view>, <oj-stream-list>, and <oj-waterfall-layout>";const COMP_LIST=["oj-list-view","oj-table","oj-stream-list","oj-waterfall-layout","oj-tree-view","oj-data-grid"];const TAG="tag";const BODY="body";const OJ_SELECT_SINGLE="oj-select-single";class Rule{getName(){return RULENAME}getDescription(){return DESCRIPTION}getShortDescription(){return SHORT_DESCRIPTION}register(regCtx){this._metaLib=regCtx.utils.metaLib;return{webcomp:this._onWC}}_onWC(ruleCtx,tag){var ar,node,issue,i;if(ruleCtx.ojTag&&COMP_LIST.includes(tag)){ar=ruleCtx.elemStack;for(i=ar.length-2;i>=0;i--){node=ar[i];if(node.type!==TAG){continue}if(node.name===OJ_SELECT_SINGLE||this._metaLib.isInterfaceImplemented(tag,"SelectSingleElement")){break}if(node.name===tag){issue=new ruleCtx.Issue(`Nesting of <${tag}> is not supported`);ruleCtx.reporter.addIssue(issue,ruleCtx);break}else if(node.name===BODY){break}}}}};module.exports=Rule;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright (c) 2018, 2023, 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-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;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright (c) 2018, 2023, Oracle and/or its affiliates.
|
|
3
|
+
* Licensed under The Universal Permissive License (UPL), Version 1.0
|
|
4
|
+
* as shown at https://oss.oracle.com/licenses/upl/
|
|
5
|
+
*/
|
|
6
|
+
const RULENAME="oj-js-numconv-pattern";const DESCRIPTION="Applications should not use the deprecated 'pattern' option of IntlNumberConverter because it is not locale "+"sensitive. Use other options instead like formatType, dateFormat and timeFormat, and if needed, set the "+"locale to be the preferred locale.";const SHORT_DESCRIPTION="The 'converterOptions' of IntlNumberConverter should not use the deprecated 'pattern' option.";const INTL_NUM_CONVERTER="IntlNumberConverter";const NUM_CONVERTER="NumberConverter";const NEW_EXPR="NewExpression";const PATTERN="pattern";class Rule{getName(){return RULENAME}getDescription(){return DESCRIPTION}getShortDescription(){return SHORT_DESCRIPTION}register(){return{MemberExpression:this._onMemExpr,CallExpression:this._onCallExpr,NewExpression:this._onNewExpr}}_onCallExpr(ruleCtx,node){var ce;if(ce=node.callee){if(ce.name===INTL_NUM_CONVERTER||ce.name===NUM_CONVERTER){this._checkConverterProps(ruleCtx,ce.name,node)}}}_onMemExpr(ruleCtx,node){if(node.property&&node.property.type==="Identifier"&&node.property.name==INTL_NUM_CONVERTER){if(node.parent&&node.parent.type===NEW_EXPR){if(node.parent.arguments){this._checkConverterProps(ruleCtx,node.property.name,node.parent)}}}}_onNewExpr(ruleCtx,node){var ce;if((ce=node.callee)&&(ce.name===INTL_NUM_CONVERTER||ce.name===NUM_CONVERTER)){this._checkConverterProps(ruleCtx,ce.name,node)}}_checkConverterProps(ruleCtx,callee,node){var args,arg,props;if((args=node.arguments)&&args.length>=1){arg=args[0];if(arg.type==="ObjectExpression"){if(props=arg.properties){let i,prop;for(i=0;i<props.length;i++){prop=props[i];if(prop.key&&prop.key.type==="Identifier"&&prop.key.name===PATTERN){this._emitIssue(ruleCtx,callee,prop)}}}}}}_emitIssue(ruleCtx,callee,prop){var md,deps,dep,since;if(md=ruleCtx.utils.metaLib._getObjectMetadata("oj.IntlNumberConverter")){if(md.typedef&&(md=md.typedef.ConverterOptions)){if(deps=md.ojdeprecated){for(let i=0;i<deps.length;i++){dep=deps[i];if(dep.for===PATTERN){if(dep.since){since=" (since "+dep.since+")"}else{since=""}break}}}}}let issue=new ruleCtx.Issue(`${callee} option 'pattern' is deprecated${since}.`);let pos=ruleCtx.utils.utils.getRowColFromIndex(ruleCtx.data,prop.start,"js");issue.setPosition(pos.row,pos.col,prop.start,prop.start+PATTERN.length-1);ruleCtx.reporter.addIssue(issue,ruleCtx)}}module.exports=Rule;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright (c) 2018, 2023, 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-ts-numconv-pattern";const DESCRIPTION="Applications should not use the deprecated 'pattern' option of IntlNumberConverter because it is not locale "+"sensitive. Use other options instead like formatType, dateFormat and timeFormat, and if needed, set the "+"locale to be the preferred locale.";const SHORT_DESCRIPTION="The 'converterOptions' of IntlNumberConverter should not use the deprecated 'pattern' option.";const INTL_NUM_CONVERTER="IntlNumberConverter";const NUM_CONVERTER="NumberConverter";const NEW_EXPR="NewExpression";const PATTERN="pattern";class Rule{getName(){return RULENAME}getDescription(){return DESCRIPTION}getShortDescription(){return SHORT_DESCRIPTION}register(){return{MemberExpression:this._onMemExpr,CallExpression:this._onCallExpr,NewExpression:this._onNewExpr}}_onCallExpr(ruleCtx,node){var ce;if(ce=node.callee){if(ce.name===INTL_NUM_CONVERTER||ce.name===NUM_CONVERTER){this._checkConverterProps(ruleCtx,ce.name,node)}}}_onMemExpr(ruleCtx,node){if(node.property&&node.property.type==="Identifier"&&node.property.name==INTL_NUM_CONVERTER){if(node.parent&&node.parent.type===NEW_EXPR){if(node.parent.arguments){this._checkConverterProps(ruleCtx,node.property.name,node.parent)}}}}_onNewExpr(ruleCtx,node){var ce;if((ce=node.callee)&&(ce.name===INTL_NUM_CONVERTER||ce.name===NUM_CONVERTER)){this._checkConverterProps(ruleCtx,ce.name,node)}}_checkConverterProps(ruleCtx,callee,node){var args,arg,props;if((args=node.arguments)&&args.length>=1){arg=args[0];if(arg.type==="ObjectExpression"){if(props=arg.properties){let i,prop;for(i=0;i<props.length;i++){prop=props[i];if(prop.key&&prop.key.type==="Identifier"&&prop.key.name===PATTERN){this._emitIssue(ruleCtx,callee,prop)}}}}}}_emitIssue(ruleCtx,callee,prop){var md,deps,dep,since;if(md=ruleCtx.utils.metaLib._getObjectMetadata("oj.IntlNumberConverter")){if(md.typedef&&(md=md.typedef.ConverterOptions)){if(deps=md.ojdeprecated){for(let i=0;i<deps.length;i++){dep=deps[i];if(dep.for===PATTERN){if(dep.since){since=" (since "+dep.since+")"}else{since=""}break}}}}}let issue=new ruleCtx.Issue(`${callee} option 'pattern' is deprecated${since}.`);let loc=prop.key.loc;issue.setPosition(loc.start.line,loc.start.column,prop.range[0],prop.range[0]+PATTERN.length-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 RULE_NAME="oj-tsx-5-tag-obs";const DESCRIPT="Obsolete HTML5 elements must not be used";const SHORT=DESCRIPT;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.
|
|
6
|
+
const RULE_NAME="oj-tsx-5-tag-obs";const DESCRIPT="Obsolete HTML5 elements must not be used";const SHORT=DESCRIPT;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;return{"TsxRenderComponent":this._onTsxRC}};Rule.prototype._onTsxRC=function(ruleCtx,tsxRC){tsxRC.components.forEach(tsxComp=>{this._checkComp(ruleCtx,tsxComp)})};Rule.prototype._checkComp=function(ruleCtx,tsxComp){var tagName=tsxComp.name;if(this._tsxUtils.isHtml5ObsoleteElem(tagName)){let issue=new ruleCtx.Issue(`Element <${tagName}> is obsolete in HTML5`);issue.setPosition(tsxComp.loc.start.line,tsxComp.loc.start.column,tsxComp.range[0],tsxComp.range[1]);ruleCtx.reporter.addIssue(issue,ruleCtx)}if(tsxComp.children){tsxComp.children.forEach(child=>{this._checkComp(ruleCtx,child)})}};module.exports=Rule;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright (c) 2018, 2023, 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="oj-tsx-acc-avatar-aria-role";const SHORT="<oj-avatar> and <oj-c-avatar> must have an 'aria-label' or 'aria-labelledby' attribute if role=\"img\" has been specified";const LONG="For accessibility, <oj-avatar> and <oj-c-avatar> must have an <i>'aria-label'</i> or </i>'aria-labelledby'</i> attribute if <i>role='img'</i> has been specified";const ROLE="role";const ARIA_LABEL="aria-label";const ARIA_LABELLEDBY="aria-labelledby";function getName(){return RULE}function getShortDescription(){return SHORT}function getDescription(){return LONG}function register(){return{"Tsx<oj-avatar>":_onAvatar,"Tsx<oj-c-avatar>":_onAvatar}};function _onAvatar(ruleCtx,tsxComp){var tsxUtils=ruleCtx.utils.tsxUtils;var tsxProp;if(tsxProp=_isRoleImg(tsxComp,tsxUtils)){if(!(tsxUtils.getProperty(tsxComp,ARIA_LABEL)||tsxUtils.getProperty(tsxComp,ARIA_LABELLEDBY))){let issue=new ruleCtx.Issue(`'role' attribute of 'img' specified on <${tsxComp.name}>, but 'aria-label' or 'aria-labelledby' is missing`);tsxUtils.setIssuePosition(issue,tsxProp);ruleCtx.reporter.addIssue(issue,ruleCtx)}}};function _isRoleImg(tsxComp,tsxUtils){var tsxProp;if((tsxProp=tsxUtils.getProperty(tsxComp,ROLE))||(tsxProp=tsxUtils.isPropertyString(tsxProp))){return tsxProp.node.value.value==="img"?tsxProp:null}};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
|
|
6
|
+
const RULE="oj-tsx-acc-button-onclick";const LONG="The ojAction event should be used in place of onClick for button-like components, because it is triggered by both mouse and keyboard.";const SHORT="The ojAction event should be used in place of onClick for button-like components.";const ON_CLICK="onClick";class Rule{getName(){return RULE}getDescription(){return LONG}getShortDescription(){return SHORT}register(regCtx){this._tsxUtils=regCtx.utils.tsxUtils;return{"Tsx<oj-action-card>":this._onBtn,"Tsx<oj-button>":this._onBtn,"Tsx<oj-menu-button>":this._onBtn,"Tsx<oj-c-button>":this._onBtn}}_onBtn(ruleCtx,tsxComp){var tsxProp;if(tsxProp=this._tsxUtils.getProperty(tsxComp,ON_CLICK)){let issue=new ruleCtx.Issue(`<${tsxComp.name}> 'onClick' event attribute - replace with 'onOjAction'`);this._tsxUtils.setIssuePosition(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
|
|
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;
|
|
@@ -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
|
|
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;
|
|
@@ -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-attr-req";const SHORT_DESCR="Check that a
|
|
6
|
+
const RULE_NAME="oj-tsx-attr-req";const SHORT_DESCR="Check that a Web Component element contains all mandatory properties";const LONG_DESCR="A Web Component property which is mandatory, must be declared on the web component element.";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{TsxRenderComponent:this._onTsxRC}};Rule.prototype._onTsxRC=function(ruleCtx,tsxRC){tsxRC.components.forEach(tsxTag=>{this._checkComp(ruleCtx,tsxTag)})};Rule.prototype._checkComp=function(ruleCtx,tsxComp){if(tsxComp.isWCTag){let tagName=tsxComp.name;let req=this._metaLib.getRequiredAttrs(tagName);if(req&&req.length){if(tsxComp.properties&&tsxComp.properties.length){this._flushReqdAttribs(ruleCtx,tsxComp,req)}else{this._flushAllReqdAttribs(ruleCtx,tsxComp,req)}}}if(tsxComp.children)tsxComp.children.forEach(child=>{this._checkComp(ruleCtx,child)})};Rule.prototype._flushAllReqdAttribs=function(ruleCtx,tsxComp,req){var val,issue,loc,i;val=req.length+" required property"+(req.length>1?"s":"")+": ";for(i=0;i<req.length;i++){val+=i?", ":"";val+="'"+req[i]+"'"}val+=" missing on <"+tsxComp.name+">";issue=new ruleCtx.Issue(val);loc=tsxComp.loc;issue.setPosition(loc.start.line,loc.start.column,tsxComp.range[0],tsxComp.range[1]);ruleCtx.reporter.addIssue(issue,ruleCtx)};Rule.prototype._flushReqdAttribs=function(ruleCtx,tsxComp,req){var tsxProps,tsxProp,aReq,reqMajor,aProp,propMajor,exprObj,name,attrReq,issue,found,i,j,k,n,issue;tsxProps=tsxComp.properties;n=0;for(i=0;i<req.length;i++){attrReq=req[i];aReq=attrReq.split(".");reqMajor=aReq[0];found=false;for(j=0;j<tsxProps.length;j++){tsxProp=tsxProps[j];if(!(name=tsxProp.name)){continue}aProp=name.split(".");propMajor=aProp[0];if(name===reqMajor){if(aReq.length===1){n++;found=true;break}if(!(exprObj=this._tsxUtils.getExpressionObject(tsxProp))){break}let soFar=exprObj;for(k=1;k<aReq.length;k++){let keys;if((keys=Object.keys(soFar))&&keys.length){if(keys.indexOf(aReq[k])>=0){soFar=soFar[aReq[k]];continue}break}}if(found=k>=aReq.length){n++};}}if(n===req.length){return}if(!found){let loc=tsxComp.loc;issue=new ruleCtx.Issue(`Required property '${attrReq}' is missing on <${tsxComp.name}>`);issue._msgEx={reqAttr:attrReq};issue.setPosition(loc.start.line,loc.start.column,tsxComp.range[0],tsxComp.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 RULE_NAME="oj-tsx-cca-tagname";const SHORT_DESCRIPT="Web component element names must be defined";const LONG_DESCRIPT="The web component is unknown to JAF. Check the spelling, or review the associated component.json "+"metadata. This may also occur because the web component's metadata has not been declared to "+"JAF via the configuration property 'components', or because the element name makes use of "+"an unregistered \"oj-\" namespace. For JET core pack components, check that the configuration "+"property 'jetCorePack', if specified, is correct.";const IGNORE_LIST=["oj-slot","oj-dynamic-form"];function Rule(){this._ignoreList=null}Rule.prototype.getName=function(){return RULE_NAME};Rule.prototype.getShortDescription=function(){return SHORT_DESCRIPT};Rule.prototype.getDescription=function(){return LONG_DESCRIPT};Rule.prototype.register=function(regCtx){if(!this._getIgnoreOverrides(regCtx)){return false}this._tsxUtils=regCtx.utils.
|
|
6
|
+
const RULE_NAME="oj-tsx-cca-tagname";const SHORT_DESCRIPT="Web component element names must be defined";const LONG_DESCRIPT="The web component is unknown to JAF. Check the spelling, or review the associated component.json "+"metadata. This may also occur because the web component's metadata has not been declared to "+"JAF via the configuration property 'components', or because the element name makes use of "+"an unregistered \"oj-\" namespace. For JET core pack components, check that the configuration "+"property 'jetCorePack', if specified, is correct.";const IGNORE_LIST=["oj-slot","oj-dynamic-form"];function Rule(){this._ignoreList=null}Rule.prototype.getName=function(){return RULE_NAME};Rule.prototype.getShortDescription=function(){return SHORT_DESCRIPT};Rule.prototype.getDescription=function(){return LONG_DESCRIPT};Rule.prototype.register=function(regCtx){if(!this._getIgnoreOverrides(regCtx)){return false}this._tsxUtils=regCtx.utils.tsxUtils;return{"TsxRenderComponent":this._onTsxRC}};Rule.prototype._onTsxRC=function(ruleCtx,tsxRC){tsxRC.components.forEach(tsxComp=>{this._checkComp(ruleCtx,tsxComp)})};Rule.prototype._checkComp=function(ruleCtx,tsxComp){var tagName=tsxComp.name;if(tagName.includes("-")){if(!(this._tsxUtils.isCommonElem(tagName)||this._tsxUtils.isHtml5ObsoleteElem(tagName)||tagName==="template"||this._isSvg(ruleCtx,tagName))){if(!ruleCtx.utils.metaLib.isWCTag(tagName)&&!IGNORE_LIST.includes(tagName)&&!this._checkOverrides(tagName)){this._emitIssue(ruleCtx,tsxComp)}}}if(tsxComp.children){tsxComp.children.forEach(child=>{this._checkComp(ruleCtx,child)})}};Rule.prototype._emitIssue=function(ruleCtx,tsxComp){var tagName=tsxComp.name;var b=tagName.includes("-");var s=b?"web component":"tag";var issue=new ruleCtx.Issue(`<${tagName}> is not a known ${s}`);if(b){issue.setMsgKey(RULE_NAME+"_1")}this._tsxUtils.setIssuePosition(issue,tsxComp);ruleCtx.reporter.addIssue(issue,ruleCtx)};Rule.prototype._checkOverrides=function(tagName){if(this._ignoreList){for(let i=0;i<this._ignoreList.length;i++){if(this._ignoreList[i].test(tagName)){return true}}}return false};Rule.prototype._getIgnoreOverrides=function(regCtx){var ignore,customOpts;if(!(customOpts=regCtx.ruleOpts.customOpts)){return true}if(ignore=customOpts.ignore){if(!Array.isArray(ignore)){regCtx.utils.msgLib.error(`Rule ${RULE_NAME} : config option 'ignore' is not an array`);return false}this._ignoreList=[];for(let i=0;i<ignore.length;i++){if(typeof ignore[i]==="string"){try{this._ignoreList[i]=new RegExp(ignore[i].trim())}catch(e){regCtx.utils.msgLib.error(`Config 'ruleMods' ${RULE_NAME} 'ignore' entry [${i}]: ${e.message}`);return false}}}}return true};Rule.prototype._isSvg=function(ruleCtx,elem){var ret=false,n;if(elem==="svg"){return true}if(this._tsxUtils.isSvgElem(elem)){n=ruleCtx.tagNode;while(n){n=n.parent;if(!n){break}if(n.name&&n.name==="svg"){ret=true;break}}}return ret};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-combo-converter";const SHORT_DESCRIPTION="Starting in JET 10.0.0, oj-combobox-one/many will not apply the converter to format the display label of the dropdown items";const DESCRIPTION=SHORT_DESCRIPTION+" It will be the application's responsibility to provide option items with already-formatted labels, potentially by calling the converter instance directly.";const PROP_CONVERTER="converter";class Rule{getName(){return RULENAME}getDescription(){return DESCRIPTION}getShortDescription(){return SHORT_DESCRIPTION}register(regCtx){this._tsxUtils=regCtx.utils.
|
|
6
|
+
const RULENAME="oj-tsx-combo-converter";const SHORT_DESCRIPTION="Starting in JET 10.0.0, oj-combobox-one/many will not apply the converter to format the display label of the dropdown items";const DESCRIPTION=SHORT_DESCRIPTION+" It will be the application's responsibility to provide option items with already-formatted labels, potentially by calling the converter instance directly.";const PROP_CONVERTER="converter";class Rule{getName(){return RULENAME}getDescription(){return DESCRIPTION}getShortDescription(){return SHORT_DESCRIPTION}register(regCtx){this._tsxUtils=regCtx.utils.tsxUtils;return{"Tsx<oj-combobox-one>":this._onCombo,"Tsx<oj-combobox-many>":this._onCombo}}_onCombo(ruleCtx,tsxComp){let attrib;if(attrib=this._tsxUtils.getProperty(tsxComp,PROP_CONVERTER)){let issue=new ruleCtx.Issue(`<${tsxComp.name}> use of 'converter' - in JET >= 10.0.0, this will not format the display label of the dropdown items`);this._tsxUtils.setIssuePosition(issue,attrib);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
|
|
6
|
+
const RULE="oj-tsx-databind-all";const HELP="A 'data-bind' property has been found! Knockout is not included, and should not be used, in a Virtual DOM (VDOM) architecture based application. "+"The use of State and Properties should be used in place of Knockout.";const DATA_BIND="data-bind";function getName(){return RULE}function getShortDescription(){return HELP}function getDescription(){return HELP}function register(){return{TsxComponent:function(ruleCtx,tsxComp){let tsxProp;if(tsxProp=ruleCtx.utils.tsxUtils.getProperty(tsxComp,DATA_BIND)){let issue=new ruleCtx.Issue(`'data-bind' property found on <${tsxComp.name}> - remove.`);ruleCtx.utils.tsxUtils.setIssuePosition(issue,tsxProp);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-dlg-title";const SHORT_DESCR="Check that <oj-dialog> attribute is not specified";const LONG_DESCR="<oj-dialog> : 'title' attribute should not be used - use 'dialog-title' instead.";const MSG="<oj-dialog> attribute 'title' should be replaced with 'dialog-title'";function getName(){return RULE_NAME};function getShortDescription(){return SHORT_DESCR};function getDescription(){return LONG_DESCR};function register(regCtx){
|
|
6
|
+
const RULE_NAME="oj-tsx-dlg-title";const SHORT_DESCR="Check that <oj-dialog> attribute is not specified";const LONG_DESCR="<oj-dialog> : 'title' attribute should not be used - use 'dialog-title' instead.";const MSG="<oj-dialog> attribute 'title' should be replaced with 'dialog-title'";function getName(){return RULE_NAME};function getShortDescription(){return SHORT_DESCR};function getDescription(){return LONG_DESCR};function register(regCtx){return{"Tsx<oj-dialog>":_onDlg}};function _onDlg(ruleCtx,tsxComp){let tsxProp,tsxUtils=ruleCtx.utils.tsxUtils;if(tsxProp=tsxUtils.getProperty(tsxComp,"title")){let issue=new ruleCtx.Issue(MSG);tsxUtils.setIssuePosition(issue,tsxProp);ruleCtx.reporter.addIssue(issue,ruleCtx)}};module.exports={getName,getDescription,getShortDescription,register};
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright (c) 2018, 2023, 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-form-bindif";const DESCRIPTION="<oj-form-layout> is meant to have static content only. The use of <oj-bind-for-each> or <oj-bind-if> is not supported";const SHORT_DESCRIPTION="The use of <oj-bind-for-each> or <oj-bind-if> inside <oj-form-layout> is not supported";const OJ_BIND_IF="oj-bind-if";const OJ_BIND_FOR_EACH="oj-bind-for-each";const COLUMN="column";const MAX_COLUMNS="max-columns";const DIRECTION="direction";class Rule{getName(){return RULENAME}getDescription(){return DESCRIPTION}getShortDescription(){return SHORT_DESCRIPTION}register(){return{"Tsx<oj-form-layout>":this._onForm}}_onForm(ruleCtx,tsxComp){let tsxUtils=ruleCtx.utils.tsxUtils;let val;if(val=tsxUtils.getPropertyRawValue(tsxComp,DIRECTION,true)){if(val!==COLUMN){let maxcol=tsxUtils.getPropertyRawValue(tsxComp,MAX_COLUMNS,true);if(!maxcol||isNaN(maxcol)||maxcol>1){this._walkDomChildren(ruleCtx,tsxComp)}}}}_emit(ruleCtx,tsxComp){let issue=new ruleCtx.Issue(`<oj-form-layout> is meant to have static content only. The use of <${tsxComp.name}> is not supported`);ruleCtx.utils.tsxUtils.setIssuePosition(issue,tsxComp);ruleCtx.reporter.addIssue(issue,ruleCtx)}_walkDomChildren(ruleCtx,comp){var ch,tsxComp,i,ok=true;;if(ch=comp.children){for(i=0;i<ch.length;i++){tsxComp=ch[i];if(tsxComp.name===OJ_BIND_FOR_EACH){ok=false;this._emit(ruleCtx,tsxComp)}else if(tsxComp.name===OJ_BIND_IF){if(tsxComp.children&&tsxComp.children.length>1){ok=false;this._emit(ruleCtx,tsxComp)}}}}return ok}}module.exports=Rule;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright (c) 2018, 2023, 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-form-noflex";const DESCRIPTION="Flex styling, as indicated by the 'oj-flex class', should only be applied in cases where the developer can then "+"indicate any managed child elements using the 'oj-flex-item' class. It cannot be applied to JET components "+"where the developer has no direct access to any child elements, for example, form controls. Doing so may "+"inadvertently interfere with the internal layout of those components.";const SHORT_DESCRIPTION="Flex styling, as indicated by the 'oj-flex' class, should only be applied in cases where the developer can then "+"indicate any managed child elements using the oj-flex-item class.";const FORM_CONTROLS=["oj-checkboxset","oj-radioset","oj-slider","oj-switch","oj-text-area","oj-c-text-area"];const CLASS="class";class Rule{getName(){return RULENAME}getDescription(){return DESCRIPTION}getShortDescription(){return SHORT_DESCRIPTION}register(regCtx){this._tsxUtils=regCtx.utils.tsxUtils;return{TsxJetComponent:this._onOjTag}}_onOjTag(ruleCtx,tsxComp){var clazz,flex;if(!_isFormControl(tsxComp.name)){return}if(this._tsxUtils.isPropertyString(tsxComp,CLASS)){clazz=this._tsxUtils.getPropertyRawValue(tsxComp,CLASS,true);if(flex=_isOjFlex(clazz)){let issue=new ruleCtx.Issue(`Form control <${tsxComp.name}> should not use JET flex class '${flex}'`);this._tsxUtils.setIssuePosition(issue,this._tsxUtils.getProperty(tsxComp,CLASS));ruleCtx.reporter.addIssue(issue,ruleCtx)}}}}function _isOjFlex(clazz){var ar,attr,ret,i;ar=clazz.split(" ");for(i=0;i<ar.length;i++){attr=ar[i].trim();if(attr==="oj-flex"){ret=attr;break}}return ret};function _isFormControl(tag){return tag.startsWith("oj-input-")||tag.startsWith("oj-combobox-")||tag.startsWith("oj-label-")||tag.startsWith("oj-select-")||tag.startsWith("oj-color-")||tag.startsWith("oj-c-input-")||tag.startsWith("oj-c-select-")||FORM_CONTROLS.includes(tag)};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-input-isodate";const DESCRIPTION="Date/time strings used in the 'value', 'min, and 'max' attributes of web components "+"<oj-input-date>, oj-input-date-time>, <oj-input-time>, <oj-date-picker>, and <oj-date-time-picker>, "+"must be valid ISO-8061 strings, and have the same format type - zulu, offset, or local. ";const SHORT_DESCRIPTION="Date/time strings used in the 'value', 'min, and 'max' attributes of <oj-date-*> and <oj-input-date-*>, "+"must have the same format type - zulu, offset, or local. ";const TARG_COMPONENTS=["oj-input-date","oj-input-date-time","oj-input-time","oj-date-picker","oj-date-time-picker"];const ISO_DATE_REGEXP=/^[+-]?\d{4}(?:-\d{2}(?:-\d{2})?)?(?:T\d{2}:\d{2}(?::\d{2}(?:\.\d{1,3})?)?(Z|[+-]\d{2}(?::?\d{2})?)?)?$|^T\d{2}:\d{2}(?::\d{2}(?:\.\d{1,3})?)?(Z|[+-]\d{2}(?::?\d{2})?)?$/;class Rule{getName(){return RULENAME}getDescription(){return DESCRIPTION}getShortDescription(){return SHORT_DESCRIPTION}register(regCtx){this._tsxUtils=regCtx.utils.
|
|
6
|
+
const RULENAME="oj-tsx-input-isodate";const DESCRIPTION="Date/time strings used in the 'value', 'min, and 'max' attributes of web components "+"<oj-input-date>, oj-input-date-time>, <oj-input-time>, <oj-date-picker>, and <oj-date-time-picker>, "+"must be valid ISO-8061 strings, and have the same format type - zulu, offset, or local. ";const SHORT_DESCRIPTION="Date/time strings used in the 'value', 'min, and 'max' attributes of <oj-date-*> and <oj-input-date-*>, "+"must have the same format type - zulu, offset, or local. ";const TARG_COMPONENTS=["oj-input-date","oj-input-date-time","oj-input-time","oj-date-picker","oj-date-time-picker"];const ISO_DATE_REGEXP=/^[+-]?\d{4}(?:-\d{2}(?:-\d{2})?)?(?:T\d{2}:\d{2}(?::\d{2}(?:\.\d{1,3})?)?(Z|[+-]\d{2}(?::?\d{2})?)?)?$|^T\d{2}:\d{2}(?::\d{2}(?:\.\d{1,3})?)?(Z|[+-]\d{2}(?::?\d{2})?)?$/;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._checkComp,"Tsx<oj-input-date-time>":this._checkComp,"Tsx<oj-input-time>":this._checkComp,"Tsx<oj-date-picker>":this._checkComp,"Tsx<oj-date-time-picker>":this._checkComp}}_checkComp(ruleCtx,tsxComp){let value,min,max;this._tsxComp=tsxComp;this._isErr=this._isValExpr=this._isMinExpr=this._isMaxExpr=false;if(this._propValue=this._tsxUtils.getProperty(tsxComp,"value")){if(!this._tsxUtils.isPropertyPreactExpr(this._propValue)){value=_getRawValue(this._propValue)}}if(this._propMin=this._tsxUtils.getProperty(tsxComp,"min")){if(!this._tsxUtils.isPropertyPreactExpr(this._propMin)){min=_getRawValue(this._propMin)}}if(this._propMax=this._tsxUtils.getProperty(tsxComp,"max")){if(!this._tsxUtils.isPropertyPreactExpr(this._propMax)){max=_getRawValue(this._propMax)}}this._isValid(ruleCtx,value,min,max)}_isValid(ruleCtx,value,min,max){if(value){this._isValExpr=_isExpr(value);if(!this._isValExpr&&!ISO_DATE_REGEXP.test(value)){this._emitIssue(ruleCtx,"value",value,1)}}if(min){this._isMinExpr=_isExpr(min);if(!this._isMinExpr&&!ISO_DATE_REGEXP.test(min)){this._emitIssue(ruleCtx,"min",min,2)}}if(max){this._isMaxExpr=_isExpr(max);if(!this._isMaxExpr&&!ISO_DATE_REGEXP.test(max)){this._emitIssue(ruleCtx,"max",max,3)}}if(this._isErr){return}this._checkZone(ruleCtx,value,min,max);if(!this._isErr){this._isMinGtMax(ruleCtx,min,max);this._isTimeOnlyValue(ruleCtx,value,min,max)}}_checkZone(ruleCtx,value,min,max){var fmtValue,fmtMin,fmtMax,fmtErr;if(value&&!this._isValExpr){fmtValue=this._getISOStrFormatType(value);if(fmtValue===null){fmtErr="value"}}if(min&&!this._isMinExpr){fmtMin=this._getISOStrFormatType(min);if(fmtMin===null){fmtErr="min"}}if(max&&!this._isMaxExpr){fmtMax=this._getISOStrFormatType(max);if(fmtMax===null){fmtErr="max"}}if(fmtErr){this._emitIssue(ruleCtx,fmtErr,null,9);return}if(value&&fmtValue){if(min&&fmtMin&&max&&fmtMax&&!(fmtValue===fmtMin&&fmtValue===fmtMax)){this._emitIssue(ruleCtx,fmtValue,null,5)}else{if(min&&fmtMin&&!(fmtValue===fmtMin)){this._emitIssue(ruleCtx,fmtValue,null,6)}if(max&&fmtMax&&!(fmtValue===fmtMax)){this._emitIssue(ruleCtx,fmtValue,null,7)}}}if(min&&fmtMin&&max&&fmtMax&&!(fmtMin===fmtMax)){this._emitIssue(ruleCtx,fmtValue,fmtMax,8)}}_isTimeOnlyValue(ruleCtx,value,min,max){if(value&&!this._isValExpr&&value.startsWith("T")){if(min&&!this._isMinExpr&&!min.startsWith("T")){this._emitIssue(ruleCtx,"min",null,10)}if(max&&!this._isMaxExpr&&!min.startsWith("T")){this._emitIssue(ruleCtx,"max",null,10)}}}_isMinGtMax(ruleCtx,min,max){if(min&&!this._isMinExpr&&max&&!this._isMaxExpr){if(_compareISODates(max,min)<=0){this._emitIssue(ruleCtx,null,null,4)}}}_getISOStrFormatType(isoStr){let format=null;var exe=ISO_DATE_REGEXP.exec(isoStr);if(exe){if(exe[1]===undefined&&exe[2]===undefined){format="local"}else{let timeZone=exe[1]!==undefined?exe[1]:exe[2];format=timeZone==="Z"?"zulu":"offset"}}return format}_emitIssue(ruleCtx,str,val,id){var issue,tsxProp;switch(id){case 1:case 2:case 3:{issue=new ruleCtx.Issue(`Attrib '${str}' : Invalid ISO-8601 time/date string`);if(id===1){tsxProp=this._propValue}else if(id===2){tsxProp=this._propMin}else{tsxProp=this._propMax}this._tsxUtils.setIssuePropValuePosition(issue,tsxProp);break}case 4:issue=new ruleCtx.Issue(`min' attribute value is greater than 'max'`);tsxProp=this._propMin;break;case 5:issue=new ruleCtx.Issue(`'min' and 'max' must be same ISO string format as 'value' (${str})`);tsxProp=this._propMin;break;case 6:issue=new ruleCtx.Issue(`'min' must be same ISO string format as 'value' (${str})`);tsxProp=this._propMin;break;case 7:issue=new ruleCtx.Issue(`'max' must be same ISO string format as 'value' (${str}))`);tsxProp=this._propMax;break;case 8:issue=new ruleCtx.Issue(`'min' and 'max' must be same ISO string format. 'min'= ${str}, 'max'=${val}`);tsxProp=this._propMin;break;case 9:issue=new ruleCtx.Issue(`Error determining ISO string format of '${str}'`);if(str==="value"){tsxProp=this._propValue}else if(str==="min"){tsxProp=this._propMin}else{tsxProp=this._propMax}break;case 10:issue=new ruleCtx.Issue(`value' is a time-only string, but '${str}' includes a date`);tsxProp=str==="min"?this._propMin:this._propMax;break}if(issue){if(id>=4&&tsxProp){this._tsxUtils.setIssuePosition(issue,tsxProp)}this._isErr=true;if(id>1){issue.setMsgKey(RULENAME+"_"+(id-1))}ruleCtx.reporter.addIssue(issue,ruleCtx)}}}function _getRawValue(tsxProp){var ret;if(tsxProp){ret=tsxProp.valueRaw;if(ret.charAt(0)==="\""){ret=ret.substring(1,ret.length-1)}}return ret};function _isExpr(s){return s.startsWith("[[")||s.startsWith("{{")};function _compareISODates(maxIso,minIso){const today=new Date;const month=today.getMonth()+1;let monthStr=_zeroPad(month.toString(),2);const day=today.getDate();let dayStr=_zeroPad(day.toString(),2);const todayIsoDate=today.getFullYear()+"-"+monthStr+"-"+dayStr;let isoString1=maxIso;let isoString2=minIso;const maxStartsWithT=maxIso.indexOf("T")===0;const minStartsWithT=minIso.indexOf("T")===0;const maxHasNoT=maxIso.indexOf("T")===-1;const minHasNoT=minIso.indexOf("T")===-1;const zeroTime="T00:00:00";if(maxStartsWithT){isoString1=todayIsoDate+isoString1}else if(maxHasNoT){isoString1+=zeroTime}if(minStartsWithT){isoString2=todayIsoDate+isoString2}else if(minHasNoT){isoString2+=zeroTime}const dateMax=new Date(isoString1);const dateMin=new Date(isoString2);return dateMax.getTime()-dateMin.getTime()};function _getAttrib(ruleCtx,attr){return _getNodeAttrib(ruleCtx,ruleCtx.node,attr)};function _getNodeAttrib(ruleCtx,node,attr){var du=ruleCtx.utils.DomUtils;return du.getAttribValue(node,attr)||du.getAttribValue(node,":"+attr)};function _zeroPad(s,n){s=s.trim(s);if(s.length<n){s="0".repeat(n-s.length)+s}return s};module.exports=Rule;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright (c) 2018, 2023, 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="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;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright (c) 2018, 2023, 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-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};
|
|
@@ -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.
|
|
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;
|
|
@@ -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="
|
|
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;
|
|
@@ -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 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){
|
|
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;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright (c) 2018, 2023, 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-ojtag-ns";const LONG="Web component namespaces starting with prefixes 'oj-' or 'ns-' must be registered. A component must not use an un-registered namespace.";const SHORT="Web component namespaces starting with prefixes 'oj-' or 'ns-' must be registered.";class Rule{getName(){return RULENAME}getDescription(){return LONG}getShortDescription(){return SHORT}register(regCtx){this._metaLib=regCtx.utils.metaLib;return{"TsxRenderComponent":this._onTsxRC}}_onTsxRC(ruleCtx,tsxRC){tsxRC.components.forEach(tsxComp=>{this._onTag(ruleCtx,tsxComp);if(tsxComp.children){tsxComp.children.forEach(child=>{this._onTag(ruleCtx,child)})}})}_onTag(ruleCtx,tsxComp){var tagName,a,prefix,msg,i;tagName=tsxComp.name;if(!tagName.includes("-")||tagName.startsWith("demo-")||tagName.startsWith("my-")||tagName==="oj-slot"||tsxComp.ojNS||tagName.charAt(0)===tagName.charAt(0).toUpperCase()){return}if(tagName.startsWith("oj-")||tagName.startsWith("ns-")){if(!ruleCtx.utils.metaLib.isNamespaceTag(tagName)){if(!ruleCtx.utils.metaLib.isJetTag(tagName)){msg=`<${tagName}> : unregistered use of '${tagName.substring(0,2)}' namespace`;this._emitIssue(ruleCtx,tsxComp,msg)}}}else{if(this._nameSpaces){a=tagName.split("-");prefix=a[0]+"-"+a[1];for(i=0;i<this._nameSpaces.length;i++){if(this._nameSpaces[i].startsWith(prefix)){return}}}msg=`'${tagName}' : use of unknown web component namespace`;this._emitIssue(ruleCtx,tsxComp,msg,1)}}_emitIssue(ruleCtx,tsxComp,msg,id){var issue;issue=new ruleCtx.Issue(msg);if(id){issue.setMsgKey(`${RULENAME}_${id}`)}ruleCtx.utils.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 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
|
|
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;
|
|
@@ -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="
|
|
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;
|
|
@@ -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-prop-inline-definition";const SHORT="Inline defintion of complex objects in component property assignments can cause unnecessary changes to the DOM.";const LONG="When properties are assigned to objects,
|
|
6
|
+
const RULE_NAME="oj-tsx-prop-inline-definition";const SHORT="Inline defintion of complex objects in component property assignments can cause unnecessary changes to the DOM.";const LONG="When properties are assigned to objects or arrays, the value should not be defined inline with the property "+"assignment but rather should be defined separately.This will prevent unnecessary changes to the live DOM from "+"render to render.";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;return{"Tsx<template>":this._onTemplate}};Rule.prototype._onTemplate=function(ruleCtx,tsxComp){var props;if(props=tsxComp.properties){props.forEach(prop=>{this._onProp(ruleCtx,prop)})}};Rule.prototype._onProp=function(ruleCtx,tsxProp){if(tsxProp.node.type==="JSXAttribute"&&tsxProp.node.value.type==="JSXExpressionContainer"){let expr;if(expr=tsxProp.node.value.expression){if(expr.type!=="Identifier"&&expr.type!=="MemberExpression"){let compName=tsxProp.parent.name;let propName=tsxProp.name;let issue=new ruleCtx.Issue(`<${compName}> in-line property '${propName}' assignment of complex object`);this._tsxUtils.setIssuePosition(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-size";const DESCRIPTION="The use of the <oj-rating-gauge> 'size'
|
|
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;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright (c) 2018, 2023, 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-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;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright (c) 2018, 2023, 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-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;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright (c) 2018, 2023, Oracle and/or its affiliates.
|
|
3
|
+
* Licensed under The Universal Permissive License (UPL), Version 1.0
|
|
4
|
+
* as shown at https://oss.oracle.com/licenses/upl/
|
|
5
|
+
*/
|
|
6
|
+
const getParentNodeForSlot=require("./helpers/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 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)}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, 2023, 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-tabbar-edge";const DESCRIPTION="Vertical support in <oj-tab-bar> is deprecated in JET 15.0.0 (use <oj-navigation-list> instead). "+"Use of 'edge' property values 'start' or 'end' (or omitting 'edge') is not recommended, and the values 'top' or 'bottom' should be used.";const SHORT="Vertical support in <oj-tab-bar> is deprecated in JET 15.0.0, use 'edge' property values 'top' or 'bottom'";const MSG_NOEDGE="Vertical support is deprecated (JET 15.0.0) : 'edge' property default value is 'start'. Specify 'top' or 'bottom'. <oj-navigation-list> is suggested for vertical layout.";const MSG_EDGE_START="The 'start' value for 'edge' attribute is not recommended (as of JET 15.0.0). Specify 'top' or 'bottom'. Specify 'top' or 'bottom'. <oj-navigation-list> is suggested for vertical layout.";const EDGE="edge";const START="start";class Rule{getName(){return RULENAME}getDescription(){return DESCRIPTION}getShortDescription(){return SHORT}register(regCtx){this._tsxUtils=regCtx.utils.tsxUtils;return{"Tsx<oj-tab-bar>":this._onTabBar}}_onTabBar(ruleCtx,tsxComp){let tsxProp;if(!(tsxProp=this._tsxUtils.getProperty(tsxComp,EDGE))){ruleCtx.reporter.addIssue(new ruleCtx.Issue(MSG_NOEDGE),ruleCtx);return}let edge;if(edge=this._tsxUtils.getPropertyStringValue(tsxProp)){if(edge===START){let issue=new ruleCtx.Issue(MSG_EDGE_START);this._tsxUtils.setIssuePropValuePosition(issue,tsxProp);issue.setMsgKey(RULENAME+"_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-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.
|
|
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;
|
|
@@ -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+="."}}let issue=new ruleCtx.Issue(msg);ruleCtx.reporter.addIssue(issue,ruleCtx)}}}module.exports=Rule;
|
|
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;
|
|
@@ -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-nested";const DESCRIPTION="The following JET components cannot be nested: <oj-data-grid>, <oj-list-view>, <oj-table>, <oj-tree-view>, <oj-stream-list>, and <oj-waterfall-layout>";const SHORT_DESCRIPTION="Cannot nest <oj-data-grid>, <oj-list-view>, <oj-table>, <oj-tree-view>, <oj-stream-list>, and <oj-waterfall-layout>";const COMP_LIST=["oj-list-view","oj-table","oj-stream-list","oj-waterfall-layout","oj-tree-view","oj-data-grid"];const BODY="body";const OJ_SELECT_SINGLE="oj-select-single";class Rule{getName(){return RULENAME}getDescription(){return DESCRIPTION}getShortDescription(){return SHORT_DESCRIPTION}register(){return{TsxWebComponent:this._onWC}}_onWC(ruleCtx,tsxComp){var tagName,ar,issue,i;tagName=tsxComp.name;if(COMP_LIST.includes(tagName)){ar=tsxComp.elemStack;for(i=ar.length-1;i>=0;i--){let entryName=ar[i].name;if(entryName===OJ_SELECT_SINGLE){break}if(entryName===tagName){issue=new ruleCtx.Issue(`Nesting of <${tagName}> is not supported`);ruleCtx.reporter.addIssue(issue,ruleCtx);break}else if(entryName===BODY){break}}}}};module.exports=Rule;
|
|
6
|
+
const RULENAME="oj-tsx-wctag-nested";const DESCRIPTION="The following JET components cannot be nested: <oj-data-grid>, <oj-list-view>, <oj-table>, <oj-tree-view>, <oj-stream-list>, and <oj-waterfall-layout>";const SHORT_DESCRIPTION="Cannot nest <oj-data-grid>, <oj-list-view>, <oj-table>, <oj-tree-view>, <oj-stream-list>, and <oj-waterfall-layout>";const COMP_LIST=["oj-list-view","oj-table","oj-stream-list","oj-waterfall-layout","oj-tree-view","oj-data-grid"];const BODY="body";const OJ_SELECT_SINGLE="oj-select-single";class Rule{getName(){return RULENAME}getDescription(){return DESCRIPTION}getShortDescription(){return SHORT_DESCRIPTION}register(regCtx){this._metaLib=regCtx.utils.metaLib;return{TsxWebComponent:this._onWC}}_onWC(ruleCtx,tsxComp){var tagName,ar,issue,i;tagName=tsxComp.name;if(COMP_LIST.includes(tagName)){ar=tsxComp.elemStack;for(i=ar.length-1;i>=0;i--){let entryName=ar[i].name;if(entryName===OJ_SELECT_SINGLE||this._metaLib.isInterfaceImplemented(tagName,"SelectSingleElement")){break}if(entryName===tagName){issue=new ruleCtx.Issue(`Nesting of <${tagName}> is not supported`);ruleCtx.reporter.addIssue(issue,ruleCtx);break}else if(entryName===BODY){break}}}}};module.exports=Rule;
|