@camunda/linting 0.16.0 → 0.17.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.
@@ -224,6 +224,10 @@ function getExtensionElementNotAllowedErrorMessage(report, executionPlatform, ex
224
224
  return getSupportedMessage('A <Script Task> with <Implementation: FEEL expression>', executionPlatform, executionPlatformVersion, allowedVersion);
225
225
  }
226
226
 
227
+ if (is(node, 'bpmn:UserTask') && is(extensionElement, 'zeebe:TaskSchedule')) {
228
+ return getSupportedMessage('A <User Task> with <Due date> or <Follow up date>', executionPlatform, executionPlatformVersion, allowedVersion);
229
+ }
230
+
227
231
  return message;
228
232
  }
229
233
 
@@ -435,12 +439,17 @@ function getPropertyRequiredErrorMessage(report, executionPlatform, executionPla
435
439
  return `${ getIndefiniteArticle(typeString) } <${ typeString }> must have a defined <Timer duration>`;
436
440
  }
437
441
 
442
+ if (is(node, 'bpmn:Process') && requiredProperty === 'historyTimeToLive') {
443
+ return `${ getIndefiniteArticle(typeString) } <${ typeString }> must have a defined <History time to live>`;
444
+ }
445
+
438
446
  return message;
439
447
  }
440
448
 
441
449
  function getExpressionRequiredErrorMessage(report) {
442
450
  const {
443
- data
451
+ data,
452
+ message
444
453
  } = report;
445
454
 
446
455
  const {
@@ -454,11 +463,14 @@ function getExpressionRequiredErrorMessage(report) {
454
463
  if (is(node, 'bpmn:FormalExpression') && TIMER_PROPERTIES.includes(property)) {
455
464
  return `${ getIndefiniteArticle(typeString) } <${ typeString }> must have a defined <Timer value>`;
456
465
  }
466
+
467
+ return message;
457
468
  }
458
469
 
459
470
  function getExpressionValueNotAllowedErrorMessage(report) {
460
471
  const {
461
- data
472
+ data,
473
+ message
462
474
  } = report;
463
475
 
464
476
  const {
@@ -470,16 +482,26 @@ function getExpressionValueNotAllowedErrorMessage(report) {
470
482
  const typeString = getTypeString(parentNode || node);
471
483
 
472
484
  if (is(node, 'bpmn:FormalExpression') && property === 'timeCycle') {
473
- return `${ getIndefiniteArticle(typeString) } <${ typeString }> <Time cycle> should be an expression, an ISO 8601 repeating interval, or a cron expression (cron requires Camunda Platform 8.1 or newer)`;
485
+ return `${ getIndefiniteArticle(typeString) } <${ typeString }> <Time cycle> must be an expression, an ISO 8601 repeating interval, or a cron expression (cron requires Camunda Platform 8.1 or newer)`;
474
486
  }
475
487
 
476
488
  if (is(node, 'bpmn:FormalExpression') && property === 'timeDate') {
477
- return `${ getIndefiniteArticle(typeString) } <${ typeString }> <Time date> should be an expression, or an ISO 8601 date`;
489
+ return `${ getIndefiniteArticle(typeString) } <${ typeString }> <Time date> must be an expression, or an ISO 8601 date`;
478
490
  }
479
491
 
480
492
  if (is(node, 'bpmn:FormalExpression') && property === 'timeDuration') {
481
- return `${ getIndefiniteArticle(typeString) } <${ typeString }> <Time duration> should be an expression, or an ISO 8601 interval`;
493
+ return `${ getIndefiniteArticle(typeString) } <${ typeString }> <Time duration> must be an expression, or an ISO 8601 interval`;
494
+ }
495
+
496
+ if (is(node, 'zeebe:TaskSchedule') && property === 'dueDate') {
497
+ return `${ getIndefiniteArticle(typeString) } <${ typeString }> <Due date> must be an ISO 8601 date`;
482
498
  }
499
+
500
+ if (is(node, 'zeebe:TaskSchedule') && property === 'followUpDate') {
501
+ return `${ getIndefiniteArticle(typeString) } <${ typeString }> <Follow up date> must be an ISO 8601 date`;
502
+ }
503
+
504
+ return message;
483
505
  }
484
506
 
485
507
  function getSupportedMessage(prefix, executionPlatform, executionPlatformVersion, allowedVersion) {
@@ -217,6 +217,34 @@ export function getEntryIds(report) {
217
217
  return [ 'assignmentDefinitionCandidateUsers' ];
218
218
  }
219
219
 
220
+ if (isPropertyError(data, 'historyTimeToLive', 'bpmn:Process')) {
221
+ return [ 'historyTimeToLive' ];
222
+ }
223
+
224
+ if (isExpressionValueNotAllowedError(data, 'dueDate', 'zeebe:TaskSchedule')) {
225
+ return [ 'taskScheduleDueDate' ];
226
+ }
227
+
228
+ if (isExpressionValueNotAllowedError(data, 'followUpDate', 'zeebe:TaskSchedule')) {
229
+ return [ 'taskScheduleFollowUpDate' ];
230
+ }
231
+
232
+ if (isExtensionElementNotAllowedError(data, 'zeebe:TaskSchedule', 'bpmn:UserTask')) {
233
+ const { extensionElement: taskSchedule } = data;
234
+
235
+ let ids = [];
236
+
237
+ if (taskSchedule.get('dueDate')) {
238
+ ids = [ ...ids, 'taskScheduleDueDate' ];
239
+ }
240
+
241
+ if (taskSchedule.get('followUpDate')) {
242
+ ids = [ ...ids, 'taskScheduleFollowUpDate' ];
243
+ }
244
+
245
+ return ids;
246
+ }
247
+
220
248
  return [];
221
249
  }
222
250
 
@@ -354,6 +382,26 @@ export function getErrorMessage(id, report) {
354
382
  if (id === 'assignmentDefinitionCandidateUsers') {
355
383
  return 'Not supported.';
356
384
  }
385
+
386
+ if (id === 'historyTimeToLive') {
387
+ return 'Time to live must be defined.';
388
+ }
389
+
390
+ if (id === 'taskScheduleDueDate') {
391
+ if (data.type === ERROR_TYPES.EXTENSION_ELEMENT_NOT_ALLOWED) {
392
+ return 'Not supported.';
393
+ } else {
394
+ return 'Must be an ISO 8601 date.';
395
+ }
396
+ }
397
+
398
+ if (id === 'taskScheduleFollowUpDate') {
399
+ if (data.type === ERROR_TYPES.EXTENSION_ELEMENT_NOT_ALLOWED) {
400
+ return 'Not supported.';
401
+ } else {
402
+ return 'Must be an ISO 8601 date.';
403
+ }
404
+ }
357
405
  }
358
406
 
359
407
  function isExtensionElementNotAllowedError(data, extensionElement, type) {
package/package.json CHANGED
@@ -1,13 +1,15 @@
1
1
  {
2
2
  "name": "@camunda/linting",
3
- "version": "0.16.0",
3
+ "version": "0.17.0",
4
4
  "description": "Linting for Camunda Platform",
5
5
  "main": "index.js",
6
6
  "scripts": {
7
7
  "all": "npm run lint && npm test",
8
8
  "dev": "npm run test:watch",
9
9
  "lint": "eslint .",
10
- "start": "cross-env SINGLE_START=modeler npm run test:watch",
10
+ "start": "npm run start:cloud",
11
+ "start:platform": "cross-env SINGLE_START=platform npm run test:watch",
12
+ "start:cloud": "cross-env SINGLE_START=cloud npm run test:watch",
11
13
  "test": "karma start",
12
14
  "test:watch": "npm test -- --auto-watch --no-single-run"
13
15
  },
@@ -27,15 +29,16 @@
27
29
  "dependencies": {
28
30
  "bpmn-moddle": "^8.0.0",
29
31
  "bpmnlint": "^8.0.0",
30
- "bpmnlint-plugin-camunda-compat": "^0.22.0",
32
+ "bpmnlint-plugin-camunda-compat": "^0.24.0",
31
33
  "bpmnlint-utils": "^1.0.2",
32
34
  "min-dash": "^4.0.0",
33
35
  "min-dom": "^4.1.0",
34
- "zeebe-bpmn-moddle": "^0.17.0"
36
+ "zeebe-bpmn-moddle": "^0.18.0"
35
37
  },
36
38
  "devDependencies": {
37
39
  "bpmn-js": "^11.1.1",
38
40
  "bpmn-js-properties-panel": "^1.15.1",
41
+ "camunda-bpmn-js-behaviors": "^0.5.0",
39
42
  "chai": "^4.3.7",
40
43
  "cross-env": "^7.0.3",
41
44
  "eslint": "^8.32.0",