@camunda/linting 3.8.1 → 3.10.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.
@@ -4,7 +4,8 @@ import { is, isAny } from 'bpmnlint-utils';
4
4
 
5
5
  import {
6
6
  every,
7
- isArray
7
+ isArray,
8
+ isString
8
9
  } from 'min-dash';
9
10
 
10
11
  import { getTypeString } from './types';
@@ -394,6 +395,10 @@ function getPropertyNotAllowedErrorMessage(report, executionPlatform, executionP
394
395
  return getSupportedMessage(`${ getIndefiniteArticle(typeString) } <${ typeString }> with <${ TIMER_PROPERTY_LABELS[ property ] }>`, executionPlatform, executionPlatformVersion, allowedVersion);
395
396
  }
396
397
 
398
+ if (is(node, 'zeebe:FormDefinition') && property === 'formId') {
399
+ return getSupportedMessage(`${ getIndefiniteArticle(typeString) } <${ typeString }> with <Form type: Camunda form (linked)>`, executionPlatform, executionPlatformVersion, allowedVersion);
400
+ }
401
+
397
402
  return message;
398
403
  }
399
404
 
@@ -483,12 +488,20 @@ function getPropertyRequiredErrorMessage(report, executionPlatform, executionPla
483
488
  return `${ getIndefiniteArticle(typeString) } <${ typeString }> must have a defined <Signal Reference>`;
484
489
  }
485
490
 
486
- if (is(node, 'zeebe:FormDefinition') && requiredProperty === 'formKey') {
491
+ if (is(node, 'zeebe:FormDefinition')
492
+ && (
493
+ requiredProperty === 'formKey'
494
+ || (isArray(requiredProperty) && requiredProperty.includes('formKey') && isEmptyString(node.get('formKey')))
495
+ )) {
487
496
  return `${ getIndefiniteArticle(typeString) } <${ typeString }> with <Form type: Custom form key> must have a defined <Form key>`;
488
497
  }
489
498
 
499
+ if (is(node, 'zeebe:FormDefinition') && isArray(requiredProperty) && requiredProperty.includes('formId') && isEmptyString(node.get('formId'))) {
500
+ return `${ getIndefiniteArticle(typeString) } <${ typeString }> with <Form type: Camunda form (linked)> must have a defined <Form ID>`;
501
+ }
502
+
490
503
  if (is(node, 'zeebe:UserTaskForm') && requiredProperty === 'body') {
491
- return `${ getIndefiniteArticle(typeString) } <${ typeString }> with <Form type: Camunda forms> must have a defined <Form JSON configuration>`;
504
+ return `${ getIndefiniteArticle(typeString) } <${ typeString }> with <Form type: Camunda form (embedded)> must have a defined <Form JSON configuration>`;
492
505
  }
493
506
 
494
507
  if (is(node, 'bpmn:SequenceFlow') && requiredProperty === 'conditionExpression') {
@@ -550,7 +563,7 @@ function getExpressionValueNotAllowedErrorMessage(report, executionPlatform, exe
550
563
 
551
564
  if (is(node, 'bpmn:FormalExpression') && property === 'timeCycle') {
552
565
  if (!greaterOrEqual(executionPlatformVersion, '8.1')) {
553
- return `${ getIndefiniteArticle(typeString) } <${ typeString }> <Time cycle> must be an expression, an ISO 8601 repeating interval, or a cron expression (cron only supported by Camunda Platform 8.1 or newer)`;
566
+ return `${ getIndefiniteArticle(typeString) } <${ typeString }> <Time cycle> must be an expression, an ISO 8601 repeating interval, or a cron expression (cron only supported by Camunda 8.1 or newer)`;
554
567
  } else {
555
568
  return `${ getIndefiniteArticle(typeString) } <${ typeString }> <Time cycle> must be an expression, an ISO 8601 repeating interval, or a cron expression`;
556
569
  }
@@ -672,4 +685,8 @@ function getLoopNotAllowedErrorMessage(report) {
672
685
  const { elements } = data;
673
686
 
674
687
  return `A <Process> is not allowed to contain a straight-through processing loop: ${ elements.map(element => `<${ element }>`).join(', ') }`;
688
+ }
689
+
690
+ function isEmptyString(value) {
691
+ return isString(value) && value.trim() === '';
675
692
  }
@@ -1,4 +1,7 @@
1
- import { isArray } from 'min-dash';
1
+ import {
2
+ isArray,
3
+ isString
4
+ } from 'min-dash';
2
5
 
3
6
  import { is } from 'bpmnlint-utils';
4
7
 
@@ -159,6 +162,23 @@ export function getEntryIds(report) {
159
162
  return [ 'customFormKey' ];
160
163
  }
161
164
 
165
+ if (isType(data, 'zeebe:FormDefinition')) {
166
+ const {
167
+ node,
168
+ requiredProperty
169
+ } = data;
170
+
171
+ if (isArray(requiredProperty) && requiredProperty.includes('formKey') && isEmptyString(node.get('formKey'))) {
172
+ return [ 'customFormKey' ];
173
+ } else if (isArray(requiredProperty) && requiredProperty.includes('formId') && isEmptyString(node.get('formId'))) {
174
+ return [ 'formId' ];
175
+ }
176
+ }
177
+
178
+ if (isPropertyError(data, 'formId', 'zeebe:FormDefinition')) {
179
+ return [ 'formId' ];
180
+ }
181
+
162
182
  if (isPropertyError(data, 'body', 'zeebe:UserTaskForm')) {
163
183
  return [ 'formConfiguration' ];
164
184
  }
@@ -396,6 +416,14 @@ export function getErrorMessage(id, report) {
396
416
  return 'Form key must be defined.';
397
417
  }
398
418
 
419
+ if (id === 'formId') {
420
+ if (data.type === ERROR_TYPES.PROPERTY_REQUIRED) {
421
+ return 'Form ID must be defined.';
422
+ } else if (data.type === ERROR_TYPES.PROPERTY_NOT_ALLOWED) {
423
+ return 'Form ID not supported.';
424
+ }
425
+ }
426
+
399
427
  if (id === 'formConfiguration') {
400
428
  return 'Form JSON configuration must be defined.';
401
429
  }
@@ -425,7 +453,7 @@ export function getErrorMessage(id, report) {
425
453
 
426
454
  if (property === 'timeCycle') {
427
455
  if (!greaterOrEqual(executionPlatformVersion, '8.1')) {
428
- return 'Must be an expression, an ISO 8601 repeating interval, or a cron expression (cron only supported by Camunda Platform 8.1 or newer).';
456
+ return 'Must be an expression, an ISO 8601 repeating interval, or a cron expression (cron only supported by Camunda 8.1 or newer).';
429
457
  }
430
458
 
431
459
  return 'Must be an expression, an ISO 8601 repeating interval, or a cron expression.';
@@ -547,4 +575,8 @@ function isElementPropertyValueDuplicated(data, propertyName, type) {
547
575
 
548
576
  function getBusinessObject(element) {
549
577
  return element.businessObject || element;
578
+ }
579
+
580
+ function isEmptyString(value) {
581
+ return isString(value) && value.trim() === '';
550
582
  }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@camunda/linting",
3
- "version": "3.8.1",
4
- "description": "Linting for Camunda Platform",
3
+ "version": "3.10.0",
4
+ "description": "Linting for Camunda",
5
5
  "main": "index.js",
6
6
  "scripts": {
7
7
  "all": "npm run lint && npm test",
@@ -32,7 +32,7 @@
32
32
  "@bpmn-io/diagram-js-ui": "^0.2.2",
33
33
  "bpmn-moddle": "^8.0.0",
34
34
  "bpmnlint": "^9.2.0",
35
- "bpmnlint-plugin-camunda-compat": "^2.8.1",
35
+ "bpmnlint-plugin-camunda-compat": "^2.11.1",
36
36
  "bpmnlint-utils": "^1.0.2",
37
37
  "camunda-bpmn-moddle": "^7.0.1",
38
38
  "clsx": "^2.0.0",
@@ -45,8 +45,8 @@
45
45
  "devDependencies": {
46
46
  "bpmn-js": "^13.2.2",
47
47
  "bpmn-js-element-templates": "^1.3.0",
48
- "bpmn-js-properties-panel": "^5.0.0",
49
- "camunda-bpmn-js-behaviors": "^1.0.0",
48
+ "bpmn-js-properties-panel": "^5.6.1",
49
+ "camunda-bpmn-js-behaviors": "^1.2.2",
50
50
  "chai": "^4.3.7",
51
51
  "cross-env": "^7.0.3",
52
52
  "eslint": "^8.45.0",