@oracle/oraclejet-audit 10.1.0 → 12.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE.md +1 -1
- package/jaf-amd.js +12 -4
- package/jaf.js +6 -1
- package/jafapi.js +6 -1
- package/lib/AST.js +6 -1
- package/lib/AST_Ts.js +6 -1
- package/lib/AstJson.js +6 -1
- package/lib/AstMd.js +6 -0
- package/lib/AstNodeTypes.js +6 -1
- package/lib/Comments.js +6 -1
- package/lib/ComponentSvcs.js +5 -0
- package/lib/Components.js +6 -1
- package/lib/Config.js +6 -1
- package/lib/ConfigLib.js +6 -1
- package/lib/CssLib.js +5 -0
- package/lib/CssUtils.js +5 -0
- package/lib/DomUtils.js +6 -1
- package/lib/FileIndex.js +5 -0
- package/lib/FileSet.js +5 -0
- package/lib/FsUtils.js +6 -1
- package/lib/Histo.js +6 -0
- package/lib/HtmlTree.js +6 -1
- package/lib/HtmlUtils.js +5 -0
- package/lib/Issue.js +6 -1
- package/lib/JafEvents.js +5 -0
- package/lib/JafLib.js +6 -1
- package/lib/Json.js +6 -0
- package/lib/JsonLoader.js +6 -1
- package/lib/Md.js +6 -0
- package/lib/MetaLib.js +6 -1
- package/lib/NetUtils.js +5 -0
- package/lib/NodeTypes.js +5 -0
- package/lib/Parser.js +6 -1
- package/lib/RegTypes.js +6 -1
- package/lib/Registry.js +6 -1
- package/lib/Reporter.js +6 -1
- package/lib/RuleContext.js +5 -0
- package/lib/RulePack.js +5 -0
- package/lib/RuleSet.js +6 -1
- package/lib/Rules.js +6 -1
- package/lib/Scope.js +6 -1
- package/lib/SemVer.js +5 -0
- package/lib/Server.js +5 -0
- package/lib/SevLib.js +5 -0
- package/lib/Severity.js +6 -1
- package/lib/Stats.js +6 -0
- package/lib/Ts.js +6 -1
- package/lib/Utils.js +6 -1
- package/lib/Watch.js +5 -0
- package/lib/Writer.js +5 -0
- package/lib/ZipUtils.js +5 -0
- package/lib/api.js +6 -0
- package/lib/builtinpacks.js +6 -0
- package/lib/cliStats.js +6 -0
- package/lib/clone.js +6 -1
- package/lib/cmdline.js +6 -1
- package/lib/colors.js +6 -1
- package/lib/defaults.js +6 -0
- package/lib/deflist.js +6 -0
- package/lib/dislist.js +6 -0
- package/lib/exportRules.js +6 -0
- package/lib/extends.js +6 -0
- package/lib/filetypes.js +6 -0
- package/lib/grouplist.js +6 -0
- package/lib/groups.js +6 -0
- package/lib/help.js +6 -1
- package/lib/jetver.js +6 -1
- package/lib/macros.js +6 -0
- package/lib/manual.js +6 -1
- package/lib/metaLoader.js +5 -0
- package/lib/metahist.js +5 -0
- package/lib/msgidLoader.js +6 -1
- package/lib/ns.js +6 -1
- package/lib/nslist.js +5 -0
- package/lib/outFormat.js +6 -0
- package/lib/outfile.js +5 -0
- package/lib/ruleLoader.js +5 -0
- package/lib/scaffold.js +6 -1
- package/lib/scaffoldRule.js +6 -1
- package/lib/schema.js +6 -1
- package/lib/scopewalker.js +6 -0
- package/lib/spinner.js +6 -1
- package/lib/spinnernoop.js +5 -0
- package/lib/tabs.js +5 -0
- package/libext/expparser.js +6 -1
- package/meta/11.0.0/jetauditmeta.js +9 -0
- package/meta/11.1.0/jetauditmeta.js +9 -0
- package/meta/12.0.0/jetauditmeta.js +9 -0
- package/meta/metaverlist.json +1 -1
- package/package.json +72 -69
- package/rulepacks/csp/csp-html-script-unsafe-inline.js +5 -0
- package/rulepacks/csp/csp-html-style-unsafe-inline.js +5 -0
- package/rulepacks/csp/csp-html-unsafe-expr.js +5 -0
- package/rulepacks/csp/csp-js-script-unsafe-eval.js +6 -1
- package/rulepacks/csp/csp-js-style-unsafe-inline.js +5 -0
- package/rulepacks/csp/csp-ts-script-unsafe-eval.js +6 -0
- package/rulepacks/csp/csp-ts-style-unsafe-inline.js +6 -0
- package/rulepacks/csp/msgid.json +6 -1
- package/rulepacks/csp/rules.json +6 -1
- package/rulepacks/jetwc/jetwc-absolute-jetversion.js +6 -1
- package/rulepacks/jetwc/jetwc-aria-redefinition.js +6 -1
- package/rulepacks/jetwc/jetwc-bootstrap.js +6 -1
- package/rulepacks/jetwc/jetwc-compjson-bp-ar.js +6 -1
- package/rulepacks/jetwc/jetwc-compjson-bp-obj.js +6 -1
- package/rulepacks/jetwc/jetwc-component-dependencies.js +6 -1
- package/rulepacks/jetwc/jetwc-component-displayname.js +6 -1
- package/rulepacks/jetwc/jetwc-component-foldername.js +6 -1
- package/rulepacks/jetwc/jetwc-component-location.js +6 -1
- package/rulepacks/jetwc/jetwc-component-type.js +6 -1
- package/rulepacks/jetwc/jetwc-css-oj-complete.js +6 -0
- package/rulepacks/jetwc/jetwc-data-property-prefix.js +6 -1
- package/rulepacks/jetwc/jetwc-deprecated-lifecycle.js +6 -1
- package/rulepacks/jetwc/jetwc-disabled-property.js +6 -1
- package/rulepacks/jetwc/jetwc-displayname.js +6 -1
- package/rulepacks/jetwc/jetwc-dynamic-slot-context.js +6 -1
- package/rulepacks/jetwc/jetwc-dynamic-slots-naming.js +6 -1
- package/rulepacks/jetwc/jetwc-event-displayname.js +6 -1
- package/rulepacks/jetwc/jetwc-events.js +6 -1
- package/rulepacks/jetwc/jetwc-jet-version.js +6 -1
- package/rulepacks/jetwc/jetwc-loader-file.js +6 -1
- package/rulepacks/jetwc/jetwc-markdown-link.js +6 -0
- package/rulepacks/jetwc/jetwc-method-displayname.js +6 -1
- package/rulepacks/jetwc/jetwc-methods.js +6 -1
- package/rulepacks/jetwc/jetwc-namespace.js +6 -1
- package/rulepacks/jetwc/jetwc-nested-defaults.js +6 -1
- package/rulepacks/jetwc/jetwc-nls-languages.js +6 -1
- package/rulepacks/jetwc/jetwc-nls-root.js +6 -1
- package/rulepacks/jetwc/jetwc-oj-register.js +6 -1
- package/rulepacks/jetwc/jetwc-ojcss.js +6 -1
- package/rulepacks/jetwc/jetwc-pack-children.js +6 -1
- package/rulepacks/jetwc/jetwc-packable-components.js +6 -1
- package/rulepacks/jetwc/jetwc-prerelease-dependencies.js +6 -1
- package/rulepacks/jetwc/jetwc-prerelease-pattern.js +6 -1
- package/rulepacks/jetwc/jetwc-prerelease-version.js +6 -1
- package/rulepacks/jetwc/jetwc-property-changed.js +6 -1
- package/rulepacks/jetwc/jetwc-property-displayname.js +6 -1
- package/rulepacks/jetwc/jetwc-property-nesting.js +6 -1
- package/rulepacks/jetwc/jetwc-public-modules.js +6 -1
- package/rulepacks/jetwc/jetwc-register-css.js +6 -1
- package/rulepacks/jetwc/jetwc-register-with-promises.js +6 -1
- package/rulepacks/jetwc/jetwc-require-paths.js +6 -1
- package/rulepacks/jetwc/jetwc-required-subproperty.js +6 -0
- package/rulepacks/jetwc/jetwc-reserved-property.js +6 -1
- package/rulepacks/jetwc/jetwc-schema.js +6 -1
- package/rulepacks/jetwc/jetwc-semantic-version.js +6 -1
- package/rulepacks/jetwc/jetwc-slot-displayname.js +6 -1
- package/rulepacks/jetwc/jetwc-slots.js +6 -1
- package/rulepacks/jetwc/jetwc-standard-files.js +6 -1
- package/rulepacks/jetwc/jetwc-subproperty-writeback.js +6 -0
- package/rulepacks/jetwc/jetwc-template-slots.js +6 -1
- package/rulepacks/jetwc/jetwc-unused-events.js +6 -1
- package/rulepacks/jetwc/jetwc-unused-slots.js +6 -1
- package/rulepacks/jetwc/jetwc-vb-category.js +6 -1
- package/rulepacks/jetwc/jetwc-vb-icon.js +6 -1
- package/rulepacks/jetwc/jetwc-vcomponent-jetversion.js +6 -0
- package/rulepacks/jetwc/jetwc-vcomponent-loader.js +6 -0
- package/rulepacks/jetwc/jetwc-vcomponent-version.js +6 -0
- package/rulepacks/jetwc/jetwc-version-openrange.js +6 -1
- package/rulepacks/jetwc/jetwc-writeback-required.js +6 -1
- package/rulepacks/jetwc/msgid.json +6 -0
- package/rulepacks/jetwc/rules.json +6 -1
- package/rulepacks/jetwc-lib/jetwcutils-auditComponentCacheManager.js +6 -0
- package/rulepacks/jetwc-lib/jetwcutils-commonListenerImpls.js +6 -0
- package/rulepacks/jetwc-lib/jetwcutils-componentAuditUtils.js +6 -0
- package/rulepacks/jetwc-lib/jetwcutils-componentFinder.js +6 -0
- package/rulepacks/jetwc-lib/jetwcutils-preCompiler.js +6 -0
- package/rulepacks/jetwc-lib/jetwcutils-tsxUtils.js +6 -0
- package/rulepacks/jetwco/jetwco-bootstrap.js +6 -1
- package/rulepacks/jetwco/jetwco-cacc-auditConstraints.js +6 -0
- package/rulepacks/jetwco/jetwco-cacc-dependencies.js +6 -0
- package/rulepacks/jetwco/jetwco-cacc-dynamicSlots.js +6 -0
- package/rulepacks/jetwco/jetwco-cacc-eventBubbles.js +6 -0
- package/rulepacks/jetwco/jetwco-cacc-eventCancelable.js +6 -0
- package/rulepacks/jetwco/jetwco-cacc-eventPayload.js +6 -0
- package/rulepacks/jetwco/jetwco-cacc-events.js +6 -0
- package/rulepacks/jetwco/jetwco-cacc-helpers.js +6 -0
- package/rulepacks/jetwco/jetwco-cacc-jetVer.js +6 -0
- package/rulepacks/jetwco/jetwco-cacc-methodParamTypes.js +6 -0
- package/rulepacks/jetwco/jetwco-cacc-methodParams.js +6 -0
- package/rulepacks/jetwco/jetwco-cacc-methodReturnType.js +6 -0
- package/rulepacks/jetwco/jetwco-cacc-methods.js +6 -0
- package/rulepacks/jetwco/jetwco-cacc-packBundle.js +6 -0
- package/rulepacks/jetwco/jetwco-cacc-packBundleContent.js +6 -0
- package/rulepacks/jetwco/jetwco-cacc-packContent.js +6 -0
- package/rulepacks/jetwco/jetwco-cacc-properties.js +6 -0
- package/rulepacks/jetwco/jetwco-cacc-propertyDefault.js +6 -0
- package/rulepacks/jetwco/jetwco-cacc-propertyEnumeration.js +6 -0
- package/rulepacks/jetwco/jetwco-cacc-propertyReadOnly.js +6 -0
- package/rulepacks/jetwco/jetwco-cacc-propertyRequired.js +6 -0
- package/rulepacks/jetwco/jetwco-cacc-propertyType.js +6 -0
- package/rulepacks/jetwco/jetwco-cacc-propertyWriteback.js +6 -0
- package/rulepacks/jetwco/jetwco-cacc-publicModules.js +6 -0
- package/rulepacks/jetwco/jetwco-cacc-slotDataVariable.js +6 -0
- package/rulepacks/jetwco/jetwco-cacc-slotDataVariableType.js +6 -0
- package/rulepacks/jetwco/jetwco-cacc-slots.js +6 -0
- package/rulepacks/jetwco/jetwco-cacc-styleClasses.js +6 -0
- package/rulepacks/jetwco/jetwco-cacc-styleVariables.js +6 -0
- package/rulepacks/jetwco/jetwco-compjson-ns-reg.js +6 -1
- package/rulepacks/jetwco/jetwco-component-api-baseline-changes.js +6 -0
- package/rulepacks/jetwco/jetwco-component-api-changes.js +6 -1
- package/rulepacks/jetwco/jetwco-component-api-controlled-changes.js +6 -0
- package/rulepacks/jetwco/jetwco-component-cdn.js +6 -1
- package/rulepacks/jetwco/jetwco-description-standards.js +6 -0
- package/rulepacks/jetwco/jetwco-displayname-standards.js +6 -0
- package/rulepacks/jetwco/jetwco-exchange-version-check.js +6 -1
- package/rulepacks/jetwco/jetwco-license-info.js +6 -1
- package/rulepacks/jetwco/jetwco-prerelease-cdn.js +6 -1
- package/rulepacks/jetwco/jetwco-thirdparty-ba.js +6 -1
- package/rulepacks/jetwco/msgid.json +6 -0
- package/rulepacks/jetwco/rules.json +6 -1
- package/rulepacks/spoc/msgid.json +5 -0
- package/rulepacks/spoc/rules.json +5 -0
- package/rulepacks/spoc/spoc-dom-manip-inv-tag.js +5 -0
- package/rulepacks/spoc/spoc-dom-manip-tag-pos.js +5 -0
- package/rulepacks/spoc/spoc-dom-manip.js +5 -0
- package/{tests/rules/oj-js-diagnose/js_FAIL_1.js → rulepacks/wdt/msgid.json} +3 -9
- package/rulepacks/wdt/rules.json +6 -0
- package/rulepacks/wdt/wd-driver-sleep.js +6 -0
- package/rulepacks/wdt/wd-xpath.js +6 -0
- package/rules/jaf/jaf-css-diagnose.js +5 -0
- package/rules/jaf/jaf-html-diagnose.js +5 -0
- package/rules/jaf/jaf-init-schema.js +5 -0
- package/rules/jaf/jaf-js-diagnose.js +5 -0
- package/rules/jaf/jaf-ts-diagnose.js +6 -0
- package/rules/jaf/msgid.json +6 -1
- package/rules/jaf/rules.json +6 -1
- package/rules/jet/helpers/acc-aria-label.js +6 -1
- package/rules/jet/helpers/bp-checkPropType.js +5 -0
- package/rules/jet/helpers/cssHelper.js +6 -1
- package/rules/jet/helpers/extractStylesFromClass.js +6 -1
- package/rules/jet/helpers/has-slot-name.js +6 -1
- package/rules/jet/helpers/has-slot.js +5 -0
- package/rules/jet/helpers/json-prop-pos.js +5 -0
- package/rules/jet/helpers/json-propname-pos.js +5 -0
- package/rules/jet/helpers/style-selector.js +6 -1
- package/rules/jet/helpers/valid-attr.js +5 -0
- package/rules/jet/helpers/vartrack.js +5 -0
- package/rules/jet/jet-css-ojselector.js +5 -0
- package/rules/jet/msgid.json +6 -1
- package/rules/jet/oj-acc-aria-labelledby.js +5 -0
- package/rules/jet/oj-acc-aria-prop.js +6 -1
- package/rules/jet/oj-acc-avatar-aria-role.js +6 -1
- package/rules/jet/oj-acc-combobox-aria-label.js +6 -1
- package/rules/jet/oj-acc-film-strip-aria-label.js +6 -1
- package/rules/jet/oj-acc-input-aria-label.js +6 -1
- package/rules/jet/oj-acc-select-aria-label.js +6 -1
- package/rules/jet/oj-cca-compjson-bp-ar.js +5 -0
- package/rules/jet/oj-cca-compjson-bp-dsplyname.js +5 -0
- package/rules/jet/oj-cca-compjson-bp-jetver.js +5 -0
- package/rules/jet/oj-cca-compjson-bp-obj.js +5 -0
- package/rules/jet/oj-cca-compjson-ns-reg.js +5 -0
- package/rules/jet/oj-css-bp-border-color.js +5 -0
- package/rules/jet/oj-css-bp-dir-flow.js +6 -1
- package/rules/jet/oj-css-bp-float.js +5 -0
- package/rules/jet/oj-css-bp-textalign.js +5 -0
- package/rules/jet/oj-css-style-abs-units.js +6 -1
- package/rules/jet/oj-css-style-bp-color.js +5 -0
- package/rules/jet/oj-css-style-bp-display.js +6 -1
- package/rules/jet/oj-css-style-bp-font-family.js +6 -1
- package/rules/jet/oj-css-style-bp-font.js +5 -0
- package/rules/jet/oj-css-style-deprecated.js +6 -1
- package/rules/jet/oj-css-style-override.js +6 -1
- package/rules/jet/oj-css-var-override.js +5 -0
- package/rules/jet/oj-form-maxcols.js +6 -1
- package/rules/jet/oj-html-5-attr-obs.js +5 -0
- package/rules/jet/oj-html-5-tag-obs.js +5 -0
- package/rules/jet/oj-html-alta-deprecated.js +6 -0
- package/rules/jet/oj-html-attr-$unique.js +5 -0
- package/rules/jet/oj-html-attr-2def.js +5 -0
- package/rules/jet/oj-html-attr-json.js +6 -1
- package/rules/jet/oj-html-attr-prefix-expr.js +6 -1
- package/rules/jet/oj-html-attr-prefix-ro.js +5 -0
- package/rules/jet/oj-html-attr-req.js +5 -0
- package/rules/jet/oj-html-bindforeach-data.js +6 -1
- package/rules/jet/oj-html-bindif-test.js +6 -1
- package/rules/jet/oj-html-binding-attr.js +6 -1
- package/rules/jet/oj-html-cca-count.js +5 -0
- package/rules/jet/oj-html-cca-tagname.js +6 -1
- package/rules/jet/oj-html-cdn.js +5 -0
- package/rules/jet/oj-html-combo-converter.js +5 -0
- package/rules/jet/oj-html-cspexpr.js +6 -1
- package/rules/jet/oj-html-databind-all.js +5 -0
- package/rules/jet/oj-html-dlg-title.js +6 -1
- package/rules/jet/oj-html-file-pick-accept.js +6 -1
- package/rules/jet/oj-html-form-bindif.js +6 -1
- package/rules/jet/oj-html-form-layout-maxcols.js +6 -1
- package/rules/jet/oj-html-form-noflex.js +5 -0
- package/rules/jet/oj-html-input-isodate.js +6 -0
- package/rules/jet/oj-html-invalid-doctype.js +6 -1
- package/rules/jet/oj-html-jq-databind.js +6 -1
- package/rules/jet/oj-html-ko-comment.js +5 -0
- package/rules/jet/oj-html-ko-databind.js +6 -1
- package/rules/jet/oj-html-label-for-prefix.js +5 -0
- package/rules/jet/oj-html-missing-doctype.js +6 -1
- package/rules/jet/oj-html-msgs-cat-text.js +6 -0
- package/rules/jet/oj-html-no-style-tag.js +6 -0
- package/rules/jet/oj-html-notag-style.js +6 -0
- package/rules/jet/oj-html-oj-lib.js +5 -0
- package/rules/jet/oj-html-ojattr-520.js +6 -1
- package/rules/jet/oj-html-ojattr-deprecated.js +6 -1
- package/rules/jet/oj-html-ojattr-enum-deprecated.js +6 -1
- package/rules/jet/oj-html-ojattr-evt-syntax.js +6 -1
- package/rules/jet/oj-html-ojattr-value.js +6 -1
- package/rules/jet/oj-html-ojattr.js +6 -1
- package/rules/jet/oj-html-ojevent.js +6 -1
- package/rules/jet/oj-html-ojslot.js +6 -1
- package/rules/jet/oj-html-ojstyle.js +5 -0
- package/rules/jet/oj-html-ojtag-datacmd.js +6 -1
- package/rules/jet/oj-html-ojtag-datactx.js +5 -0
- package/rules/jet/oj-html-ojtag-deprecated.js +6 -1
- package/rules/jet/oj-html-ojtag-globattr-noprefix.js +6 -1
- package/rules/jet/oj-html-ojtag-id.js +5 -0
- package/rules/jet/oj-html-ojtag-nonglobattr-prefix.js +6 -1
- package/rules/jet/oj-html-ojtag-ns.js +5 -0
- package/rules/jet/oj-html-picker-attrs.js +6 -0
- package/rules/jet/oj-html-redwood-cssnovars.js +6 -0
- package/rules/jet/oj-html-redwood-cssvars.js +6 -0
- package/rules/jet/oj-html-self-close.js +5 -0
- package/rules/jet/oj-html-slot-item-minmax.js +6 -0
- package/rules/jet/oj-html-slot-name.js +6 -1
- package/rules/jet/oj-html-slot-pref-content.js +6 -0
- package/rules/jet/oj-html-style-abs-units.js +5 -0
- package/rules/jet/oj-html-style-bp-color.js +5 -0
- package/rules/jet/oj-html-style-bp-display.js +6 -1
- package/rules/jet/oj-html-style-bp-font-family.js +5 -0
- package/rules/jet/oj-html-style-bp-font.js +5 -0
- package/rules/jet/oj-html-style-deprecated.js +6 -1
- package/rules/jet/oj-html-style.js +6 -1
- package/rules/jet/oj-html-stylesel.js +6 -1
- package/rules/jet/oj-html-tag-attr-noprefix.js +6 -1
- package/rules/jet/oj-html-template-index.js +6 -1
- package/rules/jet/oj-html-unsup-theme.js +6 -1
- package/rules/jet/oj-html-wctag-$props.js +6 -1
- package/rules/jet/oj-html-wctag-arialabelledby.js +5 -0
- package/rules/jet/oj-html-wctag-for.js +5 -0
- package/rules/jet/oj-html-wctag-id.js +6 -1
- package/rules/jet/oj-html-wctag-nested.js +6 -0
- package/rules/jet/oj-html-wctag-packprivate.js +6 -0
- package/rules/jet/oj-js-comp-attr-deprecated.js +6 -1
- package/rules/jet/oj-js-comp-meth-deprecated.js +6 -1
- package/rules/jet/oj-js-no-ext-final.js +5 -0
- package/rules/jet/oj-js-noconsole.js +5 -0
- package/rules/jet/oj-js-ojcomp-deprecated.js +6 -1
- package/rules/jet/oj-js-ojcomp-exist.js +5 -0
- package/rules/jet/oj-js-ojcomp-new.js +5 -0
- package/rules/jet/oj-js-poly-promise.js +6 -1
- package/rules/jet/oj-js-var-undef.js +5 -0
- package/rules/jet/oj-json-syntax.js +5 -0
- package/rules/jet/oj-ts-comp-attr-deprecated.js +6 -1
- package/rules/jet/oj-ts-comp-meth-deprecated.js +6 -1
- package/rules/jet/oj-ts-no-ext-final.js +6 -0
- package/rules/jet/oj-ts-noconsole.js +6 -1
- package/rules/jet/oj-ts-ojcomp-deprecated.js +6 -1
- package/rules/jet/oj-ts-ojcomp-exist.js +6 -1
- package/rules/jet/oj-ts-ojcomp-new.js +6 -1
- package/rules/jet/oj-ts-poly-promise.js +6 -1
- package/rules/jet/rules.json +6 -1
- package/schema/component-schema.json +125 -2
- package/src/JafCore.js +6 -1
- package/types/index.d.ts +175 -37
- package/lib/stats.js +0 -1
- package/rulepacks/jetwc-lib/component-audit-utils.js +0 -1
- package/rules/exch/helpers/json-prop-pos.js +0 -1
- package/rules/exch/msgid.json +0 -1
- package/rules/exch/oj-cca-comp-zip-content-composite.js +0 -1
- package/rules/exch/oj-cca-comp-zip-content-pack.js +0 -1
- package/rules/exch/oj-cca-comp-zip-expand.js +0 -1
- package/rules/exch/oj-cca-compjson-evnames.js +0 -1
- package/rules/exch/oj-cca-compjson-file.js +0 -1
- package/rules/exch/oj-cca-compjson-prefix.js +0 -1
- package/rules/exch/oj-cca-compjson-prop-compdeps.js +0 -1
- package/rules/exch/oj-cca-compjson-prop-deps.js +0 -1
- package/rules/exch/oj-cca-compjson-prop-jetver.js +0 -1
- package/rules/exch/oj-cca-compjson-prop-obs.js +0 -1
- package/rules/exch/oj-cca-compjson-prop-type.js +0 -1
- package/rules/exch/oj-cca-compjson-prop-types.js +0 -1
- package/rules/exch/oj-cca-compjson-prop-undef.js +0 -1
- package/rules/exch/oj-cca-compjson-prop-version.js +0 -1
- package/rules/exch/oj-cca-compjson-schema.js +0 -1
- package/rules/exch/oj-cca-zip-compjson.js +0 -1
- package/rules/exch/rules.json +0 -1
- package/rules/jet/oj-css-bp-bgcolor.js +0 -1
- package/tests/components/attr-req-test/component.json +0 -1
- package/tests/components/demo-analog-clock/component.json +0 -1
- package/tests/components/demo-analog-clock/demo-analog-clock-viewModel.js +0 -1
- package/tests/components/demo-analog-clock/extension/demo/js/viewModels/demo.js +0 -1
- package/tests/components/demo-analog-clock/loader.js +0 -1
- package/tests/components/demo-card/component.json +0 -1
- package/tests/components/demo-chart-orientation-control/component.json +0 -1
- package/tests/components/demo-chart-stack-control/component.json +0 -1
- package/tests/components/made-up/component.json +0 -1
- package/tests/components/oj-made-up/component.json +0 -1
- package/tests/components/sp-activity-item/component.json +0 -1
- package/tests/config/config_base.json +0 -1
- package/tests/golden/10.0.0/golden_base.json +0 -1
- package/tests/golden/8.1.0/golden_base.json +0 -1
- package/tests/golden/9.0.0/golden_base.json +0 -1
- package/tests/rulepacks/hooks/hook-rpext.js +0 -1
- package/tests/rulepacks/hooks/hook-start-close-rulepack.js +0 -1
- package/tests/rulepacks/hooks/rule-rpext.js +0 -1
- package/tests/rulepacks/hooks/rules.json +0 -1
- package/tests/rulepacks/tags/proc_directive.js +0 -1
- package/tests/rulepacks/tags/rules.json +0 -1
- package/tests/rulepacks/tags/tag-count-setup.js +0 -1
- package/tests/rulepacks/tags/tag-count.js +0 -1
- package/tests/rules/bugs/JET-4770_PASS_1.html +0 -9
- package/tests/rules/comments/com_FAIL_1.js +0 -57
- package/tests/rules/comments/com_FAIL_2.js +0 -96
- package/tests/rules/comments/com_PASS_1.js +0 -42
- package/tests/rules/comments/com_PASS_2.js +0 -63
- package/tests/rules/comments/com_PASS_3.js +0 -40
- package/tests/rules/comments/com_PASS_4.js +0 -36
- package/tests/rules/comments/com_PASS_5.js +0 -19
- package/tests/rules/csp/html-script-unsafe-inline/FAIL_1.html +0 -11
- package/tests/rules/csp/html-script-unsafe-inline/FAIL_2.html +0 -8
- package/tests/rules/csp/html-script-unsafe-inline/PASS_1.html +0 -8
- package/tests/rules/csp/html-script-unsafe-inline/PASS_2.html +0 -8
- package/tests/rules/csp/html-script-unsafe-inline/PASS_3.html +0 -8
- package/tests/rules/csp/html-style-unsafe-inline/FAIL_1.html +0 -11
- package/tests/rules/csp/html-style-unsafe-inline/PASS_1.html +0 -11
- package/tests/rules/csp/html-unsafe-expr/FAIL_1.html +0 -14
- package/tests/rules/csp/html-unsafe-expr/PASS_1.html +0 -23
- package/tests/rules/csp/js-script-unsafe-eval/FAIL_1.js +0 -17
- package/tests/rules/csp/js-script-unsafe-eval/FAIL_2.js +0 -40
- package/tests/rules/csp/js-script-unsafe-eval/FAIL_3.js +0 -22
- package/tests/rules/csp/js-script-unsafe-eval/PASS_1.js +0 -20
- package/tests/rules/csp/js-script-unsafe-eval/PASS_2.js +0 -44
- package/tests/rules/csp/js-script-unsafe-eval/PASS_3.js +0 -16
- package/tests/rules/csp/js-style-unsafe-inline/FAIL_1.js +0 -25
- package/tests/rules/csp/js-style-unsafe-inline/PASS.js +0 -22
- package/tests/rules/demo/noself_FAIL_1.js +0 -101
- package/tests/rules/import/import_FAIL_1.js +0 -11
- package/tests/rules/import/import_PASS_1.js +0 -10
- package/tests/rules/jet-composites/demo-buttonset-enum/component.json +0 -57
- package/tests/rules/jet-composites/demo-buttonset-enum/loader.js +0 -19
- package/tests/rules/jet-composites/demo-buttonset-enum/view.html +0 -48
- package/tests/rules/jet-composites/demo-card/component.json +0 -28
- package/tests/rules/jet-composites/demo-card/loader.js +0 -16
- package/tests/rules/jet-composites/demo-card/view.html +0 -30
- package/tests/rules/jet-composites/demo-card/viewModel.js +0 -46
- package/tests/rules/jet-composites/demo-card/view_PASS_1.html +0 -21
- package/tests/rules/jet-composites/demo-contact-form/component.json +0 -23
- package/tests/rules/jet-composites/demo-contact-form/loader.js +0 -16
- package/tests/rules/jet-composites/demo-contact-form/view.html +0 -9
- package/tests/rules/jet-composites/demo-grocery-list/component.json +0 -18
- package/tests/rules/jet-composites/demo-grocery-list/loader.js +0 -19
- package/tests/rules/jet-composites/demo-grocery-list/view.html +0 -22
- package/tests/rules/jet-composites/demo-grocery-list/viewModel.js +0 -48
- package/tests/rules/jet-composites/dummy-component-1/component.json +0 -82
- package/tests/rules/jet-composites/dummy-component-2/component.json +0 -72
- package/tests/rules/jet-composites/foo-my-cca/component.json +0 -14
- package/tests/rules/jet-composites/foo-unsup-theme/component.json +0 -29
- package/tests/rules/jet-composites/header/component.json +0 -12
- package/tests/rules/jet-composites/oj-cgbu-omc/attribute-selection/component.json +0 -154
- package/tests/rules/jet-composites/oj-cgbu-omc/component.json +0 -11
- package/tests/rules/jet-composites/oj-cgbu-omc/reference/component.json +0 -185
- package/tests/rules/jet-composites/oj-cgbu-omc/wctag_props_FAIL_1.html +0 -34
- package/tests/rules/jet-composites/oj-enum-depr/component.json +0 -69
- package/tests/rules/jet-composites/oj-html-wctag-id/id_FAIL_1.html +0 -10
- package/tests/rules/jet-composites/oj-html-wctag-id/id_PASS_1.html +0 -6
- package/tests/rules/misc/oj.js +0 -12
- package/tests/rules/oj-acc-aria-labelledby/aria_labelledby_FAIL_1.html +0 -23
- package/tests/rules/oj-acc-aria-labelledby/aria_labelledby_FAIL_2.html +0 -22
- package/tests/rules/oj-acc-aria-labelledby/aria_labelledby_PASS_1.html +0 -23
- package/tests/rules/oj-acc-aria-labelledby/aria_labelledby_PASS_2.html +0 -22
- package/tests/rules/oj-acc-aria-labelledby/aria_labelledby_PASS_3.html +0 -22
- package/tests/rules/oj-acc-aria-labelledby/aria_labelledby_PASS_4.html +0 -22
- package/tests/rules/oj-acc-aria-labelledby/aria_labelledby_PASS_5.html +0 -22
- package/tests/rules/oj-acc-aria-prop/aria_prop_FAIL_1.html +0 -22
- package/tests/rules/oj-acc-avatar-aria-role/aria_avatar_role_FAIL_1.html +0 -20
- package/tests/rules/oj-acc-avatar-aria-role/aria_avatar_role_PASS_1.html +0 -23
- package/tests/rules/oj-acc-avatar-aria-role/aria_avatar_role_PASS_2.html +0 -24
- package/tests/rules/oj-acc-avatar-aria-role/aria_avatar_role_PASS_3.html +0 -21
- package/tests/rules/oj-acc-avatar-aria-role/aria_avatar_role_PASS_4.html +0 -22
- package/tests/rules/oj-acc-avatar-aria-role/aria_avatar_role_PASS_5.html +0 -22
- package/tests/rules/oj-acc-combobox-aria-label/aria_combo_many_FAIL_1.html +0 -20
- package/tests/rules/oj-acc-combobox-aria-label/aria_combo_many_FAIL_2.html +0 -21
- package/tests/rules/oj-acc-combobox-aria-label/aria_combo_many_PASS_1.html +0 -20
- package/tests/rules/oj-acc-combobox-aria-label/aria_combo_one_FAIL_1.html +0 -21
- package/tests/rules/oj-acc-combobox-aria-label/aria_combo_one_FAIL_2.html +0 -22
- package/tests/rules/oj-acc-combobox-aria-label/aria_combo_one_PASS_1.html +0 -22
- package/tests/rules/oj-acc-film-strip-aria-label/aria_filmstrip_FAIL_1.html +0 -18
- package/tests/rules/oj-acc-film-strip-aria-label/aria_filmstrip_FAIL_2.html +0 -18
- package/tests/rules/oj-acc-film-strip-aria-label/aria_filmstrip_PASS_1.html +0 -18
- package/tests/rules/oj-acc-film-strip-aria-label/aria_filmstrip_PASS_2.html +0 -19
- package/tests/rules/oj-acc-film-strip-aria-label/aria_filmstrip_PASS_3.html +0 -22
- package/tests/rules/oj-acc-input-aria-label/oj_input_date_FAIL_1.html +0 -21
- package/tests/rules/oj-acc-input-aria-label/oj_input_date_FAIL_2.html +0 -22
- package/tests/rules/oj-acc-input-aria-label/oj_input_date_PASS_1.html +0 -16
- package/tests/rules/oj-acc-input-aria-label/oj_input_date_PASS_2.html +0 -17
- package/tests/rules/oj-acc-input-aria-label/oj_input_date_PASS_3.html +0 -26
- package/tests/rules/oj-acc-input-aria-label/oj_input_date_time_FAIL_1.html +0 -19
- package/tests/rules/oj-acc-input-aria-label/oj_input_date_time_FAIL_2.html +0 -20
- package/tests/rules/oj-acc-input-aria-label/oj_input_date_time_PASS_1.html +0 -19
- package/tests/rules/oj-acc-input-aria-label/oj_input_number_FAIL_1.html +0 -17
- package/tests/rules/oj-acc-input-aria-label/oj_input_number_FAIL_2.html +0 -18
- package/tests/rules/oj-acc-input-aria-label/oj_input_number_PASS_1.html +0 -17
- package/tests/rules/oj-acc-input-aria-label/oj_input_password_FAIL_1.html +0 -17
- package/tests/rules/oj-acc-input-aria-label/oj_input_password_FAIL_2.html +0 -17
- package/tests/rules/oj-acc-input-aria-label/oj_input_password_PASS_1.html +0 -17
- package/tests/rules/oj-acc-input-aria-label/oj_input_text_3_PASS_1.html +0 -20
- package/tests/rules/oj-acc-input-aria-label/oj_input_text_FAIL_1.html +0 -20
- package/tests/rules/oj-acc-input-aria-label/oj_input_text_FAIL_2.html +0 -21
- package/tests/rules/oj-acc-input-aria-label/oj_input_text_PASS_2.html +0 -62
- package/tests/rules/oj-acc-input-aria-label/oj_input_text_nolabel_PASS_2.html +0 -17
- package/tests/rules/oj-acc-input-aria-label/oj_input_time_FAIL_1.html +0 -19
- package/tests/rules/oj-acc-input-aria-label/oj_input_time_FAIL_2.html +0 -20
- package/tests/rules/oj-acc-input-aria-label/oj_input_time_PASS_1.html +0 -19
- package/tests/rules/oj-acc-select-aria-label/aria_selectmany_FAIL_1.html +0 -19
- package/tests/rules/oj-acc-select-aria-label/aria_selectmany_FAIL_2.html +0 -20
- package/tests/rules/oj-acc-select-aria-label/aria_selectmany_PASS_1.html +0 -19
- package/tests/rules/oj-acc-select-aria-label/aria_selectone_FAIL_1.html +0 -20
- package/tests/rules/oj-acc-select-aria-label/aria_selectone_FAIL_2.html +0 -21
- package/tests/rules/oj-cca-comp-zip/zip_FAIL_1.zip +0 -1
- package/tests/rules/oj-cca-comp-zip/zip_FAIL_2.zip +0 -0
- package/tests/rules/oj-cca-comp-zip/zip_FAIL_3.zip +0 -0
- package/tests/rules/oj-cca-comp-zip/zip_FAIL_4.zip +0 -0
- package/tests/rules/oj-cca-comp-zip/zip_FAIL_5.zip +0 -0
- package/tests/rules/oj-cca-comp-zip/zip_FAIL_6.zip +0 -0
- package/tests/rules/oj-cca-comp-zip/zip_FAIL_7.zip +0 -0
- package/tests/rules/oj-cca-comp-zip/zip_FAIL_8.zip +0 -0
- package/tests/rules/oj-cca-comp-zip/zip_PASS_1.zip +0 -0
- package/tests/rules/oj-cca-ns-reg/oj-cca-ns-FAIL_1/component.json +0 -19
- package/tests/rules/oj-cca-ns-reg/oj-cca-ns-PASS_1/component.json +0 -19
- package/tests/rules/oj-cgbu-omc_tests/html_ojevent_FAIL_1.html +0 -15
- package/tests/rules/oj-cgbu-omc_tests/html_ojevent_PASS_1.html +0 -17
- package/tests/rules/oj-compjson-syntax/ojcomp-FAIL_1/component.json +0 -16
- package/tests/rules/oj-compjson-syntax/ojcomp-FAIL_10/component.json +0 -103
- package/tests/rules/oj-compjson-syntax/ojcomp-FAIL_11/component.json +0 -24
- package/tests/rules/oj-compjson-syntax/ojcomp-FAIL_12/component.json +0 -17
- package/tests/rules/oj-compjson-syntax/ojcomp-FAIL_13/component.json +0 -17
- package/tests/rules/oj-compjson-syntax/ojcomp-FAIL_14/component.json +0 -40
- package/tests/rules/oj-compjson-syntax/ojcomp-FAIL_15/component.json +0 -24
- package/tests/rules/oj-compjson-syntax/ojcomp-FAIL_16/component.json +0 -44
- package/tests/rules/oj-compjson-syntax/ojcomp-FAIL_17/component.json +0 -8
- package/tests/rules/oj-compjson-syntax/ojcomp-FAIL_18/component.json +0 -8
- package/tests/rules/oj-compjson-syntax/ojcomp-FAIL_19/component.json +0 -8
- package/tests/rules/oj-compjson-syntax/ojcomp-FAIL_2/component.json +0 -15
- package/tests/rules/oj-compjson-syntax/ojcomp-FAIL_20/component.json +0 -18
- package/tests/rules/oj-compjson-syntax/ojcomp-FAIL_21/component.json +0 -16
- package/tests/rules/oj-compjson-syntax/ojcomp-FAIL_22/component.json +0 -19
- package/tests/rules/oj-compjson-syntax/ojcomp-FAIL_3/component.json +0 -15
- package/tests/rules/oj-compjson-syntax/ojcomp-FAIL_4/component.json +0 -16
- package/tests/rules/oj-compjson-syntax/ojcomp-FAIL_5/component.json +0 -16
- package/tests/rules/oj-compjson-syntax/ojcomp-FAIL_6/component.json +0 -18
- package/tests/rules/oj-compjson-syntax/ojcomp-FAIL_7/component.json +0 -15
- package/tests/rules/oj-compjson-syntax/ojcomp-FAIL_8/component.json +0 -15
- package/tests/rules/oj-compjson-syntax/ojcomp-FAIL_9/component.json +0 -52
- package/tests/rules/oj-compjson-syntax/ojcomp-PASS_1/component.json +0 -17
- package/tests/rules/oj-compjson-syntax/ojcomp-PASS_2/component.json +0 -88
- package/tests/rules/oj-compjson-syntax/ojcomp-PASS_3/component.json +0 -19
- package/tests/rules/oj-css-bp-dir-flow/dirflow_FAIL_1.html +0 -22
- package/tests/rules/oj-css-bp-dir-flow/dirflow_FAIL_2.html +0 -22
- package/tests/rules/oj-css-diagnose/css_FAIL_1.html +0 -14
- package/tests/rules/oj-css-diagnose/css_PASS_1.html +0 -14
- package/tests/rules/oj-css-var-override/varovr_FAIL_1.html +0 -8
- package/tests/rules/oj-html-5-attr-depr/attrdepr_FAIL_1.html +0 -16
- package/tests/rules/oj-html-5-attr-depr/attrdepr_PASS_1.html +0 -16
- package/tests/rules/oj-html-5-tag-depr/tagdepr_FAIL_1.html +0 -9
- package/tests/rules/oj-html-attr/attr_FAIL_1.html +0 -27
- package/tests/rules/oj-html-attr-$unique/attr_$unique1_FAIL_1.html +0 -19
- package/tests/rules/oj-html-attr-$unique/attr_$unique_FAIL_2.html +0 -25
- package/tests/rules/oj-html-attr-2def/attr2def_FAIL_1.html +0 -10
- package/tests/rules/oj-html-attr-2def/attr2def_PASS_1.html +0 -10
- package/tests/rules/oj-html-attr-json/attr-json_FAIL_1.html +0 -20
- package/tests/rules/oj-html-attr-json/attr-json_FAIL_2.html +0 -20
- package/tests/rules/oj-html-attr-json/attr-json_FAIL_3.html +0 -20
- package/tests/rules/oj-html-attr-json/attr-json_PASS_1.html +0 -20
- package/tests/rules/oj-html-attr-json/attr-json_PASS_2.html +0 -20
- package/tests/rules/oj-html-attr-json/attr-json_PASS_3.html +0 -8
- package/tests/rules/oj-html-attr-prefix-expr/attrprefixexpr_FAIL_1.html +0 -10
- package/tests/rules/oj-html-attr-prefix-expr/attrprefixexpr_PASS_1.html +0 -10
- package/tests/rules/oj-html-attr-prefix-ro/attrprefixro_FAIL_1.html +0 -10
- package/tests/rules/oj-html-attr-prefix-ro/attrprefixro_PASS_1.html +0 -10
- package/tests/rules/oj-html-attr-req/attrreq_FAIL_1.html +0 -17
- package/tests/rules/oj-html-attr-req/attrreq_FAIL_2.html +0 -13
- package/tests/rules/oj-html-attr-req/attrreq_FAIL_3.html +0 -8
- package/tests/rules/oj-html-attr-req/attrreq_FAIL_4.html +0 -13
- package/tests/rules/oj-html-attr-req/attrreq_FAIL_5.html +0 -17
- package/tests/rules/oj-html-attr-req/attrreq_PASS_1.html +0 -24
- package/tests/rules/oj-html-attr-req/attrreq_PASS_2.html +0 -24
- package/tests/rules/oj-html-attr-req/attrreq_PASS_3.html +0 -10
- package/tests/rules/oj-html-attr-req/attrreq_PASS_4.html +0 -11
- package/tests/rules/oj-html-bindforeach-data/bindforeach_data_FAIL_1.html +0 -19
- package/tests/rules/oj-html-bindforeach-data/bindforeach_data_PASS_1.html +0 -10
- package/tests/rules/oj-html-bindif-test/bindif_test_FAIL_1.html +0 -22
- package/tests/rules/oj-html-bindif-test/bindif_test_PASS_1.html +0 -11
- package/tests/rules/oj-html-binding-attr/binding-foreach_FAIL_2.html +0 -28
- package/tests/rules/oj-html-binding-attr/binding-if_FAIL_1.html +0 -23
- package/tests/rules/oj-html-binding-attr/binding-if_PASS_1.html +0 -23
- package/tests/rules/oj-html-cca-count/cca-count_FAIL_1.html +0 -119
- package/tests/rules/oj-html-cca-tagname/ccatag_FAIL_1.html +0 -7
- package/tests/rules/oj-html-cca-tagname/ccatag_PASS_1.html +0 -7
- package/tests/rules/oj-html-cca-tagname/tag_ns_FAIL_1.html +0 -8
- package/tests/rules/oj-html-cca-tagname/tag_ns_FAIL_2.html +0 -8
- package/tests/rules/oj-html-cca-tagname/tag_ns_FAIL_3.html +0 -8
- package/tests/rules/oj-html-cca-tagname/tag_ns_PASS_1.html +0 -10
- package/tests/rules/oj-html-cdn/html_cdn_FAIL_1.html +0 -18
- package/tests/rules/oj-html-cspexpr/cspexpr_FAIL_1.html +0 -14
- package/tests/rules/oj-html-cspexpr/cspexpr_FAIL_2.html +0 -10
- package/tests/rules/oj-html-cspexpr/cspexpr_PASS_1.html +0 -23
- package/tests/rules/oj-html-cspexpr/cspexpr_PASS_2.html +0 -10
- package/tests/rules/oj-html-cspexpr/cspexpr_PASS_3.html +0 -13
- package/tests/rules/oj-html-dlg-title/dlgtitle_FAIL_1.html +0 -12
- package/tests/rules/oj-html-dlg-title/dlgtitle_PASS_1.html +0 -12
- package/tests/rules/oj-html-form-noflex/noflex_FAIL_1.html +0 -10
- package/tests/rules/oj-html-invalid-doctype/doctype_invalid_FAIL_1.html +0 -20
- package/tests/rules/oj-html-invalid-doctype/doctype_invalid_FAIL_2.html +0 -13
- package/tests/rules/oj-html-invalid-doctype/doctype_invalid_FAIL_3.html +0 -16
- package/tests/rules/oj-html-invalid-doctype/doctype_invalid_FAIL_4.html +0 -13
- package/tests/rules/oj-html-invalid-doctype/doctype_invalid_PASS_1.html +0 -6
- package/tests/rules/oj-html-invalid-doctype/doctype_invalid_PASS_2.html +0 -7
- package/tests/rules/oj-html-invalid-doctype/doctype_invalid_PASS_3.html +0 -7
- package/tests/rules/oj-html-jq-databind/jq-databind_FAIL_1.html +0 -37
- package/tests/rules/oj-html-jq-databind/jq-databind_FAIL_2.html +0 -34
- package/tests/rules/oj-html-jq-databind/jq-databind_FAIL_3.html +0 -27
- package/tests/rules/oj-html-jq-databind/jq-databind_PASS_1.html +0 -30
- package/tests/rules/oj-html-ko-comment/ko-comment_FAIL_1.html +0 -47
- package/tests/rules/oj-html-ko-comment/ko-comment_FAIL_2.html +0 -36
- package/tests/rules/oj-html-ko-databind/ko-databind_FAIL_1.html +0 -24
- package/tests/rules/oj-html-ko-databind/ko-databind_FAIL_2.html +0 -36
- package/tests/rules/oj-html-ko-databind/ko-databind_FAIL_3.html +0 -29
- package/tests/rules/oj-html-label-for-prefix/for_FAIL_1.html +0 -8
- package/tests/rules/oj-html-label-for-prefix/for_PASS_1.html +0 -8
- package/tests/rules/oj-html-missing-doctype/doctype_missing_FAIL_1.html +0 -12
- package/tests/rules/oj-html-missing-doctype/doctype_missing_FAIL_2.html +0 -11
- package/tests/rules/oj-html-missing-doctype/doctype_missing_PASS_1.html +0 -14
- package/tests/rules/oj-html-missing-doctype/doctype_missing_PASS_2.html +0 -5
- package/tests/rules/oj-html-missing-doctype/doctype_missing_PASS_3.html +0 -12
- package/tests/rules/oj-html-missing-doctype/doctype_missing_PASS_5.html +0 -6
- package/tests/rules/oj-html-nonvoid-close/close_FAIL_1.html +0 -28
- package/tests/rules/oj-html-nonvoid-close/close_FAIL_2.html +0 -14
- package/tests/rules/oj-html-nonvoid-close/close_FAIL_3.html +0 -13
- package/tests/rules/oj-html-nonvoid-close/close_FAIL_5.html +0 -28
- package/tests/rules/oj-html-nonvoid-close/close_FAIL_6.html +0 -28
- package/tests/rules/oj-html-nonvoid-close/close_PASS_1.html +0 -7
- package/tests/rules/oj-html-oj-lib/oj_lib_FAIL_1.html +0 -15
- package/tests/rules/oj-html-ojattr/ojattr_PASS_1.html +0 -8
- package/tests/rules/oj-html-ojattr/ojattr_PASS_2.html +0 -10
- package/tests/rules/oj-html-ojattr/ojattr_PASS_3.html +0 -7
- package/tests/rules/oj-html-ojattr/ojattr_PASS_4.html +0 -7
- package/tests/rules/oj-html-ojattr-deprecated/ojattr-dep_FAIL1.html +0 -156
- package/tests/rules/oj-html-ojattr-enum-deprecated/enum_FAIL_1.html +0 -19
- package/tests/rules/oj-html-ojattr-enum-deprecated/enum_FAIL_2.html +0 -20
- package/tests/rules/oj-html-ojattr-enum-deprecated/enum_PASS_1.html +0 -25
- package/tests/rules/oj-html-ojattr-evt-syntax/evt-attr-syntax_FAIL_1.html +0 -6
- package/tests/rules/oj-html-ojattr-evt-syntax/evt-attr-syntax_PASS_1.html +0 -6
- package/tests/rules/oj-html-ojattr-value/attr-value_FAIL_1.html +0 -26
- package/tests/rules/oj-html-ojattr-value/attr-value_FAIL_2.html +0 -26
- package/tests/rules/oj-html-ojattr-value/attr-value_FAIL_3.html +0 -8
- package/tests/rules/oj-html-ojattr-value/attr-value_FAIL_4.html +0 -8
- package/tests/rules/oj-html-ojattr-value/attr-value_FAIL_5.html +0 -8
- package/tests/rules/oj-html-ojattr-value/attr-value_PASS_1.html +0 -26
- package/tests/rules/oj-html-ojattr-value/attr-value_PASS_2.html +0 -8
- package/tests/rules/oj-html-ojattr-value/attr-value_PASS_3.html +0 -7
- package/tests/rules/oj-html-ojattr-value/attr-value_PASS_6.html +0 -7
- package/tests/rules/oj-html-ojattr-value/attr-value_PASS_7.html +0 -10
- package/tests/rules/oj-html-ojattr-value/attr_value_PASS_4.html +0 -7
- package/tests/rules/oj-html-ojattr-value/attr_value_PASS_5.html +0 -9
- package/tests/rules/oj-html-ojslot/ojslot_FAIL_1.html +0 -11
- package/tests/rules/oj-html-ojslot/ojslot_PASS_1.html +0 -12
- package/tests/rules/oj-html-ojstyle/style_FAIL_1.html +0 -103
- package/tests/rules/oj-html-ojstyle/style_PASS_2.html +0 -7
- package/tests/rules/oj-html-ojtag-datacmd/datacmd_FAIL_1.html +0 -10
- package/tests/rules/oj-html-ojtag-datacmd/datacmd_FAIL_2.html +0 -18
- package/tests/rules/oj-html-ojtag-datacmd/datacmd_FAIL_3.html +0 -10
- package/tests/rules/oj-html-ojtag-datacmd/datacmd_PASS_1.html +0 -28
- package/tests/rules/oj-html-ojtag-datacmd/datacmd_PASS_2.html +0 -15
- package/tests/rules/oj-html-ojtag-datactx/datactx_FAIL_1.html +0 -14
- package/tests/rules/oj-html-ojtag-datactx/datactx_PASS_1.html +0 -14
- package/tests/rules/oj-html-ojtag-globattr-noprefix/globattr-noprefix_FAIL_1.html +0 -36
- package/tests/rules/oj-html-ojtag-nonglobattr-prefix/nonglobattr-prefix_FAIL_1.html +0 -26
- package/tests/rules/oj-html-slot-name/slot_name.FAIL_1.html +0 -24
- package/tests/rules/oj-html-slot-name/slot_name.FAIL_2.html +0 -46
- package/tests/rules/oj-html-slot-name/slot_name.FAIL_3.html +0 -10
- package/tests/rules/oj-html-slot-name/slot_name.PASS_1.html +0 -24
- package/tests/rules/oj-html-slot-name/slot_name.PASS_2.html +0 -39
- package/tests/rules/oj-html-slot-name/slot_name.PASS_3.html +0 -10
- package/tests/rules/oj-html-slot-name/slot_name_PASS_4.html +0 -16
- package/tests/rules/oj-html-slot-name/slot_name_PASS_5.html +0 -11
- package/tests/rules/oj-html-slot-name/slot_name_PASS_6.html +0 -14
- package/tests/rules/oj-html-slot-name/slot_name_PASS_7.html +0 -10
- package/tests/rules/oj-html-style/style_FAIL_1.html +0 -7
- package/tests/rules/oj-html-style/style_PASS_1.html +0 -12
- package/tests/rules/oj-html-style/style_PASS_2.html +0 -7
- package/tests/rules/oj-html-style-bp-color/color-FAIL_1.html +0 -17
- package/tests/rules/oj-html-style-bp-color/color-FAIL_2.html +0 -15
- package/tests/rules/oj-html-style-bp-color/color-FAIL_3.html +0 -7
- package/tests/rules/oj-html-style-bp-color/color-PASS_1.html +0 -7
- package/tests/rules/oj-html-style-bp-font-family/fam_FAIL_1.html +0 -23
- package/tests/rules/oj-html-tag-attr-noprefix/attr-noprefix_FAIL_1.html +0 -15
- package/tests/rules/oj-html-tag-attr-noprefix/attr-noprefix_FAIL_2.html +0 -9
- package/tests/rules/oj-html-tag-attr-noprefix/attr-noprefix_PASS_1.html +0 -9
- package/tests/rules/oj-html-unsup-theme/unsup_FAIL_1.html +0 -8
- package/tests/rules/oj-html-wctag-for/for_FAIL_1.html +0 -8
- package/tests/rules/oj-html-wctag-for/for_PASS_1.html +0 -8
- package/tests/rules/oj-js-comp-attr-deprecated/attr-del_FAIL_1.js +0 -20
- package/tests/rules/oj-js-comp-attr-deprecated/attr-dep_FAIL_1.js +0 -20
- package/tests/rules/oj-js-comp-meth-deprecated/meth-del_FAIL_1.js +0 -20
- package/tests/rules/oj-js-comp-meth-deprecated/meth-dep_FAIL_1.js +0 -20
- package/tests/rules/oj-js-define-promise/def-prom_FAIL_1.js +0 -16
- package/tests/rules/oj-js-define-promise/def-prom_FAIL_2.js +0 -16
- package/tests/rules/oj-js-diagnose/es6_PASS_1.js +0 -24
- package/tests/rules/oj-js-no-ext-final/noextfinal_FAIL_1.js +0 -30
- package/tests/rules/oj-js-no-ext-final/noextfinal_FAIL_2.js +0 -23
- package/tests/rules/oj-js-no-ext-final/noextfinal_FAIL_3.js +0 -22
- package/tests/rules/oj-js-no-ext-final/noextfinal_FAIL_4.js +0 -20
- package/tests/rules/oj-js-no-ext-final/noextfinal_FAIL_5.js +0 -24
- package/tests/rules/oj-js-no-ext-final/noextfinal_FAIL_6.js +0 -30
- package/tests/rules/oj-js-no-ext-final/noextfinal_FAIL_7.js +0 -15
- package/tests/rules/oj-js-no-ext-final/noextfinal_FAIL_8.js +0 -16
- package/tests/rules/oj-js-no-ext-final/noextfinal_PASS_1.js +0 -17
- package/tests/rules/oj-js-no-ext-final/noextfinal_PASS_2.js +0 -17
- package/tests/rules/oj-js-noconsole/nocons_FAIL_1.js +0 -11
- package/tests/rules/oj-js-ojcomp-deprecated/jscomp_FAIL_1.js +0 -27
- package/tests/rules/oj-json-syntax/json_FAIL_1.json +0 -8
- package/tests/rules/oj-json-syntax/json_FAIL_2.json +0 -12
- package/tests/rules/oj-json-syntax/json_PASS_1.json +0 -25
- package/tests/rules/oj-json-syntax/json_PASS_2.json +0 -12
- package/tests/rules/oj-json-syntax/json_PASS_3.json +0 -14
- package/tests/rules/ojcompjson/attrreq_FAIL_1/component.json +0 -69
- package/tests/rules/pack-compjson/audit-pack/component-1/component-1-view.html +0 -6
- package/tests/rules/pack-compjson/audit-pack/component-1/component-1-viewModel.js +0 -56
- package/tests/rules/pack-compjson/audit-pack/component-1/component.json +0 -13
- package/tests/rules/pack-compjson/audit-pack/component-1/loader.js +0 -20
- package/tests/rules/pack-compjson/audit-pack/component-1/resources/nls/component-1-strings.js +0 -18
- package/tests/rules/pack-compjson/audit-pack/component-2/component-2-view.html +0 -5
- package/tests/rules/pack-compjson/audit-pack/component-2/component-2-viewModel.js +0 -56
- package/tests/rules/pack-compjson/audit-pack/component-2/component.json +0 -13
- package/tests/rules/pack-compjson/audit-pack/component-2/loader.js +0 -20
- package/tests/rules/pack-compjson/audit-pack/component-2/resources/nls/component-1-strings.js +0 -18
- package/tests/rules/pack-compjson/audit-pack/component.json +0 -12
- package/tests/rules/pack-compjson/audit-singleton-1/audit-singleton-1-view.html +0 -5
- package/tests/rules/pack-compjson/audit-singleton-1/audit-singleton-1-viewModel.js +0 -56
- package/tests/rules/pack-compjson/audit-singleton-1/component.json +0 -20
- package/tests/rules/pack-compjson/audit-singleton-1/loader.js +0 -20
- package/tests/rules/pack-compjson/audit-singleton-1/resources/nls/audit-singleton-1-strings.js +0 -18
- package/tests/rules/pack-compjson/audit-singleton-2/audit-singleton-2-view.html +0 -8
- package/tests/rules/pack-compjson/audit-singleton-2/audit-singleton-2-viewModel.js +0 -56
- package/tests/rules/pack-compjson/audit-singleton-2/component.json +0 -15
- package/tests/rules/pack-compjson/audit-singleton-2/loader.js +0 -20
- package/tests/rules/pack-compjson/audit-singleton-2/resources/nls/audit-singleton-2-strings.js +0 -18
- package/tests/rules/parse-html/proc_instr.html +0 -9
- package/tests/rules/spoc-dom-manip/dom-manip_FAIL_1.js +0 -113
- package/tests/rules/spoc-dom-manip/dom-manip_FAIL_2.js +0 -151
- package/tests/rules/spoc-dom-manip/dom-manip_PASS_1.js +0 -149
- package/tests/rules/spoc-dom-manip/dom-manip_PASS_2.js +0 -147
- package/tests/rules/spoc-dom-manip/dom-manip_PASS_3.js +0 -147
- package/tests/rules/spoc-dom-manip/dom-manip_PASS_4.js +0 -20
- package/tests/rules/spoc-dom-manip/dom-manip_PASS_5.js +0 -246
- package/tests/rules/tab-tests/tab-test_FAIL_1.html +0 -37
- package/tests/rules/tab-tests/tab-test_FAIL_2.html +0 -8
- package/tests/rules/webcomptests/jet-composites/oj-html-wctag-$props/prop_PASS_1.html +0 -8
- package/tests/rules/webcomptests/jet-composites/oj-html-wctag-$props/prop_PASS_2.html +0 -8
- package/tests/rules/webcomptests/jet-composites/oj-html-wctag-for/for_FAIL_1.html +0 -8
- package/tests/rules/webcomptests/jet-composites/oj-html-wctag-for/for_PASS_1.html +0 -8
- package/tests/src/JetTest.js +0 -1
- package/tests/src/server.js +0 -1
- package/tests/test.js +0 -1
|
@@ -1 +1,6 @@
|
|
|
1
|
-
|
|
1
|
+
/*
|
|
2
|
+
* Copyright (c) 2018, 2022, Oracle and/or its affiliates.
|
|
3
|
+
* Licensed under The Universal Permissive License (UPL), Version 1.0
|
|
4
|
+
* as shown at https://oss.oracle.com/licenses/upl/
|
|
5
|
+
*/
|
|
6
|
+
const getStyles=require("./helpers/extractStylesFromClass");const StyleSelector=require("./helpers/style-selector");const RULE_NAME="oj-html-style";const SHORT="A 'class' style prefixed with 'oj-*' must be valid and applicable to the element on which it is declared";const LONG="A 'class' style prefixed with 'oj-*' must be a known JET style and applicable to the element on which it is declared, or defined in a styleset.";const ch=[">",","];const SS_IGNORE_WILD=["oj-ux-","oj-sample-","oj-typography-"];const SS_IGNORE_LIST=["oj-label","oj-applayout-content","oj-visited","oj-disabled","oj-enabled","oj-read-only","oj-invalid","oj-warning","oj-info","oj-confirmation","oj-required","oj-indeterminate","oj-active","oj-selected","oj-hover","oj-focus","oj-focus-only","oj-focus-highlight","oj-default","oj-draggable","oj-drag","oj-drop","oj-active-drop","oj-valid-drop","oj-invalid-drop","oj-expanded","oj-collapsed","oj-right","oj-center","oj-left","oj-start","oj-end","oj-top","oj-middle","oj-bottom","oj-full-width","oj-hicontrast","oj-component","oj-component-initnode","oj-complete","oj-animate-open","oj-animate-open-active","oj-animate-close","oj-animate-close-active","oj-animate-add","oj-animate-add-active","oj-animate-remove","oj-animate-remove-active","oj-animate-update","oj-animate-update-active"];class Rule{constructor(){this._ignore=null;this._metaLib=null}getName(){return RULE_NAME}getShortDescription(){return SHORT}getDescription(){return LONG}register(regCtx){var i;if(regCtx.rulePack.isRuleEnabled("oj-html-stylesel")){return false}this._ignore=regCtx.ruleOpts["ignore"];if(this._ignore){for(i=0;i<this._ignore.length;i++){this._ignore[i]=new RegExp(this._ignore[i])}}this._metaLib=regCtx.utils.metaLib;StyleSelector.setAssertMsg(regCtx.utils.msgLib.assert);return{"class":this._onClass}}_onClass(ruleCtx,attrName,attrValue){var tagName,i,j,classes,style,sType;tagName=ruleCtx.tag;classes=getStyles(attrValue);for(i=0;i<classes.length;i++){style=classes[i];if(this._ignore){for(j=0;j<this._ignore.length;j++){if(this._ignore[j].test(style)){break}}if(j<this._ignore.length){continue}}if(_isIgnoreListed(style)){continue}sType=this._metaLib.getStyleOrigin(style);if(!sType){if(style.startsWith("oj-")){if(!this._metaLib.isStylesetStyle(style)){this._emitIssue(1,style,tagName,ruleCtx)}continue}}if(sType==="c"){continue}this._handleStyle(ruleCtx,style,sType)}}_handleStyle(ruleCtx,style,sType){var ss,tags,tagName,i,simple;tagName=ruleCtx.tag;if(sType==="j"||sType==="b"){ss=this._metaLib.getStyleSelector(style,sType==="j"||sType==="b");if(ss){if(StyleSelector.match(ruleCtx,ss)){return true}}else{tags=this._metaLib.getNonSSStyleElems(style,true);if(tags){for(i=0;i<tags.length;i++){if(tags[i]===tagName){return true}}}}}if(sType==="j"){if(ss){simple=_isSimpleElemOrStyle(ss);simple=!simple?3:simple==="e"?5:6;this._emitIssue(simple,style,tagName,ruleCtx,ss)}else if(tags){this._emitIssue(2,style,tagName,ruleCtx,tags)}return false}tags=null;ss=this._metaLib.getStyleSelector(style,false);if(ss){if(StyleSelector.match(ruleCtx,ss)){return true}}if(ss){simple=_isSimpleElemOrStyle(ss);simple=!simple?3:simple==="e"?5:6;this._emitIssue(simple,style,tagName,ruleCtx,ss);return false}return true}_emitIssue(num,style,tag,ruleCtx,extra1,extra2){var msg,ss,i;switch(num){case 1:msg=`Unknown style '${style}' found on <${tag}>`;break;case 2:msg=`'${style}' cannot be applied to <${tag}> - only ${_fmt(num,extra1)}`;break;case 3:if(Array.isArray(extra1)){ss="";for(i=0;i<extra1.length;i++){if(i){ss+=", or "}ss+="'"+extra1[i]+"'"}}else{ss="'"+extra1+"'"}msg=`'${style}' on <${tag}> is not matched by ${ss}`;break;case 5:msg=`'${style}' can only be applied to <${extra1}> - not <${tag}>`;break;case 6:msg=`'${style}' - <${tag}> must also contain style '${extra1.substring(1)}'`;break;case 7:msg=`'${style}' cannot be applied to <${tag}> : no style selector match (${extra1}) and no elem match (${_fmt(num,extra2)})`;break;}if(msg){ruleCtx.reporter.addIssue(new ruleCtx.Issue(msg),ruleCtx)}}};function _isIgnoreListed(style){var ret=false,i;for(i=0;i<SS_IGNORE_WILD.length;i++){if(style.startsWith(SS_IGNORE_WILD[i])){ret=true;break}}if(!ret){ret=SS_IGNORE_LIST.includes(style)}return ret};function _isSimpleElemOrStyle(ss){const COMMA=",";const DOT=".";const SPACE=" ";const GT=">";if(Array.isArray(ss)){if(ss.length===1){ss=ss[0]}else{return null}}ss=ss.trim();if(ss.includes(COMMA)||ss.includes(DOT,1)||ss.includes(SPACE)||ss.includes(GT)){return null}return ss.startsWith(DOT)?"s":"e"};function _fmt(n,extra){if(n===2||n===7){let s="";for(let i=0;i<extra.length;i++){if(i){s+=", ";if(extra.length>=2){if(i===extra.length-1){s+="or "}}}s+="<"+extra[i]+">"}return s}return"<"+extra[0]+">"};module.exports=Rule;
|
|
@@ -1 +1,6 @@
|
|
|
1
|
-
|
|
1
|
+
/*
|
|
2
|
+
* Copyright (c) 2018, 2022, Oracle and/or its affiliates.
|
|
3
|
+
* Licensed under The Universal Permissive License (UPL), Version 1.0
|
|
4
|
+
* as shown at https://oss.oracle.com/licenses/upl/
|
|
5
|
+
*/
|
|
6
|
+
const getStyles=require("./helpers/extractStylesFromClass");const StyleSelector=require("./helpers/style-selector");const RULENAME="oj-html-stylesel";const SHORT="A 'class' style must be applicable to the element on which it is declared";const LONG="A 'class' style must be a known style and its placement applicable to the element on which it is declared."+" Refer to the component documentation for the style selector defining the placement rules.";const SS_IGNORE_WILD=["oj-ux-","oj-sample-","oj-typography-"];const SS_IGNORE_LIST=["oj-label","oj-applayout-content","oj-visited","oj-disabled","oj-enabled","oj-read-only","oj-invalid","oj-warning","oj-info","oj-confirmation","oj-required","oj-indeterminate","oj-active","oj-selected","oj-hover","oj-focus","oj-focus-only","oj-focus-highlight","oj-default","oj-draggable","oj-drag","oj-drop","oj-active-drop","oj-valid-drop","oj-invalid-drop","oj-expanded","oj-collapsed","oj-right","oj-center","oj-left","oj-start","oj-end","oj-top","oj-middle","oj-bottom","oj-full-width","oj-hicontrast","oj-component","oj-component-initnode","oj-complete","oj-animate-open","oj-animate-open-active","oj-animate-close","oj-animate-close-active","oj-animate-add","oj-animate-add-active","oj-animate-remove","oj-animate-remove-active","oj-animate-update","oj-animate-update-active"];class Rule{constructor(){this._ignore=null;this._metaLib=null}getName(){return RULENAME}getShortDescription(){return SHORT}getDescription(){return LONG}register(regCtx){var i;this._ignore=regCtx.ruleOpts["ignore"];if(this._ignore){for(i=0;i<this._ignore.length;i++){this._ignore[i]=new RegExp(this._ignore[i])}}this._metaLib=regCtx.utils.metaLib;StyleSelector.setAssertMsg(regCtx.utils.msgLib.assert);return{"class":this._onClass}}_onClass(ruleCtx,attrName,attrValue){var tagName,i,j,dataBindChecked=false,classes,style,sType;tagName=ruleCtx.tag;classes=getStyles(attrValue);for(i=0;i<classes.length;i++){style=classes[i];if(this._ignore){for(j=0;j<this._ignore.length;j++){if(this._ignore[j].test(style)){break}}if(j<this._ignore.length){continue}}if(_isIgnoreListed(style)){continue}sType=this._metaLib.getStyleOrigin(style);if(!sType){if(style.startsWith("oj-")){if(!this._metaLib.isStylesetStyle(style)){this._emitIssue(1,style,tagName,ruleCtx)}continue}}this._handleStyle(ruleCtx,style,sType)}}_handleStyle(ruleCtx,style,sType){var ss,tags,tagName,i;tagName=ruleCtx.tag;if(sType==="c"){if(ss=this._metaLib.getStyleSelector(style)){if(StyleSelector.match(ruleCtx,ss)){return true}this._emitIssueEx(ss,style,tagName,ruleCtx);return false}}if(sType==="j"||sType==="b"){ss=this._metaLib.getStyleSelector(style,sType==="j"||sType==="b");if(ss){if(StyleSelector.match(ruleCtx,ss)){return true}}else{tags=this._metaLib.getNonSSStyleElems(style,true);if(tags){for(i=0;i<tags.length;i++){if(tags[i]===tagName){return true}}}}}if(sType==="j"){if(ss){this._emitIssueEx(ss,style,tagName,ruleCtx)}else if(tags){this._emitIssue(2,style,tagName,ruleCtx,tags)}return false}tags=null;if(ss=this._metaLib.getStyleSelector(style,false)){if(StyleSelector.match(ruleCtx,ss)){return true}}if(ss){this._emitIssueEx(ss,style,tagName,ruleCtx);return false}return true}_emitIssue(num,style,tag,ruleCtx,extra1,extra2){var msg,issue,ss,i;switch(num){case 1:msg=`unknown style '${style}' found on <${tag}>`;break;case 2:msg=`style '${style}' cannot be applied to <${tag}> - only ${_fmt(num,extra1)}`;break;case 3:if(Array.isArray(extra1)){ss="";for(i=0;i<extra1.length;i++){if(i){ss+=", or "}ss+="'"+extra1[i]+"'"}}else{ss="'"+extra1+"'"}msg=`style '${style}' on <${tag}> is not matched by ${ss}`;break;case 5:msg=`style '${style}' can only be applied to <${extra1}> - not <${tag}>`;break;case 6:msg=`style '${style}' - <${tag}> must also contain style '${extra1.substring(1)}'`;break;case 7:msg=`'${style}' cannot be applied to <${tag}> : no style selector match (${extra1}) and no elem match (${_fmt(num,extra2)})`;break;}if(msg){issue=new ruleCtx.Issue(msg);ruleCtx.reporter.addIssue(issue.setMsgKey(RULENAME+(num>1?"_"+num:"")),ruleCtx)}}_emitIssueEx(ss,style,tagName,ruleCtx){var simple;simple=_isSimpleElemOrStyle(ss);simple=!simple?3:simple==="e"?5:6;this._emitIssue(simple,style,tagName,ruleCtx,ss)}};function _isIgnoreListed(style){var ret=false,i;for(i=0;i<SS_IGNORE_WILD.length;i++){if(style.startsWith(SS_IGNORE_WILD[i])){ret=true;break}}if(!ret){ret=SS_IGNORE_LIST.includes(style)}return ret};function _isSimpleElemOrStyle(ss){const COMMA=",";const DOT=".";const SPACE=" ";const GT=">";if(Array.isArray(ss)){if(ss.length===1){ss=ss[0]}else{return null}}ss=ss.trim();if(ss.includes(COMMA)||ss.includes(DOT,1)||ss.includes(SPACE)||ss.includes(GT)){return null}return ss.startsWith(DOT)?"s":"e"};function _fmt(n,extra){if(n===2||n===7){let s="";for(let i=0;i<extra.length;i++){if(i){s+=", ";if(extra.length>=2){if(i===extra.length-1){s+="or "}}}s+="<"+extra[i]+">"}return s}return"<"+extra[0]+">"};module.exports=Rule;
|
|
@@ -1 +1,6 @@
|
|
|
1
|
-
|
|
1
|
+
/*
|
|
2
|
+
* Copyright (c) 2018, 2022, Oracle and/or its affiliates.
|
|
3
|
+
* Licensed under The Universal Permissive License (UPL), Version 1.0
|
|
4
|
+
* as shown at https://oss.oracle.com/licenses/upl/
|
|
5
|
+
*/
|
|
6
|
+
const RULE_NAME="oj-html-tag-attr-noprefix";function getName(){return RULE_NAME};function getShortDescription(){return"Global HTML elements with an attribute expression with no ':' prefix are invalid"};function getDescription(){return"On a common HTML element (i.e. is not a custom element), any use of an attribute "+"not prefixed with ':' and with an expression (e.g. attr=\"[[...]]\" or attr=\"{{...}}\"), is invalid."};function register(){return{"globtag":_onTag}};function _onTag(context,tagName){var attribs,attrib,attrValue;if(!(attribs=context.node.attribs));for(attrib in attribs){if(attrib==="data-oj-context"||attrib==="data-oj-command"){continue}if(attrib.charAt(0)!==":"&&!attrib.startsWith("on-")){attrValue=attribs[attrib];if(attrValue.startsWith("[[")||attrValue.startsWith("{{")){let issue=new context.Issue(`Expression-bound attribute without ':' prefix '${attrib}' found on global elem <${tagName}> - use ':${attrib}'`);let attrPos=context.utils.DomUtils.getAttrPosition(context.data,context.node,attrib);issue.setPosition(attrPos.row,attrPos.col,attrPos.start,attrPos.end);context.reporter.addIssue(issue,context)}}}};module.exports={getName,getDescription,getShortDescription,register};
|
|
@@ -1 +1,6 @@
|
|
|
1
|
-
|
|
1
|
+
/*
|
|
2
|
+
* Copyright (c) 2018, 2022, Oracle and/or its affiliates.
|
|
3
|
+
* Licensed under The Universal Permissive License (UPL), Version 1.0
|
|
4
|
+
* as shown at https://oss.oracle.com/licenses/upl/
|
|
5
|
+
*/
|
|
6
|
+
const RULENAME="oj-html-template-index";const DESCRIPTION="Due to a bug in JET 9.x <oj-list-view>, the value of ItemTemplateContext.index starts at 1 instead "+"of 0, depending on whether skeletons (when a fetch from a DataProvider "+"takes more than 50ms) are displayed or not. In JET 10.0.0, the index value always starts at 0 as intended. ";"Review use of the index value to ensure correct usage.";const SHORT_DESCRIPTION="Due to a bug in JET 9.x <oj-list-view>, the value of ItemTemplateContext.index starts at 1 instead "+"of 0, depending on whether skeletons are displayed or not.";const OJ_LIST_VIEW="oj-list-view";const DATA_OJ_AS="data-oj-as";const $CURINDEX="$current.index";const DOT_INDEX=".index";const TAG="tag";const RO_EXPR="[[";const RW_EXPR="{{";class Rule{getName(){return RULENAME}getDescription(){return DESCRIPTION}getShortDescription(){return SHORT_DESCRIPTION}register(regCtx){this._utils=regCtx.utils.utils;return{"<template>":this._onTemplate}}_onTemplate(ruleCtx){if(this._childOfListView(ruleCtx)){let val;if(val=ruleCtx.utils.DomUtils.getAttribValue(ruleCtx.node,DATA_OJ_AS)){this._processTemplateAttribs(ruleCtx,val)}}}_processTemplateAttribs(ruleCtx,find){var node;var find=find+DOT_INDEX;node=ruleCtx.node;this._processDescendants(ruleCtx,node,find)}_processDescendants(ruleCtx,node,find){var nodes,n,attrs,attr,val;nodes=node.children;if(!nodes){return}for(n in nodes){n=nodes[n];if(!n.type||n.type!==TAG){continue}attrs=n.attribs;if(attrs&&this._utils.hasAnyProps(attrs)){for(attr in attrs){val=attrs[attr];if(_isExpr(val)){if(val.includes(find)||val.includes($CURINDEX)){let issue=new ruleCtx.Issue(`Behavior change to ItemTemplateContext.index : <${n.name} ${attr}= >`);let attrPos=ruleCtx.utils.DomUtils.getAttrPosition(ruleCtx.data,n,attr);issue.setPosition(attrPos.row,attrPos.col,attrPos.start,attrPos.end);ruleCtx.reporter.addIssue(issue,ruleCtx)}}}}if(n.children){this._processDescendants(ruleCtx,n,find)}}}_childOfListView(ruleCtx){let stack=ruleCtx.elemStack;for(let i=stack.length-1;i>=0;i--){if(stack[i].name===OJ_LIST_VIEW){return true}}return false}}function _isExpr(s){return s.startsWith(RO_EXPR)||s.startsWith(RW_EXPR)};module.exports=Rule;
|
|
@@ -1 +1,6 @@
|
|
|
1
|
-
|
|
1
|
+
/*
|
|
2
|
+
* Copyright (c) 2018, 2022, Oracle and/or its affiliates.
|
|
3
|
+
* Licensed under The Universal Permissive License (UPL), Version 1.0
|
|
4
|
+
* as shown at https://oss.oracle.com/licenses/upl/
|
|
5
|
+
*/
|
|
6
|
+
const RULENAME="oj-html-unsup-theme";const SHORT_DESCRIPTION="Some web component elements and/or their attributes may not be supported in the specified JET theme";const DESCRIPTION=SHORT_DESCRIPTION+". Refer to the JET API documentation for the version being audited. "+"The theme used by the audit can be set by the JAF configuration property 'theme'.";class Rule{getName(){return RULENAME}getDescription(){return DESCRIPTION}getShortDescription(){return SHORT_DESCRIPTION}register(regCtx){this._theme=regCtx.config.theme;this._metaLib=regCtx.utils.metaLib;return{"webcomp":this._onWebComp}}_onWebComp(ruleCtx,tag){var issue,attribs,attrib;if(!this._metaLib.isTagSupportedInTheme(tag)){issue=new ruleCtx.Issue(`<${tag}> is not supported in theme '${this._theme}'`);ruleCtx.reporter.addIssue(issue,ruleCtx)}attribs=ruleCtx.tagNode.attribs;if(attribs){for(attrib in attribs){this._fnAttrib(ruleCtx,attrib)}}}_fnAttrib(ruleCtx,attrib){if(!this._metaLib.isAttrSupportedInTheme(ruleCtx.tag,attrib)){let issue,attrPos;issue=new ruleCtx.Issue(`<${ruleCtx.tag}> attribute '${attrib}' is not supported in theme '${this._theme}'`);attrPos=ruleCtx.utils.DomUtils.getAttrPosition(ruleCtx.data,ruleCtx.node,attrib);issue.setPosition(attrPos.row,attrPos.col,attrPos.start,attrPos.end);ruleCtx.reporter.addIssue(issue,ruleCtx)}}}module.exports=Rule;
|
|
@@ -1 +1,6 @@
|
|
|
1
|
-
|
|
1
|
+
/*
|
|
2
|
+
* Copyright (c) 2018, 2022, Oracle and/or its affiliates.
|
|
3
|
+
* Licensed under The Universal Permissive License (UPL), Version 1.0
|
|
4
|
+
* as shown at https://oss.oracle.com/licenses/upl/
|
|
5
|
+
*/
|
|
6
|
+
const RULE_NAME="oj-html-wctag-$props";const LONG_DESCRIPT="Any use of $properties.xxx in a web component should ensure that xxx is a declared property for the web component.";const SHORT_DESCRIPT="Any use of $properties.xxx in a web component should ensure that xxx is a declared property for the web component.";const PERIOD=".";const PROPS="$properties";const RE=/\s/;const DELIMS="}]!><+-|=/%&?[,)";const COMPJSON="component.json";const LENGTH="length";const OBJECT="object";const ARRAY="array";const STRING="string";var curFile,tagName;var libPath,libFs;function getName(){return RULE_NAME};function getShortDescription(){return SHORT_DESCRIPT};function getDescription(){return LONG_DESCRIPT};function register(){return{"attrexpr":_handle}};function _handle(ruleCtx,attrName,attrValue){var prop,issue,attrPos,subProps,subProp,soFar,curType,remainder,len,i,x;var metaLib=ruleCtx.utils.metaLib;if(attrValue.indexOf(PROPS)<0||!ruleCtx.filepath.includes("jet-composites")||!metaLib.isWCTag(ruleCtx.tagNode.name)){return}attrValue=attrValue.trim();x=attrValue.indexOf(PROPS);x+=PROPS.length;if(attrValue.charAt(x)!==PERIOD){return}attrValue=attrValue.substring(x+1).trim();prop=_findTerm(attrValue);if(!prop){return}if(curFile!==ruleCtx.filepath){curFile=ruleCtx.filepath;tagName=_getComponentName(curFile)}if(!tagName){return}if(metaLib.isTagCompProp(tagName,prop)){return}subProps=prop.split(PERIOD);len=subProps.length-1;if(len>=1){soFar="";curType=null;for(i=0;i<len;i++){subProp=subProps[i];soFar=soFar+(i?".":"")+subProp;curType=metaLib.getTagPropType(tagName,soFar);if(curType&&curType.toLowerCase()===OBJECT){if(!metaLib.hasTagCompPropSubprop(tagName,soFar)){remainder=_getRemainder(subProps,i);issue=new ruleCtx.Issue("$properties."+soFar+" is an 'object' : cannot verify that '"+remainder+"' is defined by <"+tagName+">");issue.setSeverity("info");attrPos=ruleCtx.utils.DomUtils.getAttrPosition(ruleCtx.data,ruleCtx.tagNode,attrName);issue.setPosition(attrPos.row,attrPos.col,attrPos.start,attrPos.end);issue.setMsgKey(RULE_NAME+"_1");ruleCtx.reporter.addIssue(issue,ruleCtx);return}}}}len=subProps.length;if(len>1&&subProps[len-1]===LENGTH){subProps.splice(len-1,1);soFar=subProps.join(PERIOD);curType=metaLib.getTagPropType(tagName,soFar);curType=curType?curType.toLowerCase():curType;if(curType&&(curType.startsWith(ARRAY)||curType.startsWith(STRING))){return}}if(!metaLib.isTagCompProp(tagName,prop)){issue=new ruleCtx.Issue("Expression refers to $properties."+prop+" : not defined by web component <"+tagName+">");attrPos=ruleCtx.utils.DomUtils.getAttrPosition(ruleCtx.data,ruleCtx.tagNode,attrName);issue.setPosition(attrPos.row,attrPos.col,attrPos.start,attrPos.end);ruleCtx.reporter.addIssue(issue,ruleCtx)}};function _findTerm(attrValue){var x,s,inSq;for(x=0;x<attrValue.length;x++){s=attrValue.charAt(x);if(!inSq){if(s==="["){inSq=true}}if(DELIMS.includes(s)||RE.test(s)){if(inSq&&s==="]"){inSq=false;continue}s=attrValue.substring(0,x);if(s.endsWith("(")){s=s.substring(0,s.length-1)}break}}return s};function _getComponentName(file){var path,name,meta;if(!libPath){libPath=require("path");libFs=require("fs")}path=libPath.dirname(file);meta=_getCompMeta(path);if(meta){name=(meta.pack?meta.pack+"-":"")+meta.name}return name};function _getCompMeta(filepath){var metaPath,json;try{metaPath=libPath.join(filepath,COMPJSON);json=_readFile(metaPath);if(json){json=JSON.parse(json)}}catch(e){}return json};function _getRemainder(a,i){var len=a.length;var n=len-i;var s="";i++;n=i;while(i<len){s+=(i>n?PERIOD:"")+a[i];i++}return s};function _readFile(file){var data;try{data=libFs.readFileSync(file,"utf8")}catch(e){}return data};module.exports={getName,getDescription,getShortDescription,register};
|
|
@@ -1 +1,6 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright (c) 2018, 2022, Oracle and/or its affiliates.
|
|
3
|
+
* Licensed under The Universal Permissive License (UPL), Version 1.0
|
|
4
|
+
* as shown at https://oss.oracle.com/licenses/upl/
|
|
5
|
+
*/
|
|
1
6
|
const RULE_NAME="oj-html-wctag-arialabelledby";const SHORT_DESCRIPT="Custom components should not used a hard-coded 'aria-labelledby' attribute and it should be set to an expression";const LONG_DESCRIPT="Hard-coded 'aria-labelledby' attributes should not be used within custom components. 'aria-labelledby' values must be unique for each instance of the component. See context.uniqueId in the custom element documentation for information on how to derive unique values for elements."+"<p>If a web component implements a hard-coded 'aria-labelledby' elements in the web component view, e.g.<p>"+"<oj-xxx aria-labelledby=\"foo\"><p>"+"then this is guaranteed to cause issues as soon as more than one instance of "+"the component is used on the page (plus there is a significant risk of "+"collision with other values in the page as a whole.";const ATTR="aria-labelledby";const COLON_ATTR=":aria-labelledby";function getName(){return RULE_NAME};function getShortDescription(){return SHORT_DESCRIPT};function getDescription(){return LONG_DESCRIPT};function register(){return{"webcomp":_handle}}function _handle(context,tagName){var attribs,attr,isAttr,isColonAttr,isExpr,msg,issue,attrPos;if(!context.ojTag||!context.filepath.includes("jet-composites")||!context.tagNode.attribs){return}if(context.utils.metaLib.isBindingTag(tagName)){return}attribs=context.tagNode.attribs;isAttr=attribs.hasOwnProperty(ATTR);isColonAttr=attribs.hasOwnProperty(COLON_ATTR);if(!isAttr&&!isColonAttr){return}attr=isAttr?ATTR:COLON_ATTR;isExpr=_isAttrExpr(attribs[attr]);if(isAttr){msg="<"+context.tag+"> 'aria-labelledby be prefixed as ':aria-labelledby'"+(!isExpr?" and set to an expression":"")}else if(!isExpr){msg="<"+context.tag+"> ':aria-labelledby' should be set to an expression"}if(msg){issue=new context.Issue(msg);attrPos=context.utils.DomUtils.getAttrPosition(context.data,context.node,attr);issue.setPosition(attrPos.row,attrPos.col,attrPos.start,attrPos.end);context.reporter.addIssue(issue,context)}};function _isAttrExpr(attrValue){var rc=false;if(typeof attrValue==="string"){attrValue=attrValue.trim();rc=attrValue.startsWith("[[")||attrValue.startsWith("{{")}return rc};module.exports={getName,getDescription,getShortDescription,register};
|
|
@@ -1 +1,6 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright (c) 2018, 2022, Oracle and/or its affiliates.
|
|
3
|
+
* Licensed under The Universal Permissive License (UPL), Version 1.0
|
|
4
|
+
* as shown at https://oss.oracle.com/licenses/upl/
|
|
5
|
+
*/
|
|
1
6
|
const RULE_NAME="oj-html-wctag-for";const SHORT_DESCRIPT="Custom components should not used a hard-coded 'for' attribute and it should be set an expression";const LONG_DESCRIPT="Hard-coded 'for' attributes should not be used within custom components. 'for' attributes must be unique for each instance of the component and set to an expression. See context.uniqueId in the custom element documentation for information on how to derive unique values for elements."+"<p>If a webcomponent implements hard-coded 'for's for HTML elements in the web component view, e.g.<p>"+"<oj-input for=\"foo\"><p>"+"then this is guaranteed to cause issues as soon as more than one instance of "+"the component is used on the page (plus there is a significant risk of "+"collision with other attributes in the page as a whole.";const FOR="for";const COLON_FOR=":for";function getName(){return RULE_NAME};function getShortDescription(){return SHORT_DESCRIPT};function getDescription(){return LONG_DESCRIPT};function register(){return{"webcomp":_handle}}function _handle(context,tagName){var attribs,attr,isFor,isColonFor,isExpr,isOjLabel,msg,issue,attrPos;if(!context.ojTag||!context.filepath.includes("jet-composites")||!context.tagNode.attribs){return}if(context.utils.metaLib.isBindingTag(tagName)){return}isOjLabel=tagName==="oj-label";attribs=context.tagNode.attribs;isFor=attribs.hasOwnProperty(FOR);isColonFor=attribs.hasOwnProperty(COLON_FOR);if(!isFor&&!isColonFor){return}attr=isFor?FOR:COLON_FOR;isExpr=_isAttrExpr(attribs[attr]);if(isFor){if(isOjLabel){if(!isExpr){msg="<"+context.tag+"> 'for' should be set to an expression"}}else{msg="<"+context.tag+"> 'for' should be prefixed as ':for'"+(!isExpr?" and set to an expression":"")}}else{if(isOjLabel){msg="<"+context.tag+"> ':for' should be unprefixed"+(!isExpr?", and set to an expression":"")}else{msg="<"+context.tag+"> ':for' should be set to an expression"}}if(msg){issue=new context.Issue(msg);attrPos=context.utils.DomUtils.getAttrPosition(context.data,context.node,attr);issue.setPosition(attrPos.row,attrPos.col,attrPos.start,attrPos.end);context.reporter.addIssue(issue,context)}};function _isAttrExpr(attrValue){var rc=false;if(typeof attrValue==="string"){attrValue=attrValue.trim();rc=attrValue.startsWith("[[")||attrValue.startsWith("{{")}return rc};module.exports={getName,getDescription,getShortDescription,register};
|
|
@@ -1 +1,6 @@
|
|
|
1
|
-
|
|
1
|
+
/*
|
|
2
|
+
* Copyright (c) 2018, 2022, Oracle and/or its affiliates.
|
|
3
|
+
* Licensed under The Universal Permissive License (UPL), Version 1.0
|
|
4
|
+
* as shown at https://oss.oracle.com/licenses/upl/
|
|
5
|
+
*/
|
|
6
|
+
const RULE_NAME="oj-html-wctag-id";const SHORT_DESCRIPT="Custom components should not used a hard-coded 'id' attribute and should be set to an expression";const LONG_DESCRIPT="Hard-coded element IDs should not be used within custom components and should be set to an expression. Element IDs must be unique for each instance of the component. See context.uniqueId in the custom element documentation for information on how to derive unique IDs for elements."+"<p>If a CCA implements hard-coded IDs for HTML elements in the CCA view, e.g.<p>"+"<oj-input id=\"foo\"><p>"+"then this is guaranteed to cause issues as soon as more than one instance of "+"the component is used on the page (plus there is a significant risk of "+"collision with other IDs in the page as a whole.";const ID="id";const COLON_ID=":id";class Rule{getName(){return RULE_NAME}getDescription(){return LONG_DESCRIPT}getShortDescription(){return SHORT_DESCRIPT}register(){return{"webcomp":this._onTag}}_onTag(ruleCtx,tag){var attribs,idAttr,isId,isColonId,isExpr,isLit,av,val,msg,mid;if(!ruleCtx.ojTag||!ruleCtx.filepath.includes("jet-composites")||!ruleCtx.tagNode.attribs){return}if(ruleCtx.utils.metaLib.isBindingTag(tag)){return}attribs=ruleCtx.tagNode.attribs;isId=attribs.hasOwnProperty(ID);isColonId=attribs.hasOwnProperty(COLON_ID);if(!isId&&!isColonId){return}idAttr=isId?ID:COLON_ID;av=attribs[idAttr];isExpr=_isAttrExpr(av);val=isExpr?_stripExprDelims(av):av;isLit=_isLiteral(val);if(isId){msg=`<${tag}> 'id' should be prefixed as ':id'${isExpr?"":" and set to an expression"}`;mid=0}else if(!isExpr){msg=`<${tag}> ':id' should be set to an expression`;mid=1}if(msg){_emitIssue(ruleCtx,msg,idAttr,mid)}if(isExpr&&isLit){msg=`<${tag}> '${idAttr}' attribute expression returns a constant - convert to a calculated expression`;_emitIssue(ruleCtx,msg,idAttr,2)}}};function _emitIssue(ruleCtx,msg,idAttr,mid){var issue,attrPos;issue=new ruleCtx.Issue(msg);attrPos=ruleCtx.utils.DomUtils.getAttrPosition(ruleCtx.data,ruleCtx.node,idAttr);issue.setPosition(attrPos.row,attrPos.col,attrPos.start,attrPos.end);if(mid){issue.setMsgKey(RULE_NAME+"_"+mid)}ruleCtx.reporter.addIssue(issue,ruleCtx)}function _isAttrExpr(s){var rc=false;if(typeof s==="string"){s=s.trim();rc=s.startsWith("[[")||s.startsWith("{{")}return rc};function _stripExprDelims(s){return s.substring(2,s.length-2).trim()}function _isLiteral(s){return s.charAt(0)==="'"&&s.charAt(s.length-1)==="'"};module.exports=Rule;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright (c) 2018, 2022, 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-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";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){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, 2022, Oracle and/or its affiliates.
|
|
3
|
+
* Licensed under The Universal Permissive License (UPL), Version 1.0
|
|
4
|
+
* as shown at https://oss.oracle.com/licenses/upl/
|
|
5
|
+
*/
|
|
6
|
+
const RULENAME="oj-html-wctag-packprivate";const DESCRIPTION="Components marked as 'packPrivate' in their component.json metadata, are private base classes "+"that can be extended by other classes in the same pack. They cannot be used as application "+"'stand-alone' components.";const SHORT_DESCRIPTION="'packPrivate' components cannot be used as application 'stand-alone' components.";class Rule{getName(){return RULENAME}getDescription(){return DESCRIPTION}getShortDescription(){return SHORT_DESCRIPTION}register(){return{webcomp:this._onWebComp}}_onWebComp(ruleCtx,tag){if(ruleCtx.utils.metaLib.isTagPackPrivate(tag)){let issue=new ruleCtx.Issue(`<${tag}> is not intended for stand-alone use in an application`);ruleCtx.reporter.addIssue(issue,ruleCtx)}}}module.exports=Rule;
|
|
@@ -1 +1,6 @@
|
|
|
1
|
-
const helperClass=require("./helpers/vartrack");const RULE_NAME="oj-js-comp-attr-deprecated";const _GLOBAL="_@global";const THIS="this";var nt;var depMembers;var delMembers;function Rule(){this._reset();this._scope=null};Rule.prototype.getName=function(){return RULE_NAME};Rule.prototype.getShortDescription=function(){return"JET component class deprecated members should not be referenced"};Rule.prototype.getDescription=function(){return"JET component class deprecated members should not be referenced"};Rule.prototype.register=function(regCtx){if(!this._getRuleOptions(regCtx)){return null}var ret={file:this._newFile,startscript:this._newFile,endfile:this._endFile,endscript:this._endFile};nt=regCtx.jsNodeTypes;ret[nt.FUNC_DECLARATION]=this._setup;ret[nt.FUNC_EXPR]=this._setup;ret[nt.MEMBER_EXPR]=this._handleMemberExpr;ret[nt.ASSIGNMENT_EXPR]=this._handleAssign;ret[nt.CALL_EXPR]=this._handleCall;return ret};Rule.prototype._reset=function(){this._funcVarTable=null;this._globalVars=false;this._define=false;if(this._helper){this._helper.reset()}};Rule.prototype._handleCall=function(ruleCtx,node){if(node.callee&&(node.callee.name==="define"||node.callee.name==="require")){this._funcVarTable=this._handleViewModelDefine(ruleCtx,node);return}if(!depMembers){depMembers=ruleCtx.utils.metaLib.getDeprecatedMemberList(ruleCtx)}if(!delMembers){delMembers=ruleCtx.utils.metaLib.getDeletedMemberList(ruleCtx)}};Rule.prototype._handleViewModelDefine=function(ruleCtx,node){var args,stmt,o,i;args=node.arguments;if(!args){return}for(i=0;i<args.length;i++){stmt=args[i];if(stmt.type===nt.FUNC_EXPR){o=this._helper.createFuncDeclarations(ruleCtx,stmt);this._funcVarTable=o.funcVarTable}}this._define=true;return this._funcVarTable};Rule.prototype._handleMemberExpr=function(ruleCtx,node){var component,member,objName,comment,issue,version,deleted;var thoughtToBe,emitDep,emitDel;var metaLib=ruleCtx.utils.metaLib;if(!depMembers){depMembers=metaLib.getDeprecatedMemberList(ruleCtx)}if(!delMembers){delMembers=metaLib.getDeletedMemberList(ruleCtx)}if(node.parent&&node.parent.type===nt.CALL_EXPR){return}objName=this._getVarFromMemberExpr(node);if(this._isCommonObject(ruleCtx,objName)){return}if(node.property){member=node.property.name}if(!(member&&objName)){return}if(!depMembers[member]){deleted=delMembers[member];if(!deleted){return}}component=this._findInstantiatedComponent(ruleCtx,node,objName);if(ruleCtx.utils.AstUtils.isFuncArg(node,objName)||!component){if(member!=="constructor"&&!objName.endsWith(".constructor")){if(deleted&&this._scope.deleted.unsure||!deleted&&this._scope.deprecated.unsure){issue=new ruleCtx.Issue("Possible use of "+(deleted?"deleted (in "+deleted[0]+", "+deleted[1]+")":"deprecated")+" JET member '"+member+"' on var '"+objName+"' (class cannot be determined)");issue.setMsgKey(ruleCtx.ruleName+"_1");issue.setPosition(null,null,node.property.start,node.property.end);ruleCtx.reporter.addIssue(issue,ruleCtx)}}return}if(member.startsWith("_")){return}comment=metaLib.isClassMemberDeprecated(component,member);thoughtToBe=this._isOrigVarValue(ruleCtx,node,objName)?"":"thought to be ";emitDep=thoughtToBe&&this._scope.deprecated.unsure||!thoughtToBe&&this._scope.deprecated.sure;emitDel=thoughtToBe&&this._scope.deleted.unsure||!thoughtToBe&&this._scope.deleted.sure;if(comment){if(emitDep){comment=ruleCtx.utils.utils.removeMarkup(comment);issue=new ruleCtx.Issue("Member '"+member+"' on var '"+objName+"' ("+thoughtToBe+component+")"+(comment.toLowerCase().includes("deprecated")?". ":" is deprecated. ")+comment)}}else{if(metaLib.isClassDeprecated(component)){if(emitDep){issue=new ruleCtx.Issue("Method '"+member+"' on var '"+objName+"' called on deprecated component ("+thoughtToBe+component+").")}}}if(!issue){version=metaLib.isClassMemberDeleted(component,member);if(version){if(deleted&&emitDel){issue=new ruleCtx.Issue("Member '"+member+"' on var '"+objName+"' ("+thoughtToBe+component+")"+" was removed in version "+version)}}else if(metaLib.isClassDeleted(component)){if(deleted&&emitDel){issue=new ruleCtx.Issue("Member '"+member+"' on var '"+objName+"' called on deleted class ("+thoughtToBe+component+").");issue.setSeverity("critical")}}if(issue){issue.setSeverity("critical");issue.setMsgKey(RULE_NAME+"_2")}}if(issue){ruleCtx.reporter.addIssue(issue,ruleCtx)}};Rule.prototype._handleAssign=function(ruleCtx,node){if(node.left){this._handleAssign2(ruleCtx,node,node.left,true)}if(node.right){this._handleAssign2(ruleCtx,node,node.right,false)}};Rule.prototype._handleAssign2=function(ruleCtx,exprNode,node,isSetter){var component,objName,member,comment,issue;if(node.property){if(!node.object){return}objName=node.object.name;if(!objName){if(node.object&&node.object.object){if(node.object.object.name){objName=node.object.object.name}else if(node.object.object.type===nt.THIS_EXPR){objName=THIS}}}if(!objName){if(node.object.type===nt.THIS_EXPR){objName=THIS}}if(!objName){return}if(node.property.type==="Identifier"){member=node.property.name;if(!depMembers){depMembers=ruleCtx.utils.metaLib.getDeprecatedMemberList(ruleCtx)}if(!delMembers){delMembers=ruleCtx.utils.metaLib.getDeletedMemberList(ruleCtx)}if(!depMembers[member]){return}component=this._findInstantiatedComponent(ruleCtx,exprNode,objName);if(!component&&objName!=="this"){if(member!=="constructor"&&!objName.endsWith(".constructor")){if(this._scope.deprecated.unsure){issue=new ruleCtx.Issue("Possible use of deprecated JET member '"+member+"' on var '"+objName+"' (class cannot be determined)");issue.setMsgKey(ruleCtx.ruleName+"_1");ruleCtx.reporter.addIssue(issue,ruleCtx)}}return}if(!this._scope.deprecated.unsure){return}comment=ruleCtx.utils.metaLib.isClassMemberDeprecated(component,member);if(comment){issue=new ruleCtx.Issue("Member '"+member+"' on var '"+objName+"' (thought to be "+component+")"+(comment.toLowerCase().includes("deprecated")?". ":" is deprecated. ")+comment)}else{if(ruleCtx.utils.metaLib.isClassDeprecated(component)){issue=new ruleCtx.Issue("Member '"+member+"' on var '"+objName+"' called on deprecated component (thought to be "+component+").")}}if(issue){ruleCtx.reporter.addIssue(issue,ruleCtx)}}}};Rule.prototype._newFile=function(ruleCtx,node){if(ruleCtx.type==="file"&&ruleCtx.filetype==="html"){return}if(!this._helper){this._helper=new helperClass}this._reset();if(!nt&&ruleCtx.utils.AstUtils){nt=ruleCtx.utils.AstUtils.getNodeTypes()}};Rule.prototype._endFile=function(ruleCtx){this._define=false;if(this._helper){this._helper.reset()}};Rule.prototype._setup=function(ruleCtx,node){if(!depMembers){depMembers=ruleCtx.utils.metaLib.getDeprecatedMemberList(ruleCtx)}if(!this._globalVars){this._helper.getGlobalVars(ruleCtx);this._globalVars=true}var o=this._helper.createFuncDeclarations(ruleCtx,node);if(o){this._funcVarTable=o.funcVarTable;var funcName;for(funcName in this._funcVarTable){this._handleVarAssignments(ruleCtx,node,this._funcVarTable[funcName])}}};Rule.prototype._addVarToTrackingTable=function(stmt,funcVars,global){var decls,decl,obj,i;decls=stmt.declarations;for(i=0;i<decls.length;i++){decl=decls[i];if(decl.type===nt.VAR_DECLARATOR){funcVars[decl.id.name]=obj={type:global?"globvar":"var"};if(decl.init){if(decl.init.type===nt.NEW_EXPR){obj.valType="new";if(decl.init.callee.type===nt.MEMBER_EXPR){if(decl.init.callee.object&&decl.init.callee.object.type===nt.IDENTIFIER){obj.obj=decl.init.callee.object.name;obj.class=decl.init.callee.property.name;obj.origClass=obj.class}}}else if(decl.init.type===nt.LITERAL){obj.valType="lit"}else if(decl.init.type===nt.CALL_EXPR){if(decl.init.callee.type===nt.IDENTIFIER){obj.valType="funcret";obj.func=decl.init.callee.name}}else if(decl.init.type===nt.IDENTIFIER){obj.valType="var";obj.varName=decl.init.name}}}}};Rule.prototype._findInstantiatedComponent=function(ruleCtx,node,varName){var funcName=ruleCtx.utils.AstUtils.getContainingFunctionName(node);var funcVars=funcName&&this._funcVarTable?this._funcVarTable[funcName]:null;var varDef;if(funcVars){varDef=funcVars[varName];if(!varDef){funcVars=this._funcVarTable[_GLOBAL];if(funcVars){varDef=funcVars[varName]}}if(varDef&&varDef.valType){while(varDef.valType==="var"||varDef.valType==="globvar"){varDef=funcVars[varDef.varName];if(!varDef.valType){return}}if(varDef.class){return(varDef.obj?varDef.obj+".":"")+varDef.class}}}};Rule.prototype._handleVarAssignments=function(ruleCtx,node,funcVars){var body,stmt,leftObj,rightObj,i;body=node.body.body;for(i=0;i<body.length;i++){stmt=body[i];if(stmt.type===nt.EXPR_STMT){if(stmt.expression){if(stmt.expression.type===nt.ASSIGNMENT_EXPR){if(stmt.expression.left.type===nt.IDENTIFIER){if(!funcVars[stmt.expression.left.name]){funcVars[stmt.expression.left.name]={type:"globvar"}}if(stmt.expression.right.type===nt.IDENTIFIER){if(!funcVars[stmt.expression.right.name]){funcVars[stmt.expression.right.name]={type:"globvar"}}leftObj=funcVars[stmt.expression.left.name];rightObj=funcVars[stmt.expression.right.name];leftObj.valType=rightObj.valType;leftObj.varName=rightObj.varName}}}}}}};Rule.prototype._getVarFromMemberExpr=function(me,varSoFar,level){var obj;level=typeof level==="number"?level+1:0;if(me.object){obj=me.object;if(obj.type===nt.IDENTIFIER){varSoFar=varSoFar?varSoFar+"."+obj.name:obj.name}else if(obj.type===nt.MEMBER_EXPR){varSoFar=this._getVarFromMemberExpr(obj,varSoFar,level)}else if(obj.type===nt.THIS_EXPR){varSoFar=THIS}if(me.property&&level){if(me.property.type===nt.IDENTIFIER){varSoFar=varSoFar?varSoFar+"."+me.property.name:me.property.name}else if(me.property.type===nt.MEMBER_EXPR){varSoFar=this._getVarFromMemberExpr(me.property,varSoFar,level)}}}return varSoFar};Rule.prototype._isCommonObject=function(ruleCtx,objName){return objName==="this"||objName==="self"||objName==="_self"||objName==="window"||objName==="console"||this._helper.isCommonVar(objName)};Rule.prototype._isOrigVarValue=function(ruleCtx,node,varName){var funcName,funcVars,varDef;funcName=ruleCtx.utils.AstUtils.getContainingFunctionName(node);if(funcName){funcVars=this._funcVarTable[funcName];if(funcVars){varDef=funcVars[varName]}}if(!varDef){funcVars=this._funcVarTable[_GLOBAL];if(funcVars){varDef=funcVars[varName]}}if(!varDef){return false}while(varDef.valType!=="new"){if(varDef.valType==="lit"){break}if(varDef.valType==="var"){varDef=funcVars[varDef.varName]}}return varDef&&varDef.valType==="new"&&varDef.class===varDef.origClass};Rule.prototype._getRuleOptions=function(regCtx){var scope=regCtx.ruleOpts.scope;if(scope&&typeof scope!=="object"){regCtx.error("Rule "+RULE_NAME+" : invalid config 'ruleMods.scope' property. Rule disabled.");return false}this._scope={deprecated:{sure:true,unsure:false},deleted:{sure:true,unsure:false}};if(!scope){return true}var o=scope.deprecated;if(o){if(o.hasOwnProperty("sure")){this._scope.deprecated.sure=!!scope.deprecated.sure}if(o.hasOwnProperty("unsure")){this._scope.deprecated.unsure=!!scope.deprecated.unsure}}o=scope.deleted;if(o){if(o.hasOwnProperty("sure")){this._scope.deleted.sure=!!scope.deleted.sure}if(o.hasOwnProperty("unsure")){this._scope.deleted.unsure=!!scope.deleted.unsure}}return this._scope.deprecated.sure||this._scope.deprecated.unsure||this._scope.deleted.sure||this._scope.deleted.unsure};module.exports=Rule;
|
|
1
|
+
/*
|
|
2
|
+
* Copyright (c) 2018, 2022, 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 helperClass=require("./helpers/vartrack");const RULE_NAME="oj-js-comp-attr-deprecated";const _GLOBAL="_@global";const THIS="this";var nt;var depMembers;var delMembers;function Rule(){this._reset();this._scope=null};Rule.prototype.getName=function(){return RULE_NAME};Rule.prototype.getShortDescription=function(){return"JET component class deprecated members should not be referenced"};Rule.prototype.getDescription=function(){return"JET component class deprecated members should not be referenced"};Rule.prototype.register=function(regCtx){if(!this._getRuleOptions(regCtx)){return null}var ret={file:this._newFile,startscript:this._newFile,endfile:this._endFile,endscript:this._endFile};nt=regCtx.jsNodeTypes;ret[nt.FUNC_DECLARATION]=this._setup;ret[nt.FUNC_EXPR]=this._setup;ret[nt.MEMBER_EXPR]=this._handleMemberExpr;ret[nt.ASSIGNMENT_EXPR]=this._handleAssign;ret[nt.CALL_EXPR]=this._handleCall;return ret};Rule.prototype._reset=function(){this._funcVarTable=null;this._globalVars=false;this._define=false;if(this._helper){this._helper.reset()}};Rule.prototype._handleCall=function(ruleCtx,node){if(node.callee&&(node.callee.name==="define"||node.callee.name==="require")){this._funcVarTable=this._handleViewModelDefine(ruleCtx,node);return}if(!depMembers){depMembers=ruleCtx.utils.metaLib.getDeprecatedMemberList(ruleCtx)}if(!delMembers){delMembers=ruleCtx.utils.metaLib.getDeletedMemberList(ruleCtx)}};Rule.prototype._handleViewModelDefine=function(ruleCtx,node){var args,stmt,o,i;args=node.arguments;if(!args){return}for(i=0;i<args.length;i++){stmt=args[i];if(stmt.type===nt.FUNC_EXPR){o=this._helper.createFuncDeclarations(ruleCtx,stmt);this._funcVarTable=o.funcVarTable}}this._define=true;return this._funcVarTable};Rule.prototype._handleMemberExpr=function(ruleCtx,node){var component,member,objName,status,comment,issue,version,deleted;var thoughtToBe,emitDep,emitDel;var metaLib=ruleCtx.utils.metaLib;if(!depMembers){depMembers=metaLib.getDeprecatedMemberList(ruleCtx)}if(!delMembers){delMembers=metaLib.getDeletedMemberList(ruleCtx)}if(node.parent&&node.parent.type===nt.CALL_EXPR){return}objName=this._getVarFromMemberExpr(node);if(this._isCommonObject(ruleCtx,objName)){return}if(node.property){member=node.property.name}if(!(member&&objName)){return}if(!depMembers[member]){deleted=delMembers[member];if(!deleted){return}}component=this._findInstantiatedComponent(ruleCtx,node,objName);if(ruleCtx.utils.AstUtils.isFuncArg(node,objName)||!component){if(member!=="constructor"&&!objName.endsWith(".constructor")){if(deleted&&this._scope.deleted.unsure||!deleted&&this._scope.deprecated.unsure){issue=new ruleCtx.Issue("Possible use of "+(deleted?"deleted (in "+deleted[0]+", "+deleted[1]+")":"deprecated")+" JET member '"+member+"' on var '"+objName+"' (class cannot be determined)");issue.setMsgKey(ruleCtx.ruleName+"_1");issue.setPosition(null,null,node.property.start,node.property.end);ruleCtx.reporter.addIssue(issue,ruleCtx)}}return}if(member.startsWith("_")){return}if(status=metaLib.isClassMemberDeprecated(component,member)){comment=ruleCtx.utils.utils.removeMarkup(status[0].description)}thoughtToBe=this._isOrigVarValue(ruleCtx,node,objName)?"":"thought to be ";emitDep=thoughtToBe&&this._scope.deprecated.unsure||!thoughtToBe&&this._scope.deprecated.sure;emitDel=thoughtToBe&&this._scope.deleted.unsure||!thoughtToBe&&this._scope.deleted.sure;if(comment){if(emitDep){issue=new ruleCtx.Issue("Member '"+member+"' on var '"+objName+"' ("+thoughtToBe+component+")"+(comment.toLowerCase().includes("deprecated")?". ":" is deprecated. ")+comment)}}else{if(metaLib.isClassDeprecated(component)){if(emitDep){issue=new ruleCtx.Issue("Method '"+member+"' on var '"+objName+"' called on deprecated component ("+thoughtToBe+component+").")}}}if(!issue){version=metaLib.isClassMemberDeleted(component,member);if(version){if(deleted&&emitDel){issue=new ruleCtx.Issue("Member '"+member+"' on var '"+objName+"' ("+thoughtToBe+component+")"+" was removed in version "+version)}}else if(metaLib.isClassDeleted(component)){if(deleted&&emitDel){issue=new ruleCtx.Issue("Member '"+member+"' on var '"+objName+"' called on deleted class ("+thoughtToBe+component+").");issue.setSeverity("critical")}}if(issue){issue.setSeverity("critical");issue.setMsgKey(RULE_NAME+"_2")}}if(issue){ruleCtx.reporter.addIssue(issue,ruleCtx)}};Rule.prototype._handleAssign=function(ruleCtx,node){if(node.left){this._handleAssign2(ruleCtx,node,node.left,true)}if(node.right){this._handleAssign2(ruleCtx,node,node.right,false)}};Rule.prototype._handleAssign2=function(ruleCtx,exprNode,node){var component,objName,member,status,comment,issue;if(node.property){if(!node.object){return}objName=node.object.name;if(!objName){if(node.object&&node.object.object){if(node.object.object.name){objName=node.object.object.name}else if(node.object.object.type===nt.THIS_EXPR){objName=THIS}}}if(!objName){if(node.object.type===nt.THIS_EXPR){objName=THIS}}if(!objName){return}if(node.property.type==="Identifier"){member=node.property.name;if(!depMembers){depMembers=ruleCtx.utils.metaLib.getDeprecatedMemberList(ruleCtx)}if(!delMembers){delMembers=ruleCtx.utils.metaLib.getDeletedMemberList(ruleCtx)}if(!depMembers[member]){return}component=this._findInstantiatedComponent(ruleCtx,exprNode,objName);if(!component&&objName!=="this"){if(member!=="constructor"&&!objName.endsWith(".constructor")){if(this._scope.deprecated.unsure){issue=new ruleCtx.Issue("Possible use of deprecated JET member '"+member+"' on var '"+objName+"' (class cannot be determined)");issue.setMsgKey(ruleCtx.ruleName+"_1");ruleCtx.reporter.addIssue(issue,ruleCtx)}}return}if(!this._scope.deprecated.unsure){return}if(status=ruleCtx.utils.metaLib.isClassMemberDeprecated(component,member)){comment=ruleCtx.utils.utils.removeMarkup(status[0].description);issue=new ruleCtx.Issue("Member '"+member+"' on var '"+objName+"' (thought to be "+component+")"+(comment.toLowerCase().includes("deprecated")?". ":" is deprecated. ")+comment)}else{if(ruleCtx.utils.metaLib.isClassDeprecated(component)){issue=new ruleCtx.Issue("Member '"+member+"' on var '"+objName+"' called on deprecated component (thought to be "+component+").")}}if(issue){ruleCtx.reporter.addIssue(issue,ruleCtx)}}}};Rule.prototype._newFile=function(ruleCtx){if(ruleCtx.type==="file"&&ruleCtx.filetype==="html"){return}if(!this._helper){this._helper=new helperClass}this._reset();if(!nt&&ruleCtx.utils.AstUtils){nt=ruleCtx.utils.AstUtils.getNodeTypes()}};Rule.prototype._endFile=function(ruleCtx){this._define=false;if(this._helper){this._helper.reset()}};Rule.prototype._setup=function(ruleCtx,node){if(!depMembers){depMembers=ruleCtx.utils.metaLib.getDeprecatedMemberList(ruleCtx)}if(!this._globalVars){this._helper.getGlobalVars(ruleCtx);this._globalVars=true}var o=this._helper.createFuncDeclarations(ruleCtx,node);if(o){this._funcVarTable=o.funcVarTable;var funcName;for(funcName in this._funcVarTable){this._handleVarAssignments(ruleCtx,node,this._funcVarTable[funcName])}}};Rule.prototype._addVarToTrackingTable=function(stmt,funcVars,global){var decls,decl,obj,i;decls=stmt.declarations;for(i=0;i<decls.length;i++){decl=decls[i];if(decl.type===nt.VAR_DECLARATOR){funcVars[decl.id.name]=obj={type:global?"globvar":"var"};if(decl.init){if(decl.init.type===nt.NEW_EXPR){obj.valType="new";if(decl.init.callee.type===nt.MEMBER_EXPR){if(decl.init.callee.object&&decl.init.callee.object.type===nt.IDENTIFIER){obj.obj=decl.init.callee.object.name;obj.class=decl.init.callee.property.name;obj.origClass=obj.class}}}else if(decl.init.type===nt.LITERAL){obj.valType="lit"}else if(decl.init.type===nt.CALL_EXPR){if(decl.init.callee.type===nt.IDENTIFIER){obj.valType="funcret";obj.func=decl.init.callee.name}}else if(decl.init.type===nt.IDENTIFIER){obj.valType="var";obj.varName=decl.init.name}}}}};Rule.prototype._findInstantiatedComponent=function(ruleCtx,node,varName){var funcName=ruleCtx.utils.AstUtils.getContainingFunctionName(node);var funcVars=funcName&&this._funcVarTable?this._funcVarTable[funcName]:null;var varDef;if(funcVars){varDef=funcVars[varName];if(!varDef){funcVars=this._funcVarTable[_GLOBAL];if(funcVars){varDef=funcVars[varName]}}if(varDef&&varDef.valType){while(varDef.valType==="var"||varDef.valType==="globvar"){varDef=funcVars[varDef.varName];if(!varDef.valType){return}}if(varDef.class){return(varDef.obj?varDef.obj+".":"")+varDef.class}}}};Rule.prototype._handleVarAssignments=function(ruleCtx,node,funcVars){var body,stmt,leftObj,rightObj,i;body=node.body.body;for(i=0;i<body.length;i++){stmt=body[i];if(stmt.type===nt.EXPR_STMT){if(stmt.expression){if(stmt.expression.type===nt.ASSIGNMENT_EXPR){if(stmt.expression.left.type===nt.IDENTIFIER){if(!funcVars[stmt.expression.left.name]){funcVars[stmt.expression.left.name]={type:"globvar"}}if(stmt.expression.right.type===nt.IDENTIFIER){if(!funcVars[stmt.expression.right.name]){funcVars[stmt.expression.right.name]={type:"globvar"}}leftObj=funcVars[stmt.expression.left.name];rightObj=funcVars[stmt.expression.right.name];leftObj.valType=rightObj.valType;leftObj.varName=rightObj.varName}}}}}}};Rule.prototype._getVarFromMemberExpr=function(me,varSoFar,level){var obj;level=typeof level==="number"?level+1:0;if(me.object){obj=me.object;if(obj.type===nt.IDENTIFIER){varSoFar=varSoFar?varSoFar+"."+obj.name:obj.name}else if(obj.type===nt.MEMBER_EXPR){varSoFar=this._getVarFromMemberExpr(obj,varSoFar,level)}else if(obj.type===nt.THIS_EXPR){varSoFar=THIS}if(me.property&&level){if(me.property.type===nt.IDENTIFIER){varSoFar=varSoFar?varSoFar+"."+me.property.name:me.property.name}else if(me.property.type===nt.MEMBER_EXPR){varSoFar=this._getVarFromMemberExpr(me.property,varSoFar,level)}}}return varSoFar};Rule.prototype._isCommonObject=function(ruleCtx,objName){return objName==="this"||objName==="self"||objName==="_self"||objName==="window"||objName==="console"||this._helper.isCommonVar(objName)};Rule.prototype._isOrigVarValue=function(ruleCtx,node,varName){var funcName,funcVars,varDef;funcName=ruleCtx.utils.AstUtils.getContainingFunctionName(node);if(funcName){funcVars=this._funcVarTable[funcName];if(funcVars){varDef=funcVars[varName]}}if(!varDef){funcVars=this._funcVarTable[_GLOBAL];if(funcVars){varDef=funcVars[varName]}}if(!varDef){return false}while(varDef.valType!=="new"){if(varDef.valType==="lit"){break}if(varDef.valType==="var"){varDef=funcVars[varDef.varName]}}return varDef&&varDef.valType==="new"&&varDef.class===varDef.origClass};Rule.prototype._getRuleOptions=function(regCtx){var scope=regCtx.ruleOpts.scope;if(scope&&typeof scope!=="object"){regCtx.error("Rule "+RULE_NAME+" : invalid config 'ruleMods.scope' property. Rule disabled.");return false}this._scope={deprecated:{sure:true,unsure:false},deleted:{sure:true,unsure:false}};if(!scope){return true}var o=scope.deprecated;if(o){if(o.hasOwnProperty("sure")){this._scope.deprecated.sure=!!scope.deprecated.sure}if(o.hasOwnProperty("unsure")){this._scope.deprecated.unsure=!!scope.deprecated.unsure}}o=scope.deleted;if(o){if(o.hasOwnProperty("sure")){this._scope.deleted.sure=!!scope.deleted.sure}if(o.hasOwnProperty("unsure")){this._scope.deleted.unsure=!!scope.deleted.unsure}}return this._scope.deprecated.sure||this._scope.deprecated.unsure||this._scope.deleted.sure||this._scope.deleted.unsure};module.exports=Rule;
|
|
@@ -1 +1,6 @@
|
|
|
1
|
-
|
|
1
|
+
/*
|
|
2
|
+
* Copyright (c) 2018, 2022, 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 helperClass=require("./helpers/vartrack");const RULE_NAME="oj-js-comp-meth-deprecated";const _GLOBAL="_@global";var NT;var depMethods;var delMethods;function Rule(){this._reset();this._scope=null};Rule.prototype.getName=function(){return RULE_NAME};Rule.prototype.getShortDescription=function(){return"JET component class deprecated methods should not be invoked"};Rule.prototype.getDescription=function(){return"JET component class deprecated methods should not be invoked"};Rule.prototype.register=function(regCtx){if(!this._getRuleOptions(regCtx)){return null}return{CallExpression:this._handleCall,FunctionDeclaration:this._setup,FunctionExpression:this._setup,file:this._newFile,endfile:this._endFile,startscript:this._newFile,endscript:this._endFile}};Rule.prototype._reset=function(){this._funcVarTable=null;this._globalVars=false;this._define=false;if(this._helper){this._helper.reset()}};Rule.prototype._handleCall=function(context,node){var component,method,objName,status,comment,version,issue;var me,prop,method,del;var thoughtToBe,emitDep,emitDel;var metaLib=context.utils.metaLib;if(!NT){NT=context.utils.AstUtils.getNodeTypes()}if(node.callee&&(node.callee.name==="define"||node.callee.name==="require")){this._funcVarTable=this._handleViewModelDefine(context,node);return}if(!depMethods){depMethods=metaLib.getDeprecatedMethodList(context)}if(!delMethods){delMethods=metaLib.getDeletedMethodList(context)}me=node.callee;if(me.name&&me.name==="$"){return}if(me.type!==NT.MEMBER_EXPR){return}objName=this._getVarFromMemberExpr(me);prop=me.property;if(prop&&prop.name){method=prop.name}if(!(method&&objName)){return}if(this._isCommonMethod(context,objName,method)){return}if(!depMethods[method]){del=delMethods[method];if(!del){return}}if(context.utils.AstUtils.isFuncArg(node,objName)){if(del&&this._scope.deleted.unsure||!del&&this._scope.deprecated.unsure){issue=new context.Issue("Possible use of "+(del?"deleted":"deprecated")+" JET method "+method+"() on var '"+objName+"' (class cannot be determined)");issue.setMsgKey(context.ruleName+"_1");context.reporter.addIssue(issue,context);return}}component=this._findInstantiatedComponent(context,node,objName);if(!component){return}if(status=metaLib.isClassMethodDeprecated(component,method)){comment=context.utils.utils.removeMarkup(status[0].description)}thoughtToBe=this._isOrigVarValue(context,node,objName)?"":"thought to be ";emitDep=thoughtToBe&&this._scope.deprecated.unsure||!thoughtToBe&&this._scope.deprecated.sure;emitDel=thoughtToBe&&this._scope.deleted.unsure||!thoughtToBe&&this._scope.deleted.sure;if(del&&emitDel||!del&&emitDep){if(comment){comment=context.utils.utils.removeMarkup(comment);issue=new context.Issue("Method "+method+"() on var '"+objName+"' ("+thoughtToBe+component+")"+(comment.toLowerCase().includes("deprecated")?". ":" is "+(del?"deleted":"deprecated")+". ")+comment)}else{if(metaLib.isClassDeprecated(component)){issue=new context.Issue("Method "+method+"() on var '"+objName+"' called on deprecated class ("+thoughtToBe+component+").")}}}if(!issue){if(emitDel){version=metaLib.isClassMethodDeleted(component,method);if(version){issue=new context.Issue("Method "+method+"() on var '"+objName+"' ("+thoughtToBe+component+")"+" was removed in version "+version)}else if(metaLib.isClassDeleted(component)){issue=new context.Issue("Method "+method+"() on var '"+objName+"' called on deleted class ("+thoughtToBe+component+").")}if(issue){issue.setSeverity("critical");issue.setMsgKey(RULE_NAME+"_2")}}}if(issue){context.reporter.addIssue(issue,context)}};Rule.prototype._newFile=function(context){if(context.type==="file"&&context.filetype==="html"){return}if(!this._helper){this._helper=new helperClass}this._reset();if(!NT&&context.utils.AstUtils){NT=context.utils.AstUtils.getNodeTypes()}};Rule.prototype._endFile=function(context){this._define=false;if(this._helper){this._helper.reset()}};Rule.prototype._setup=function(context,node){var funcName;if(!depMethods){depMethods=context.utils.metaLib.getDeprecatedMethodList(context)}if(!delMethods){delMethods=context.utils.metaLib.getDeletedMethodList(context)}if(!NT){NT=context.utils.AstUtils.getNodeTypes()}if(!this._globalVars){this._helper.getGlobalVars(context);this._globalVars=true}if(this._define){return}var o=this._helper.createFuncDeclarations(context,node);if(o){this._funcVarTable=o.funcVarTable;for(funcName in this._funcVarTable){this._handleVarAssignments(context,node,this._funcVarTable[funcName])}}else{this._funcVarTable=null}};Rule.prototype._findInstantiatedComponent=function(context,node,varName){var funcName=this._helper.getContainingFunctionName(context,node);var funcVars=funcName&&this._funcVarTable?this._funcVarTable[funcName]:null;var varDef;if(funcVars){varDef=funcVars[varName];if(!varDef){funcVars=this._funcVarTable[_GLOBAL];if(funcVars){varDef=funcVars[varName]}}if(varDef&&varDef.valType){if(varDef.valType==="funcret"&&varDef.func==="$")return null;while(varDef.valType==="var"||varDef.valType==="globvar"){varDef=funcVars[varDef.varName];if(!varDef.valType){return}}if(varDef.class){return(varDef.obj?varDef.obj+".":"")+varDef.class}}}};Rule.prototype._handleVarAssignments=function(context,node,funcVars){var body,stmt,leftObj,rightObj,i;body=node.body.body;for(i=0;i<body.length;i++){stmt=body[i];if(stmt.type===NT.EXPR_STMT){if(stmt.expression){if(stmt.expression.type===NT.ASSIGNMENT_EXPR){if(stmt.expression.left.type===NT.IDENTIFIER){if(!funcVars[stmt.expression.left.name]){funcVars[stmt.expression.left.name]={type:"globvar"}}if(stmt.expression.right.type===NT.IDENTIFIER){if(!funcVars[stmt.expression.right.name]){funcVars[stmt.expression.right.name]={type:"globvar"}}leftObj=funcVars[stmt.expression.left.name];rightObj=funcVars[stmt.expression.right.name];leftObj.valType=rightObj.valType;leftObj.varName=rightObj.varName}}}}}}};Rule.prototype._getVarFromMemberExpr=function(me,varSoFar,level){var obj;level=typeof level==="number"?level+1:0;if(me.object){obj=me.object;if(obj.type===NT.IDENTIFIER){varSoFar=varSoFar?varSoFar+"."+obj.name:obj.name}else if(obj.type===NT.MEMBER_EXPR){varSoFar=this._getVarFromMemberExpr(obj,varSoFar,level)}if(me.property&&level){if(me.property.type===NT.IDENTIFIER){varSoFar=varSoFar?varSoFar+"."+me.property.name:me.property.name}else if(me.property.type===NT.MEMBER_EXPR){varSoFar=this._getVarFromMemberExpr(me.property,varSoFar,level)}}}return varSoFar};Rule.prototype._isOrigVarValue=function(context,node,varName){var funcName,funcVars,varDef;funcName=this._helper.getContainingFunctionName(context,node);if(funcName){funcVars=this._funcVarTable[funcName];if(funcVars){varDef=funcVars[varName]}}if(!varDef){funcVars=this._funcVarTable[_GLOBAL];if(funcVars){varDef=funcVars[varName]}}if(!varDef){return false}while(varDef.valType!=="new"){if(varDef.valType==="lit"){break}if(varDef.valType==="var"){varDef=funcVars[varDef.varName]}}return varDef&&varDef.valType==="new"&&varDef.class===varDef.origClass};Rule.prototype._handleViewModelDefine=function(context,node){var p,args,stmt,o,i;args=node.arguments;if(!args){return}for(i=0;i<args.length;i++){stmt=args[i];if(stmt.type===NT.FUNC_EXPR){o=this._helper.createFuncDeclarations(context,stmt);this._funcVarTable=o.funcVarTable}}this._define=true;return this._funcVarTable};Rule.prototype._isCommonMethod=function(context,objName,method){return method.charAt(0)==="_"||method==="observable"||method==="applyBindings"||method==="addEventListener"||method==="removeEventListener"||context.utils.AstUtils.isCommonDocApi(method)||objName==="this"||objName==="self"||objName==="_self"||objName==="window"||objName==="console"||this._helper.isCommonVar(objName)};Rule.prototype._getRuleOptions=function(regCtx){var scope=regCtx.ruleOpts.scope;if(scope&&typeof scope!=="object"){regCtx.error("Rule "+RULE_NAME+" : invalid config 'ruleMods.scope' property. Rule disabled.");return false}this._scope={deprecated:{sure:true,unsure:false},deleted:{sure:true,unsure:false}};if(!scope){return true}var o=scope.deprecated;if(o){if(o.hasOwnProperty("sure")){this._scope.deprecated.sure=!!scope.deprecated.sure}if(o.hasOwnProperty("unsure")){this._scope.deprecated.unsure=!!scope.deprecated.unsure}}o=scope.deleted;if(o){if(o.hasOwnProperty("sure")){this._scope.deleted.sure=!!scope.deleted.sure}if(o.hasOwnProperty("unsure")){this._scope.deleted.unsure=!!scope.deleted.unsure}}return this._scope.deprecated.sure||this._scope.deprecated.unsure||this._scope.deleted.sure||this._scope.deleted.unsure};module.exports=Rule;
|
|
@@ -1 +1,6 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright (c) 2018, 2022, Oracle and/or its affiliates.
|
|
3
|
+
* Licensed under The Universal Permissive License (UPL), Version 1.0
|
|
4
|
+
* as shown at https://oss.oracle.com/licenses/upl/
|
|
5
|
+
*/
|
|
1
6
|
const RULE_NAME="oj-js-no-ext-final";const LONG_DESCR="Starting in 8.0.0, constructors for classes marked with @final in the JET JS Doc cannot be invoked without use of 'new'";const MSG_PART="' constructor without 'new' will fail in version 8.x or later";const OJ="oj";const OJDOT="oj.";var lookup;function getName(){return RULE_NAME};function getShortDescription(){return"Classes marked @final must be constructed with 'new'"};function getDescription(){return LONG_DESCR};function register(){return{CallExpression:_fnCall,MemberExpression:_fnMemExpr,file:_fnNewFile,ImportDeclaration:_fnImport}};function _fnNewFile(context){lookup={}};function _fnImport(context,node){var obj;obj=context.utils.AstUtils.parseImport(node);if(obj){_getClassNames(context,obj);for(var name in obj){obj[name]=name}Object.assign(lookup,obj)}};function _fnCall(context,node){let callee,obj,exit=false;if(!node.callee){return}callee=node.callee;if(callee){if(callee.name==="define"){obj=context.utils.AstUtils.parseDefine(node);exit=true}else if(callee.name==="require"){obj=_parseRequire(context,node);exit=true}if(obj){_getClassNames(context,obj);Object.assign(lookup,obj)}if(exit){return}}if(_specialCase(callee)){return}return _handleCall(context,node,callee)};function _handleCall(context,node,callee){var clazz,ojclazz,obj,classBase,pos,immed=false;if(callee.type==="Identifier"){clazz=callee.name;pos=callee;immed=true}else if(callee.type==="MemberExpression"&&callee.object){if(callee.object.type==="NewExpression"){return}if(callee.object.type==="Identifier"){if(callee.object.name===OJ){if(callee.property.type==="Identifier"){clazz=OJDOT+callee.property.name;pos=callee.object.property}}else{clazz=callee.object.name;pos=callee.object}}else if(callee.object.type==="MemberExpression"){if(callee.object.object&&callee.object.object.type==="Identifier"&&callee.object.object.name===OJ){classBase=callee.object.property.name;clazz=OJDOT+classBase}}}if(clazz){ojclazz=lookup[clazz];if(ojclazz){if(_checkFinal(context,ojclazz,pos)){return}}else if(!immed){ojclazz=clazz;if(context.utils.metaLib.isClass(ojclazz)){obj=_checkStatic(context,ojclazz,callee);if(obj.exists&&!obj.static){_emitIssue("uninstantiated '"+ojclazz+" : use of non-static method '"+obj.fn+"' will fail in JET 8.x or higher",context,pos)}else if(!obj.exists){if(callee.property&&callee.property.type==="Identifier"&&callee.property.name){if(clazz.substring(3)===callee.property.name||callee.property.name==="call"||callee.property.name==="apply"){_emitIssue("'"+clazz+MSG_PART,context)}}}}}}};function _emitIssue(msg,context,pos){var issue=new context.Issue(msg);if(pos){issue.setPosition(null,null,pos.start,pos.end)}context.reporter.addIssue(issue,context)}function _fnMemExpr(context,node){let ojclazz,attr;if(node.parent&&node.parent.type==="CallExpression"){return}if(node.object&&node.object.type&&node.object.type==="MemberExpression"){if(node.object.object&&node.object.object.type==="Identifier"&&node.object.property){if(node.object.property.type==="Identifier"){ojclazz=node.object.object.name+"."+node.object.property.name;attr=node.property.name;if(context.utils.metaLib.isClassMember(ojclazz,attr)&&!context.utils.metaLib.isClassMemberStatic(ojclazz,attr)){_emitIssue("uninstantiated '"+ojclazz+" : use of non-static member '"+attr+"' will fail in JET 8.x or higher",context,node.property)}}}}};function _checkFinal(context,clazz,pos){var ret=false;if(context.utils.metaLib.isClassFinal(clazz)){_emitIssue("'"+clazz+MSG_PART,context,pos);ret=true}return ret};function _getClassNames(context,obj){var clazz,module,name;if(obj){for(name in obj){module=obj[name];clazz=context.utils.metaLib.getClassFromModule(module);obj[name]=clazz}}};function _parseRequire(context,node,obj){var module,clazz,p;obj=obj||null;if(node.arguments){module=node.arguments[0];if(module&&module.type==="Literal"){module=module.value;p=node.parent;if(p.type==="VariableDeclarator"){if(p.id&&p.id.type==="Identifier"){clazz=p.id.name}}else if(p.type==="AssignmentExpression"){if(p.left.type==="Identifier"){clazz=p.left.name}}if(clazz){obj=obj||{};obj[clazz]=module}}}return obj};function _specialCase(callee){var obj;if(callee){if(callee.object&&callee.object.name){if(callee.object.object){return false}obj=callee.object.name;if(obj==="Object"){return true}}}return false};function _checkStatic(context,ojclazz,callee){var name;var ret={};if(context.utils.metaLib.isClassFinal(ojclazz)){if(callee.property&&callee.property.type==="Identifier"&&callee.property.name){name=callee.property.name;ret.fn=name;if(context.utils.metaLib.isClassMethod(ojclazz,name)){ret.exists=true;ret.static=context.utils.metaLib.isClassMethodStatic(ojclazz,name);return ret}}}ret.fn=null;return ret};module.exports={getName,getDescription,getShortDescription,register};
|
|
@@ -1 +1,6 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright (c) 2018, 2022, Oracle and/or its affiliates.
|
|
3
|
+
* Licensed under The Universal Permissive License (UPL), Version 1.0
|
|
4
|
+
* as shown at https://oss.oracle.com/licenses/upl/
|
|
5
|
+
*/
|
|
1
6
|
const RULENAME="oj-js-noconsole";const DESCRIPTION="All uses of console.log() should be removed before general release";const SHORT_DESCRIPTION="console.log() should be removed before general release";class Rule{getName(){return RULENAME}getDescription(){return DESCRIPTION}getShortDescription(){return SHORT_DESCRIPTION}register(){return{CallExpression:this._onCall}}_onCall(ruleCtx,node){if(node.callee&&node.callee.object&&node.callee.object.name==="console"){let meth=node.callee.property&&node.callee.property.type==="Identifier"?": method "+node.callee.property.name+"()":"";let issue=new ruleCtx.Issue(`Use of console object found ${meth} - strip before shipping!`);ruleCtx.reporter.addIssue(issue,ruleCtx)}}}module.exports=Rule;
|
|
@@ -1 +1,6 @@
|
|
|
1
|
-
|
|
1
|
+
/*
|
|
2
|
+
* Copyright (c) 2018, 2022, Oracle and/or its affiliates.
|
|
3
|
+
* Licensed under The Universal Permissive License (UPL), Version 1.0
|
|
4
|
+
* as shown at https://oss.oracle.com/licenses/upl/
|
|
5
|
+
*/
|
|
6
|
+
const RULENAME="oj-js-ojcomp-deprecated";const DESCRIPTION="Deprecated JET component classes should not be instantiated";const SHORT_DESCRIPTION="Deprecated JET component classes should not be instantiated";const PERIOD=".";var nt;class Rule{getName(){return RULENAME}getDescription(){return DESCRIPTION}getShortDescription(){return SHORT_DESCRIPTION}register(regCtx){var ret={};nt=regCtx.jsNodeTypes;ret[nt.NEW_EXPR]=this._onNew;return ret}_onNew(ruleCtx,node){var component,issue,status,comment,since;var me,obj,start,pos;me=node.callee;if(me.type===nt.MEMBER_EXPR){obj=me.object;if(obj&&obj.type===nt.IDENTIFIER){if(obj.name==="oj"){if(me.property&&me.property.name){component="oj."+me.property.name;start=obj}}}}else if(me.type===nt.IDENTIFIER){component=me.name;start=me}if(component){if(status=ruleCtx.utils.metaLib.isClassDeprecated(component)){comment=ruleCtx.utils.utils.removeMarkup(status.description);since=status.since;since=since?"(since "+since+") ":"";issue=new ruleCtx.Issue(`Instantiation of deprecated ${since}JET class ${component}. ${comment} ${comment.endsWith(PERIOD)?"":PERIOD}`);let ft=ruleCtx.filepath.substring(ruleCtx.filepath.lastIndexOf(".")+1);start=ft==="ts"?start.range[0]:start.start;pos=ruleCtx.utils.utils.getRowColFromIndex(ruleCtx.data,start,ft);issue.setPosition(pos.row,pos.col,start,start+component.length);ruleCtx.reporter.addIssue(issue,ruleCtx)}}}}module.exports=Rule;
|
|
@@ -1 +1,6 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright (c) 2018, 2022, Oracle and/or its affiliates.
|
|
3
|
+
* Licensed under The Universal Permissive License (UPL), Version 1.0
|
|
4
|
+
* as shown at https://oss.oracle.com/licenses/upl/
|
|
5
|
+
*/
|
|
1
6
|
const RULENAME="oj-js-ojcomp-exist";const DESCRIPTION="The JET component class is unknown or has been renamed. The component class's deprecation period may have expired and it has been removed.";const SHORT_DESCRIPTION="Unknown JET component classes should not be instantiated";class Rule{getName(){return RULENAME}getDescription(){return DESCRIPTION}getShortDescription(){return SHORT_DESCRIPTION}register(regCtx){var ret={};this._nt=regCtx.jsNodeTypes;ret[this._nt.NEW_EXPR]=this._onNew;return ret}_onNew(ruleCtx,node){var clazz,issue,exists;var me,obj,start;var metaLib=ruleCtx.utils.metaLib;me=node.callee;if(me.type==="MemberExpression"){obj=me.object;if(obj&&obj.type==="Identifier"){if(obj.name==="oj"){if(me.property&&me.property.name){clazz="oj."+me.property.name}start=obj}}}else if(me.type==="Identifier"){clazz=me.name;start=me}if(clazz){exists=metaLib.isComponent(clazz);if(!exists){issue=this._isRenamed(clazz,ruleCtx);if(!issue){issue=this._isDeleted(clazz,ruleCtx)}if(issue){let ft=ruleCtx.filepath.substring(ruleCtx.filepath.lastIndexOf(".")+1);start=ft==="ts"?start.range[0]:start.start;let pos=ruleCtx.utils.utils.getRowColFromIndex(ruleCtx.data,start,ft);issue.setPosition(pos.row,pos.col,start,start+clazz.length);ruleCtx.reporter.addIssue(issue,ruleCtx,start)}}}}_isRenamed(clazz,ruleCtx){var o,issue;o=ruleCtx.utils.metaLib.isClassRenamed(clazz);if(o){issue=new ruleCtx.Issue(`Instantiation of '${clazz}' - this class was renamed to ${o.to} in ${o.since}`);issue.setMsgKey(RULENAME+"_1")}return issue}_isDeleted(clazz,ruleCtx){var ver,issue;ver=ruleCtx.utils.metaLib.isClassDeleted(clazz);if(ver){if(clazz==="oj.ojTree"){issue=new ruleCtx.Issue(`Instantiation of '${clazz}' - this class was undocumented in version 6.0.0`)}else{issue=new ruleCtx.Issue(`Instantiation of '${clazz}' - this class was removed in version ${ver}`)}}else if(clazz.startsWith("oj.")){if(clazz!=="oj.ojTree"){issue=new ruleCtx.Issue(`Instantiation of unknown JET component '${clazz}'`)}else{issue=new ruleCtx.Issue(`Instantiation of ${clazz} - this class was undocumented in version 6.0.0`)}}return issue}}module.exports=Rule;
|
|
@@ -1 +1,6 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright (c) 2018, 2022, Oracle and/or its affiliates.
|
|
3
|
+
* Licensed under The Universal Permissive License (UPL), Version 1.0
|
|
4
|
+
* as shown at https://oss.oracle.com/licenses/upl/
|
|
5
|
+
*/
|
|
1
6
|
const RULENAME="oj-js-ojcomp-new";const DESCRIPTION="JET custom element usage should be used instead of instantiating a JET component class via 'new'.";const SHORT_DESCRIPTION="Replace Instantiation of a JET component class via \"new\" with a custom element";class Rule{getName(){return RULENAME}getDescription(){return DESCRIPTION}getShortDescription(){return SHORT_DESCRIPTION}register(){return{NewExpression:this._onNew}}_onNew(ruleCtx,node){var component,issue,elem;var me,obj,start;var metaLib=ruleCtx.utils.metaLib;me=node.callee;if(me.type==="MemberExpression"){obj=me.object;if(obj&&obj.type==="Identifier"){if(obj.name==="oj"){if(me.property&&me.property.name){component="oj."+me.property.name;start=obj}}}}else if(me.type==="Identifier"){component=me.name;start=me}if(component){if(metaLib.isClassRenamed(component)||metaLib.isClassDeleted(component)){return}if(metaLib.isComponent(component)){if(component==="oj.ojTree"){elem="oj-tree-view"}else{elem=metaLib.getTagFromClass(component)}if(elem){issue=new ruleCtx.Issue("Instantiation of JET class "+component+" found. Use web component <"+elem+">.");let ft=ruleCtx.filepath.substring(ruleCtx.filepath.lastIndexOf(".")+1);start=ft==="ts"?start.range[0]:start.start;let pos=ruleCtx.utils.utils.getRowColFromIndex(ruleCtx.data,start,ft);issue.setPosition(pos.row,pos.col,start,start+component.length);ruleCtx.reporter.addIssue(issue,ruleCtx)}}}}}module.exports=Rule;
|
|
@@ -1 +1,6 @@
|
|
|
1
|
-
|
|
1
|
+
/*
|
|
2
|
+
* Copyright (c) 2018, 2022, 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
|
+
var path=require("path");const RULENAME="oj-js-poly-promise";const SHORT="The 'promise' polyfill should not be declared explicitly in define/require()";const DESCRIPTION="The Promise polyfill is no longer distributed with JET v11 and higher. Support for Internet Explorer 11 and ES5 "+"has been removed starting with JET v11. All modern browsers provide direct support for Promise and the Promise "+"polyfill should no longer be referenced separately.";const DEFINE="define";const REQUIRE="require";const TS="ts";var nt;class Rule{getName(){return RULENAME}getDescription(){return DESCRIPTION}getShortDescription(){return SHORT}register(regCtx){nt=regCtx.jsNodeTypes;return{CallExpression:this._onCall}}_onCall(ruleCtx,node){var args,arg,argVal,i,start,issue;if(node.callee&&(node.callee.name===DEFINE||node.callee.name===REQUIRE)){if(node.arguments&&node.arguments.length>=1){if(node.arguments[0].type===nt.ARRAY_EXPR){args=node.arguments[0].elements;for(i=0;i<args.length;i++){arg=args[i];if(arg&&arg.type==="Literal"){argVal=arg.raw.toLowerCase();argVal=path.basename(argVal);if(argVal.includes("promise")){issue=new ruleCtx.Issue(node.callee.name+"() explicitly loads polyfill 'promise'");start=_isTS(ruleCtx)?arg.range[0]:arg.start;start=start+arg.raw.indexOf("promise");issue.setPosition(null,null,start,start+6);ruleCtx.reporter.addIssue(issue,ruleCtx);break}}}}}}}}function _isTS(ctx){return ctx.filepath.substring(ctx.filepath.lastIndexOf(".")+1)===TS};module.exports=Rule;
|
|
@@ -1 +1,6 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright (c) 2018, 2022, Oracle and/or its affiliates.
|
|
3
|
+
* Licensed under The Universal Permissive License (UPL), Version 1.0
|
|
4
|
+
* as shown at https://oss.oracle.com/licenses/upl/
|
|
5
|
+
*/
|
|
1
6
|
const helperClass=require("./helpers/vartrack");const RULE_NAME="oj-js-var-undef";var NT;function Rule(){this._reset()};Rule.prototype.getName=function(){return RULE_NAME};Rule.prototype.getShortDescription=function(){return"JS variables should be defined"};Rule.prototype.getDescription=function(){return"Referenced Javascript variables should be defined."};Rule.prototype.register=function(){return{FunctionDeclaration:this._setup,file:this._newFile,startscript:this._newFile,endfile:this._endFile,endscript:this._endFile,CallExpression:this._handleCallExpressions,MemberExpression:this._handleMemberExpressions,AssignmentExpression:this._handleAssignments,FunctionExpression:this._handleFuncExpressions,IfStatement:this._handleIf,NewExpression:this._handleNew,ReturnStatement:this._handleReturns}};Rule.prototype._reset=function(){this._funcVarTable=null;this._globalVars=false;this._define=false;if(this._helper){this._helper.reset()}};Rule.prototype._handleCallExpressions=function(context,node){var n,arg,props,prop,i,j;if(node.callee&&(node.callee.name==="define"||node.callee.name==="require")){this._funcVarTable=this._handleViewModelDefine(context,node);return}n=node.callee;while(n){if(n.type===NT.IDENTIFIER){break}n=n.object}if(n&&n.name){if(!this._funcVarTable[n.name]){this._helper.isVarDefined(context,node,n,n.name)}}if(node.arguments){for(i=0;i<node.arguments.length;i++){arg=node.arguments[i];if(arg&&arg.type===NT.IDENTIFIER){this._helper.isVarDefined(context,node,arg,arg.name)}else if(arg.type===NT.OBJ_EXPR){props=arg.properties;for(j=0;j<props.length;j++){prop=props[j];if(prop.type===NT.PROPERTY){if(prop.value.type===NT.IDENTIFIER){this._helper.isVarDefined(context,node,prop.value,prop.value.name)}}}}}}};Rule.prototype._handleMemberExpressions=function(context,node){var n,v;if(node.parent&&node.parent.type===NT.NEW_EXPR){return}if(node.object&&node.object.type===NT.IDENTIFIER&&node.property.name!=="prototype"){if(node.object.name){this._helper.isVarDefined(context,node,node.object,node.object.name);return}}if(node.object){n=node.object;while(n){if(n.property&&n.property.type===NT.IDENTIFIER&&n.property.name==="prototype"){return}if(n.type===NT.IDENTIFIER){v=n.name;break}n=n.object}}else if(node.callee){n=node.callee;while(n){if(n.type===NT.IDENTIFIER){v=n.name;break}n=n.object}}if(v){if(!this._funcVarTable[v]){this._helper.isVarDefined(context,node,n,v)}}};Rule.prototype._handleAssignments=function(context,node){var n;if(node.left.type===NT.IDENTIFIER){this._helper.isVarDefined(context,node,node.left,node.left.name)}if(node.right.type===NT.IDENTIFIER){this._helper.isVarDefined(context,node,node.right,node.right.name)}if(node.right.type===NT.CONDITIONAL_EXPR){if(node.right.test.type===NT.IDENTIFIER){this._helper.isVarDefined(context,node,node.right,node.right.test.name)}if(node.right.alternate.type===NT.IDENTIFIER){this._helper.isVarDefined(context,node,node.right.alternate,node.right.alternate.name)}if(node.right.consequent.type===NT.IDENTIFIER){this._helper.isVarDefined(context,node,node.right.consequent,node.right.consequent.name)}}if(node.left.type===NT.MEMBER_EXPR){n=node.left.object;while(n){if(n.type===NT.IDENTIFIER){this._helper.isVarDefined(context,node,n,n.name);break}n=n.object}}if(node.right.type===NT.MEMBER_EXPR){n=node.right.object;while(n){if(n.type===NT.IDENTIFIER){this._helper.isVarDefined(context,node,n,n.name);break}n=n.object}}if(node.left.object&&node.left.object.type===NT.IDENTIFIER){this._helper.isVarDefined(context,node,node.left.object,node.left.object.name)}if(node.right.object&&node.right.object.type===NT.IDENTIFIER){this._helper.isVarDefined(context,node,node.right.object,node.right.object.name)}};Rule.prototype._handleIf=function(context,node){var n,body,stmt;if(node.test){if(node.test.type===NT.BINARY_EXPR){if(node.test.left.type===NT.IDENTIFIER){this._helper.isVarDefined(context,node,node.test.left,node.test.left.name)}if(node.test.right.type===NT.IDENTIFIER){this._helper.isVarDefined(context,node,node.test.right,node.test.right.name)}return}else if(node.test.type===NT.MEMBER_EXPR){n=node.test.object;while(n){if(n.type===NT.IDENTIFIER){this._helper.isVarDefined(context,node,n,n.name);return}n=n.object}}else if(node.test.type===NT.IDENTIFIER){this._helper.isVarDefined(context,node,node.test,node.test.name)}}if(node.consequent){n=node.consequent;if(n.type===NT.IDENTIFIER){this._helper.isVarDefined(context,node,n,n.name);return}n=n.object;while(n){if(n.type===NT.IDENTIFIER){this._helper.isVarDefined(context,node,n,n.name);return}n=n.object}if(node.consequent.body){body=node.consequent.body;for(stmt in body){stmt=body[stmt];this._helper.pushNodeWithParent(node);this._dispatchHandler(context,stmt);this._helper.popNodeWithParent()}}}if(node.alternate){n=node.alternate;if(n.type===NT.IDENTIFIER){this._helper.isVarDefined(context,node,n,n.name);return}n=n.object;while(n){if(n.type===NT.IDENTIFIER){this._helper.isVarDefined(context,node,n,n.name);return}n=n.object}if(node.alternate.body){body=node.alternate.body;for(stmt in body){stmt=body[stmt];this._helper.pushNodeWithParent(node);this._dispatchHandler(context,stmt);this._helper.popNodeWithParent()}}}};Rule.prototype._handleFuncExpressions=function(context,node){if(!this._helper.isFunctionKnown(context,node)){this._helper.createFuncDeclarations(context,node)}};Rule.prototype._handleExpressions=function(context,node){var expr=node.expression;if(expr.type===NT.ASSIGNMENT_EXPR){this._handleAssignments(context,expr)}};Rule.prototype._handleReturns=function(context,node){var n,args,arg,i;if(node.argument){if(node.argument.type===NT.IDENTIFIER){this._helper.isVarDefined(context,node,node.argument,node.argument.name)}else if(node.argument.type===NT.MEMBER_EXPR){n=n.argument.object;while(n){if(n.type===NT.IDENTIFIER){this._helper.isVarDefined(context,node,n,n.name);return}n=n.object}}else if(node.argument.type===NT.NEW_EXPR){this._handleNew(context,node)}else if(node.argument.type===NT.CALL_EXPR){args=node.argument.arguments;for(i=0;i<args.length;i++){arg=args[i];if(arg.type===NT.IDENTIFIER){this._helper.isVarDefined(context,node,arg,arg.name)}}}}};Rule.prototype._handleNew=function(context,node){var i,arg;if(node.arguments){for(i=0;i<node.arguments.length;i++){arg=node.arguments[i];if(arg.type===NT.IDENTIFIER){this._helper.isVarDefined(context,node,arg,arg.name)}}}};Rule.prototype._dispatchHandler=function(context,node){if(node.type===NT.MEMBER_EXPR){this._handleMemberExpressions(context,node)}else if(node.type===NT.ASSIGNMENT_EXPR){this._handleAssignments(context,node)}else if(node.type===NT.CALL_EXPR){this._handleCallExpressions(context,node)}else if(node.type===NT.EXPR_STMT){this._handleExpressions(context,node)}else{var jj=42}};Rule.prototype._newFile=function(context){if(context.type==="file"&&context.filetype==="html"){return}this._globalVars=this._funcVarTable=null;this._define=false;if(!this._helper){this._helper=new helperClass}this._reset();if(!NT&&context.utils.AstUtils){NT=context.utils.AstUtils.getNodeTypes()}};Rule.prototype._endFile=function(context){var funcName;var undeclared=this._helper.getUndeclared();if(this._funcVarTable){for(funcName in this._funcVarTable){this._reportUnusedVars(context,this._funcVarTable[funcName])}this._reportUndeclared(context,this._funcVarTable[funcName],undeclared)}this._reset()};Rule.prototype._reportUnusedVars=function(context,funcVars){var varName,varObj,issue,rowcol;for(varName in funcVars){varObj=funcVars[varName];if((varObj.type==="var"||varObj.type==="globvar")&&!funcVars[varName].used){issue=new context.Issue("Unreferenced var '"+varName+"'");rowcol=context.utils.utils.getRowColFromIndex(context.rawData,varObj.start);issue.setPosition(rowcol.row,rowcol.col,varObj.start,varObj.start+varName.length-1);issue.setSeverity("info");issue.setMsgKey(context.ruleName+"_1");context.reporter.addIssue(issue,context)}}};Rule.prototype._reportUndeclared=function(context,funcVars,undeclared){var varName,funcName,node,issue,rowcol,entry,x;for(entry in undeclared){node=undeclared[entry];x=entry.indexOf("!@#$%");varName=entry.substring(0,x);funcName=this._helper.getContainingFunctionName(context,node);if(funcName){funcVars=this._funcVarTable[funcName];if(funcVars){if(funcVars[varName]){if(funcVars[varName.used]){continue}}}}issue=new context.Issue("Undeclared var '"+varName+"'");rowcol=context.utils.utils.getRowColFromIndex(context.rawData,node.start);issue.setPosition(rowcol.row,rowcol.col,node.start,node.start+varName.length-1);issue.setSeverity("info");issue.setMsgKey(context.ruleName+"_1");context.reporter.addIssue(issue,context)}};Rule.prototype._setup=function(context,node){if(!NT){NT=context.utils.AstUtils.getNodeTypes()}if(!this._globalVars){this._helper.getGlobalVars(context);this._globalVars=true}if(this._define){return}var o=this._helper.createFuncDeclarations(context,node);this._funcVarTable=o.funcVarTable};Rule.prototype._handleViewModelDefine=function(context,node){var args,stmt,o,i;args=node.arguments;if(!args){return}for(i=0;i<args.length;i++){stmt=args[i];if(stmt.type===NT.FUNC_EXPR){o=this._helper.createFuncDeclarations(context,stmt);this._funcVarTable=o.funcVarTable}}this._define=true;return this._funcVarTable};module.exports=Rule;
|
|
@@ -1 +1,6 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright (c) 2018, 2022, Oracle and/or its affiliates.
|
|
3
|
+
* Licensed under The Universal Permissive License (UPL), Version 1.0
|
|
4
|
+
* as shown at https://oss.oracle.com/licenses/upl/
|
|
5
|
+
*/
|
|
1
6
|
const RULE_NAME="oj-json-syntax";function getName(){return RULE_NAME};function getShortDescription(){return"JSON syntax must be valid"};function getDescription(){return"The contents of a JSON file must be syntactically valid, and produce no parse errors."};function register(){return{"file":function(context){if(context.filepath.indexOf("component.json")>=0){return true}if(context.suppData.msg){var issue;issue=new context.Issue(context.suppData.msg);issue.setPosition(context.suppData.line,context.suppData.col);context.reporter.addIssue(issue,context);return false}}}};module.exports={getName,getDescription,getShortDescription,register};
|
|
@@ -1 +1,6 @@
|
|
|
1
|
-
|
|
1
|
+
/*
|
|
2
|
+
* Copyright (c) 2018, 2022, 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 helperClass=require("./helpers/vartrack");const RULE_NAME="oj-ts-comp-attr-deprecated";var NT;var depMembers;var delMembers;function Rule(){this._reset();this._scope=null};Rule.prototype.getName=function(){return RULE_NAME};Rule.prototype.getShortDescription=function(){return"JET component class deprecated members should not be invoked"};Rule.prototype.getDescription=function(){return"JET component class deprecated members should not be invoked"};Rule.prototype.register=function(regCtx){if(!depMembers){depMembers=regCtx.utils.metaLib.getDeprecatedMemberList(regCtx)}if(!delMembers){delMembers=regCtx.utils.metaLib.getDeletedMemberList(regCtx)}return{MemberExpression:this._onMemExpr,file:this._onNewFile}};Rule.prototype._reset=function(){if(this._helper){this._helper.reset()}};Rule.prototype._onMemExpr=function(ruleCtx,node){var component,member,objName,status,comment,issue,version,deleted;var metaLib=ruleCtx.utils.metaLib;if(node.parent&&node.parent.type==="CallExpression"){return}objName=this._getVarFromMemberExpr(node);if(this._isCommonObject(ruleCtx,objName)){return}if(node.property){member=node.property.name}if(!(member&&objName&&!member.startsWith("_"))){return}if(!depMembers[member]){deleted=delMembers[member];if(!deleted){return}}component=this._scope.getVarType(node.object);if(!component||component==="TSAnyKeyword"){return}if(status=metaLib.isClassMemberDeprecated(component,member)){comment=ruleCtx.utils.utils.removeMarkup(status[0].description);issue=new ruleCtx.Issue(`Member '${member}' on var '${objName}' (${component}) ${comment.toLowerCase().includes("deprecated")?". ":" is deprecated. "} ${comment}`)}else{if(metaLib.isClassDeprecated(component)){issue=new ruleCtx.Issue(`Method '${member}' on var '${objName}' called on deprecated component ${component}.`)}}if(!issue){version=metaLib.isClassMemberDeleted(component,member);if(version){issue=new ruleCtx.Issue(`Member '${member}' on var '${objName}' (${component}) was removed in version ${version}`)}else if(metaLib.isClassDeleted(component)){issue=new ruleCtx.Issue(`Member '${member}' on var '${objName}' called on deleted class ${component}.`);issue.setSeverity("critical")}if(issue){issue.setSeverity("critical");issue.setMsgKey(RULE_NAME+"_2")}}if(issue){ruleCtx.reporter.addIssue(issue,ruleCtx)}};Rule.prototype._onNewFile=function(ruleCtx){if(!this._helper){this._helper=new helperClass}this._reset();if(!NT&&ruleCtx.utils.AstUtils){NT=ruleCtx.utils.AstUtils.getNodeTypes()}this._scope=ruleCtx.utils.AstUtils.getScopes()};Rule.prototype._getVarFromMemberExpr=function(me,varSoFar,level){var obj;level=typeof level==="number"?level+1:0;if(me.object){obj=me.object;if(obj.type===NT.IDENTIFIER){varSoFar=varSoFar?varSoFar+"."+obj.name:obj.name}else if(obj.type===NT.MEMBER_EXPR){varSoFar=this._getVarFromMemberExpr(obj,varSoFar,level)}if(me.property&&level){if(me.property.type===NT.IDENTIFIER){varSoFar=varSoFar?varSoFar+"."+me.property.name:me.property.name}else if(me.property.type===NT.MEMBER_EXPR){varSoFar=this._getVarFromMemberExpr(me.property,varSoFar,level)}}}return varSoFar};Rule.prototype._isCommonObject=function(ruleCtx,objName){return objName==="this"||objName==="self"||objName==="_self"||objName==="window"||objName==="console"||this._helper.isCommonVar(objName)};module.exports=Rule;
|
|
@@ -1 +1,6 @@
|
|
|
1
|
-
|
|
1
|
+
/*
|
|
2
|
+
* Copyright (c) 2018, 2022, 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 helperClass=require("./helpers/vartrack");const RULENAME="oj-ts-comp-meth-deprecated";var NT;var depMethods;var delMethods;function Rule(){this._reset();this._scope=null};Rule.prototype.getName=function(){return RULENAME};Rule.prototype.getShortDescription=function(){return"JET component class deprecated methods should not be invoked"};Rule.prototype.getDescription=function(){return"JET component class deprecated methods should not be invoked"};Rule.prototype.register=function(regCtx){if(!depMethods){depMethods=regCtx.utils.metaLib.getDeprecatedMethodList(regCtx)}if(!delMethods){delMethods=regCtx.utils.metaLib.getDeletedMethodList(regCtx)}return{CallExpression:this._onCall,file:this._onNewFile,endfile:this._onEndFile}};Rule.prototype._reset=function(){if(this._helper){this._helper.reset()}};Rule.prototype._onCall=function(ruleCtx,node){var component,method,objName,status,comment,version,issue;var me,prop,method,del;var metaLib=ruleCtx.utils.metaLib;if(!NT){NT=ruleCtx.utils.AstUtils.getNodeTypes()}me=node.callee;objName=this._getVarFromMemberExpr(me);prop=me.property;if(prop&&prop.name){method=prop.name}if(!(method&&objName)){return}if(this._isCommonMethod(ruleCtx,objName,method)){return}if(!depMethods[method]){del=delMethods[method];if(!del){return}}component=this._scope.getVarType(me.object);if(!component||component==="TSAnyKeyword"){return}if(status=metaLib.isClassMethodDeprecated(component,method)){comment=ruleCtx.utils.utils.removeMarkup(status[0].description);issue=new ruleCtx.Issue(`Method ${method}() on var '${objName}' (${component}) ${comment.toLowerCase().includes("deprecated")?". ":" is "+(del?"deleted":"deprecated")+". "}${comment}`)}else if(metaLib.isClassDeprecated(component)){issue=new ruleCtx.Issue(`Method ${method}() on var '${objName}' called on deprecated class ${component}`)}if(!issue){if(del){version=metaLib.isClassMethodDeleted(component,method);if(version){issue=new ruleCtx.Issue(`Method ${method}() on var '${objName}' (${component}) was removed in version ${version}`)}else if(metaLib.isClassDeleted(component)){issue=new ruleCtx.Issue(`Method ${method}() on var '${objName}' called on deleted class (${component}).`)}if(issue){issue.setSeverity("critical");issue.setMsgKey(RULENAME+"_2")}}}if(issue){ruleCtx.reporter.addIssue(issue,ruleCtx)}};Rule.prototype._onNewFile=function(ruleCtx){if(ruleCtx.type==="file"&&ruleCtx.filetype!=="ts"){return}if(!this._helper){this._helper=new helperClass}this._reset();if(!NT&&ruleCtx.utils.AstUtils){NT=ruleCtx.utils.AstUtils.getNodeTypes()}this._scope=ruleCtx.utils.AstUtils.getScopes()};Rule.prototype._onEndFile=function(){};Rule.prototype._getVarFromMemberExpr=function(me,varSoFar,level){var obj;level=typeof level==="number"?level+1:0;if(me.object){obj=me.object;if(obj.type===NT.IDENTIFIER){varSoFar=varSoFar?varSoFar+"."+obj.name:obj.name}else if(obj.type===NT.MEMBER_EXPR){varSoFar=this._getVarFromMemberExpr(obj,varSoFar,level)}if(me.property&&level){if(me.property.type===NT.IDENTIFIER){varSoFar=varSoFar?varSoFar+"."+me.property.name:me.property.name}else if(me.property.type===NT.MEMBER_EXPR){varSoFar=this._getVarFromMemberExpr(me.property,varSoFar,level)}}}return varSoFar};Rule.prototype._isCommonMethod=function(ruleCtx,objName,method){return method.charAt(0)==="_"||method==="observable"||method==="applyBindings"||method==="addEventListener"||method==="removeEventListener"||ruleCtx.utils.AstUtils.isCommonDocApi(method)||objName==="this"||objName==="self"||objName==="_self"||objName==="window"||objName==="console"||this._helper.isCommonVar(objName)};module.exports=Rule;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright (c) 2018, 2022, 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-ts-no-ext-final";const LONG_DESCR="Starting in 8.0.0, constructors for classes marked with @final in the JET JS Doc cannot be invoked without use of 'new'";const MSG_PART="' constructor without 'new' will fail in version 8.x or later";const OJ="oj";const OJDOT="oj.";class Rule{getName(){return RULE_NAME}getDescription(){return LONG_DESCR}getShortDescription(){return LONG_DESCR}register(){return{CallExpression:this._onCall,file:this._onNewFile}}_onCall(ruleCtx,node){let callee;if(!node.callee){return}callee=node.callee;if(callee){if(callee.name==="define"||callee.name==="require"){return}if(_specialCase(callee)){return}return this._handleCall(ruleCtx,node,callee)}}_onNewFile(ruleCtx){this._scope=ruleCtx.utils.AstUtils.getScopes()}_handleCall(ruleCtx,node,callee){var clazz,ojclazz,obj,classBase,ojdot,pos,immed=false;if(callee.type==="Identifier"){clazz=callee.name;if(!ruleCtx.utils.metaLib.isClass(clazz)){clazz=this._scope.getVarType(callee);if(!clazz){return}}ojclazz=clazz;pos={start:callee.range[0],end:callee.range[1]};immed=true}else if(callee.type==="MemberExpression"&&callee.object){if(callee.object.type==="NewExpression"){return}if(callee.object.type==="Identifier"){if(callee.object.name===OJ){if(callee.property.type==="Identifier"){clazz=callee.property.name;ojclazz=clazz=OJDOT+clazz;pos={start:callee.object.range[0],end:callee.object.range[0]+ojclazz.length}}}else{clazz=callee.object.name;pos={start:callee.object.range[0],end:callee.object.range[1]}}}else if(callee.object.type==="MemberExpression"){if(callee.object.object&&callee.object.object.type==="Identifier"&&callee.object.object.name===OJ){classBase=callee.object.property.name;clazz=classBase;ojdot=true;pos={start:callee.object.range[0],end:callee.object.range[1]}}}}if(!clazz){return}if(ojclazz){if(_checkFinal(ruleCtx,ojclazz,pos)){return}}if(!immed){ojclazz=clazz;if(!ruleCtx.utils.metaLib.isClass(ojclazz)){if(ojdot){ojclazz=OJDOT+clazz}}if(ruleCtx.utils.metaLib.isClass(ojclazz)){obj=_checkStatic(ruleCtx,ojclazz,callee);if(obj.exists&&!obj.static){_emitIssue("uninstantiated '"+ojclazz+" : use of non-static method '"+obj.fn+"' will fail in JET 8.x or higher",ruleCtx,pos)}else if(!obj.exists){if(callee.property&&callee.property.type==="Identifier"&&callee.property.name){if(clazz.substring(3)===callee.property.name||callee.property.name==="call"||callee.property.name==="apply"){_emitIssue("'"+clazz+MSG_PART,ruleCtx,pos)}}}}}}}function _emitIssue(msg,ruleCtx,pos){var issue=new ruleCtx.Issue(msg);if(pos){issue.setPosition(null,null,pos.start,pos.end)}ruleCtx.reporter.addIssue(issue,ruleCtx)}function _checkFinal(ruleCtx,clazz,pos){var cls,metaLib,ret=false;metaLib=ruleCtx.utils.metaLib;if(clazz.startsWith(OJDOT)){cls=metaLib.isClassRenamed(clazz);if(cls){clazz=cls.to}}if(ruleCtx.utils.metaLib.isClassFinal(clazz)){_emitIssue("'"+clazz+MSG_PART,ruleCtx,pos);ret=true}return ret};function _specialCase(callee){var obj;if(callee){if(callee.object&&callee.object.name){if(callee.object.object){return false}obj=callee.object.name;if(obj==="Object"){return true}}}return false};function _checkStatic(context,ojclazz,callee){var name;var ret={};if(context.utils.metaLib.isClassFinal(ojclazz)){if(callee.property&&callee.property.type==="Identifier"&&callee.property.name){name=callee.property.name;ret.fn=name;if(context.utils.metaLib.isClassMethod(ojclazz,name)){ret.exists=true;ret.static=context.utils.metaLib.isClassMethodStatic(ojclazz,name);return ret}}}ret.fn=null;return ret};module.exports=Rule;
|
|
@@ -1 +1,6 @@
|
|
|
1
|
-
|
|
1
|
+
/*
|
|
2
|
+
* Copyright (c) 2018, 2022, 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-noconsole";const DESCRIPTION="All uses of console.log() should be removed before general release";const SHORT_DESCRIPTION="console.log() should be removed before general release";const CONSOLE="Console";class Rule{getName(){return RULENAME}getDescription(){return DESCRIPTION}getShortDescription(){return SHORT_DESCRIPTION}register(){return{CallExpression:this._onCall,file:this._onNewFile}}_onCall(ruleCtx,node){var callee,meth,isCons;callee=node.callee;if(callee&&callee.object){if(callee.object.name==="console"){isCons=true}else{let t=this._scopes.getVarType(callee.object);isCons=t===CONSOLE}if(isCons){meth=callee.property&&callee.property.type==="Identifier"?": method "+callee.property.name+"()":"";let issue=new ruleCtx.Issue(`Use of console object found ${meth} - strip before shipping!`);issue.setPosition(null,null,callee.property.range[0],callee.property.range[1]);ruleCtx.reporter.addIssue(issue,ruleCtx)}}}_onNewFile(ruleCtx){this._scopes=ruleCtx.utils.AstUtils.getScopes()}}module.exports=Rule;
|
|
@@ -1 +1,6 @@
|
|
|
1
|
-
|
|
1
|
+
/*
|
|
2
|
+
* Copyright (c) 2018, 2022, 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-ojcomp-deprecated";const DESCRIPTION="Deprecated JET component classes should not be instantiated";const SHORT_DESCRIPTION="Deprecated JET component classes should not be instantiated";const PERIOD=".";var nt;class Rule{getName(){return RULENAME}getDescription(){return DESCRIPTION}getShortDescription(){return SHORT_DESCRIPTION}register(regCtx){var ret={};nt=regCtx.tsNodeTypes;ret[nt.NEW_EXPR]=this._onNew;return ret}_onNew(ruleCtx,node){var component,issue,status,comment;var me,obj,start,pos;me=node.callee;if(me.type===nt.MEMBER_EXPR){obj=me.object;if(obj&&obj.type===nt.IDENTIFIER){if(obj.name==="oj"){if(me.property&&me.property.name){component="oj."+me.property.name;start=obj}}}}else if(me.type===nt.IDENTIFIER){component=me.name;start=me}if(component){if(status=ruleCtx.utils.metaLib.isClassDeprecated(component)){comment=ruleCtx.utils.utils.removeMarkup(status.description);issue=new ruleCtx.Issue(`Instantiation of deprecated JET class ${component}. ${comment} ${comment.endsWith(PERIOD)?"":PERIOD}`);issue.setPosition(null,null,start.range[0],start.range[0]+component.length);ruleCtx.reporter.addIssue(issue,ruleCtx)}}}}module.exports=Rule;
|
|
@@ -1 +1,6 @@
|
|
|
1
|
-
|
|
1
|
+
/*
|
|
2
|
+
* Copyright (c) 2018, 2022, 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-ojcomp-exist";const DESCRIPTION="The JET component class is unknown or has been renamed. The component class's deprecation period may have expired and it has been removed.";const SHORT_DESCRIPTION="Unknown JET component classes should not be instantiated";class Rule{getName(){return RULENAME}getDescription(){return DESCRIPTION}getShortDescription(){return SHORT_DESCRIPTION}register(regCtx){var ret={};this._nt=regCtx.tsNodeTypes;ret[this._nt.NEW_EXPR]=this._onNew;return ret}_onNew(ruleCtx,node){var clazz,issue,exists;var me,obj,start;var metaLib=ruleCtx.utils.metaLib;me=node.callee;if(me.type==="MemberExpression"){obj=me.object;if(obj&&obj.type==="Identifier"){if(obj.name==="oj"){if(me.property&&me.property.name){clazz="oj."+me.property.name}start=obj}}}else if(me.type==="Identifier"){clazz=me.name;start=me}if(clazz){exists=metaLib.isComponent(clazz);if(!exists){issue=this._isRenamed(clazz,ruleCtx);if(!issue){issue=this._isDeleted(clazz,ruleCtx)}if(issue){start=start.range[0];issue.setPosition(null,null,start,start+clazz.length);ruleCtx.reporter.addIssue(issue,ruleCtx)}}}}_isRenamed(clazz,ruleCtx){var o,issue;o=ruleCtx.utils.metaLib.isClassRenamed(clazz);if(o){issue=new ruleCtx.Issue(`Instantiation of '${clazz}' - this class was renamed to ${o.to} in ${o.since}`);issue.setMsgKey(RULENAME+"_1")}return issue}_isDeleted(clazz,ruleCtx){var ver,issue;ver=ruleCtx.utils.metaLib.isClassDeleted(clazz);if(ver){if(clazz==="oj.ojTree"){issue=new ruleCtx.Issue(`Instantiation of '${clazz}' - this class was undocumented in version 6.0.0`)}else{issue=new ruleCtx.Issue(`Instantiation of '${clazz}' - this class was removed in version ${ver}`)}}else if(clazz.startsWith("oj.")){if(clazz!=="oj.ojTree"){issue=new ruleCtx.Issue(`Instantiation of unknown JET component '${clazz}'`)}else{issue=new ruleCtx.Issue(`Instantiation of ${clazz} - this class was undocumented in version 6.0.0`)}}return issue}}module.exports=Rule;
|
|
@@ -1 +1,6 @@
|
|
|
1
|
-
|
|
1
|
+
/*
|
|
2
|
+
* Copyright (c) 2018, 2022, 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-ojcomp-new";const DESCRIPTION="JET custom element usage should be used instead of instantiating a JET component class via 'new'.";const SHORT_DESCRIPTION="Replace Instantiation of a JET component class via \"new\" with a custom element";class Rule{getName(){return RULENAME}getDescription(){return DESCRIPTION}getShortDescription(){return SHORT_DESCRIPTION}register(){return{NewExpression:this._onNew}}_onNew(ruleCtx,node){var component,issue,elem;var me,obj,start;var metaLib=ruleCtx.utils.metaLib;me=node.callee;if(me.type==="MemberExpression"){obj=me.object;if(obj&&obj.type==="Identifier"){if(obj.name==="oj"){if(me.property&&me.property.name){component="oj."+me.property.name;start=obj}}}}else if(me.type==="Identifier"){component=me.name;start=me}if(component){if(metaLib.isClassRenamed(component)||metaLib.isClassDeleted(component)){return}if(metaLib.isComponent(component)){if(component==="oj.ojTree"){elem="oj-tree-view"}else{elem=metaLib.getTagFromClass(component)}if(elem){issue=new ruleCtx.Issue(`Instantiation of JET class ${component} found. Use web component <${elem}>.`);issue.setPosition(null,null,start.range[0],start.range[0]+component.length);ruleCtx.reporter.addIssue(issue,ruleCtx)}}}}}module.exports=Rule;
|