@camunda/linting 0.15.1 → 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.
- package/lib/utils/error-messages.js +45 -10
- package/lib/utils/properties-panel.js +48 -0
- package/package.json +7 -4
|
@@ -96,7 +96,7 @@ export function getErrorMessage(report, executionPlatform, executionPlatformVers
|
|
|
96
96
|
}
|
|
97
97
|
|
|
98
98
|
if (type === ERROR_TYPES.PROPERTY_REQUIRED) {
|
|
99
|
-
return getPropertyRequiredErrorMessage(report);
|
|
99
|
+
return getPropertyRequiredErrorMessage(report, executionPlatform, executionPlatformVersion);
|
|
100
100
|
}
|
|
101
101
|
|
|
102
102
|
if (type === ERROR_TYPES.PROPERTY_VALUE_DUPLICATED) {
|
|
@@ -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
|
|
|
@@ -329,13 +333,14 @@ function getPropertyNotAllowedErrorMessage(report, executionPlatform, executionP
|
|
|
329
333
|
}
|
|
330
334
|
|
|
331
335
|
|
|
332
|
-
function getPropertyRequiredErrorMessage(report) {
|
|
336
|
+
function getPropertyRequiredErrorMessage(report, executionPlatform, executionPlatformVersion) {
|
|
333
337
|
const {
|
|
334
338
|
data,
|
|
335
339
|
message
|
|
336
340
|
} = report;
|
|
337
341
|
|
|
338
342
|
const {
|
|
343
|
+
allowedVersion,
|
|
339
344
|
node,
|
|
340
345
|
parentNode,
|
|
341
346
|
requiredProperty
|
|
@@ -368,7 +373,13 @@ function getPropertyRequiredErrorMessage(report) {
|
|
|
368
373
|
}
|
|
369
374
|
|
|
370
375
|
if (is(node, 'bpmn:Error') && requiredProperty === 'errorCode') {
|
|
371
|
-
|
|
376
|
+
|
|
377
|
+
if (parentNode && is(parentNode, 'bpmn:CatchEvent')) {
|
|
378
|
+
return getSupportedMessage(`${ getIndefiniteArticle(typeString) } <${ typeString }> without defined <Error code>`, executionPlatform, executionPlatformVersion, allowedVersion);
|
|
379
|
+
} else if (parentNode && is(parentNode, 'bpmn:ThrowEvent')) {
|
|
380
|
+
return `${ getIndefiniteArticle(typeString) } <${ typeString }> with <Error Reference> must have a defined <Error code>`;
|
|
381
|
+
}
|
|
382
|
+
|
|
372
383
|
}
|
|
373
384
|
|
|
374
385
|
if (is(node, 'bpmn:Escalation') && requiredProperty === 'escalationCode') {
|
|
@@ -392,7 +403,13 @@ function getPropertyRequiredErrorMessage(report) {
|
|
|
392
403
|
}
|
|
393
404
|
|
|
394
405
|
if (requiredProperty === 'errorRef') {
|
|
395
|
-
|
|
406
|
+
|
|
407
|
+
if (parentNode && is(parentNode, 'bpmn:CatchEvent')) {
|
|
408
|
+
return getSupportedMessage(`${ getIndefiniteArticle(typeString) } <${ typeString }> without defined <Error Reference>`, executionPlatform, executionPlatformVersion, allowedVersion);
|
|
409
|
+
} else if (parentNode && is(parentNode, 'bpmn:ThrowEvent')) {
|
|
410
|
+
return `${ getIndefiniteArticle(typeString) } <${ typeString }> must have a defined <Error Reference>`;
|
|
411
|
+
}
|
|
412
|
+
|
|
396
413
|
}
|
|
397
414
|
|
|
398
415
|
if (requiredProperty === 'messageRef') {
|
|
@@ -422,12 +439,17 @@ function getPropertyRequiredErrorMessage(report) {
|
|
|
422
439
|
return `${ getIndefiniteArticle(typeString) } <${ typeString }> must have a defined <Timer duration>`;
|
|
423
440
|
}
|
|
424
441
|
|
|
442
|
+
if (is(node, 'bpmn:Process') && requiredProperty === 'historyTimeToLive') {
|
|
443
|
+
return `${ getIndefiniteArticle(typeString) } <${ typeString }> must have a defined <History time to live>`;
|
|
444
|
+
}
|
|
445
|
+
|
|
425
446
|
return message;
|
|
426
447
|
}
|
|
427
448
|
|
|
428
449
|
function getExpressionRequiredErrorMessage(report) {
|
|
429
450
|
const {
|
|
430
|
-
data
|
|
451
|
+
data,
|
|
452
|
+
message
|
|
431
453
|
} = report;
|
|
432
454
|
|
|
433
455
|
const {
|
|
@@ -441,11 +463,14 @@ function getExpressionRequiredErrorMessage(report) {
|
|
|
441
463
|
if (is(node, 'bpmn:FormalExpression') && TIMER_PROPERTIES.includes(property)) {
|
|
442
464
|
return `${ getIndefiniteArticle(typeString) } <${ typeString }> must have a defined <Timer value>`;
|
|
443
465
|
}
|
|
466
|
+
|
|
467
|
+
return message;
|
|
444
468
|
}
|
|
445
469
|
|
|
446
470
|
function getExpressionValueNotAllowedErrorMessage(report) {
|
|
447
471
|
const {
|
|
448
|
-
data
|
|
472
|
+
data,
|
|
473
|
+
message
|
|
449
474
|
} = report;
|
|
450
475
|
|
|
451
476
|
const {
|
|
@@ -457,16 +482,26 @@ function getExpressionValueNotAllowedErrorMessage(report) {
|
|
|
457
482
|
const typeString = getTypeString(parentNode || node);
|
|
458
483
|
|
|
459
484
|
if (is(node, 'bpmn:FormalExpression') && property === 'timeCycle') {
|
|
460
|
-
return `${ getIndefiniteArticle(typeString) } <${ typeString }> <Time cycle>
|
|
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)`;
|
|
461
486
|
}
|
|
462
487
|
|
|
463
488
|
if (is(node, 'bpmn:FormalExpression') && property === 'timeDate') {
|
|
464
|
-
return `${ getIndefiniteArticle(typeString) } <${ typeString }> <Time date>
|
|
489
|
+
return `${ getIndefiniteArticle(typeString) } <${ typeString }> <Time date> must be an expression, or an ISO 8601 date`;
|
|
465
490
|
}
|
|
466
491
|
|
|
467
492
|
if (is(node, 'bpmn:FormalExpression') && property === 'timeDuration') {
|
|
468
|
-
return `${ getIndefiniteArticle(typeString) } <${ typeString }> <Time duration>
|
|
493
|
+
return `${ getIndefiniteArticle(typeString) } <${ typeString }> <Time duration> must be an expression, or an ISO 8601 interval`;
|
|
469
494
|
}
|
|
495
|
+
|
|
496
|
+
if (is(node, 'zeebe:TaskSchedule') && property === 'dueDate') {
|
|
497
|
+
return `${ getIndefiniteArticle(typeString) } <${ typeString }> <Due date> must be an ISO 8601 date`;
|
|
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;
|
|
470
505
|
}
|
|
471
506
|
|
|
472
507
|
function getSupportedMessage(prefix, executionPlatform, executionPlatformVersion, allowedVersion) {
|
|
@@ -495,4 +530,4 @@ function getExpressionNotAllowedErrorMessage(report) {
|
|
|
495
530
|
}
|
|
496
531
|
|
|
497
532
|
return report.message;
|
|
498
|
-
}
|
|
533
|
+
}
|
|
@@ -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.
|
|
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": "
|
|
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.
|
|
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.
|
|
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",
|