@camunda/linting 0.17.0 → 1.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.
@@ -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') {
@@ -105,11 +105,11 @@ export function getEntryIds(report) {
105
105
  return [ 'multiInstance-inputCollection' ];
106
106
  }
107
107
 
108
- if (isPropertyDependendRequiredError(data, 'outputCollection', 'zeebe:LoopCharacteristics')) {
108
+ if (isPropertyDependentRequiredError(data, 'outputCollection', 'zeebe:LoopCharacteristics')) {
109
109
  return [ 'multiInstance-outputCollection' ];
110
110
  }
111
111
 
112
- if (isPropertyDependendRequiredError(data, 'outputElement', 'zeebe:LoopCharacteristics')) {
112
+ if (isPropertyDependentRequiredError(data, 'outputElement', 'zeebe:LoopCharacteristics')) {
113
113
  return [ 'multiInstance-outputElement' ];
114
114
  }
115
115
 
@@ -417,9 +417,9 @@ function isExtensionElementRequiredError(data, requiredExtensionElement, type) {
417
417
  && (!type || is(data.node, type));
418
418
  }
419
419
 
420
- function isPropertyDependendRequiredError(data, dependendRequiredProperty, type) {
421
- return data.type === ERROR_TYPES.PROPERTY_DEPENDEND_REQUIRED
422
- && data.dependendRequiredProperty === dependendRequiredProperty
420
+ function isPropertyDependentRequiredError(data, dependentRequiredProperty, type) {
421
+ return data.type === ERROR_TYPES.PROPERTY_DEPENDENT_REQUIRED
422
+ && data.dependentRequiredProperty === dependentRequiredProperty
423
423
  && (!type || is(data.node, type));
424
424
  }
425
425
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@camunda/linting",
3
- "version": "0.17.0",
3
+ "version": "1.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": "^0.24.0",
32
+ "bpmnlint-plugin-camunda-compat": "^1.0.1",
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",