@camunda/linting 1.2.1 → 2.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.
@@ -17,6 +17,12 @@ const TIMER_PROPERTIES = [
17
17
  'timeDuration'
18
18
  ];
19
19
 
20
+ const TIMER_PROPERTY_LABELS = {
21
+ timeCycle: 'Cycle',
22
+ timeDate: 'Date',
23
+ timeDuration: 'Duration'
24
+ };
25
+
20
26
  const executionPlatformLabels = {
21
27
  'Camunda Cloud': {
22
28
  'default': 'Camunda',
@@ -361,6 +367,10 @@ function getPropertyNotAllowedErrorMessage(report, executionPlatform, executionP
361
367
  return `${ getIndefiniteArticle(typeString) } <${ typeString }> with <Condition expression> is only supported if the source is an <Exclusive Gateway> or <Inclusive Gateway>`;
362
368
  }
363
369
 
370
+ if (is(node, 'bpmn:TimerEventDefinition') && TIMER_PROPERTIES.includes(property)) {
371
+ return getSupportedMessage(`${ getIndefiniteArticle(typeString) } <${ typeString }> with <${ TIMER_PROPERTY_LABELS[ property ] }>`, executionPlatform, executionPlatformVersion, allowedVersion);
372
+ }
373
+
364
374
  return message;
365
375
  }
366
376
 
@@ -469,10 +479,6 @@ function getPropertyRequiredErrorMessage(report, executionPlatform, executionPla
469
479
  return `${ getIndefiniteArticle(typeString) } <${ typeString }> must have a defined <Timer type>`;
470
480
  }
471
481
 
472
- if (is(node, 'bpmn:TimerEventDefinition') && requiredProperty === 'timeDuration') {
473
- return `${ getIndefiniteArticle(typeString) } <${ typeString }> must have a defined <Timer duration>`;
474
- }
475
-
476
482
  if (is(node, 'bpmn:Process') && requiredProperty === 'historyTimeToLive') {
477
483
  return `${ getIndefiniteArticle(typeString) } <${ typeString }> must have a defined <History time to live>`;
478
484
  }
@@ -48,9 +48,14 @@ export function getEntryIds(report) {
48
48
  const {
49
49
  data = {},
50
50
  id,
51
- path
51
+ path,
52
+ entryIds
52
53
  } = report;
53
54
 
55
+ if (entryIds) {
56
+ return entryIds;
57
+ }
58
+
54
59
  if (isPropertyError(data, 'isExecutable')) {
55
60
  return [ 'isExecutable' ];
56
61
  }
@@ -174,10 +179,6 @@ export function getEntryIds(report) {
174
179
  return [ 'conditionExpression' ];
175
180
  }
176
181
 
177
- if (isPropertyError(data, 'timeDuration', 'bpmn:TimerEventDefinition')) {
178
- return [ 'timerEventDefinitionDurationValue' ];
179
- }
180
-
181
182
  if (isPropertyError(data, 'completionCondition', 'bpmn:MultiInstanceLoopCharacteristics')) {
182
183
  return [ 'multiInstance-completionCondition' ];
183
184
  }
@@ -191,13 +192,19 @@ export function getEntryIds(report) {
191
192
  if (isExpressionRequiredError(data, 'timeCycle', 'bpmn:FormalExpression')
192
193
  || isExpressionRequiredError(data, 'timeDate', 'bpmn:FormalExpression')
193
194
  || isExpressionRequiredError(data, 'timeDuration', 'bpmn:FormalExpression')) {
194
- return hasOnlyDurationTimer(data.parentNode) ? [ 'timerEventDefinitionDurationValue' ] : [ 'timerEventDefinitionValue' ];
195
+ return [ 'timerEventDefinitionValue' ];
195
196
  }
196
197
 
197
198
  if (isExpressionValueNotAllowedError(data, 'timeCycle', 'bpmn:FormalExpression')
198
199
  || isExpressionValueNotAllowedError(data, 'timeDate', 'bpmn:FormalExpression')
199
200
  || isExpressionValueNotAllowedError(data, 'timeDuration', 'bpmn:FormalExpression')) {
200
- return hasOnlyDurationTimer(data.parentNode) ? [ 'timerEventDefinitionDurationValue' ] : [ 'timerEventDefinitionValue' ];
201
+ return [ 'timerEventDefinitionValue' ];
202
+ }
203
+
204
+ if (isPropertyError(data, 'timeCycle', 'bpmn:TimerEventDefinition')
205
+ || isPropertyError(data, 'timeDate', 'bpmn:TimerEventDefinition')
206
+ || isPropertyError(data, 'timeDuration', 'bpmn:TimerEventDefinition')) {
207
+ return [ 'timerEventDefinitionType' ];
201
208
  }
202
209
 
203
210
  const LIST_PROPERTIES = [
@@ -257,7 +264,7 @@ export function getEntryIds(report) {
257
264
  }
258
265
 
259
266
  export function getErrorMessage(id, report) {
260
- const { data } = report;
267
+ const { data = {} } = report;
261
268
 
262
269
  // do not override FEEL message
263
270
  if (data.type === ERROR_TYPES.FEEL_EXPRESSION_INVALID) {
@@ -342,7 +349,11 @@ export function getErrorMessage(id, report) {
342
349
  return 'Process ID must be defined.';
343
350
  }
344
351
 
345
- if (id === 'taskDefinitionType' || id === 'timerEventDefinitionType') {
352
+ if (id === 'taskDefinitionType') {
353
+ return 'Type must be defined.';
354
+ }
355
+
356
+ if (id === 'timerEventDefinitionType' && data.type === ERROR_TYPES.PROPERTY_REQUIRED) {
346
357
  return 'Type must be defined.';
347
358
  }
348
359
 
@@ -370,9 +381,8 @@ export function getErrorMessage(id, report) {
370
381
  return 'Condition expression must be defined.';
371
382
  }
372
383
 
373
- if (id === 'timerEventDefinitionDurationValue') {
374
- return data.type === ERROR_TYPES.EXPRESSION_REQUIRED ?
375
- 'Duration must be defined.' : 'Must be an expression, or an ISO 8601 interval.';
384
+ if (id === 'timerEventDefinitionType' && data.type === ERROR_TYPES.PROPERTY_NOT_ALLOWED) {
385
+ return 'Type not supported.';
376
386
  }
377
387
 
378
388
  if (id === 'timerEventDefinitionValue') {
@@ -482,12 +492,4 @@ function isExpressionValueNotAllowedError(data, propertyName, type) {
482
492
 
483
493
  function getBusinessObject(element) {
484
494
  return element.businessObject || element;
485
- }
486
-
487
- function hasOnlyDurationTimer(node) {
488
- return is(node, 'bpmn:IntermediateCatchEvent') || isInterruptingBoundaryEvent(node);
489
- }
490
-
491
- function isInterruptingBoundaryEvent(event) {
492
- return is(event, 'bpmn:BoundaryEvent') && event.get('cancelActivity') !== false;
493
- }
495
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@camunda/linting",
3
- "version": "1.2.1",
3
+ "version": "2.0.0",
4
4
  "description": "Linting for Camunda Platform",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -29,7 +29,7 @@
29
29
  "dependencies": {
30
30
  "bpmn-moddle": "^8.0.0",
31
31
  "bpmnlint": "^8.0.0",
32
- "bpmnlint-plugin-camunda-compat": "^1.2.0",
32
+ "bpmnlint-plugin-camunda-compat": "^1.3.2",
33
33
  "bpmnlint-utils": "^1.0.2",
34
34
  "min-dash": "^4.0.0",
35
35
  "min-dom": "^4.1.0",
@@ -38,8 +38,8 @@
38
38
  },
39
39
  "devDependencies": {
40
40
  "bpmn-js": "^11.1.1",
41
- "bpmn-js-properties-panel": "^1.20.0",
42
- "camunda-bpmn-js-behaviors": "^0.5.0",
41
+ "bpmn-js-properties-panel": "^2.0.0",
42
+ "camunda-bpmn-js-behaviors": "^0.6.0",
43
43
  "chai": "^4.3.7",
44
44
  "cross-env": "^7.0.3",
45
45
  "eslint": "^8.32.0",
@@ -59,7 +59,7 @@
59
59
  "webpack": "^5.75.0"
60
60
  },
61
61
  "peerDependencies": {
62
- "bpmn-js-properties-panel": ">= 1.10.0"
62
+ "bpmn-js-properties-panel": ">= 2.0.0"
63
63
  },
64
64
  "peerDependenciesMeta": {
65
65
  "bpmn-js-properties-panel": {