@camunda/linting 0.17.0 → 1.1.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.
@@ -43,7 +43,7 @@ export function getExecutionPlatformLabel(executionPlatform, executionPlatformVe
43
43
  return `${ executionPlatform } ${ toSemverMinor(executionPlatformVersion) }`;
44
44
  }
45
45
 
46
- function getIndefiniteArticle(type) {
46
+ function getIndefiniteArticle(type, uppercase = true) {
47
47
  if ([
48
48
  'Ad',
49
49
  'Error',
@@ -53,10 +53,10 @@ function getIndefiniteArticle(type) {
53
53
  'Intermediate',
54
54
  'Undefined'
55
55
  ].includes(type.split(' ')[ 0 ])) {
56
- return 'An';
56
+ return uppercase ? 'An' : 'an';
57
57
  }
58
58
 
59
- return 'A';
59
+ return uppercase ? 'A' : 'a';
60
60
  }
61
61
 
62
62
  export function getErrorMessage(report, executionPlatform, executionPlatformVersion, modeler = 'desktop') {
@@ -71,6 +71,10 @@ export function getErrorMessage(report, executionPlatform, executionPlatformVers
71
71
 
72
72
  const { type } = data;
73
73
 
74
+ if (type === ERROR_TYPES.CHILD_ELEMENT_TYPE_NOT_ALLOWED) {
75
+ return getChildElementTypeNotAllowedErrorMessage(report, executionPlatform, executionPlatformVersion);
76
+ }
77
+
74
78
  if (type === ERROR_TYPES.ELEMENT_COLLAPSED_NOT_ALLOWED) {
75
79
  return getElementCollapsedNotAllowedErrorMessage(report);
76
80
  }
@@ -87,8 +91,8 @@ export function getErrorMessage(report, executionPlatform, executionPlatformVers
87
91
  return getExtensionElementRequiredErrorMessage(report);
88
92
  }
89
93
 
90
- if (type === ERROR_TYPES.PROPERTY_DEPENDEND_REQUIRED) {
91
- return getPropertyDependendRequiredErrorMessage(report);
94
+ if (type === ERROR_TYPES.PROPERTY_DEPENDENT_REQUIRED) {
95
+ return getPropertyDependentRequiredErrorMessage(report);
92
96
  }
93
97
 
94
98
  if (type === ERROR_TYPES.PROPERTY_NOT_ALLOWED) {
@@ -122,6 +126,26 @@ export function getErrorMessage(report, executionPlatform, executionPlatformVers
122
126
  return message;
123
127
  }
124
128
 
129
+ function getChildElementTypeNotAllowedErrorMessage(report, executionPlatform, executionPlatformVersion) {
130
+ const { data } = report;
131
+
132
+ const {
133
+ allowedVersion,
134
+ node,
135
+ parent
136
+ } = data;
137
+
138
+ const typeString = getTypeString(node),
139
+ parentTypeString = getTypeString(parent);
140
+
141
+ return getSupportedMessage(
142
+ `${ getIndefiniteArticle(typeString) } <${ typeString }> in ${ getIndefiniteArticle(parentTypeString, false) } <${ parentTypeString }>`,
143
+ executionPlatform,
144
+ executionPlatformVersion,
145
+ allowedVersion
146
+ );
147
+ }
148
+
125
149
  function getElementCollapsedNotAllowedErrorMessage(report) {
126
150
  const {
127
151
  data,
@@ -272,7 +296,7 @@ function getExtensionElementRequiredErrorMessage(report) {
272
296
  return message;
273
297
  }
274
298
 
275
- function getPropertyDependendRequiredErrorMessage(report) {
299
+ function getPropertyDependentRequiredErrorMessage(report) {
276
300
  const {
277
301
  data,
278
302
  message
@@ -282,16 +306,16 @@ function getPropertyDependendRequiredErrorMessage(report) {
282
306
  node,
283
307
  parentNode,
284
308
  property,
285
- dependendRequiredProperty
309
+ dependentRequiredProperty
286
310
  } = data;
287
311
 
288
312
  const typeString = getTypeString(parentNode || node);
289
313
 
290
- if (is(node, 'zeebe:LoopCharacteristics') && property === 'outputCollection' && dependendRequiredProperty === 'outputElement') {
314
+ if (is(node, 'zeebe:LoopCharacteristics') && property === 'outputCollection' && dependentRequiredProperty === 'outputElement') {
291
315
  return `${ getIndefiniteArticle(typeString) } <${ typeString }> with <Multi-instance marker> and defined <Output collection> must have a defined <Output element>`;
292
316
  }
293
317
 
294
- if (is(node, 'zeebe:LoopCharacteristics') && property === 'outputElement' && dependendRequiredProperty === 'outputCollection') {
318
+ if (is(node, 'zeebe:LoopCharacteristics') && property === 'outputElement' && dependentRequiredProperty === 'outputCollection') {
295
319
  return `${ getIndefiniteArticle(typeString) } <${ typeString }> with <Multi-instance marker> and defined <Output element> must have a defined <Output collection>`;
296
320
  }
297
321
 
@@ -373,13 +397,7 @@ function getPropertyRequiredErrorMessage(report, executionPlatform, executionPla
373
397
  }
374
398
 
375
399
  if (is(node, 'bpmn:Error') && requiredProperty === 'errorCode') {
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
-
400
+ return `${ getIndefiniteArticle(typeString) } <${ typeString }> with <Error Reference> must have a defined <Error code>`;
383
401
  }
384
402
 
385
403
  if (is(node, 'bpmn:Escalation') && requiredProperty === 'escalationCode') {
@@ -394,6 +412,10 @@ function getPropertyRequiredErrorMessage(report, executionPlatform, executionPla
394
412
  return `${ getIndefiniteArticle(typeString) } <${ typeString }> with <Message Reference> must have a defined <Name>`;
395
413
  }
396
414
 
415
+ if (is(node, 'bpmn:Signal') && requiredProperty === 'name') {
416
+ return `${ getIndefiniteArticle(typeString) } <${ typeString }> with <Signal Reference> must have a defined <Name>`;
417
+ }
418
+
397
419
  if (is(node, 'zeebe:Subscription') && requiredProperty === 'correlationKey') {
398
420
  return `${ getIndefiniteArticle(typeString) } <${ typeString }> with <Message Reference> must have a defined <Subscription correlation key>`;
399
421
  }
@@ -416,6 +438,10 @@ function getPropertyRequiredErrorMessage(report, executionPlatform, executionPla
416
438
  return `${ getIndefiniteArticle(typeString) } <${ typeString }> must have a defined <Message Reference>`;
417
439
  }
418
440
 
441
+ if (requiredProperty === 'signalRef') {
442
+ return `${ getIndefiniteArticle(typeString) } <${ typeString }> must have a defined <Signal Reference>`;
443
+ }
444
+
419
445
  if (is(node, 'zeebe:FormDefinition') && requiredProperty === 'formKey') {
420
446
  return `${ getIndefiniteArticle(typeString) } <${ typeString }> with <Form type: Custom form key> must have a defined <Form key>`;
421
447
  }
@@ -76,6 +76,10 @@ export function getEntryIds(report) {
76
76
  return [ 'messageRef' ];
77
77
  }
78
78
 
79
+ if (isPropertyError(data, 'signalRef')) {
80
+ return [ 'signalRef' ];
81
+ }
82
+
79
83
  if (isPropertyError(data, 'decisionId', 'zeebe:CalledDecision')) {
80
84
  return [ 'decisionId' ];
81
85
  }
@@ -100,16 +104,20 @@ export function getEntryIds(report) {
100
104
  return [ 'messageName' ];
101
105
  }
102
106
 
107
+ if (isPropertyError(data, 'name', 'bpmn:Signal')) {
108
+ return [ 'signalName' ];
109
+ }
110
+
103
111
  if (isExtensionElementRequiredError(data, 'zeebe:LoopCharacteristics', 'bpmn:MultiInstanceLoopCharacteristics')
104
112
  || isPropertyError(data, 'inputCollection', 'zeebe:LoopCharacteristics')) {
105
113
  return [ 'multiInstance-inputCollection' ];
106
114
  }
107
115
 
108
- if (isPropertyDependendRequiredError(data, 'outputCollection', 'zeebe:LoopCharacteristics')) {
116
+ if (isPropertyDependentRequiredError(data, 'outputCollection', 'zeebe:LoopCharacteristics')) {
109
117
  return [ 'multiInstance-outputCollection' ];
110
118
  }
111
119
 
112
- if (isPropertyDependendRequiredError(data, 'outputElement', 'zeebe:LoopCharacteristics')) {
120
+ if (isPropertyDependentRequiredError(data, 'outputElement', 'zeebe:LoopCharacteristics')) {
113
121
  return [ 'multiInstance-outputElement' ];
114
122
  }
115
123
 
@@ -286,6 +294,10 @@ export function getErrorMessage(id, report) {
286
294
  return 'Global message reference must be defined.';
287
295
  }
288
296
 
297
+ if (id === 'signalRef') {
298
+ return 'Global signal reference must be defined.';
299
+ }
300
+
289
301
  if (id === 'decisionId') {
290
302
  return 'Decision ID must be defined.';
291
303
  }
@@ -310,6 +322,10 @@ export function getErrorMessage(id, report) {
310
322
  return 'Name must be defined.';
311
323
  }
312
324
 
325
+ if (id === 'signalName') {
326
+ return 'Name must be defined.';
327
+ }
328
+
313
329
  if (id === 'multiInstance-inputCollection') {
314
330
  return 'Input collection must be defined.';
315
331
  }
@@ -417,9 +433,9 @@ function isExtensionElementRequiredError(data, requiredExtensionElement, type) {
417
433
  && (!type || is(data.node, type));
418
434
  }
419
435
 
420
- function isPropertyDependendRequiredError(data, dependendRequiredProperty, type) {
421
- return data.type === ERROR_TYPES.PROPERTY_DEPENDEND_REQUIRED
422
- && data.dependendRequiredProperty === dependendRequiredProperty
436
+ function isPropertyDependentRequiredError(data, dependentRequiredProperty, type) {
437
+ return data.type === ERROR_TYPES.PROPERTY_DEPENDENT_REQUIRED
438
+ && data.dependentRequiredProperty === dependentRequiredProperty
423
439
  && (!type || is(data.node, type));
424
440
  }
425
441
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@camunda/linting",
3
- "version": "0.17.0",
3
+ "version": "1.1.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": "^0.24.0",
32
+ "bpmnlint-plugin-camunda-compat": "^1.1.0",
33
33
  "bpmnlint-utils": "^1.0.2",
34
34
  "min-dash": "^4.0.0",
35
35
  "min-dom": "^4.1.0",
@@ -37,7 +37,7 @@
37
37
  },
38
38
  "devDependencies": {
39
39
  "bpmn-js": "^11.1.1",
40
- "bpmn-js-properties-panel": "^1.15.1",
40
+ "bpmn-js-properties-panel": "^1.20.0",
41
41
  "camunda-bpmn-js-behaviors": "^0.5.0",
42
42
  "chai": "^4.3.7",
43
43
  "cross-env": "^7.0.3",