@oracle/oraclejet-audit 16.1.3 → 17.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/corePackMigrator/cli.js +1 -1
- package/corePackMigrator/corePackMigrator.js +2 -2
- package/corePackMigrator/metadata/actionCardMetadata.json +10 -0
- package/corePackMigrator/metadata/avatarMetadata.json +11 -1
- package/corePackMigrator/metadata/bindIfMetadata.json +4 -0
- package/corePackMigrator/metadata/buttonMetadata.json +65 -49
- package/corePackMigrator/metadata/chartMetadata.json +53 -0
- package/corePackMigrator/metadata/collapsibleMetadata.json +27 -12
- package/corePackMigrator/metadata/conveyorBeltMetadata.json +34 -0
- package/corePackMigrator/metadata/datePickerMetadata.json +43 -0
- package/corePackMigrator/metadata/drawerLayoutMetadata.json +18 -0
- package/corePackMigrator/metadata/drawerPopupMetadata.json +27 -14
- package/corePackMigrator/metadata/filePickerMetadata.json +20 -7
- package/corePackMigrator/metadata/formLayoutMetadata.json +11 -1
- package/corePackMigrator/metadata/highlightTextMetadata.json +10 -0
- package/corePackMigrator/metadata/inputDateMetadata.json +110 -0
- package/corePackMigrator/metadata/inputNumberMetadata.json +107 -75
- package/corePackMigrator/metadata/inputPasswordMetadata.json +111 -75
- package/corePackMigrator/metadata/inputTextMetadata.json +118 -81
- package/corePackMigrator/metadata/labelValueMetadata.json +245 -0
- package/corePackMigrator/metadata/legendItemMetadata.json +11 -1
- package/corePackMigrator/metadata/legendMetadata.json +59 -49
- package/corePackMigrator/metadata/listItemLayoutMetadata.json +11 -1
- package/corePackMigrator/metadata/listviewMetadata.json +104 -63
- package/corePackMigrator/metadata/messageBannerMetadata.json +10 -0
- package/corePackMigrator/metadata/messagesMetadata.json +11 -1
- package/corePackMigrator/metadata/progressBarMetadata.json +11 -1
- package/corePackMigrator/metadata/progressCircleMetadata.json +10 -0
- package/corePackMigrator/metadata/radiosetMetadata.json +11 -1
- package/corePackMigrator/metadata/ratingGaugeMetadata.json +113 -87
- package/corePackMigrator/metadata/selectManyMetadata.json +72 -42
- package/corePackMigrator/metadata/selectSingleMetadata.json +61 -46
- package/corePackMigrator/metadata/selectorMetadata.json +1 -1
- package/corePackMigrator/metadata/statusMeterGaugeMetadata.json +1 -1
- package/corePackMigrator/metadata/tagCloudMetadata.json +10 -0
- package/corePackMigrator/metadata/textAreaMetadata.json +88 -46
- package/corePackMigrator/resource/astUtils.js +1 -1
- package/corePackMigrator/resource/componentMigrator.js +1 -1
- package/corePackMigrator/resource/fileScanner.js +1 -1
- package/corePackMigrator/resource/htmlUtils.js +1 -1
- package/corePackMigrator/resource/manifest.json +137 -36
- package/corePackMigrator/resource/testUtils.js +6 -0
- package/corePackMigrator/templates/componentMetaData.json +118 -14
- package/corePackMigrator/templates/migrationConfig.json +4 -0
- package/corePackMigrator/utilities/deltaWebElementAPIs.js +6 -0
- package/corePackMigrator/utilities/logging.js +1 -1
- package/jaf-amd.js +1 -1
- package/lib/AstJson.js +1 -1
- package/lib/Components.js +1 -1
- package/lib/Config.js +1 -1
- package/lib/ConfigEx.js +6 -0
- package/lib/ConfigLib.js +1 -1
- package/lib/MetaLib.js +1 -1
- package/lib/OjCPack.js +1 -1
- package/lib/RegTypes.js +1 -1
- package/lib/RulePack.js +1 -1
- package/lib/RuleSet.js +1 -1
- package/lib/Rules.js +1 -1
- package/lib/TsxUtils.js +1 -1
- package/lib/checkage.js +1 -1
- package/lib/defaults.js +1 -1
- package/lib/extends.js +1 -1
- package/lib/migrator.js +1 -1
- package/lib/ns.js +1 -1
- package/libext/expparser.js +1 -1
- package/meta/16.1.0/jetauditmeta.js +1 -1
- package/meta/17.0.0/jetauditmeta.js +9 -0
- package/meta/metaverlist.json +1 -1
- package/package.json +3 -3
- package/profiles/best-practice.json +97 -78
- package/profiles/redwood-strict.json +22 -14
- package/rulepacks/csp/csp-json-unsafe-expr.js +1 -1
- package/rulepacks/jetwc/jetwc-bootstrap.js +1 -1
- package/rulepacks/jetwc/jetwc-css-scoping.js +1 -1
- package/rulepacks/jetwc/jetwc-displayname.js +1 -1
- package/rulepacks/jetwc/jetwc-jet-version.js +1 -1
- package/rulepacks/jetwc/jetwc-markdown-link.js +1 -1
- package/rulepacks/jetwc/jetwc-namespace.js +1 -1
- package/rulepacks/jetwc/jetwc-nls-languages.js +1 -1
- package/rulepacks/jetwc/jetwc-property-nesting.js +1 -1
- package/rulepacks/jetwc/jetwc-property-translatable.js +1 -1
- package/rulepacks/jetwc/jetwc-require-paths.js +1 -1
- package/rulepacks/jetwc/jetwc-reserved-property.js +1 -1
- package/rulepacks/jetwc/jetwc-schema.js +1 -1
- package/rulepacks/jetwc/jetwc-standard-files.js +1 -1
- package/rulepacks/jetwc/jetwc-vb-category.js +1 -1
- package/rulepacks/jetwc/rules.json +1 -1
- package/rulepacks/jetwc-lib/jetwcutils-auditComponentCacheManager.js +1 -1
- package/rulepacks/jetwc-lib/jetwcutils-commonListenerImpls.js +1 -1
- package/rulepacks/jetwc-lib/jetwcutils-componentAuditUtils.js +1 -1
- package/rulepacks/jetwc-lib/jetwcutils-componentFinder.js +1 -1
- package/rulepacks/jetwc-lib/jetwcutils-tsxUtils.js +1 -1
- package/rulepacks/jetwco/jetwco-bootstrap.js +1 -1
- package/rulepacks/jetwco/jetwco-component-api-baseline-changes.js +1 -1
- package/rulepacks/jetwco/jetwco-component-api-changes.js +1 -1
- package/rulepacks/jetwco/jetwco-component-api-controlled-changes.js +1 -1
- package/rulepacks/jetwco/jetwco-license-info.js +1 -1
- package/rulepacks/jetwco/jetwco-prerelease-cdn.js +1 -1
- package/rulepacks/jetwco/jetwco-validate-applied-audits.js +1 -1
- package/rulepacks/jetwco/rules.json +1 -1
- package/rules/jet/helpers/cssHelper.js +1 -1
- package/rules/jet/helpers/has-attrib-value.js +6 -0
- package/rules/jet/helpers/tsx/has-prop-value.js +6 -0
- package/rules/jet/msgid.json +1 -1
- package/rules/jet/oj-acc-button-label.js +6 -0
- package/rules/jet/oj-css-style-bp-display.js +1 -1
- package/rules/jet/oj-html-attr-expr-writeback.js +1 -1
- package/rules/jet/oj-html-bindif-test.js +1 -1
- package/rules/jet/oj-html-binding-as-slot-child.js +1 -1
- package/rules/jet/oj-html-bp-button-xs-chroming.js +6 -0
- package/rules/jet/oj-html-bp-title-to-tooltip.js +6 -0
- package/rules/jet/oj-html-button-size-chroming.js +6 -0
- package/rules/jet/oj-html-dlg-title.js +1 -1
- package/rules/jet/oj-html-form-bindif.js +1 -1
- package/rules/jet/oj-html-ko-comment.js +1 -1
- package/rules/jet/oj-html-ko-databind.js +1 -1
- package/rules/jet/oj-html-ojattr-value.js +1 -1
- package/rules/jet/oj-html-ojtag-ns.js +1 -1
- package/rules/jet/oj-html-redwood-clear-icon.js +6 -0
- package/rules/jet/oj-html-slot-default.js +1 -1
- package/rules/jet/oj-html-slot-pref-content.js +1 -1
- package/rules/jet/oj-html-style-abs-units.js +1 -1
- package/rules/jet/oj-html-style-bp-color.js +1 -1
- package/rules/jet/oj-html-style-bp-display.js +1 -1
- package/rules/jet/oj-html-style-bp-font-family.js +1 -1
- package/rules/jet/oj-html-style-bp-font.js +1 -1
- package/rules/jet/oj-html-style-bp-margin-padding.js +6 -0
- package/rules/jet/oj-html-wctag-maintenance.js +1 -1
- package/rules/jet/oj-tsx-acc-button-label.js +6 -0
- package/rules/jet/oj-tsx-bp-button-xs-chroming.js +6 -0
- package/rules/jet/oj-tsx-bp-title-to-tooltip.js +6 -0
- package/rules/jet/oj-tsx-button-size-chroming.js +6 -0
- package/rules/jet/oj-tsx-dlg-title.js +1 -1
- package/rules/jet/oj-tsx-form-bindif.js +1 -1
- package/rules/jet/oj-tsx-ojtag-ns.js +1 -1
- package/rules/jet/oj-tsx-redwood-clear-icon.js +6 -0
- package/rules/jet/oj-tsx-slot-default.js +6 -0
- package/rules/jet/oj-tsx-slot-pref-content.js +1 -1
- package/rules/jet/oj-tsx-style-abs-units.js +6 -0
- package/rules/jet/oj-tsx-style-bp-margin-padding.js +6 -0
- package/rules/jet/oj-tsx-wctag-maintenance.js +1 -1
- package/rules/jet/rules.json +1 -1
- package/schema/component-schema.json +1 -1
- package/src/JafCore.js +1 -1
- package/types/index.d.ts +3 -0
package/meta/metaverlist.json
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"metaList":{"8.3.0":{"version":"8.3.0","date":"Monday May 04, 2020","time":"4:34pm edt"},"9.0.0":{"version":"9.0.0","date":"Friday Jun 12, 2020","time":"1:57am utc"},"9.1.0":{"version":"9.1.0","date":"Thursday Aug 06, 2020","time":"2:13am utc"},"9.2.0":{"version":"9.2.0","date":"Wednesday Oct 07, 2020","time":"5:41pm utc"},"10.0.0":{"version":"10.0.0","date":"Thursday Jan 07, 2021","time":"9:20pm utc"},"10.1.0":{"version":"10.1.0","date":"Saturday Apr 17, 2021","time":"4:01pm utc"},"11.0.0":{"version":"11.0.0","date":"Friday Jul 02, 2021","time":"3:02am utc"},"11.1.0":{"version":"11.1.0","date":"Thursday Sep 30, 2021","time":"9:33pm utc"},"12.0.0":{"version":"12.0.0","date":"Friday Feb 04, 2022","time":"2:29am utc"},"12.1.0":{"version":"12.1.0","date":"Saturday Apr 09, 2022","time":"7:54am utc"},"13.0.0":{"version":"13.0.4","date":"Thursday Sep 22, 2022","time":"3:14am utc"},"13.1.0":{"version":"13.1.0","date":"Sunday Oct 02, 2022","time":"3:37am utc"},"14.0.0":{"version":"14.0.0","date":"Tuesday Jan 03, 2023","time":"8:54pm utc"},"14.1.0":{"version":"14.1.0","date":"Thursday Apr 06, 2023","time":"7:55pm utc"},"15.0.0":{"version":"15.0.0","date":"Saturday Jul 01, 2023","time":"2:08pm utc"},"15.1.0":{"version":"15.1.0","date":"Thursday Jul 06, 2023","time":"8:04pm utc"},"16.0.0":{"version":"16.0.0","date":"Saturday Feb 10, 2024","time":"4:36pm utc"},"16.1.0":{"version":"16.1.
|
|
1
|
+
{"metaList":{"8.3.0":{"version":"8.3.0","date":"Monday May 04, 2020","time":"4:34pm edt"},"9.0.0":{"version":"9.0.0","date":"Friday Jun 12, 2020","time":"1:57am utc"},"9.1.0":{"version":"9.1.0","date":"Thursday Aug 06, 2020","time":"2:13am utc"},"9.2.0":{"version":"9.2.0","date":"Wednesday Oct 07, 2020","time":"5:41pm utc"},"10.0.0":{"version":"10.0.0","date":"Thursday Jan 07, 2021","time":"9:20pm utc"},"10.1.0":{"version":"10.1.0","date":"Saturday Apr 17, 2021","time":"4:01pm utc"},"11.0.0":{"version":"11.0.0","date":"Friday Jul 02, 2021","time":"3:02am utc"},"11.1.0":{"version":"11.1.0","date":"Thursday Sep 30, 2021","time":"9:33pm utc"},"12.0.0":{"version":"12.0.0","date":"Friday Feb 04, 2022","time":"2:29am utc"},"12.1.0":{"version":"12.1.0","date":"Saturday Apr 09, 2022","time":"7:54am utc"},"13.0.0":{"version":"13.0.4","date":"Thursday Sep 22, 2022","time":"3:14am utc"},"13.1.0":{"version":"13.1.0","date":"Sunday Oct 02, 2022","time":"3:37am utc"},"14.0.0":{"version":"14.0.0","date":"Tuesday Jan 03, 2023","time":"8:54pm utc"},"14.1.0":{"version":"14.1.0","date":"Thursday Apr 06, 2023","time":"7:55pm utc"},"15.0.0":{"version":"15.0.0","date":"Saturday Jul 01, 2023","time":"2:08pm utc"},"15.1.0":{"version":"15.1.0","date":"Thursday Jul 06, 2023","time":"8:04pm utc"},"16.0.0":{"version":"16.0.0","date":"Saturday Feb 10, 2024","time":"4:36pm utc"},"16.1.0":{"version":"16.1.0","date":"Monday Feb 12, 2024","time":"8:58pm utc"},"17.0.0":{"version":"17.0.0","date":"Saturday Aug 10, 2024","time":"0:25am utc"}}}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@oracle/oraclejet-audit",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "17.0.0",
|
|
4
4
|
"description": "JET AUDIT FRAMEWORK",
|
|
5
5
|
"main": "jaf.js",
|
|
6
6
|
"files": [
|
|
@@ -44,7 +44,7 @@
|
|
|
44
44
|
"lint"
|
|
45
45
|
],
|
|
46
46
|
"Jaf": {
|
|
47
|
-
"version": "
|
|
47
|
+
"version": "10.5.6"
|
|
48
48
|
},
|
|
49
49
|
"license": "UPL-1.0",
|
|
50
50
|
"dependencies": {
|
|
@@ -72,7 +72,7 @@
|
|
|
72
72
|
"strip-json-comments": "2.0.1",
|
|
73
73
|
"sync-request": "6.1.0",
|
|
74
74
|
"tmp": "0.0.33",
|
|
75
|
-
"typescript": "5.
|
|
75
|
+
"typescript": "5.4.5"
|
|
76
76
|
},
|
|
77
77
|
"devDependencies": {
|
|
78
78
|
"@babel/traverse": "^7.19.6",
|
|
@@ -7,13 +7,14 @@
|
|
|
7
7
|
{
|
|
8
8
|
"title" : "JAF Standard profile configuration enforcing best practices for JET Application Development.",
|
|
9
9
|
"builtinJetRules": true,
|
|
10
|
-
"ecmaVer":
|
|
10
|
+
"ecmaVer": 14,
|
|
11
11
|
"ruleMods": {
|
|
12
12
|
"enable":[
|
|
13
13
|
"oj-html-databind-all",
|
|
14
14
|
"oj-html-cdn",
|
|
15
|
-
"oj-html-no-style-tag",
|
|
16
|
-
"oj-html-no-style",
|
|
15
|
+
"oj-html-no-style-tag", // deprecated 5.3.0 (defers to oj-html-no-style if enabled)
|
|
16
|
+
"oj-html-no-style", // unconfigured default mode is compatible with oj-html-no-style-tag
|
|
17
|
+
"oj-html-bp-button-xs-chroming",
|
|
17
18
|
"oj-ts-comp-meth-deprecated",
|
|
18
19
|
"oj-ts-comp-attr-deprecated",
|
|
19
20
|
"oj-ts-ojcomp-new",
|
|
@@ -28,6 +29,7 @@
|
|
|
28
29
|
"oj-html-style-bp-font",
|
|
29
30
|
"oj-html-style-bp-display",
|
|
30
31
|
"oj-html-style-bp-font-family",
|
|
32
|
+
"oj-html-style-bp-margin-padding",
|
|
31
33
|
"oj-html-style-abs-units",
|
|
32
34
|
"oj-css-style-bp-color",
|
|
33
35
|
"oj-css-style-bp-font",
|
|
@@ -37,7 +39,8 @@
|
|
|
37
39
|
"oj-css-bp-float",
|
|
38
40
|
"oj-css-bp-textalign",
|
|
39
41
|
"oj-css-bp-bgcolor",
|
|
40
|
-
"oj-css-bp-border-color"
|
|
42
|
+
"oj-css-bp-border-color",
|
|
43
|
+
"oj-tsx-bp-button-xs-chroming"
|
|
41
44
|
],
|
|
42
45
|
"disable": [
|
|
43
46
|
"oj-html-attr-$unique",
|
|
@@ -58,91 +61,107 @@
|
|
|
58
61
|
"JET": {
|
|
59
62
|
"oj-html-style-bp-font-family": {
|
|
60
63
|
"enabled": true,
|
|
61
|
-
"
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
64
|
+
"customOpts": {
|
|
65
|
+
"ignore": [
|
|
66
|
+
"inherit",
|
|
67
|
+
"initial"
|
|
68
|
+
]
|
|
69
|
+
}
|
|
65
70
|
},
|
|
66
71
|
"oj-css-style-bp-font-family": {
|
|
67
72
|
"enabled": true,
|
|
68
|
-
"
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
73
|
+
"customOpts": {
|
|
74
|
+
"ignore": [
|
|
75
|
+
"inherit",
|
|
76
|
+
"initial"
|
|
77
|
+
]
|
|
78
|
+
}
|
|
72
79
|
},
|
|
73
80
|
"oj-css-style-abs-units": {
|
|
74
|
-
"
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
81
|
+
"customOpts": {
|
|
82
|
+
"selectors": {
|
|
83
|
+
"ignore": [
|
|
84
|
+
"icon",
|
|
85
|
+
"img",
|
|
86
|
+
"image"
|
|
87
|
+
]
|
|
88
|
+
}
|
|
80
89
|
}
|
|
81
90
|
}
|
|
82
91
|
}
|
|
83
92
|
},
|
|
84
93
|
"sevMap": {
|
|
85
94
|
"sevMsg": {
|
|
86
|
-
"JET-0010":"blocker",
|
|
87
|
-
"JET-0011":"critical"
|
|
88
|
-
"JET-0020":"blocker",
|
|
89
|
-
"JET-0021":"blocker",
|
|
90
|
-
"JET-0040":"blocker",
|
|
91
|
-
"JET-0041":"blocker",
|
|
92
|
-
"JET-0060":"blocker",
|
|
93
|
-
"JET-0070":"blocker",
|
|
94
|
-
"JET-0100":"blocker",
|
|
95
|
-
"JET-0110":"blocker",
|
|
96
|
-
"JET-0120":"blocker",
|
|
97
|
-
"JET-0130":"blocker",
|
|
98
|
-
"JET-0140":"blocker",
|
|
99
|
-
"JET-0150":"blocker",
|
|
100
|
-
"JET-0153":"major",
|
|
101
|
-
"JET-0190":"blocker",
|
|
102
|
-
"JET-0200":"blocker",
|
|
103
|
-
"JET-0240":"critical"
|
|
104
|
-
"JET-0250":"blocker",
|
|
105
|
-
"JET-0260":"blocker",
|
|
106
|
-
"JET-0400":"blocker",
|
|
107
|
-
"JET-0410":"blocker",
|
|
108
|
-
"JET-0465":"blocker",
|
|
109
|
-
"JET-0470":"blocker",
|
|
110
|
-
"JET-0505":"blocker",
|
|
111
|
-
"JET-3060":"blocker",
|
|
112
|
-
"JET-3070":"blocker",
|
|
113
|
-
"JET-3071":"blocker",
|
|
114
|
-
"JET-3090":"blocker",
|
|
115
|
-
"JET-3100":"blocker",
|
|
116
|
-
"JET-3400":"blocker",
|
|
117
|
-
"JET-3440":"blocker",
|
|
118
|
-
"JET-3445":"blocker",
|
|
119
|
-
"JET-3455":"blocker",
|
|
120
|
-
"JET-3460":"blocker",
|
|
121
|
-
"JET-3465":"blocker",
|
|
122
|
-
"JET-5000":"blocker",
|
|
123
|
-
"JET-5015":"blocker",
|
|
124
|
-
"JET-5020":"blocker",
|
|
125
|
-
"JET-5025":"blocker",
|
|
126
|
-
"JET-5030":"critical"
|
|
127
|
-
"JET-5040":"critical"
|
|
128
|
-
"JET-5095":"blocker",
|
|
129
|
-
"JET-5096":"blocker",
|
|
130
|
-
"JET-5097":"blocker",
|
|
131
|
-
"JET-5098":"blocker",
|
|
132
|
-
"JET-5099":"blocker",
|
|
133
|
-
"JET-5100":"blocker",
|
|
134
|
-
"JET-5101":"blocker",
|
|
135
|
-
"JET-5102":"blocker",
|
|
136
|
-
"JET-5103":"blocker",
|
|
137
|
-
"JET-5104":"blocker",
|
|
138
|
-
"JET-
|
|
139
|
-
"JET-
|
|
140
|
-
"JET-
|
|
141
|
-
"JET-
|
|
142
|
-
"JET-
|
|
143
|
-
"JET-
|
|
144
|
-
"JET-
|
|
145
|
-
"JET-
|
|
95
|
+
"JET-0010": "blocker", // oj-html-ojtag-deprecated
|
|
96
|
+
"JET-0011": "critical", // oj-html-ojtag-deprecated
|
|
97
|
+
"JET-0020": "blocker", // oj-html-attr-json
|
|
98
|
+
"JET-0021": "blocker", // oj-html-attr-json
|
|
99
|
+
"JET-0040": "blocker", // oj-html-ojattr
|
|
100
|
+
"JET-0041": "blocker", // oj-html-ojattr-520
|
|
101
|
+
"JET-0060": "blocker", // oj-html-ojattr-value
|
|
102
|
+
"JET-0070": "blocker", // oj-html-attr-2def
|
|
103
|
+
"JET-0100": "blocker", // oj-html-jq-databind
|
|
104
|
+
"JET-0110": "blocker", // oj-html-jq-databind
|
|
105
|
+
"JET-0120": "blocker", // oj-html-jq-databind
|
|
106
|
+
"JET-0130": "blocker", // oj-html-databind-all
|
|
107
|
+
"JET-0140": "blocker", // oj-html-slot-name
|
|
108
|
+
"JET-0150": "blocker", // oj-html-slot-name
|
|
109
|
+
"JET-0153": "major", // oj-html-slot-pref-content
|
|
110
|
+
"JET-0190": "blocker", // oj-html-tag-attr-noprefix
|
|
111
|
+
"JET-0200": "blocker", // oj-html-ojtag-globattr-noprefix
|
|
112
|
+
"JET-0240": "critical", // oj-html-oj-lib
|
|
113
|
+
"JET-0250": "blocker", // oj-html-ko-comment
|
|
114
|
+
"JET-0260": "blocker", // oj-html-ko-databind
|
|
115
|
+
"JET-0400": "blocker", // oj-html-5-tag-obs
|
|
116
|
+
"JET-0410": "blocker", // oj-html-5-attr-obs
|
|
117
|
+
"JET-0465": "blocker", // oj-html-wctag-packprivate
|
|
118
|
+
"JET-0470": "blocker", // oj-html-picker-attrs
|
|
119
|
+
"JET-0505": "blocker", // oj-html-no-style / oj-html-no-style-tag
|
|
120
|
+
"JET-3060": "blocker", // oj-js-ojcomp-new
|
|
121
|
+
"JET-3070": "blocker", // oj-js-ojcomp-exist
|
|
122
|
+
"JET-3071": "blocker", // oj-js-ojcomp-exist
|
|
123
|
+
"JET-3090": "blocker", // oj-js-poly-promise
|
|
124
|
+
"JET-3100": "blocker", // oj-js-noconsole
|
|
125
|
+
"JET-3400": "blocker", // oj-ts-ojcomp-deprecated
|
|
126
|
+
"JET-3440": "blocker", // oj-ts-ojcomp-new
|
|
127
|
+
"JET-3445": "blocker", // oj-ts-ojcomp-exist
|
|
128
|
+
"JET-3455": "blocker", // oj-ts-poly-promise
|
|
129
|
+
"JET-3460": "blocker", // oj-ts-noconsole
|
|
130
|
+
"JET-3465": "blocker", // oj-ts-no-ext-final
|
|
131
|
+
"JET-5000": "blocker", // oj-html-style
|
|
132
|
+
"JET-5015": "blocker", // oj-html-ojstyle
|
|
133
|
+
"JET-5020": "blocker", // oj-html-style-bp-color
|
|
134
|
+
"JET-5025": "blocker", // oj-html-style-bp-font
|
|
135
|
+
"JET-5030": "critical", // oj-html-style-bp-display
|
|
136
|
+
"JET-5040": "critical", // oj-html-style-bp-font-family
|
|
137
|
+
"JET-5095": "blocker", // oj-html-input-isodate
|
|
138
|
+
"JET-5096": "blocker", // oj-html-input-isodate
|
|
139
|
+
"JET-5097": "blocker", // oj-html-input-isodate
|
|
140
|
+
"JET-5098": "blocker", // oj-html-input-isodate
|
|
141
|
+
"JET-5099": "blocker", // oj-html-input-isodate
|
|
142
|
+
"JET-5100": "blocker", // oj-html-input-isodate
|
|
143
|
+
"JET-5101": "blocker", // oj-html-input-isodate
|
|
144
|
+
"JET-5102": "blocker", // oj-html-input-isodate
|
|
145
|
+
"JET-5103": "blocker", // oj-html-input-isodate
|
|
146
|
+
"JET-5104": "blocker", // oj-html-input-isodate
|
|
147
|
+
"JET-5120": "blocker", // oj-html-style-bp-margin-padding
|
|
148
|
+
"JET-5121": "blocker", // oj-html-style-bp-margin-padding
|
|
149
|
+
"JET-5122": "blocker", // oj-html-style-bp-margin-padding
|
|
150
|
+
"JET-5135": "blocker", // oj-html-bp-button-xs-chroming
|
|
151
|
+
"JET-5140": "blocker", // oj-html-bp-title-to-tooltip
|
|
152
|
+
"JET-6015": "blocker", // oj-css-style-bp-color
|
|
153
|
+
"JET-6025": "blocker", // oj-css-style-bp-font
|
|
154
|
+
"JET-6030": "critical", // oj-css-style-bp-display
|
|
155
|
+
"JET-6035": "critical", // oj-css-style-bp-font-family
|
|
156
|
+
"JET-6055": "blocker", // oj-css-bp-bgcolor
|
|
157
|
+
"JET-6056": "blocker", // oj-css-bp-bgcolor
|
|
158
|
+
"JET-6060": "blocker", // oj-css-bp-border-color
|
|
159
|
+
"JET-6061": "blocker", // oj-css-bp-border-color
|
|
160
|
+
"JET-7200": "blocker", // oj-tsx-style-bp-margin-padding
|
|
161
|
+
"JET-7201": "blocker", // oj-tsx-style-bp-margin-padding
|
|
162
|
+
"JET-7202": "blocker", // oj-tsx-style-bp-margin-padding
|
|
163
|
+
"JET-7220": "blocker", // oj-tsx-bp-button-xs-chroming
|
|
164
|
+
"JET-7230": "blocker" // oj-tsx-bp-title-to-tooltip
|
|
146
165
|
}
|
|
147
166
|
}
|
|
148
167
|
}
|
|
@@ -9,24 +9,32 @@
|
|
|
9
9
|
"extends": {"profile":"best-practice"},
|
|
10
10
|
"theme": "Redwood",
|
|
11
11
|
"ruleMods": {
|
|
12
|
-
"enable":[
|
|
13
|
-
"oj-html-redwood-bp-endslot"
|
|
12
|
+
"enable":[ // rules enabled here cannot be disabled by an inheriting config
|
|
13
|
+
"oj-html-redwood-bp-endslot",
|
|
14
|
+
"oj-html-redwood-clear-icon",
|
|
15
|
+
"oj-tsx-redwood-clear-icon",
|
|
16
|
+
"oj-html-button-size-chroming",
|
|
17
|
+
"oj-tsx-button-size-chroming"
|
|
14
18
|
]
|
|
15
19
|
},
|
|
16
20
|
"sevMap": {
|
|
17
21
|
"sevMsg": {
|
|
18
|
-
"JET-0153":"blocker",
|
|
19
|
-
"JET-0156":"blocker",
|
|
20
|
-
"JET-0157":"blocker",
|
|
21
|
-
"JET-0490":"blocker",
|
|
22
|
-
"JET-0491":"blocker",
|
|
23
|
-
"JET-0510":"blocker",
|
|
24
|
-
"JET-5110":"blocker",
|
|
25
|
-
"JET-5111":"blocker",
|
|
26
|
-
"JET-
|
|
27
|
-
"JET-
|
|
28
|
-
"JET-
|
|
29
|
-
"JET-
|
|
22
|
+
"JET-0153": "blocker", // oj-html-slot-pref-content
|
|
23
|
+
"JET-0156": "blocker", // oj-html-slot-minmax
|
|
24
|
+
"JET-0157": "blocker", // oj-html-slot-minmax,
|
|
25
|
+
"JET-0490": "blocker", // oj-html-notag-style
|
|
26
|
+
"JET-0491": "blocker", // oj-html-notag-style
|
|
27
|
+
"JET-0510": "blocker", // oj-html-alta-deprecated
|
|
28
|
+
"JET-5110": "blocker", // oj-html-no-pageopts-type
|
|
29
|
+
"JET-5111": "blocker", // oj-html-no-pageopts-type
|
|
30
|
+
"JET-5130": "blocker", // oj-html-button-size-chroming
|
|
31
|
+
"JET-5131": "blocker", // oj-html-button-size-chroming
|
|
32
|
+
"JET-6065": "blocker", // oj-css-var-override
|
|
33
|
+
"JET-6066": "blocker", // oj-css-var-override
|
|
34
|
+
"JET-0520": "blocker", // oj-html-rating-gauge-size
|
|
35
|
+
"JET-0525": "blocker", // oj-html-rating-gauge-track-resize
|
|
36
|
+
"JET-7215": "blocker", // oj-tsx-button-size-chroming
|
|
37
|
+
"JET-7216": "blocker" // oj-tsx-button-size-chroming
|
|
30
38
|
}
|
|
31
39
|
}
|
|
32
40
|
}
|
|
@@ -3,4 +3,4 @@
|
|
|
3
3
|
* Licensed under The Universal Permissive License (UPL), Version 1.0
|
|
4
4
|
* as shown at https://oss.oracle.com/licenses/upl/
|
|
5
5
|
*/
|
|
6
|
-
const RULE_NAME="csp-json-unsafe-expr";const LONG_DESCRIPT="A JSON member value contains an expression that violates the Content Security Policy, "+"and is not supported. Execution of the expression will be blocked.";const SHORT_DESCRIPT=LONG_DESCRIPT;const CHARACTER="character";const VB_ASSET_TOKEN_MATCHER=/\@{2}(?<tokenRef>[A-Z\d\-\$]*)@{2}/gmi;function Rule(){};Rule.prototype.getName=function(){return RULE_NAME};Rule.prototype.getShortDescription=function(){return SHORT_DESCRIPT};Rule.prototype.getDescription=function(){return LONG_DESCRIPT};Rule.prototype.register=function(regCtx){if(regCtx.runMode==="api"&®Ctx.VsCodeExtHint){if(this._exprEval){regCtx.decache(this._exprEval)}}this._exprEval=require("../../libext/expparser");this._exprEval=new this._exprEval;return{"json":this._onJson}};Rule.prototype._onJson=function(ruleCtx,ast){if(!ast){_onSyntaxError(ruleCtx);return false}this._walk(ruleCtx,ast)};Rule.prototype._walk=function(ruleCtx,ast,members){if(members=members||ast.members){members.forEach(member=>{let val,subMems;if(val=member.value){if(val?.type==="string"&&_isExpr(val?.value)){this._checkExpr(ruleCtx,member)}else if(val?.type==="array"){this._checkArrayExpr(ruleCtx,ast,member)}if(val?.members){if(subMems=val.members){this._walk(ruleCtx,ast,subMems)};}}})}};Rule.prototype._checkArrayExpr=function(ruleCtx,ast,member){var arrayMems,mem,i;if(arrayMems=member.value.members){for(i=0;i<arrayMems.length;i++){if(mem=arrayMems[i]){if(mem.type==="Object"&&mem.members){this._walk(ruleCtx,ast,mem.members)}}}}};Rule.prototype._checkExpr=function(ruleCtx,member){var value,issue,p;value=member.value.value.trim();value=value.substring(2,value.length-2).trimEnd();value=value.replace(VB_ASSET_TOKEN_MATCHER,"$<tokenRef>");try{p=this._exprEval.parse(value)}catch(e){let o=_cleanUp(e.message,member);issue=new ruleCtx.Issue(`Member '${member.name}' contains an expression that may not be compatible with all Content Security policies: ${o.msg}`);if(o.pos>=0){let pos=member.value.pos;issue.setPosition(pos.line,pos.col+o.pos+3,pos.start+o.pos+3,pos.end+o.pos+3)}else{issue.setPosition(member.value.pos)}ruleCtx.reporter.addIssue(issue,ruleCtx)}};function _cleanUp(msg,member){var pos=-1,x;if((x=msg.indexOf(CHARACTER))>=0){let posChars=msg.substring(x+CHARACTER.length+1);pos=parseInt(posChars);if(!isNaN(pos)){msg=msg.replace(CHARACTER,"expression position");msg=msg+` [${member.value.pos.row}, ${pos+member.value.pos.col+3}]`}}return{msg:msg,pos:pos}};function _onSyntaxError(ruleCtx){if(ruleCtx.suppData){if(!ruleCtx.rulePack.isRuleEnabled("oj-json-syntax","JET")){let issue=new ruleCtx.Issue(ruleCtx.suppData.msg);issue.setPosition(ruleCtx.suppData.line,ruleCtx.suppData.col,ruleCtx.suppData.position,ruleCtx.suppData.position+3);issue.setMsgKey(RULE_NAME+"_1");issue.setSeverity("critical");ruleCtx.reporter.addIssue(issue,ruleCtx)}}};function _isExpr(s){s=s.trimStart();return s.startsWith("[[")||s.startsWith("{{")};module.exports=Rule;
|
|
6
|
+
const RULE_NAME="csp-json-unsafe-expr";const LONG_DESCRIPT="A JSON member value contains an expression that violates the Content Security Policy, "+"and is not supported. Execution of the expression will be blocked.";const SHORT_DESCRIPT=LONG_DESCRIPT;const CHARACTER="character";const VB_ASSET_TOKEN_MATCHER=/\@{2}(?<tokenRef>[A-Z\d\-\$]*)@{2}/gmi;function Rule(){};Rule.prototype.getName=function(){return RULE_NAME};Rule.prototype.getShortDescription=function(){return SHORT_DESCRIPT};Rule.prototype.getDescription=function(){return LONG_DESCRIPT};Rule.prototype.register=function(regCtx){if(regCtx.runMode==="api"&®Ctx.VsCodeExtHint){if(this._exprEval){regCtx.decache(this._exprEval)}}this._exprEval=require("../../libext/expparser");this._exprEval=new this._exprEval;return{"json":this._onJson}};Rule.prototype._onJson=function(ruleCtx,ast){if(!ast){_onSyntaxError(ruleCtx);return false}this._walk(ruleCtx,ast)};Rule.prototype._walk=function(ruleCtx,ast,members){if(members=members||ast.members){members.forEach(member=>{let val,subMems;if(val=member.value){if(val?.type==="string"&&_isExpr(val?.value)){this._checkExpr(ruleCtx,member)}else if(val?.type==="array"){this._checkArrayExpr(ruleCtx,ast,member)}if(val?.members){if(subMems=val.members){this._walk(ruleCtx,ast,subMems)};}}})}};Rule.prototype._checkArrayExpr=function(ruleCtx,ast,member){var arrayMems,mem,i;if(arrayMems=member.value.members){for(i=0;i<arrayMems.length;i++){if(mem=arrayMems[i]){if(mem.type==="Object"&&mem.members){this._walk(ruleCtx,ast,mem.members)}}}}};Rule.prototype._checkExpr=function(ruleCtx,member){var value,issue,p;value=member.value.value.trim();value=value.substring(2,value.length-2).trimEnd();value=value.replace(VB_ASSET_TOKEN_MATCHER,"$<tokenRef>");try{p=this._exprEval.parse(value)}catch(e){let o=_cleanUp(e.message,member);issue=new ruleCtx.Issue(`Member '${member.name}' contains an expression that may not be compatible with all Content Security policies: ${o.msg}. The expression is:\n\"${value}\"`);if(o.pos>=0){let pos=member.value.pos;issue.setPosition(pos.line,pos.col+o.pos+3,pos.start+o.pos+3,pos.end+o.pos+3)}else{issue.setPosition(member.value.pos)}ruleCtx.reporter.addIssue(issue,ruleCtx)}};function _cleanUp(msg,member){var pos=-1,x;if((x=msg.indexOf(CHARACTER))>=0){let posChars=msg.substring(x+CHARACTER.length+1);pos=parseInt(posChars);if(!isNaN(pos)){msg=msg.replace(CHARACTER,"expression position");msg=msg+` ~[${member.value.pos.row}, ${pos+member.value.pos.col+3}]`}}return{msg:msg,pos:pos}};function _onSyntaxError(ruleCtx){if(ruleCtx.suppData){if(!ruleCtx.rulePack.isRuleEnabled("oj-json-syntax","JET")){let issue=new ruleCtx.Issue(ruleCtx.suppData.msg);issue.setPosition(ruleCtx.suppData.line,ruleCtx.suppData.col,ruleCtx.suppData.position,ruleCtx.suppData.position+3);issue.setMsgKey(RULE_NAME+"_1");issue.setSeverity("critical");ruleCtx.reporter.addIssue(issue,ruleCtx)}}};function _isExpr(s){s=s.trimStart();return s.startsWith("[[")||s.startsWith("{{")};module.exports=Rule;
|
|
@@ -3,4 +3,4 @@
|
|
|
3
3
|
* Licensed under The Universal Permissive License (UPL), Version 1.0
|
|
4
4
|
* as shown at https://oss.oracle.com/licenses/upl/
|
|
5
5
|
*/
|
|
6
|
-
const path=require("path");const Utils=require("../jetwc-lib/jetwcutils-componentAuditUtils");const componentFinder=require("../jetwc-lib/jetwcutils-componentFinder");const ruleDef=function(){};ruleDef.prototype.getName=function(){return"jetwc-bootstrap"};ruleDef.prototype.getShortDescription=function(){return"Bootstrap processing for the JETWC rulset"};ruleDef.prototype.getDescription=function(){return"This rule is for internal use by the ruleset and should not be disabled"};ruleDef.prototype.register=function(context){this.componentRoots=context.config.components;this.auditBase=context.config.base;this.typeScriptCompile=context.config.typescript&&context.config.typescript.compile;return{startupRP:this._getAllVisibleComponents,closedownRP:this._reportDiagnostics}};ruleDef.prototype._getAllVisibleComponents=function(context){const{msgLib}=context.utils;msgLib.info(`builtinJetWcRules (${context.rulePack.getPackInfo().prefix}): ${context.rulePack.getPackInfo().version}`);const projectPathInfo=Utils.getKeyPathInfoForRulepack(context,this.auditBase);const componentRootFolder=context.rulePack.
|
|
6
|
+
const path=require("path");const Utils=require("../jetwc-lib/jetwcutils-componentAuditUtils");const componentFinder=require("../jetwc-lib/jetwcutils-componentFinder");const ruleDef=function(){};ruleDef.prototype.getName=function(){return"jetwc-bootstrap"};ruleDef.prototype.getShortDescription=function(){return"Bootstrap processing for the JETWC rulset"};ruleDef.prototype.getDescription=function(){return"This rule is for internal use by the ruleset and should not be disabled"};ruleDef.prototype.register=function(context){this.componentRoots=context.config.components;this.auditBase=context.config.base;this.typeScriptCompile=context.config.typescript&&context.config.typescript.compile;return{startupRP:this._getAllVisibleComponents,closedownRP:this._reportDiagnostics}};ruleDef.prototype._getAllVisibleComponents=function(context){const{msgLib}=context.utils;msgLib.info(`builtinJetWcRules (${context.rulePack.getPackInfo().prefix}): ${context.rulePack.getPackInfo().version}`);const projectPathInfo=Utils.getKeyPathInfoForRulepack(context,this.auditBase);const componentRootFolder=context.rulePack.getRuleCustomOption("componentRoot")||projectPathInfo.componentRootFolder;const masterComponentList=componentFinder.findAllComponents(context,this.auditBase,projectPathInfo,this.componentRoots);if(masterComponentList&&masterComponentList.length>0){const allComponentsMap=masterComponentList.reduce((wmap,component)=>{if(!projectPathInfo.isBuiltOutput||projectPathInfo.isBuiltOutput&&!wmap.has(component.fullName)){wmap.set(component.fullName,component)}return wmap},new Map);const referenceComponents=new Map;const componentPaths=new Map;allComponentsMap.forEach(component=>{component.language=Utils.detectComponentSourceType(context,component.rootFolder,component.vcomponent);switch(component.type){case"reference":referenceComponents.set(component.fullName,component.ba);break;case"composite":case"resource":if(component.local){if(component.dependencies){Object.values(component.dependencies).forEach(dependency=>{if(allComponentsMap.has(dependency.name)){const proxyPaths=allComponentsMap.get(dependency.name).requirePaths;proxyPaths.forEach(path=>{component.requirePaths.add(path)})}else{msgLib.debug(`JETWC: missing dependency lookup for ${dependency.name} when resolving requirePaths`)}})}componentPaths.set(component.rootFolder,component.fullName)}break}});context.rulePack.setExtension({rulepackVersion:context.rulePack.getPackInfo().version,bootStrap:true,platform:Utils.isWindows?"Windows":"Unix-like",precompiled:this.typeScriptCompile,componentHome:`/${componentRootFolder}/`,auditBuildOutput:projectPathInfo.isBuiltOutput,discoveredPaths:projectPathInfo,componentRoots:this.componentRoots,allReferenceComponents:referenceComponents,allComponents:allComponentsMap,auditableComponentPaths:componentPaths,allAuditableFilePaths:new Map})}else{msgLib.error(`No components have been discovered from the JAF configuration for the ${context.rulePack.getPackInfo().prefix} ruleset to process. You will need to configure the "components" array to point at your component root folder`);Utils.disableRulePack(context)}};ruleDef.prototype._reportDiagnostics=function(context){const msgLib=context.utils.msgLib;const opts=context.rulePack.getRuleCustomOptions();const diagnostics=context.rulePack.getExtension();if(opts.debug){msgLib.msg("The custom component specific audits discovered the following components:");diagnostics.allComponents.forEach(component=>{msgLib.msg(` ${component.fullName}`)})}if(!opts.testMode){let foundVMMapping=0;let candidateLocal=0;if(diagnostics&&diagnostics.allComponents&&diagnostics.allComponents.length>0){diagnostics.allComponents.forEach(component=>{if(component.local&&component.type==="composite"){candidateLocal++;if(component.viewModel&&component.viewModel.resolved){foundVMMapping++}}});if(foundVMMapping!==candidateLocal){msgLib.error(`Error: Audit was only able to map ${foundVMMapping} out of ${candidateLocal} components to their viewModels. Some audits will be unable to operate.`)}}}if(opts.debug&&opts.diagnosticFile&&diagnostics){msgLib.msg(`Writing JETWC diagnostics to ${opts.diagnosticFile}.json`);const dFile=Utils.toJAFPath(path.join(path.resolve("."),opts.diagnosticFile+".json"));context.utils.fsUtils.writeJsonSync(diagnostics,dFile,{spaces:2,replacer:Utils.diagnosticReplacer})}};module.exports=ruleDef;
|
|
@@ -3,4 +3,4 @@
|
|
|
3
3
|
* Licensed under The Universal Permissive License (UPL), Version 1.0
|
|
4
4
|
* as shown at https://oss.oracle.com/licenses/upl/
|
|
5
5
|
*/
|
|
6
|
-
const Utils=require("../jetwc-lib/jetwcutils-componentAuditUtils");const path=require("path");const ruleDef=function(){};ruleDef.prototype.getName=function(){return"jetwc-css-scoping"};ruleDef.prototype.getShortDescription=function(){return"Verify that any styles defined by a component are correctly scoped"};ruleDef.prototype.getDescription=function(){return"Any style defined by a custom component should be scoped to only operate in the context of that component so as not to bleed through to the rest of the page and cause unexpected side effects"};ruleDef.prototype.register=function(context){return{"css-rule":this._doAudit,"css-atrule":this._doAudit}};ruleDef.prototype._doAudit=function(context,cssRule,indentifier){const withinComponent=Utils.matchComponentPath(context,path.dirname(context.filepath));if(withinComponent){const componentInfo=Utils.componentInfo(context,withinComponent);const ruleOptions=context.rulePack.
|
|
6
|
+
const Utils=require("../jetwc-lib/jetwcutils-componentAuditUtils");const path=require("path");const ruleDef=function(){};ruleDef.prototype.getName=function(){return"jetwc-css-scoping"};ruleDef.prototype.getShortDescription=function(){return"Verify that any styles defined by a component are correctly scoped"};ruleDef.prototype.getDescription=function(){return"Any style defined by a custom component should be scoped to only operate in the context of that component so as not to bleed through to the rest of the page and cause unexpected side effects"};ruleDef.prototype.register=function(context){return{"css-rule":this._doAudit,"css-atrule":this._doAudit}};ruleDef.prototype._doAudit=function(context,cssRule,indentifier){const withinComponent=Utils.matchComponentPath(context,path.dirname(context.filepath));if(withinComponent){const componentInfo=Utils.componentInfo(context,withinComponent);const ruleOptions=context.rulePack.getRuleCustomOptions();let validPrefixes=[];let packContext;if(componentInfo.type==="resource"){packContext=componentInfo.pack;if(packContext){const packInfo=Utils.componentInfo(context,packContext);const packJson=path.join(packInfo.rootFolder,"component.json");const packDef=context.utils.fsUtils.readJsonSync(packJson);validPrefixes=validPrefixes.concat(Object.keys(packDef.dependencies))}}else{validPrefixes.push(withinComponent)}let relaxedForPack=false;if(componentInfo.pack&&ruleOptions?.allowPackScoping){validPrefixes.push(componentInfo.pack);relaxedForPack=true}let globalIgnore=["html","body","oj-color-invert","from","to"];if(ruleOptions?.ignoreScopes&&Array.isArray(ruleOptions.ignoreScopes)){globalIgnore=globalIgnore.concat(ruleOptions.ignoreScopes)}let ruleSelectorName,ruleSelectorType;if(cssRule.type==="Atrule"){ruleSelectorType=cssRule.type;if(cssRule.prelude.children[0]&&cssRule.prelude.children[0].name){ruleSelectorName=cssRule.prelude.children[0].name}}else{for(let i=0;i<cssRule.prelude.children[0].children.length;i++){const selector=cssRule.prelude.children[0].children[i];if(selector.type==="TypeSelector"&&!globalIgnore.includes(selector.name)){ruleSelectorType=selector.type;ruleSelectorName=selector.name;break}else if(selector.type==="ClassSelector"&&!globalIgnore.includes(selector.name)){ruleSelectorType=selector.type;ruleSelectorName=selector.name;break}}}let errorMessage;let validScopes=`by the custom component tag name: ${withinComponent}`;if(ruleSelectorName&&ruleSelectorType){if(ruleSelectorType==="TypeSelector"){if(!validPrefixes.includes(ruleSelectorName)){if(packContext){validScopes=`by the tag name of one of the custom elements in the pack: ${packContext}`}errorMessage=`CSS Type selector ${ruleSelectorName} must be scoped ${validScopes}`}}else if(ruleSelectorType==="ClassSelector"||ruleSelectorType==="Atrule"){if(packContext){validPrefixes.push(packContext);validScopes=`by the one of the tag names of one of the custom elements in the pack: ${packContext}`}const matchingPrefixes=validPrefixes.filter(prefix=>ruleSelectorName.startsWith(prefix));if(matchingPrefixes.length===0){errorMessage=`Error in class selector naming for class: ${ruleSelectorName}. CSS Class selectors used by custom components must be scoped ${validScopes}${relaxedForPack?" or the pack name itself":""}`}}}if(errorMessage){if(!Utils.shouldIgnoreCheck(context,this.getName(),withinComponent)){const issue=new context.Issue(errorMessage);context.reporter.addIssue(issue,context)}}}};module.exports=ruleDef;
|
|
@@ -3,4 +3,4 @@
|
|
|
3
3
|
* Licensed under The Universal Permissive License (UPL), Version 1.0
|
|
4
4
|
* as shown at https://oss.oracle.com/licenses/upl/
|
|
5
5
|
*/
|
|
6
|
-
const Utils=require("../jetwc-lib/jetwcutils-componentAuditUtils");const TsxUtils=require("../jetwc-lib/jetwcutils-tsxUtils");const ruleDef=function(){};ruleDef.prototype.getName=function(){return"jetwc-displayname"};ruleDef.prototype.getShortDescription=function(){return"Check component display name will work with Visual Builder"};ruleDef.prototype.getDescription=function(){return"This rule checks both the length and the number of words of the display name - configurable"};ruleDef.prototype.register=function(context){return{compjson:this._doAudit,Program:this._doVComponentAudit}};ruleDef.prototype._doAudit=function(context){if(context.suppData.obj){let issue;const meta=context.suppData.obj;const fullName=Utils.getComponentFullName(meta);const componentType=Utils.getComponentType(meta);this._checkDisplayNames(context,fullName,componentType,meta.displayName,meta.properties,meta.events,meta.slots)}};ruleDef.prototype._doVComponentAudit=function(context){const componentInfo=TsxUtils.matchToVComponentImpl(context,context.filepath);if(componentInfo){this._checkDisplayNames(context,componentInfo.fullName,componentInfo.type,componentInfo.displayName,componentInfo.properties,componentInfo.events,componentInfo.slots)}};ruleDef.prototype._checkDisplayNames=function(context,fullName,componentType,displayName,properties,events,slots){const ruleOptions=context.rulePack.
|
|
6
|
+
const Utils=require("../jetwc-lib/jetwcutils-componentAuditUtils");const TsxUtils=require("../jetwc-lib/jetwcutils-tsxUtils");const ruleDef=function(){};ruleDef.prototype.getName=function(){return"jetwc-displayname"};ruleDef.prototype.getShortDescription=function(){return"Check component display name will work with Visual Builder"};ruleDef.prototype.getDescription=function(){return"This rule checks both the length and the number of words of the display name - configurable"};ruleDef.prototype.register=function(context){return{compjson:this._doAudit,Program:this._doVComponentAudit}};ruleDef.prototype._doAudit=function(context){if(context.suppData.obj){let issue;const meta=context.suppData.obj;const fullName=Utils.getComponentFullName(meta);const componentType=Utils.getComponentType(meta);this._checkDisplayNames(context,fullName,componentType,meta.displayName,meta.properties,meta.events,meta.slots)}};ruleDef.prototype._doVComponentAudit=function(context){const componentInfo=TsxUtils.matchToVComponentImpl(context,context.filepath);if(componentInfo){this._checkDisplayNames(context,componentInfo.fullName,componentInfo.type,componentInfo.displayName,componentInfo.properties,componentInfo.events,componentInfo.slots)}};ruleDef.prototype._checkDisplayNames=function(context,fullName,componentType,displayName,properties,events,slots){const ruleOptions=context.rulePack.getRuleCustomOptions();let limits;let elimits;let plimits;let slimits;switch(componentType){case"composite":elimits=ruleOptions.limits.event;plimits=ruleOptions.limits.property;slimits=ruleOptions.limits.slot;case"vbcs-pattern":limits=ruleOptions.limits.component;break;case"vbcs-template":limits=ruleOptions.limits.template;break}if(limits&&displayName){if(displayName.length>limits.length){this._lengthError(context,fullName,componentType,limits.length)}if(displayName.split(" ").length>limits.words){this._wordCountError(context,fullName,componentType,limits.words)}}if(plimits&&properties){this.checkByAttributeType(context,fullName,componentType,plimits,properties,"properties","property")}if(elimits&&events){this.checkByAttributeType(context,fullName,componentType,elimits,events,"events","event")}if(slimits&&slots){this.checkByAttributeType(context,fullName,componentType,slimits,slots,"slots","slot")}};ruleDef.prototype._lengthError=function(context,component,type,limit,scope){issue=new context.Issue(`displayName property for Component ${component}${scope?" ("+scope+")":""} exceeds the defined length limit of ${limit} for a ${type}`);issue.setMsgKey(context.ruleName+"_1");context.reporter.addIssue(issue,context)};ruleDef.prototype._wordCountError=function(context,component,type,limit,scope){issue=new context.Issue(`displayName property for Component ${component}${scope?" ("+scope+")":""} exceeds the defined word count of ${limit} for a ${type}`);issue.setMsgKey(context.ruleName+"_2");context.reporter.addIssue(issue,context)};ruleDef.prototype.checkByAttributeType=function(context,fullName,componentType,limits,meta,attributeType,typeName){Object.keys(meta).forEach(cName=>{const cDN=meta[cName].displayName;if(cDN){if(cDN.length>limits.length){this._lengthError(context,fullName,componentType+" "+typeName,limits.length,attributeType+"=>"+cName)}if(cDN.split(" ").length>limits.words){this._wordCountError(context,fullName,componentType+" "+typeName,limits.words,attributeType+"=>"+cName)}}})};module.exports=ruleDef;
|
|
@@ -3,4 +3,4 @@
|
|
|
3
3
|
* Licensed under The Universal Permissive License (UPL), Version 1.0
|
|
4
4
|
* as shown at https://oss.oracle.com/licenses/upl/
|
|
5
5
|
*/
|
|
6
|
-
const Utils=require("../jetwc-lib/jetwcutils-componentAuditUtils");const TsxUtils=require("../jetwc-lib/jetwcutils-tsxUtils");const ruleDef=function(){};ruleDef.prototype.getName=function(){return"jetwc-jet-version"};ruleDef.prototype.getShortDescription=function(){return"Verify the JET version range of a component "};ruleDef.prototype.getDescription=function(){return"This rule is configured with your required JET version range for a set of components to make sure that they are all consistent"};ruleDef.prototype.register=function(context){return{compjson:this._doAudit,Program:this._doVComponentAudit}};ruleDef.prototype._doAudit=function(context){if(context.suppData.obj){const meta=context.suppData.obj;const fullName=Utils.getComponentFullName(meta);if(meta.jetVersion&&fullName){this._checkVersion(context,fullName,meta.jetVersion)}}};ruleDef.prototype._doVComponentAudit=function(context){const componentInfo=TsxUtils.matchToVComponentImpl(context,context.filepath);if(componentInfo&&componentInfo.jetVersion){this._checkVersion(context,componentInfo.fullName,componentInfo.jetVersion)}};ruleDef.prototype._checkVersion=function(context,fullName,version){let issue;const ruleOptions=context.rulePack.
|
|
6
|
+
const Utils=require("../jetwc-lib/jetwcutils-componentAuditUtils");const TsxUtils=require("../jetwc-lib/jetwcutils-tsxUtils");const ruleDef=function(){};ruleDef.prototype.getName=function(){return"jetwc-jet-version"};ruleDef.prototype.getShortDescription=function(){return"Verify the JET version range of a component "};ruleDef.prototype.getDescription=function(){return"This rule is configured with your required JET version range for a set of components to make sure that they are all consistent"};ruleDef.prototype.register=function(context){return{compjson:this._doAudit,Program:this._doVComponentAudit}};ruleDef.prototype._doAudit=function(context){if(context.suppData.obj){const meta=context.suppData.obj;const fullName=Utils.getComponentFullName(meta);if(meta.jetVersion&&fullName){this._checkVersion(context,fullName,meta.jetVersion)}}};ruleDef.prototype._doVComponentAudit=function(context){const componentInfo=TsxUtils.matchToVComponentImpl(context,context.filepath);if(componentInfo&&componentInfo.jetVersion){this._checkVersion(context,componentInfo.fullName,componentInfo.jetVersion)}};ruleDef.prototype._checkVersion=function(context,fullName,version){let issue;const ruleOptions=context.rulePack.getRuleCustomOptions();let targetJetVersion;if(ruleOptions.hasOwnProperty("jetVersion")){targetJetVersion=ruleOptions.jetVersion}else{targetJetVersion=context.utils.jafLib.getConfig().getJetVer()}if(ruleOptions.hasOwnProperty("versionMatch")){switch(ruleOptions.versionMatch){case"absolute":if(targetJetVersion!==version){issue=new context.Issue(`Component ${fullName} does not support the expected JET version range ${targetJetVersion} (found ${version})`);issue.setMsgKey(context.ruleName+"_1");context.reporter.addIssue(issue,context)}break;case"upperLimit":if(!context.utils.semVerUtils.satisfiesRange(targetJetVersion,version)){issue=new context.Issue(`Component ${fullName} does not support the required version of JET ${targetJetVersion} (supported range found ${version})`);issue.setMsgKey(context.ruleName+"_2");context.reporter.addIssue(issue,context)}break}}};module.exports=ruleDef;
|
|
@@ -3,4 +3,4 @@
|
|
|
3
3
|
* Licensed under The Universal Permissive License (UPL), Version 1.0
|
|
4
4
|
* as shown at https://oss.oracle.com/licenses/upl/
|
|
5
5
|
*/
|
|
6
|
-
const ruleDef=function(){};ruleDef.prototype.getName=function(){return"jetwc-markdown-link"};ruleDef.prototype.getShortDescription=function(){return"Validates any links in markdown documents"};ruleDef.prototype.getDescription=function(){return"This rule flags any links used in markdown based documents such as README.md or CHANGELOG.md which are not in the correct markdown format. It also allows verification of any servers against include or exclude globs so that links can be sanitised if required"};ruleDef.prototype.register=function(context){return{startaudit:this._auditPrep,"md-link":this._doAudit}};ruleDef.prototype._auditPrep=function(context){let allowList=context.rulePack.
|
|
6
|
+
const ruleDef=function(){};ruleDef.prototype.getName=function(){return"jetwc-markdown-link"};ruleDef.prototype.getShortDescription=function(){return"Validates any links in markdown documents"};ruleDef.prototype.getDescription=function(){return"This rule flags any links used in markdown based documents such as README.md or CHANGELOG.md which are not in the correct markdown format. It also allows verification of any servers against include or exclude globs so that links can be sanitised if required"};ruleDef.prototype.register=function(context){return{startaudit:this._auditPrep,"md-link":this._doAudit}};ruleDef.prototype._auditPrep=function(context){let allowList=context.rulePack.getRuleCustomOption("allow");let disallowList=context.rulePack.getRuleCustomOption("disallow");this.urlMatchExpressions=[];this.allowMatching=true;let processList=allowList;if(!processList){processList=disallowList;this.allowMatching=false}if(processList){processList.forEach(pattern=>{this.urlMatchExpressions.push(new RegExp(pattern,"i"))})}};ruleDef.prototype._doAudit=function(context,linkObj){let issue;let matchCount=0;this.urlMatchExpressions.forEach(urlRegex=>{if(urlRegex.test(linkObj.link)){matchCount++}});if(this.allowMatching&&matchCount===0){issue=new context.Issue(`Hyperlink '${linkObj.link}' does not match an allowed link pattern`);issue.setMsgKey(context.ruleName+"_2");issue.setSeverity("blocker")}else if(!this.allowMatching&&matchCount>0){issue=new context.Issue(`Hyperlink '${linkObj.link}' matches a disallowed link pattern`);issue.setMsgKey(context.ruleName+"_2");issue.setSeverity("blocker")}if(!issue&&!linkObj.text){issue=new context.Issue(`Hyperlink '${linkObj.link}' is missing an associated label in the markdown`);issue.setMsgKey(context.ruleName+"_1")}if(issue){issue.setPosition(linkObj.pos);context.reporter.addIssue(issue,context)}};module.exports=ruleDef;
|
|
@@ -3,4 +3,4 @@
|
|
|
3
3
|
* Licensed under The Universal Permissive License (UPL), Version 1.0
|
|
4
4
|
* as shown at https://oss.oracle.com/licenses/upl/
|
|
5
5
|
*/
|
|
6
|
-
const Utils=require("../jetwc-lib/jetwcutils-componentAuditUtils");const TsxUtils=require("../jetwc-lib/jetwcutils-tsxUtils");const ruleDef=function(){};ruleDef.prototype.getName=function(){return"jetwc-namespace"};ruleDef.prototype.getShortDescription=function(){return"Verify components are within your registered namespace"};ruleDef.prototype.getDescription=function(){return"This rule is configured with your namespace(s) in the audit configuration file and will match the naming of your component to those namespaces"};ruleDef.prototype.register=function(context){return{compjson:this._doAudit,Program:this._doVComponentAudit}};ruleDef.prototype._doAudit=function(context){if(context.suppData.obj){const meta=context.suppData.obj;const fullName=Utils.getComponentFullName(meta);this._checkNamespace(context,fullName)}};ruleDef.prototype._doVComponentAudit=function(context){const componentInfo=TsxUtils.matchToVComponentImpl(context,context.filepath);if(componentInfo){this._checkNamespace(context,componentInfo.fullName)}};ruleDef.prototype._checkNamespace=function(context,fullName){let issue;if(context.rulePack.
|
|
6
|
+
const Utils=require("../jetwc-lib/jetwcutils-componentAuditUtils");const TsxUtils=require("../jetwc-lib/jetwcutils-tsxUtils");const ruleDef=function(){};ruleDef.prototype.getName=function(){return"jetwc-namespace"};ruleDef.prototype.getShortDescription=function(){return"Verify components are within your registered namespace"};ruleDef.prototype.getDescription=function(){return"This rule is configured with your namespace(s) in the audit configuration file and will match the naming of your component to those namespaces"};ruleDef.prototype.register=function(context){return{compjson:this._doAudit,Program:this._doVComponentAudit}};ruleDef.prototype._doAudit=function(context){if(context.suppData.obj){const meta=context.suppData.obj;const fullName=Utils.getComponentFullName(meta);this._checkNamespace(context,fullName)}};ruleDef.prototype._doVComponentAudit=function(context){const componentInfo=TsxUtils.matchToVComponentImpl(context,context.filepath);if(componentInfo){this._checkNamespace(context,componentInfo.fullName)}};ruleDef.prototype._checkNamespace=function(context,fullName){let issue;if(context.rulePack.getRuleCustomOption("namespaces")?.filter(ns=>fullName.startsWith(ns)).length===0){issue=new context.Issue(`Component ${fullName} is not in an assigned namespace`);context.reporter.addIssue(issue,context)}};module.exports=ruleDef;
|
|
@@ -3,4 +3,4 @@
|
|
|
3
3
|
* Licensed under The Universal Permissive License (UPL), Version 1.0
|
|
4
4
|
* as shown at https://oss.oracle.com/licenses/upl/
|
|
5
5
|
*/
|
|
6
|
-
const path=require("path");const Utils=require("../jetwc-lib/jetwcutils-componentAuditUtils");const ruleDef=function(){};ruleDef.prototype.getName=function(){return"jetwc-nls-languages"};ruleDef.prototype.getShortDescription=function(){return"Ensures that the correct language bundles are supplied"};ruleDef.prototype.getDescription=function(){return"This rule ensures that a string bundle both declares and implements locale overrides for each required language"};ruleDef.prototype.register=function(context){return{CallExpression:this._doAudit,TSExportAssignment:this._doAudit}};ruleDef.prototype._doAudit=function(context,node){let issue;const NT=context.utils.AstUtils.getNodeTypes();if(context.filepath.includes("/resources/nls/")){const dirPath=path.dirname(context.filepath);const bundleName=path.basename(context.filepath);const pathSegs=dirPath.split("/").reverse();const ruleOptions=context.rulePack.
|
|
6
|
+
const path=require("path");const Utils=require("../jetwc-lib/jetwcutils-componentAuditUtils");const ruleDef=function(){};ruleDef.prototype.getName=function(){return"jetwc-nls-languages"};ruleDef.prototype.getShortDescription=function(){return"Ensures that the correct language bundles are supplied"};ruleDef.prototype.getDescription=function(){return"This rule ensures that a string bundle both declares and implements locale overrides for each required language"};ruleDef.prototype.register=function(context){return{CallExpression:this._doAudit,TSExportAssignment:this._doAudit}};ruleDef.prototype._doAudit=function(context,node){let issue;const NT=context.utils.AstUtils.getNodeTypes();if(context.filepath.includes("/resources/nls/")){const dirPath=path.dirname(context.filepath);const bundleName=path.basename(context.filepath);const pathSegs=dirPath.split("/").reverse();const ruleOptions=context.rulePack.getRuleCustomOptions();if(pathSegs[0]==="nls"){const withinComponent=Utils.matchComponentPath(context,dirPath);if(withinComponent){let langProps;if(node.callee&&node.callee.type===NT.IDENTIFIER&&node.callee.name==="define"&&node.arguments&&node.arguments.length>0&&node.arguments[0].type===NT.OBJ_EXPR){langProps=node.arguments[0].properties}else if(node.type===NT.EXPORT_ASSIGNMENT&&node.expression&&node.expression.type===NT.OBJ_EXPR){langProps=node.expression.properties}if(langProps){const languagesSupported=langProps.reduce((langs,langEntry)=>{if(langEntry.type===NT.PROPERTY&&langEntry.key.type===NT.LITERAL){if(langEntry.value.type===NT.LITERAL){langs.push({locale:langEntry.key.value,verified:false,enabled:langEntry.value.value})}else if(langEntry.value.type===NT.OBJ_EXPR){langs.push({locale:langEntry.key.value,verified:true})}}return langs},[]);const nlsFiles=context.utils.fsUtils.readDir(dirPath);const expectedLocales=ruleOptions.locales.reduce((locs,locale)=>{if(locale.includes("|")){const alternatives=locale.split("|");locs.push({locale:alternatives[0].toLowerCase(),alt:alternatives[1].toLowerCase(),found:false,configured:locale})}else{locs.push({locale:locale.toLowerCase(),alt:locale.toLowerCase(),found:false,configured:locale})}return locs},[]);expectedLocales.push({locale:"root",alt:"root",found:false,configured:"Root Bundle"});languagesSupported.forEach(lang=>{if(lang.verified){issue=new context.Issue(`Component '${withinComponent}' - the recommended pattern for string bundles is for each locale to be defined in its own file in a locale specific subdirectory under /resources/nls/`);issue.setMsgKey(context.ruleName+"_1");context.reporter.addIssue(issue,context,"info")}else{if(!lang.enabled){issue=new context.Issue(`Component '${withinComponent}' - locale support declared for '${lang.locale}', but is currently disabled`);issue.setMsgKey(context.ruleName+"_2");context.reporter.addIssue(issue,context,"info")}else{let bundleFound=false;const localeFolder=nlsFiles.filter(nlsChild=>{let found=false;if(!nlsChild.isFile){found=this._localeMatch(nlsChild.name,lang.locale,ruleOptions.strict)}return found});if(localeFolder.length===1){const localeSpecificFile=localeFolder[0].files.filter(localeChild=>localeChild.isFile&&localeChild.name===bundleName);if(localeSpecificFile.length===1){bundleFound=true;expectedLocales.forEach(localeRec=>{if(this._localeMatch(localeRec.locale,lang.locale,ruleOptions.strict)||this._localeMatch(localeRec.alt,lang.locale,ruleOptions.strict)){localeRec.found=true}})}}if(!bundleFound){issue=new context.Issue(`Component '${withinComponent}' - locale support declared for '${lang.locale}', but the expected file: '/resources/nls/${lang.locale}/${bundleName}' is missing`);issue.setMsgKey(context.ruleName+"_3");context.reporter.addIssue(issue,context)}}}});if(!issue){expectedLocales.forEach(localeRec=>{if(!localeRec.found){issue=new context.Issue(`Component '${withinComponent}' - required locale support not provided for '${localeRec.configured}'`);issue.setMsgKey(context.ruleName+"_4");context.reporter.addIssue(issue,context)}})}}}}}};ruleDef.prototype._localeMatch=function(test,against,strict){let l1,l2;if(strict){l1=test;l2=against}else{l1=test.toLowerCase().replace("_","-");l2=against.toLowerCase().replace("_","-")}return l1===l2};module.exports=ruleDef;
|
|
@@ -3,4 +3,4 @@
|
|
|
3
3
|
* Licensed under The Universal Permissive License (UPL), Version 1.0
|
|
4
4
|
* as shown at https://oss.oracle.com/licenses/upl/
|
|
5
5
|
*/
|
|
6
|
-
const Utils=require("../jetwc-lib/jetwcutils-componentAuditUtils");const TsxUtils=require("../jetwc-lib/jetwcutils-tsxUtils");const ruleDef=function(){};ruleDef.prototype.getName=function(){return"jetwc-property-nesting"};ruleDef.prototype.getShortDescription=function(){return"Checks for correct property nesting depth"};ruleDef.prototype.getDescription=function(){return"This rule determines the depth at which we are are happy to see nested properties. The default depth is 3, e.g. parent-child-grandchild. Setting to 1 would catch any use of subProperties"};ruleDef.prototype.register=function(context){return{compjson:this._doAudit,Program:this._doVComponentAudit}};ruleDef.prototype._doAudit=function(context){if(context.suppData.obj){const meta=context.suppData.obj;const fullName=Utils.getComponentFullName(meta);const componentType=Utils.getComponentType(meta);const maxDepth=context.rulePack.
|
|
6
|
+
const Utils=require("../jetwc-lib/jetwcutils-componentAuditUtils");const TsxUtils=require("../jetwc-lib/jetwcutils-tsxUtils");const ruleDef=function(){};ruleDef.prototype.getName=function(){return"jetwc-property-nesting"};ruleDef.prototype.getShortDescription=function(){return"Checks for correct property nesting depth"};ruleDef.prototype.getDescription=function(){return"This rule determines the depth at which we are are happy to see nested properties. The default depth is 3, e.g. parent-child-grandchild. Setting to 1 would catch any use of subProperties"};ruleDef.prototype.register=function(context){return{compjson:this._doAudit,Program:this._doVComponentAudit}};ruleDef.prototype._doAudit=function(context){if(context.suppData.obj){const meta=context.suppData.obj;const fullName=Utils.getComponentFullName(meta);const componentType=Utils.getComponentType(meta);const maxDepth=context.rulePack.getRuleCustomOption("depth")??1;if(componentType==="composite"&&meta.properties){this._propertyDrill(context,fullName,meta,0,maxDepth)}}};ruleDef.prototype._doVComponentAudit=function(context){const componentInfo=TsxUtils.matchToVComponentImpl(context,context.filepath);if(componentInfo&&componentInfo.properties){const maxDepth=context.rulePack.getRuleCustomOption("depth")??1;this._propertyDrill(context,componentInfo.fullName,componentInfo,0,maxDepth)}};ruleDef.prototype._propertyDrill=function(context,fullName,metadata,depth,maxDepth,recursion){depth++;const propKeys=Object.keys(metadata.properties);const propDepthCount=new Map;propKeys.forEach(propertyName=>{const checkProperty=metadata.properties[propertyName];if(checkProperty.hasOwnProperty("properties")){propDepthCount.set(propertyName,this._propertyDrill(context,fullName,checkProperty,depth,maxDepth,true))}else{propDepthCount.set(propertyName,depth)}if(!recursion&&propDepthCount.get(propertyName)>maxDepth){issue=new context.Issue(`Property '${propertyName}' in component ${fullName} exceeds the defined maximum level of property nesting. Max: ${maxDepth}, encountered: ${propDepthCount.get(propertyName)}`);context.reporter.addIssue(issue,context)}});let maxChild=depth;propDepthCount.forEach(depth=>{if(depth>maxChild){maxChild=depth}});return maxChild};module.exports=ruleDef;
|
|
@@ -3,4 +3,4 @@
|
|
|
3
3
|
* Licensed under The Universal Permissive License (UPL), Version 1.0
|
|
4
4
|
* as shown at https://oss.oracle.com/licenses/upl/
|
|
5
5
|
*/
|
|
6
|
-
const Utils=require("../jetwc-lib/jetwcutils-componentAuditUtils");const helperPos=require("../../rules/jet/helpers/json-propname-pos");const TsxUtils=require("../jetwc-lib/jetwcutils-tsxUtils");const ruleDef=function(){};ruleDef.prototype.getName=function(){return"jetwc-property-translatable"};ruleDef.prototype.getShortDescription=function(){return"Verify that properties with a given name have the translatable flag set "};ruleDef.prototype.getDescription=function(){return"To promote consistency amongst a set of components this audit will verify that properties or sub-properties with a given name e.g. pageTitle have the translatable flag set. This flag is primarily used in Visual Builder to guide users to set these properties to resource bundle references rather than hardcoded strings"};ruleDef.prototype.register=function(context){return{compjson:this._doAudit,Program:this._doVComponentAudit}};ruleDef.prototype._doAudit=function(context){if(context.suppData.obj){this._checkForTranslatable(context,Utils.getComponentFullName(context.suppData.obj),context.suppData.obj)}};ruleDef.prototype._doVComponentAudit=function(context){const componentInfo=TsxUtils.matchToVComponentImpl(context,context.filepath);if(componentInfo){this._checkForTranslatable(context,componentInfo.fullName,componentInfo)}};ruleDef.prototype._checkForTranslatable=function(context,componentName,componentInfo){let issue;const customOpts=context.rulePack.
|
|
6
|
+
const Utils=require("../jetwc-lib/jetwcutils-componentAuditUtils");const helperPos=require("../../rules/jet/helpers/json-propname-pos");const TsxUtils=require("../jetwc-lib/jetwcutils-tsxUtils");const ruleDef=function(){};ruleDef.prototype.getName=function(){return"jetwc-property-translatable"};ruleDef.prototype.getShortDescription=function(){return"Verify that properties with a given name have the translatable flag set "};ruleDef.prototype.getDescription=function(){return"To promote consistency amongst a set of components this audit will verify that properties or sub-properties with a given name e.g. pageTitle have the translatable flag set. This flag is primarily used in Visual Builder to guide users to set these properties to resource bundle references rather than hardcoded strings"};ruleDef.prototype.register=function(context){return{compjson:this._doAudit,Program:this._doVComponentAudit}};ruleDef.prototype._doAudit=function(context){if(context.suppData.obj){this._checkForTranslatable(context,Utils.getComponentFullName(context.suppData.obj),context.suppData.obj)}};ruleDef.prototype._doVComponentAudit=function(context){const componentInfo=TsxUtils.matchToVComponentImpl(context,context.filepath);if(componentInfo){this._checkForTranslatable(context,componentInfo.fullName,componentInfo)}};ruleDef.prototype._checkForTranslatable=function(context,componentName,componentInfo){let issue;const customOpts=context.rulePack.getRuleCustomOptions();if(customOpts.translatableProperties&&Array.isArray(customOpts.translatableProperties)&&customOpts.translatableProperties.length>0){let matchExpressions;if(customOpts.expressionMatch){matchExpressions=[];customOpts.translatableProperties.forEach(expString=>{matchExpressions.push(new RegExp(expString,"i"))})}const propertyList=Utils.flattenComponentProperties(componentInfo,"translatable",this._propertyFilter);propertyList.forEach(prop=>{let needsTranslatableFlagSet=false;let matchKey=prop.key;if(matchKey.includes(".")){matchKey=matchKey.split(".").reverse()[0]}if(!matchExpressions&&customOpts.translatableProperties.includes(matchKey)&&!prop.value){needsTranslatableFlagSet=true}else if(matchExpressions?.length>0){matchExpressions.forEach(matchExpression=>{if(matchKey.match(matchExpression)&&!prop.value){needsTranslatableFlagSet=true}})}if(needsTranslatableFlagSet){issue=new context.Issue(`translatable flag should be set for property '${prop.key}'`);context.reporter.addIssue(issue,context)}})}};ruleDef.prototype._propertyFilter=function(propertyName,propertyMetadata){if(propertyMetadata.type==="string"&&!propertyMetadata.enumValues){return true}return false};module.exports=ruleDef;
|
|
@@ -3,4 +3,4 @@
|
|
|
3
3
|
* Licensed under The Universal Permissive License (UPL), Version 1.0
|
|
4
4
|
* as shown at https://oss.oracle.com/licenses/upl/
|
|
5
5
|
*/
|
|
6
|
-
const path=require("path");const Utils=require("../jetwc-lib/jetwcutils-componentAuditUtils");const ruleDef=function(){};ruleDef.prototype.getName=function(){return"jetwc-require-paths"};ruleDef.prototype.getShortDescription=function(){return"Checks that any import paths used are valid"};ruleDef.prototype.getDescription=function(){return"This rule ensures that all path references (define, require or import) use paths that are valid in the context of the component. This list of valid paths will be constructed based on the declared and implicit dependencies of the component, combined with the standardPaths configuration property of the jetwc-require-paths rule which you can add to if needs be. The path \".\" is always valid. The path .. should not be used outside of the boundary of a given component, use the pack root instead."};ruleDef.prototype.register=function(context){return{CallExpression:this._doAuditRequireStyle,ImportDeclaration:this._doAuditImport,TSImportEqualsDeclaration:this._doAuditImportRequire}};ruleDef.prototype._doAuditRequireStyle=function(context,node){const
|
|
6
|
+
const path=require("path");const Utils=require("../jetwc-lib/jetwcutils-componentAuditUtils");const ruleDef=function(){};ruleDef.prototype.getName=function(){return"jetwc-require-paths"};ruleDef.prototype.getShortDescription=function(){return"Checks that any import paths used are valid"};ruleDef.prototype.getDescription=function(){return"This rule ensures that all path references (define, require or import) use paths that are valid in the context of the component. This list of valid paths will be constructed based on the declared and implicit dependencies of the component, combined with the standardPaths configuration property of the jetwc-require-paths rule which you can add to if needs be. The path \".\" is always valid. The path .. should not be used outside of the boundary of a given component, use the pack root instead."};ruleDef.prototype.register=function(context){return{CallExpression:this._doAuditRequireStyle,ImportDeclaration:this._doAuditImport,TSImportEqualsDeclaration:this._doAuditImportRequire}};ruleDef.prototype._doAuditRequireStyle=function(context,node){const NT=context.utils.AstUtils.getNodeTypes();if(context.rulePack.getExtension()&&context.rulePack.getExtension().hasOwnProperty("allComponents")){const withinComponent=Utils.matchComponentPath(context,path.dirname(context.filepath));const componentInfo=context.rulePack.getExtension().allComponents.get(withinComponent);if(withinComponent&&node.callee.type===NT.IDENTIFIER&&(node.callee.name==="define"||node.callee.name==="require")){if(node.arguments[0].type===NT.ARRAY_EXPR&&node.arguments[0].elements.length>0){node.arguments[0].elements.forEach(arg=>{if(arg.value){this._verifyPath(context,arg.value,componentInfo,node.callee.name)}})}else if(node.arguments[0].type===NT.LITERAL&&node.arguments[0].value){this._verifyPath(context,node.arguments[0].value,componentInfo,node.callee.name)}}}else{Utils.reportMissingBootstrapInfo(context,"allComponents")}};ruleDef.prototype._doAuditImport=function(context,node){if(context.rulePack.getExtension()&&context.rulePack.getExtension().hasOwnProperty("allComponents")){const NT=context.utils.AstUtils.getNodeTypes();const withinComponent=Utils.matchComponentPath(context,path.dirname(context.filepath));const componentInfo=context.rulePack.getExtension().allComponents.get(withinComponent);if(componentInfo){if(node.source&&node.source.type===NT.LITERAL){const sourcePath=node.source.value;this._verifyPath(context,sourcePath,componentInfo,"import")}}}else{Utils.reportMissingBootstrapInfo(context,"allComponents")}};ruleDef.prototype._doAuditImportRequire=function(context,node){const NT=context.utils.AstUtils.getNodeTypes();if(context.rulePack.getExtension()&&context.rulePack.getExtension().hasOwnProperty("allComponents")){const withinComponent=Utils.matchComponentPath(context,path.dirname(context.filepath));const componentInfo=context.rulePack.getExtension().allComponents.get(withinComponent);if(componentInfo){if(node.moduleReference&&node.moduleReference.type===NT.EXTERN_MOD_REF&&node.moduleReference.expression){const sourcePath=node.moduleReference.expression.value;this._verifyPath(context,sourcePath,componentInfo,"importRequire")}}}else{Utils.reportMissingBootstrapInfo(context,"allComponents")}};ruleDef.prototype._verifyPath=function(context,pathToCheck,componentInfo,importType){if(pathToCheck&&typeof pathToCheck==="string"){let pathVerified=false;const allValidPaths=context.rulePack.getRuleCustomOption("standardPaths")?.slice(0);const additionalPaths=context.rulePack.getRuleCustomOption("additionalPaths");if(additionalPaths&&Array.isArray(additionalPaths)){additionalPaths.forEach(addPath=>{allValidPaths.push(addPath)})}if(componentInfo.requirePaths){componentInfo.requirePaths.forEach(depPath=>{allValidPaths.push(depPath)})}let targetPath=pathToCheck;const pluginPos=targetPath.indexOf("!");if(pluginPos>=0){targetPath=targetPath.substring(pluginPos+1)}const targetPathParts=targetPath.split("/");if(targetPathParts[0]!==".."){if(allValidPaths.includes(targetPathParts[0])){pathVerified=true}else{if(targetPathParts[1]){const packCompPath=targetPathParts[0]+"/"+targetPathParts[1];if(allValidPaths.includes(packCompPath)){pathVerified=true}}}}else{let walkBackDepth=0;let examineSegment="..";while(examineSegment===".."){examineSegment=targetPathParts.shift();if(examineSegment===".."){walkBackDepth++}}const compRootPathParts=componentInfo.rootFolder.split("/");const importingFileParts=context.filepath.split("/");for(let i=walkBackDepth;i>=0;i--){importingFileParts.pop()}if(importingFileParts.length>=compRootPathParts.length){if(importingFileParts.slice(0,compRootPathParts.length).join("/")===componentInfo.rootFolder){pathVerified=true}}}if(!pathVerified){let sourceInfo;switch(importType){case"import":sourceInfo="Import";break;case"importRequire":sourceInfo="Import via require()";break;case"define":sourceInfo="Import via define()";break;case"require":sourceInfo="Import via require()";break};issue=new context.Issue(`${sourceInfo} for component ${componentInfo.fullName} is not based on a valid path in that component context. Valid paths would be [${allValidPaths.join(",")}] encountered: '${pathToCheck}'`);context.reporter.addIssue(issue,context)}}};module.exports=ruleDef;
|
|
@@ -3,4 +3,4 @@
|
|
|
3
3
|
* Licensed under The Universal Permissive License (UPL), Version 1.0
|
|
4
4
|
* as shown at https://oss.oracle.com/licenses/upl/
|
|
5
5
|
*/
|
|
6
|
-
const Utils=require("../jetwc-lib/jetwcutils-componentAuditUtils");const TsxUtils=require("../jetwc-lib/jetwcutils-tsxUtils");const ruleDef=function(){};ruleDef.prototype.getName=function(){return"jetwc-reserved-property"};ruleDef.prototype.getShortDescription=function(){return"Check component does not a reserved word as a property name"};ruleDef.prototype.getDescription=function(){return"This rule checks that a component does not define a property that is on the list of reserved values e.g. slot, key, ref, children etc."};ruleDef.prototype.register=function(context){return{compjson:this._doAudit,Program:this._doVComponentAudit}};ruleDef.prototype._doAudit=function(context){if(context.suppData.obj){const meta=context.suppData.obj;const fullName=Utils.getComponentFullName(meta);const componentType=Utils.getComponentType(meta);if(componentType==="composite"){this._checkForReservedPropertyNames(context,fullName,meta)}}};ruleDef.prototype._doVComponentAudit=function(context){const componentInfo=TsxUtils.matchToVComponentImpl(context,context.filepath);if(componentInfo&&componentInfo.properties){this._checkForReservedPropertyNames(context,componentInfo.fullName,componentInfo)}};ruleDef.prototype._checkForReservedPropertyNames=function(context,fullName,componentMeta){if(componentMeta&&componentMeta.properties){const reservedProperties=context.rulePack.
|
|
6
|
+
const Utils=require("../jetwc-lib/jetwcutils-componentAuditUtils");const TsxUtils=require("../jetwc-lib/jetwcutils-tsxUtils");const ruleDef=function(){};ruleDef.prototype.getName=function(){return"jetwc-reserved-property"};ruleDef.prototype.getShortDescription=function(){return"Check component does not a reserved word as a property name"};ruleDef.prototype.getDescription=function(){return"This rule checks that a component does not define a property that is on the list of reserved values e.g. slot, key, ref, children etc."};ruleDef.prototype.register=function(context){return{compjson:this._doAudit,Program:this._doVComponentAudit}};ruleDef.prototype._doAudit=function(context){if(context.suppData.obj){const meta=context.suppData.obj;const fullName=Utils.getComponentFullName(meta);const componentType=Utils.getComponentType(meta);if(componentType==="composite"){this._checkForReservedPropertyNames(context,fullName,meta)}}};ruleDef.prototype._doVComponentAudit=function(context){const componentInfo=TsxUtils.matchToVComponentImpl(context,context.filepath);if(componentInfo&&componentInfo.properties){this._checkForReservedPropertyNames(context,componentInfo.fullName,componentInfo)}};ruleDef.prototype._checkForReservedPropertyNames=function(context,fullName,componentMeta){if(componentMeta&&componentMeta.properties){const reservedProperties=context.rulePack.getRuleCustomOption("reserved");reservedProperties.forEach(reserved=>{if(componentMeta.properties.hasOwnProperty(reserved)){const issue=new context.Issue(`Component ${fullName} defines a property which uses a reserved name: '${reserved}'. You must select a different name for this property`);context.reporter.addIssue(issue,context)}})}};module.exports=ruleDef;
|
|
@@ -3,4 +3,4 @@
|
|
|
3
3
|
* Licensed under The Universal Permissive License (UPL), Version 1.0
|
|
4
4
|
* as shown at https://oss.oracle.com/licenses/upl/
|
|
5
5
|
*/
|
|
6
|
-
const TsxUtils=require("../jetwc-lib/jetwcutils-tsxUtils");const ruleDef=function(){};ruleDef.prototype.getName=function(){return"jetwc-schema"};ruleDef.prototype.getShortDescription=function(){return"Validate component json definition against the schema"};ruleDef.prototype.getDescription=function(){return"This rule checks verifies the component.json file included by or generated from the component against the schema supplied for this purpose"};ruleDef.prototype.register=function(context){return{compjson:this._doAudit,Program:this._doVComponentAudit}};ruleDef.prototype._doAudit=function(context,obj){let issue;if(context.suppData.obj){const jsonToValidate=obj.obj.component?obj.obj.component:obj.obj;const schemaErrors=context.utils.metaLib.applySchema(jsonToValidate);if(schemaErrors){schemaErrors.forEach(error=>{issue=new context.Issue(`component.json schema violation: ${this._formatViolation(error)}`);context.reporter.addIssue(issue,context)})}}};ruleDef.prototype._doVComponentAudit=function(context){
|
|
6
|
+
const TsxUtils=require("../jetwc-lib/jetwcutils-tsxUtils");const ruleDef=function(){};ruleDef.prototype.getName=function(){return"jetwc-schema"};ruleDef.prototype.getShortDescription=function(){return"Validate component json definition against the schema"};ruleDef.prototype.getDescription=function(){return"This rule checks verifies the component.json file included by or generated from the component against the schema supplied for this purpose"};ruleDef.prototype.register=function(context){return{compjson:this._doAudit,Program:this._doVComponentAudit}};ruleDef.prototype._doAudit=function(context,obj){let issue;if(context.suppData.obj){const jsonToValidate=obj.obj.component?obj.obj.component:obj.obj;const schemaErrors=context.utils.metaLib.applySchema(jsonToValidate);if(schemaErrors){schemaErrors.forEach(error=>{issue=new context.Issue(`component.json schema violation: ${this._formatViolation(error)}`);context.reporter.addIssue(issue,context)})}}};ruleDef.prototype._doVComponentAudit=function(context){let lenient=context.rulePack.getRuleCustomOption("ignoreAdditionalProperties")??false;const componentInfo=TsxUtils.matchToVComponentImpl(context,context.filepath);if(componentInfo&&componentInfo.compiledMetadata){const jsonToValidate=componentInfo.compiledMetadata;const schemaErrors=context.utils.metaLib.applySchema(jsonToValidate);if(schemaErrors){const encounteredErrors=new Set;schemaErrors.forEach(report=>{const skip=lenient&&report.error&&report.error.keyword==="additionalProperties";if(!skip){const formattedError=this._formatViolation(report);if(!encounteredErrors.has(formattedError)){encounteredErrors.add(formattedError);issue=new context.Issue(`Generated component.json has schema violation: ${formattedError}`);context.reporter.addIssue(issue,context)}}})}}};ruleDef.prototype._formatViolation=function(report){let formattedMsg;switch(report.error.keyword){case"required":const jsonErrorPath=report.error.dataPath?report.error.dataPath:report.error.instancePath;const formattedPath=this._transformViolationDataPath(jsonErrorPath);formattedMsg=`${formattedPath} ${report.msg}`;break;default:formattedMsg=report.msg}return formattedMsg};ruleDef.prototype._transformViolationDataPath=function(dataPath){let formatted=dataPath;;const parser=/\.(\w*)\['(\w*)'\]/g;const segparser=/\.(\w*)\['(\w*)'\]/;const instancePathParser=/\/(\w*)\/(\w*)/g;const instancePathSegParser=/\/(\w*)\/(\w*)/;let segments=dataPath.match(parser);let deconstructed;if(segments!==null){deconstructed=segments.map(seg=>{subParts=seg.match(segparser);return{segment:subParts[0],type:subParts[1],context:subParts[2]}})}else{segments=dataPath.match(instancePathParser);deconstructed=segments.map(seg=>{subParts=seg.match(instancePathSegParser);return{segment:subParts[0],type:subParts[1],context:subParts[2]}})}if(deconstructed&&deconstructed.length>0){if(deconstructed[0].type==="properties"){formatted=`Property ${deconstructed[0].context}`;if(deconstructed.length>1){for(let i=1;i<deconstructed.length;i++){if(deconstructed[i].type==="properties"){formatted+=`.${deconstructed[i].context}`}else{formatted+=` ${deconstructed[i].type}:${deconstructed[i].context}`}}}}}return formatted};module.exports=ruleDef;
|