@servicenow/sdk-build-plugins 4.4.1 → 4.6.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/dist/acl-plugin.js +54 -4
- package/dist/acl-plugin.js.map +1 -1
- package/dist/applicability-plugin.js +2 -0
- package/dist/applicability-plugin.js.map +1 -1
- package/dist/application-menu-plugin.js +2 -0
- package/dist/application-menu-plugin.js.map +1 -1
- package/dist/arrow-function-plugin.d.ts +6 -1
- package/dist/arrow-function-plugin.js +105 -12
- package/dist/arrow-function-plugin.js.map +1 -1
- package/dist/atf/test-plugin.js +2 -0
- package/dist/atf/test-plugin.js.map +1 -1
- package/dist/basic-syntax-plugin.js +20 -0
- package/dist/basic-syntax-plugin.js.map +1 -1
- package/dist/call-expression-plugin.js +1 -0
- package/dist/call-expression-plugin.js.map +1 -1
- package/dist/claims-plugin.js +1 -0
- package/dist/claims-plugin.js.map +1 -1
- package/dist/client-script-plugin.js +1 -0
- package/dist/client-script-plugin.js.map +1 -1
- package/dist/column-plugin.js +4 -7
- package/dist/column-plugin.js.map +1 -1
- package/dist/cross-scope-privilege-plugin.js +1 -0
- package/dist/cross-scope-privilege-plugin.js.map +1 -1
- package/dist/dashboard/dashboard-plugin.js +2 -0
- package/dist/dashboard/dashboard-plugin.js.map +1 -1
- package/dist/data-plugin.js +1 -0
- package/dist/data-plugin.js.map +1 -1
- package/dist/email-notification-plugin.js +9 -13
- package/dist/email-notification-plugin.js.map +1 -1
- package/dist/flow/constants/flow-plugin-constants.d.ts +1 -1
- package/dist/flow/constants/flow-plugin-constants.js +1 -1
- package/dist/flow/constants/flow-plugin-constants.js.map +1 -1
- package/dist/flow/flow-logic/flow-logic-diagnostics.js +5 -5
- package/dist/flow/flow-logic/flow-logic-diagnostics.js.map +1 -1
- package/dist/flow/flow-logic/flow-logic-plugin-helpers.d.ts +82 -2
- package/dist/flow/flow-logic/flow-logic-plugin-helpers.js +48 -40
- package/dist/flow/flow-logic/flow-logic-plugin-helpers.js.map +1 -1
- package/dist/flow/flow-logic/flow-logic-plugin.js +1 -0
- package/dist/flow/flow-logic/flow-logic-plugin.js.map +1 -1
- package/dist/flow/plugins/approval-rules-plugin.js +1 -0
- package/dist/flow/plugins/approval-rules-plugin.js.map +1 -1
- package/dist/flow/plugins/flow-action-definition-plugin.js +1232 -55
- package/dist/flow/plugins/flow-action-definition-plugin.js.map +1 -1
- package/dist/flow/plugins/flow-data-pill-plugin.js +6 -2
- package/dist/flow/plugins/flow-data-pill-plugin.js.map +1 -1
- package/dist/flow/plugins/flow-definition-plugin.js +23 -44
- package/dist/flow/plugins/flow-definition-plugin.js.map +1 -1
- package/dist/flow/plugins/flow-diagnostics-plugin.d.ts +2 -2
- package/dist/flow/plugins/flow-diagnostics-plugin.js +3 -2
- package/dist/flow/plugins/flow-diagnostics-plugin.js.map +1 -1
- package/dist/flow/plugins/flow-instance-plugin.js +136 -34
- package/dist/flow/plugins/flow-instance-plugin.js.map +1 -1
- package/dist/flow/plugins/flow-trigger-instance-plugin.js +1 -0
- package/dist/flow/plugins/flow-trigger-instance-plugin.js.map +1 -1
- package/dist/flow/plugins/inline-script-plugin.js +1 -0
- package/dist/flow/plugins/inline-script-plugin.js.map +1 -1
- package/dist/flow/plugins/step-definition-plugin.js +4 -2
- package/dist/flow/plugins/step-definition-plugin.js.map +1 -1
- package/dist/flow/plugins/step-instance-plugin.d.ts +9 -1
- package/dist/flow/plugins/step-instance-plugin.js +649 -135
- package/dist/flow/plugins/step-instance-plugin.js.map +1 -1
- package/dist/flow/plugins/trigger-plugin.js +2 -0
- package/dist/flow/plugins/trigger-plugin.js.map +1 -1
- package/dist/flow/plugins/wfa-datapill-plugin.js +21 -5
- package/dist/flow/plugins/wfa-datapill-plugin.js.map +1 -1
- package/dist/flow/post-install.d.ts +2 -0
- package/dist/flow/post-install.js +59 -0
- package/dist/flow/post-install.js.map +1 -0
- package/dist/flow/utils/complex-object-resolver.js +4 -1
- package/dist/flow/utils/complex-object-resolver.js.map +1 -1
- package/dist/flow/utils/complex-objects.js +5 -3
- package/dist/flow/utils/complex-objects.js.map +1 -1
- package/dist/flow/utils/flow-constants.d.ts +90 -2
- package/dist/flow/utils/flow-constants.js +430 -7
- package/dist/flow/utils/flow-constants.js.map +1 -1
- package/dist/flow/utils/flow-io-to-record.d.ts +1 -1
- package/dist/flow/utils/flow-io-to-record.js +37 -16
- package/dist/flow/utils/flow-io-to-record.js.map +1 -1
- package/dist/flow/utils/flow-shapes.js +4 -0
- package/dist/flow/utils/flow-shapes.js.map +1 -1
- package/dist/flow/utils/flow-to-xml.d.ts +3 -2
- package/dist/flow/utils/flow-to-xml.js +3 -4
- package/dist/flow/utils/flow-to-xml.js.map +1 -1
- package/dist/flow/utils/label-cache-parser.d.ts +9 -2
- package/dist/flow/utils/label-cache-parser.js +32 -4
- package/dist/flow/utils/label-cache-parser.js.map +1 -1
- package/dist/flow/utils/label-cache-processor.d.ts +5 -0
- package/dist/flow/utils/label-cache-processor.js +14 -2
- package/dist/flow/utils/label-cache-processor.js.map +1 -1
- package/dist/flow/utils/pill-shape-helpers.d.ts +15 -0
- package/dist/flow/utils/pill-shape-helpers.js +35 -0
- package/dist/flow/utils/pill-shape-helpers.js.map +1 -0
- package/dist/flow/utils/pill-string-parser.js +1 -0
- package/dist/flow/utils/pill-string-parser.js.map +1 -1
- package/dist/flow/utils/schema-to-flow-object.d.ts +6 -1
- package/dist/flow/utils/schema-to-flow-object.js +131 -15
- package/dist/flow/utils/schema-to-flow-object.js.map +1 -1
- package/dist/flow/utils/service-catalog.js +5 -1
- package/dist/flow/utils/service-catalog.js.map +1 -1
- package/dist/flow/utils/utils.d.ts +1 -0
- package/dist/flow/utils/utils.js +6 -1
- package/dist/flow/utils/utils.js.map +1 -1
- package/dist/form-plugin.d.ts +2 -0
- package/dist/form-plugin.js +1132 -0
- package/dist/form-plugin.js.map +1 -0
- package/dist/html-import-plugin.js +1 -0
- package/dist/html-import-plugin.js.map +1 -1
- package/dist/import-sets-plugin.js +2 -0
- package/dist/import-sets-plugin.js.map +1 -1
- package/dist/inbound-email-action-plugin.d.ts +10 -0
- package/dist/inbound-email-action-plugin.js +128 -0
- package/dist/inbound-email-action-plugin.js.map +1 -0
- package/dist/index.d.ts +13 -0
- package/dist/index.js +17 -1
- package/dist/index.js.map +1 -1
- package/dist/instance-scan-plugin.d.ts +2 -0
- package/dist/instance-scan-plugin.js +293 -0
- package/dist/instance-scan-plugin.js.map +1 -0
- package/dist/json-plugin.js +1 -0
- package/dist/json-plugin.js.map +1 -1
- package/dist/list-plugin.js +1 -0
- package/dist/list-plugin.js.map +1 -1
- package/dist/now-attach-plugin.js +1 -0
- package/dist/now-attach-plugin.js.map +1 -1
- package/dist/now-config-plugin.js +659 -51
- package/dist/now-config-plugin.js.map +1 -1
- package/dist/now-id-plugin.js +1 -0
- package/dist/now-id-plugin.js.map +1 -1
- package/dist/now-include-plugin.js +1 -0
- package/dist/now-include-plugin.js.map +1 -1
- package/dist/now-ref-plugin.js +1 -0
- package/dist/now-ref-plugin.js.map +1 -1
- package/dist/now-unresolved-plugin.js +1 -0
- package/dist/now-unresolved-plugin.js.map +1 -1
- package/dist/package-json-plugin.js +1 -0
- package/dist/package-json-plugin.js.map +1 -1
- package/dist/property-plugin.js +3 -1
- package/dist/property-plugin.js.map +1 -1
- package/dist/record-plugin.d.ts +37 -0
- package/dist/record-plugin.js +47 -3
- package/dist/record-plugin.js.map +1 -1
- package/dist/repack/lint/Rules.d.ts +11 -2
- package/dist/repack/lint/Rules.js +160 -16
- package/dist/repack/lint/Rules.js.map +1 -1
- package/dist/repack/lint/index.d.ts +10 -5
- package/dist/repack/lint/index.js +76 -50
- package/dist/repack/lint/index.js.map +1 -1
- package/dist/rest-api-plugin.js +22 -1
- package/dist/rest-api-plugin.js.map +1 -1
- package/dist/role-plugin.js +1 -0
- package/dist/role-plugin.js.map +1 -1
- package/dist/schedule-script/index.d.ts +1 -0
- package/dist/schedule-script/index.js +18 -0
- package/dist/schedule-script/index.js.map +1 -0
- package/dist/schedule-script/scheduled-script-plugin.d.ts +2 -0
- package/dist/schedule-script/scheduled-script-plugin.js +556 -0
- package/dist/schedule-script/scheduled-script-plugin.js.map +1 -0
- package/dist/schedule-script/timeZoneConverter.d.ts +61 -0
- package/dist/schedule-script/timeZoneConverter.js +170 -0
- package/dist/schedule-script/timeZoneConverter.js.map +1 -0
- package/dist/script-action-plugin.js +2 -0
- package/dist/script-action-plugin.js.map +1 -1
- package/dist/script-include-plugin.js +2 -0
- package/dist/script-include-plugin.js.map +1 -1
- package/dist/server-module-plugin/index.js +13 -2
- package/dist/server-module-plugin/index.js.map +1 -1
- package/dist/service-catalog/catalog-clientscript-plugin.js +2 -0
- package/dist/service-catalog/catalog-clientscript-plugin.js.map +1 -1
- package/dist/service-catalog/catalog-item-plugin.js +2 -0
- package/dist/service-catalog/catalog-item-plugin.js.map +1 -1
- package/dist/service-catalog/catalog-ui-policy-plugin.js +2 -0
- package/dist/service-catalog/catalog-ui-policy-plugin.js.map +1 -1
- package/dist/service-catalog/sc-record-producer-plugin.js +2 -0
- package/dist/service-catalog/sc-record-producer-plugin.js.map +1 -1
- package/dist/service-catalog/service-catalog-base.d.ts +18 -18
- package/dist/service-catalog/service-catalog-base.js +22 -22
- package/dist/service-catalog/service-catalog-base.js.map +1 -1
- package/dist/service-catalog/service-catalog-diagnostics.d.ts +6 -0
- package/dist/service-catalog/service-catalog-diagnostics.js +20 -0
- package/dist/service-catalog/service-catalog-diagnostics.js.map +1 -1
- package/dist/service-catalog/shape-to-record.js +7 -2
- package/dist/service-catalog/shape-to-record.js.map +1 -1
- package/dist/service-catalog/variable-set-plugin.js +2 -0
- package/dist/service-catalog/variable-set-plugin.js.map +1 -1
- package/dist/service-portal/angular-provider-plugin.js +2 -0
- package/dist/service-portal/angular-provider-plugin.js.map +1 -1
- package/dist/service-portal/dependency-plugin.js +5 -31
- package/dist/service-portal/dependency-plugin.js.map +1 -1
- package/dist/service-portal/header-footer-plugin.d.ts +2 -0
- package/dist/service-portal/header-footer-plugin.js +50 -0
- package/dist/service-portal/header-footer-plugin.js.map +1 -0
- package/dist/service-portal/menu-plugin.d.ts +2 -0
- package/dist/service-portal/menu-plugin.js +334 -0
- package/dist/service-portal/menu-plugin.js.map +1 -0
- package/dist/service-portal/page-plugin.d.ts +2 -0
- package/dist/service-portal/page-plugin.js +681 -0
- package/dist/service-portal/page-plugin.js.map +1 -0
- package/dist/service-portal/page-route-map-plugin.d.ts +2 -0
- package/dist/service-portal/page-route-map-plugin.js +114 -0
- package/dist/service-portal/page-route-map-plugin.js.map +1 -0
- package/dist/service-portal/portal-plugin.d.ts +2 -0
- package/dist/service-portal/portal-plugin.js +309 -0
- package/dist/service-portal/portal-plugin.js.map +1 -0
- package/dist/service-portal/theme-plugin.d.ts +2 -0
- package/dist/service-portal/theme-plugin.js +112 -0
- package/dist/service-portal/theme-plugin.js.map +1 -0
- package/dist/service-portal/utils.d.ts +46 -0
- package/dist/service-portal/utils.js +331 -0
- package/dist/service-portal/utils.js.map +1 -0
- package/dist/service-portal/widget-plugin.js +10 -182
- package/dist/service-portal/widget-plugin.js.map +1 -1
- package/dist/sla-plugin.js +2 -0
- package/dist/sla-plugin.js.map +1 -1
- package/dist/static-content-plugin.js +5 -0
- package/dist/static-content-plugin.js.map +1 -1
- package/dist/table-plugin.js +191 -26
- package/dist/table-plugin.js.map +1 -1
- package/dist/ui-action-plugin.js +3 -4
- package/dist/ui-action-plugin.js.map +1 -1
- package/dist/ui-page-plugin.js +101 -21
- package/dist/ui-page-plugin.js.map +1 -1
- package/dist/ui-policy-plugin.js +1 -0
- package/dist/ui-policy-plugin.js.map +1 -1
- package/dist/user-preference-plugin.js +2 -0
- package/dist/user-preference-plugin.js.map +1 -1
- package/dist/utils.d.ts +20 -2
- package/dist/utils.js +34 -3
- package/dist/utils.js.map +1 -1
- package/dist/ux-list-menu-config-plugin.js +2 -0
- package/dist/ux-list-menu-config-plugin.js.map +1 -1
- package/dist/view-plugin.js +9 -3
- package/dist/view-plugin.js.map +1 -1
- package/dist/workspace-plugin.js +41 -36
- package/dist/workspace-plugin.js.map +1 -1
- package/package.json +11 -11
- package/src/_types/eslint-community-eslint-utils.d.ts +15 -0
- package/src/acl-plugin.ts +97 -8
- package/src/applicability-plugin.ts +2 -0
- package/src/application-menu-plugin.ts +2 -0
- package/src/arrow-function-plugin.ts +128 -13
- package/src/atf/test-plugin.ts +2 -0
- package/src/basic-syntax-plugin.ts +21 -0
- package/src/call-expression-plugin.ts +1 -0
- package/src/claims-plugin.ts +1 -0
- package/src/client-script-plugin.ts +2 -1
- package/src/column-plugin.ts +4 -8
- package/src/cross-scope-privilege-plugin.ts +2 -1
- package/src/dashboard/dashboard-plugin.ts +2 -0
- package/src/data-plugin.ts +1 -0
- package/src/email-notification-plugin.ts +3 -23
- package/src/flow/constants/flow-plugin-constants.ts +1 -1
- package/src/flow/flow-logic/flow-logic-diagnostics.ts +5 -6
- package/src/flow/flow-logic/flow-logic-plugin-helpers.ts +47 -45
- package/src/flow/flow-logic/flow-logic-plugin.ts +1 -0
- package/src/flow/plugins/approval-rules-plugin.ts +1 -0
- package/src/flow/plugins/flow-action-definition-plugin.ts +1584 -62
- package/src/flow/plugins/flow-data-pill-plugin.ts +6 -2
- package/src/flow/plugins/flow-definition-plugin.ts +22 -51
- package/src/flow/plugins/flow-diagnostics-plugin.ts +3 -2
- package/src/flow/plugins/flow-instance-plugin.ts +201 -36
- package/src/flow/plugins/flow-trigger-instance-plugin.ts +1 -0
- package/src/flow/plugins/inline-script-plugin.ts +1 -0
- package/src/flow/plugins/step-definition-plugin.ts +4 -2
- package/src/flow/plugins/step-instance-plugin.ts +772 -155
- package/src/flow/plugins/trigger-plugin.ts +2 -0
- package/src/flow/plugins/wfa-datapill-plugin.ts +26 -5
- package/src/flow/post-install.ts +93 -0
- package/src/flow/utils/complex-object-resolver.ts +4 -1
- package/src/flow/utils/complex-objects.ts +11 -3
- package/src/flow/utils/flow-constants.ts +451 -6
- package/src/flow/utils/flow-io-to-record.ts +43 -17
- package/src/flow/utils/flow-shapes.ts +4 -0
- package/src/flow/utils/flow-to-xml.ts +4 -4
- package/src/flow/utils/label-cache-parser.ts +33 -4
- package/src/flow/utils/label-cache-processor.ts +14 -2
- package/src/flow/utils/pill-shape-helpers.ts +42 -0
- package/src/flow/utils/pill-string-parser.ts +1 -0
- package/src/flow/utils/schema-to-flow-object.ts +183 -15
- package/src/flow/utils/service-catalog.ts +5 -2
- package/src/flow/utils/utils.ts +12 -1
- package/src/form-plugin.ts +1409 -0
- package/src/html-import-plugin.ts +1 -0
- package/src/import-sets-plugin.ts +2 -0
- package/src/inbound-email-action-plugin.ts +145 -0
- package/src/index.ts +13 -0
- package/src/instance-scan-plugin.ts +313 -0
- package/src/json-plugin.ts +1 -0
- package/src/list-plugin.ts +2 -1
- package/src/now-attach-plugin.ts +1 -0
- package/src/now-config-plugin.ts +833 -53
- package/src/now-id-plugin.ts +1 -0
- package/src/now-include-plugin.ts +1 -0
- package/src/now-ref-plugin.ts +1 -0
- package/src/now-unresolved-plugin.ts +1 -0
- package/src/package-json-plugin.ts +1 -0
- package/src/property-plugin.ts +6 -1
- package/src/record-plugin.ts +56 -6
- package/src/repack/lint/Rules.ts +171 -22
- package/src/repack/lint/index.ts +80 -56
- package/src/rest-api-plugin.ts +28 -2
- package/src/role-plugin.ts +2 -1
- package/src/schedule-script/index.ts +1 -0
- package/src/schedule-script/scheduled-script-plugin.ts +690 -0
- package/src/schedule-script/timeZoneConverter.ts +188 -0
- package/src/script-action-plugin.ts +2 -0
- package/src/script-include-plugin.ts +2 -0
- package/src/server-module-plugin/index.ts +14 -2
- package/src/service-catalog/catalog-clientscript-plugin.ts +2 -0
- package/src/service-catalog/catalog-item-plugin.ts +2 -0
- package/src/service-catalog/catalog-ui-policy-plugin.ts +2 -0
- package/src/service-catalog/sc-record-producer-plugin.ts +2 -0
- package/src/service-catalog/service-catalog-base.ts +22 -22
- package/src/service-catalog/service-catalog-diagnostics.ts +30 -0
- package/src/service-catalog/shape-to-record.ts +8 -2
- package/src/service-catalog/variable-set-plugin.ts +2 -0
- package/src/service-portal/angular-provider-plugin.ts +2 -0
- package/src/service-portal/dependency-plugin.ts +6 -53
- package/src/service-portal/header-footer-plugin.ts +57 -0
- package/src/service-portal/menu-plugin.ts +413 -0
- package/src/service-portal/page-plugin.ts +805 -0
- package/src/service-portal/page-route-map-plugin.ts +124 -0
- package/src/service-portal/portal-plugin.ts +342 -0
- package/src/service-portal/theme-plugin.ts +135 -0
- package/src/service-portal/utils.ts +470 -0
- package/src/service-portal/widget-plugin.ts +18 -224
- package/src/sla-plugin.ts +2 -0
- package/src/static-content-plugin.ts +4 -0
- package/src/table-plugin.ts +228 -37
- package/src/ui-action-plugin.ts +3 -8
- package/src/ui-page-plugin.ts +110 -21
- package/src/ui-policy-plugin.ts +2 -1
- package/src/user-preference-plugin.ts +2 -0
- package/src/utils.ts +42 -2
- package/src/ux-list-menu-config-plugin.ts +2 -0
- package/src/view-plugin.ts +11 -4
- package/src/workspace-plugin.ts +45 -43
- package/src/_types/eslint-plugin-es-x.d.ts +0 -17
package/src/now-id-plugin.ts
CHANGED
package/src/now-ref-plugin.ts
CHANGED
package/src/property-plugin.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { isSNScope } from '@servicenow/sdk-build-core'
|
|
2
2
|
import { CallExpressionShape, Plugin, type Shape } from '@servicenow/sdk-build-core'
|
|
3
3
|
import { NowIdShape } from './now-id-plugin'
|
|
4
|
+
import { createSdkDocEntry } from './utils'
|
|
4
5
|
|
|
5
6
|
const getRolesArray = (roles: string): Array<string> => {
|
|
6
7
|
return roles
|
|
@@ -11,6 +12,7 @@ const getRolesArray = (roles: string): Array<string> => {
|
|
|
11
12
|
|
|
12
13
|
export const PropertyPlugin = Plugin.create({
|
|
13
14
|
name: 'PropertyPlugin',
|
|
15
|
+
docs: [createSdkDocEntry('Property', ['sys_properties'])],
|
|
14
16
|
records: {
|
|
15
17
|
sys_properties: {
|
|
16
18
|
toShape(record, { config }) {
|
|
@@ -68,7 +70,10 @@ export const PropertyPlugin = Plugin.create({
|
|
|
68
70
|
const name = prop.get('name').asString()
|
|
69
71
|
|
|
70
72
|
if (!isSNScope(scope) && config.scope !== 'global' && !name.asString().startsWith(`${scope}.`)) {
|
|
71
|
-
diagnostics.
|
|
73
|
+
diagnostics.warn(
|
|
74
|
+
name.getOriginalNode(),
|
|
75
|
+
`Property names should begin with '${scope}.' to match the app scope and avoid collisions with properties from other scopes`
|
|
76
|
+
)
|
|
72
77
|
}
|
|
73
78
|
|
|
74
79
|
return {
|
package/src/record-plugin.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { CallExpressionShape, Database, Plugin, unloadBuilder, type Record } from '@servicenow/sdk-build-core'
|
|
2
2
|
import { NowIdShape } from './now-id-plugin'
|
|
3
|
+
import { createSdkDocEntry } from './utils'
|
|
3
4
|
import {
|
|
4
5
|
Acl,
|
|
5
6
|
ApplicationMenu,
|
|
@@ -13,11 +14,17 @@ import {
|
|
|
13
14
|
Sla,
|
|
14
15
|
} from '@servicenow/sdk-core/runtime/app'
|
|
15
16
|
import {
|
|
17
|
+
ServicePortal,
|
|
16
18
|
SPWidget,
|
|
19
|
+
SPHeaderFooter,
|
|
17
20
|
SPAngularProvider,
|
|
18
21
|
SPWidgetDependency,
|
|
19
22
|
CssInclude,
|
|
20
23
|
JsInclude,
|
|
24
|
+
SPPage,
|
|
25
|
+
SPTheme,
|
|
26
|
+
SPMenu,
|
|
27
|
+
SPPageRouteMap,
|
|
21
28
|
} from '@servicenow/sdk-core/runtime/service-portal'
|
|
22
29
|
import {
|
|
23
30
|
CatalogItem,
|
|
@@ -27,21 +34,27 @@ import {
|
|
|
27
34
|
CatalogItemRecordProducer,
|
|
28
35
|
} from '@servicenow/sdk-core/runtime/service-catalog'
|
|
29
36
|
import { ClientScript } from '@servicenow/sdk-core/runtime/clientscript'
|
|
30
|
-
import { ScriptAction, ScriptInclude } from '@servicenow/sdk-core/runtime/sys'
|
|
31
|
-
import { List } from '@servicenow/sdk-core/runtime/ui'
|
|
37
|
+
import { ScriptAction, ScriptInclude, ScheduledScript } from '@servicenow/sdk-core/runtime/sys'
|
|
38
|
+
import { List, Form } from '@servicenow/sdk-core/runtime/ui'
|
|
32
39
|
import { Table } from '@servicenow/sdk-core/runtime/db'
|
|
33
40
|
import { RestApi } from '@servicenow/sdk-core/runtime/rest'
|
|
34
|
-
import { EmailNotification } from '@servicenow/sdk-core/runtime/notification'
|
|
41
|
+
import { EmailNotification, InboundEmailAction } from '@servicenow/sdk-core/runtime/notification'
|
|
35
42
|
import { UiAction, UiPage, UiPolicy } from '@servicenow/sdk-core/runtime/ui'
|
|
43
|
+
import { ActionStepDefinition } from '@servicenow/sdk-core/runtime/flow'
|
|
36
44
|
import { Applicability, UxListMenuConfig, Workspace } from '@servicenow/sdk-core/runtime/uxf'
|
|
37
45
|
import { Dashboard } from '@servicenow/sdk-core/runtime/dashboard'
|
|
46
|
+
import { ColumnTypeCheck, LinterCheck, ScriptOnlyCheck, TableCheck } from '@servicenow/sdk-core/runtime/instancescan'
|
|
38
47
|
|
|
39
48
|
export const RecordPlugin = Plugin.create({
|
|
40
49
|
name: 'RecordPlugin',
|
|
50
|
+
docs: [createSdkDocEntry('Record', ['*'])],
|
|
41
51
|
records: {
|
|
42
52
|
'*': {
|
|
43
53
|
getUpdateName(record) {
|
|
44
|
-
return {
|
|
54
|
+
return {
|
|
55
|
+
success: true,
|
|
56
|
+
value: `${record.getTable()}_${record.getId().getValue()}`,
|
|
57
|
+
}
|
|
45
58
|
},
|
|
46
59
|
async diff(existing, incoming) {
|
|
47
60
|
const changeDatabase = existing.compare(incoming)
|
|
@@ -213,6 +226,10 @@ export const TableOwnership = {
|
|
|
213
226
|
sys_script: BusinessRule.name,
|
|
214
227
|
sys_script_client: ClientScript.name,
|
|
215
228
|
sys_scope_privilege: CrossScopePrivilege.name,
|
|
229
|
+
sys_ui_form: Form.name,
|
|
230
|
+
sys_ui_section: Form.name,
|
|
231
|
+
sys_ui_form_section: Form.name,
|
|
232
|
+
sys_ui_element: Form.name,
|
|
216
233
|
sys_ui_list_element: List.name,
|
|
217
234
|
sys_ui_list: List.name,
|
|
218
235
|
sys_properties: Property.name,
|
|
@@ -220,16 +237,26 @@ export const TableOwnership = {
|
|
|
220
237
|
sys_user_role_contains: Role.name,
|
|
221
238
|
sys_script_include: ScriptInclude.name,
|
|
222
239
|
sp_widget: SPWidget.name,
|
|
240
|
+
sp_header_footer: SPHeaderFooter.name,
|
|
223
241
|
m2m_sp_widget_dependency: SPWidget.name,
|
|
224
242
|
m2m_sp_ng_pro_sp_widget: SPWidget.name,
|
|
243
|
+
sp_portal: ServicePortal.name,
|
|
225
244
|
sp_ng_template: SPWidget.name,
|
|
226
245
|
sp_dependency: SPWidgetDependency.name,
|
|
246
|
+
sp_container: SPPage.name,
|
|
247
|
+
sp_page: SPPage.name,
|
|
248
|
+
sp_row: SPPage.name,
|
|
249
|
+
sp_column: SPPage.name,
|
|
250
|
+
sp_instance: SPPage.name,
|
|
227
251
|
m2m_sp_dependency_css_include: SPWidgetDependency.name,
|
|
228
252
|
m2m_sp_dependency_js_include: SPWidgetDependency.name,
|
|
229
253
|
sp_css_include: CssInclude.name,
|
|
230
254
|
sp_js_include: JsInclude.name,
|
|
231
255
|
sp_angular_provider: SPAngularProvider.name,
|
|
232
256
|
m2m_sp_ng_pro_sp_ng_pro: SPAngularProvider.name,
|
|
257
|
+
sp_instance_menu: SPMenu.name,
|
|
258
|
+
sp_rectangle_menu_item: SPMenu.name,
|
|
259
|
+
sp_page_route_map: SPPageRouteMap.name,
|
|
233
260
|
sys_atf_test: Test.name,
|
|
234
261
|
sys_ws_header_map: RestApi.name,
|
|
235
262
|
sys_ws_query_parameter_map: RestApi.name,
|
|
@@ -247,7 +274,9 @@ export const TableOwnership = {
|
|
|
247
274
|
sys_ui_policy_action: UiPolicy.name,
|
|
248
275
|
sys_ui_policy_rl_action: UiPolicy.name,
|
|
249
276
|
sysevent_script_action: ScriptAction.name,
|
|
277
|
+
sysauto_script: ScheduledScript.name,
|
|
250
278
|
sysevent_email_action: EmailNotification.name,
|
|
279
|
+
sysevent_in_email_action: InboundEmailAction.name,
|
|
251
280
|
sys_db_object: Table.name,
|
|
252
281
|
sys_dictionary: Table.name,
|
|
253
282
|
sys_hub_flow: 'Flow',
|
|
@@ -255,10 +284,13 @@ export const TableOwnership = {
|
|
|
255
284
|
sys_hub_action_instance_v2: 'wfa.action',
|
|
256
285
|
sys_hub_sub_flow_instance_v2: 'wfa.subflow',
|
|
257
286
|
sys_hub_flow_logic_instance_v2: 'wfa.flowLogic',
|
|
258
|
-
sys_flow_step_definition:
|
|
287
|
+
sys_flow_step_definition: ActionStepDefinition.name,
|
|
259
288
|
sys_decision: 'DecisionTablePlugin',
|
|
260
289
|
sys_hub_action_type_definition: 'Action',
|
|
261
|
-
sys_hub_step_instance: 'wfa.
|
|
290
|
+
sys_hub_step_instance: 'wfa.actionStep',
|
|
291
|
+
sp_theme: SPTheme.name,
|
|
292
|
+
m2m_sp_theme_css_include: SPTheme.name,
|
|
293
|
+
m2m_sp_theme_js_include: SPTheme.name,
|
|
262
294
|
sys_transform_map: ImportSet.name,
|
|
263
295
|
sys_transform_entry: ImportSet.name,
|
|
264
296
|
sys_transform_script: ImportSet.name,
|
|
@@ -275,9 +307,27 @@ export const TableOwnership = {
|
|
|
275
307
|
par_dashboard_widget: Dashboard.name,
|
|
276
308
|
par_dashboard_permission: Dashboard.name,
|
|
277
309
|
par_dashboard_visibility: Dashboard.name,
|
|
310
|
+
scan_column_type_check: ColumnTypeCheck.name,
|
|
311
|
+
scan_linter_check: LinterCheck.name,
|
|
312
|
+
scan_script_only_check: ScriptOnlyCheck.name,
|
|
313
|
+
scan_table_check: TableCheck.name,
|
|
278
314
|
item_option_new_set: VariableSet.name,
|
|
279
315
|
sc_cat_item: CatalogItem.name,
|
|
280
316
|
sc_cat_item_producer: CatalogItemRecordProducer.name,
|
|
281
317
|
catalog_script_client: CatalogClientScript.name,
|
|
282
318
|
catalog_ui_policy: CatalogUiPolicy.name,
|
|
319
|
+
sn_aia_agent: 'AiAgentPlugin',
|
|
320
|
+
sn_aia_agent_config: 'AiAgentPlugin',
|
|
321
|
+
sn_aia_version: 'AiAgentPlugin',
|
|
322
|
+
sn_aia_tool: 'AiAgentPlugin',
|
|
323
|
+
sn_aia_agent_tool_m2m: 'AiAgentPlugin',
|
|
324
|
+
sn_aia_ltm_category_mapping: 'AiAgentPlugin',
|
|
325
|
+
sn_aia_trigger_configuration: 'AiAgentPlugin',
|
|
326
|
+
sn_aia_trigger_agent_usecase_m2m: 'AiAgentPlugin',
|
|
327
|
+
sn_aia_usecase: 'AiAgenticWorkflowPlugin',
|
|
328
|
+
sn_aia_usecase_config_override: 'AiAgenticWorkflowPlugin',
|
|
329
|
+
sn_aia_team: 'AiAgenticWorkflowPlugin',
|
|
330
|
+
sn_aia_team_member: 'AiAgenticWorkflowPlugin',
|
|
331
|
+
sn_nowassist_skill_config: 'NowAssistSkillPlugin',
|
|
332
|
+
sys_one_extend_capability: 'NowAssistSkillPlugin',
|
|
283
333
|
}
|
package/src/repack/lint/Rules.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import * as globals from 'globals'
|
|
2
|
-
import mapValues from 'lodash/mapValues'
|
|
3
2
|
import omit from 'lodash/omit'
|
|
4
3
|
import { GlideAPIs } from '@servicenow/glide/util'
|
|
5
|
-
import type { Rule, Linter } from 'eslint'
|
|
4
|
+
import type { Rule, Linter, Scope } from 'eslint'
|
|
5
|
+
import { ReferenceTracker } from '@eslint-community/eslint-utils'
|
|
6
6
|
|
|
7
7
|
const BROWSER_API_WARNING = 'Web APIs are not supported by the now platform'
|
|
8
8
|
const GLIDE_API_WARNING = 'Glide APIs are not supported by the now platform when used from a 3rd party dependency'
|
|
@@ -21,18 +21,129 @@ const glideAPIs = GlideAPIs
|
|
|
21
21
|
|
|
22
22
|
const globalsAllowList: string[] = ['console', 'fetch']
|
|
23
23
|
|
|
24
|
-
|
|
24
|
+
const coreNodeModules = [
|
|
25
|
+
'assert',
|
|
26
|
+
'buffer',
|
|
27
|
+
'child_process',
|
|
28
|
+
'cluster',
|
|
29
|
+
'crypto',
|
|
30
|
+
'dgram',
|
|
31
|
+
'dns',
|
|
32
|
+
'domain',
|
|
33
|
+
'events',
|
|
34
|
+
'freelist',
|
|
35
|
+
'fs',
|
|
36
|
+
'http',
|
|
37
|
+
'https',
|
|
38
|
+
'module',
|
|
39
|
+
'net',
|
|
40
|
+
'os',
|
|
41
|
+
'path',
|
|
42
|
+
'punycode',
|
|
43
|
+
'querystring',
|
|
44
|
+
'readline',
|
|
45
|
+
'repl',
|
|
46
|
+
'smalloc',
|
|
47
|
+
'stream',
|
|
48
|
+
'string_decoder',
|
|
49
|
+
'sys',
|
|
50
|
+
'timers',
|
|
51
|
+
'tls',
|
|
52
|
+
'tracing',
|
|
53
|
+
'tty',
|
|
54
|
+
'url',
|
|
55
|
+
'util',
|
|
56
|
+
'vm',
|
|
57
|
+
'zlib',
|
|
58
|
+
]
|
|
59
|
+
|
|
60
|
+
const getNodeGlobals = () => Object.keys(globals.nodeBuiltin).filter((key) => !globalsAllowList.includes(key))
|
|
61
|
+
|
|
62
|
+
function createTrackMap(isNodeGlobals: boolean): Record<string, { [key: symbol]: { name: string } }> {
|
|
63
|
+
const trackMapItems = isNodeGlobals ? getNodeGlobals() : coreNodeModules
|
|
64
|
+
const trackMap: Record<string, { [key: symbol]: { name: string } }> = {}
|
|
65
|
+
|
|
66
|
+
for (const item of trackMapItems) {
|
|
67
|
+
trackMap[item] = {
|
|
68
|
+
[ReferenceTracker.READ]: {
|
|
69
|
+
name: item,
|
|
70
|
+
},
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
return trackMap
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
/**
|
|
78
|
+
* Custom rule: disallow unsupported Node.js built-in APIs.
|
|
79
|
+
* Replaces @servicenow/eslint-plugin-sdk-app-plugin/no-unsupported-node-builtins.
|
|
80
|
+
*/
|
|
81
|
+
const noUnsupportedNodeBuiltins: Rule.RuleModule = {
|
|
82
|
+
meta: {
|
|
83
|
+
docs: {
|
|
84
|
+
description: 'disallow unsupported Node.js built-in APIs',
|
|
85
|
+
},
|
|
86
|
+
messages: {
|
|
87
|
+
forbidden: 'The {{name}} Node.js API is not supported in now platform.',
|
|
88
|
+
},
|
|
89
|
+
schema: [],
|
|
90
|
+
type: 'problem',
|
|
91
|
+
},
|
|
92
|
+
create(context) {
|
|
93
|
+
return {
|
|
94
|
+
// biome-ignore lint/suspicious/noExplicitAny: ESLint rule listener typing
|
|
95
|
+
'Program:exit'(node: any) {
|
|
96
|
+
const sourceCode = context.sourceCode
|
|
97
|
+
const tracker = new ReferenceTracker(sourceCode.getScope(node) as Scope.Scope, { mode: 'legacy' })
|
|
98
|
+
const trackMap = createTrackMap(false)
|
|
99
|
+
const globalsTrackMap = createTrackMap(true)
|
|
100
|
+
|
|
101
|
+
const references = [
|
|
102
|
+
...tracker.iterateCjsReferences(trackMap),
|
|
103
|
+
...tracker.iterateEsmReferences(trackMap),
|
|
104
|
+
...tracker.iterateGlobalReferences(globalsTrackMap),
|
|
105
|
+
]
|
|
106
|
+
|
|
107
|
+
for (const { node: refNode, info } of references) {
|
|
108
|
+
context.report({
|
|
109
|
+
node: refNode as Rule.Node,
|
|
110
|
+
messageId: 'forbidden',
|
|
111
|
+
data: info as Record<string, string>,
|
|
112
|
+
})
|
|
113
|
+
}
|
|
114
|
+
},
|
|
115
|
+
}
|
|
116
|
+
},
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
/**
|
|
120
|
+
* Custom rule: disallow dynamic import() syntax.
|
|
121
|
+
* Replaces eslint-plugin-es-x/no-dynamic-import.
|
|
122
|
+
*/
|
|
123
|
+
const noDynamicImport: Rule.RuleModule = {
|
|
124
|
+
meta: {
|
|
125
|
+
docs: {
|
|
126
|
+
description: 'disallow dynamic import() syntax',
|
|
127
|
+
},
|
|
128
|
+
messages: {
|
|
129
|
+
forbidden: "Dynamic 'import()' syntax is not supported on the now platform.",
|
|
130
|
+
},
|
|
131
|
+
schema: [],
|
|
132
|
+
type: 'problem',
|
|
133
|
+
},
|
|
134
|
+
create(context) {
|
|
135
|
+
return {
|
|
136
|
+
ImportExpression(node: Rule.Node) {
|
|
137
|
+
context.report({ node, messageId: 'forbidden' })
|
|
138
|
+
},
|
|
139
|
+
}
|
|
140
|
+
},
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
export const getPluginRules = (): Record<string, Rule.RuleModule> => {
|
|
25
144
|
return {
|
|
26
|
-
'
|
|
27
|
-
'
|
|
28
|
-
await import('eslint-plugin-es-x/lib/rules/no-regexp-lookbehind-assertions.js')
|
|
29
|
-
).default,
|
|
30
|
-
'es-x/no-regexp-unicode-property-escapes': (
|
|
31
|
-
await import('eslint-plugin-es-x/lib/rules/no-regexp-unicode-property-escapes.js')
|
|
32
|
-
).default,
|
|
33
|
-
'@servicenow/sdk-app-plugin/no-unsupported-node-builtins': (
|
|
34
|
-
await import('@servicenow/eslint-plugin-sdk-app-plugin')
|
|
35
|
-
).default.rules['no-unsupported-node-builtins'],
|
|
145
|
+
'no-dynamic-import': noDynamicImport,
|
|
146
|
+
'no-unsupported-node-builtins': noUnsupportedNodeBuiltins,
|
|
36
147
|
}
|
|
37
148
|
}
|
|
38
149
|
|
|
@@ -63,19 +174,29 @@ const getGlideGlobalEslintRules = () => {
|
|
|
63
174
|
const getGlideNamespaceEslintRules = () => {
|
|
64
175
|
const namespacedAPIs = omit(glideAPIs, ['defaults'])
|
|
65
176
|
|
|
66
|
-
|
|
67
|
-
|
|
177
|
+
// Deduplicate rules — the Glide API data contains duplicate object.property entries
|
|
178
|
+
// across namespaces, and ESLint v9 rejects arrays with duplicate items.
|
|
179
|
+
const deduplicatedRuleKeys = new Set<string>()
|
|
180
|
+
const rules: ESLintPropertyRule[] = []
|
|
181
|
+
|
|
182
|
+
const addRule = (rule: ESLintPropertyRule) => {
|
|
183
|
+
const key = `${rule.object}.${rule.property}`
|
|
184
|
+
if (!deduplicatedRuleKeys.has(key)) {
|
|
185
|
+
deduplicatedRuleKeys.add(key)
|
|
186
|
+
rules.push(rule)
|
|
187
|
+
}
|
|
188
|
+
}
|
|
68
189
|
|
|
69
190
|
for (const [namespace, classes] of Object.entries(namespacedAPIs)) {
|
|
70
191
|
for (const [className, properties] of Object.entries(classes)) {
|
|
71
|
-
|
|
192
|
+
addRule({
|
|
72
193
|
object: namespace,
|
|
73
194
|
property: className,
|
|
74
195
|
message: GLIDE_API_WARNING,
|
|
75
196
|
})
|
|
76
197
|
|
|
77
198
|
for (const property of properties) {
|
|
78
|
-
|
|
199
|
+
addRule({
|
|
79
200
|
object: className,
|
|
80
201
|
property,
|
|
81
202
|
message: GLIDE_API_WARNING,
|
|
@@ -84,14 +205,42 @@ const getGlideNamespaceEslintRules = () => {
|
|
|
84
205
|
}
|
|
85
206
|
}
|
|
86
207
|
|
|
87
|
-
return
|
|
208
|
+
return rules
|
|
209
|
+
}
|
|
210
|
+
|
|
211
|
+
/**
|
|
212
|
+
* ESLint config for local modules — Rhino compatibility rules only (no Glide restrictions).
|
|
213
|
+
* Local modules can use Glide APIs since they run in the ServiceNow scope.
|
|
214
|
+
*/
|
|
215
|
+
export const getLocalModuleEslintConfig = (level: LogLevel = 'error'): Linter.LegacyConfig => {
|
|
216
|
+
const pluginRules = getPluginRules()
|
|
217
|
+
const restrictedGlobals = getRestrictedGlobals()
|
|
218
|
+
const rules: Linter.LegacyConfig['rules'] = {
|
|
219
|
+
...Object.fromEntries(Object.keys(pluginRules).map((name) => [name, level])),
|
|
220
|
+
'no-restricted-globals': [level, ...restrictedGlobals],
|
|
221
|
+
}
|
|
222
|
+
|
|
223
|
+
return {
|
|
224
|
+
env: {
|
|
225
|
+
node: true,
|
|
226
|
+
},
|
|
227
|
+
parserOptions: {
|
|
228
|
+
ecmaVersion: 'latest',
|
|
229
|
+
sourceType: 'module',
|
|
230
|
+
},
|
|
231
|
+
rules,
|
|
232
|
+
}
|
|
88
233
|
}
|
|
89
234
|
|
|
90
|
-
|
|
91
|
-
|
|
235
|
+
/**
|
|
236
|
+
* ESLint config for 3rd party dependencies — Rhino compatibility + Glide API restrictions.
|
|
237
|
+
* 3rd party code must not use Glide APIs (they are platform-internal).
|
|
238
|
+
*/
|
|
239
|
+
export const getEslintConfig = (level: LogLevel = 'warn'): Linter.LegacyConfig => {
|
|
240
|
+
const pluginRules = getPluginRules()
|
|
92
241
|
const restrictedGlobals = getRestrictedGlobals()
|
|
93
242
|
const rules = {
|
|
94
|
-
...
|
|
243
|
+
...Object.fromEntries(Object.keys(pluginRules).map((name) => [name, level])),
|
|
95
244
|
...getDependencyConfig(level, restrictedGlobals),
|
|
96
245
|
}
|
|
97
246
|
|
|
@@ -107,7 +256,7 @@ export const getEslintConfig = async (level: LogLevel = 'warn'): Promise<Linter.
|
|
|
107
256
|
}
|
|
108
257
|
}
|
|
109
258
|
|
|
110
|
-
function getDependencyConfig(level: LogLevel, restrictedGlobals: ESLintPropertyRule[]): Linter.
|
|
259
|
+
function getDependencyConfig(level: LogLevel, restrictedGlobals: ESLintPropertyRule[]): Linter.LegacyConfig['rules'] {
|
|
111
260
|
const globalRules = getGlideGlobalEslintRules()
|
|
112
261
|
const namespaceRules = getGlideNamespaceEslintRules()
|
|
113
262
|
return {
|
package/src/repack/lint/index.ts
CHANGED
|
@@ -1,71 +1,95 @@
|
|
|
1
1
|
import { Linter, type ESLint } from 'eslint'
|
|
2
2
|
import formatter from 'eslint-formatter-stylish'
|
|
3
|
-
import { getEslintConfig,
|
|
3
|
+
import { getEslintConfig, getLocalModuleEslintConfig, getPluginRules } from './Rules'
|
|
4
4
|
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
async check(fileContent: string): Promise<string | undefined> {
|
|
20
|
-
await this.initESLint()
|
|
5
|
+
// Module-level singletons — the Linter and configs are shared across all Lint instances.
|
|
6
|
+
// Uses configType: 'eslintrc' (legacy mode) because ESLint v9's flat config verify() path
|
|
7
|
+
// re-validates the config (including 7000+ no-restricted-properties entries) on every call,
|
|
8
|
+
// causing significant performance overhead. In legacy mode, defineRules() loads rules once
|
|
9
|
+
// and verify() is lightweight — matching ESLint v8 behavior.
|
|
10
|
+
//
|
|
11
|
+
// TODO: configType: 'eslintrc' is deprecated and will be removed in ESLint v10.
|
|
12
|
+
// When that happens, replace the 7000+ no-restricted-properties entries with a single
|
|
13
|
+
// custom ESLint rule that internalizes the Glide API blocklist. This would make flat
|
|
14
|
+
// config verify() fast by reducing the rule count, eliminating the need for legacy mode.
|
|
15
|
+
let sharedLinter: Linter | undefined
|
|
16
|
+
let dependencyConfig: Linter.LegacyConfig | undefined
|
|
17
|
+
let localModuleConfig: Linter.LegacyConfig | undefined
|
|
21
18
|
|
|
22
|
-
|
|
23
|
-
|
|
19
|
+
function getSharedLinter(): Linter {
|
|
20
|
+
if (!sharedLinter) {
|
|
21
|
+
sharedLinter = new Linter({ configType: 'eslintrc' })
|
|
22
|
+
sharedLinter.defineRules(getPluginRules())
|
|
23
|
+
dependencyConfig = getEslintConfig()
|
|
24
|
+
localModuleConfig = getLocalModuleEslintConfig()
|
|
24
25
|
}
|
|
26
|
+
return sharedLinter
|
|
27
|
+
}
|
|
25
28
|
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
29
|
+
function outputLintingResults(messages: Linter.LintMessage[]): string | undefined {
|
|
30
|
+
const stats = messages.reduce(
|
|
31
|
+
(result, message) => {
|
|
32
|
+
if (message.fatal) {
|
|
33
|
+
result.fatalErrorCount++
|
|
34
|
+
}
|
|
32
35
|
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
}
|
|
36
|
+
if (message.severity === 1) {
|
|
37
|
+
result.warningCount++
|
|
38
|
+
if (message.fix) {
|
|
39
|
+
result.fixableWarningCount++
|
|
38
40
|
}
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
41
|
+
}
|
|
42
|
+
if (message.severity === 2) {
|
|
43
|
+
result.errorCount++
|
|
44
|
+
if (message.fix) {
|
|
45
|
+
result.fixableErrorCount++
|
|
44
46
|
}
|
|
45
|
-
|
|
46
|
-
return result
|
|
47
|
-
},
|
|
48
|
-
{
|
|
49
|
-
errorCount: 0,
|
|
50
|
-
fatalErrorCount: 0,
|
|
51
|
-
warningCount: 0,
|
|
52
|
-
fixableErrorCount: 0,
|
|
53
|
-
fixableWarningCount: 0,
|
|
54
47
|
}
|
|
55
|
-
)
|
|
56
|
-
const results: ESLint.LintResult = {
|
|
57
|
-
filePath: '',
|
|
58
|
-
messages,
|
|
59
|
-
suppressedMessages: [],
|
|
60
|
-
usedDeprecatedRules: [],
|
|
61
|
-
...stats,
|
|
62
|
-
}
|
|
63
48
|
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
49
|
+
return result
|
|
50
|
+
},
|
|
51
|
+
{
|
|
52
|
+
errorCount: 0,
|
|
53
|
+
fatalErrorCount: 0,
|
|
54
|
+
warningCount: 0,
|
|
55
|
+
fixableErrorCount: 0,
|
|
56
|
+
fixableWarningCount: 0,
|
|
67
57
|
}
|
|
58
|
+
)
|
|
59
|
+
const results: ESLint.LintResult = {
|
|
60
|
+
filePath: '',
|
|
61
|
+
messages,
|
|
62
|
+
suppressedMessages: [],
|
|
63
|
+
usedDeprecatedRules: [],
|
|
64
|
+
...stats,
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
const problems = results.errorCount + results.warningCount + results.fatalErrorCount
|
|
68
|
+
if (problems <= 0) {
|
|
69
|
+
return
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
return (formatter as (results: ESLint.LintResult[]) => string)([results])
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
/**
|
|
76
|
+
* Lint for 3rd party dependencies — Rhino compatibility + Glide API restrictions.
|
|
77
|
+
*/
|
|
78
|
+
export class Lint {
|
|
79
|
+
check(fileContent: string): string | undefined {
|
|
80
|
+
const linter = getSharedLinter()
|
|
81
|
+
const messages = linter.verify(fileContent, dependencyConfig!)
|
|
82
|
+
return outputLintingResults(messages)
|
|
83
|
+
}
|
|
84
|
+
}
|
|
68
85
|
|
|
69
|
-
|
|
86
|
+
/**
|
|
87
|
+
* Lint for local modules — Rhino compatibility rules only (no Glide restrictions).
|
|
88
|
+
*/
|
|
89
|
+
export class LocalModuleLint {
|
|
90
|
+
check(fileContent: string): string | undefined {
|
|
91
|
+
const linter = getSharedLinter()
|
|
92
|
+
const messages = linter.verify(fileContent, localModuleConfig!)
|
|
93
|
+
return outputLintingResults(messages)
|
|
70
94
|
}
|
|
71
95
|
}
|