@camunda/linting 0.11.0 → 0.13.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.
@@ -1,6 +1,6 @@
1
1
  import { ERROR_TYPES } from 'bpmnlint-plugin-camunda-compat/rules/utils/element';
2
2
 
3
- import { is } from 'bpmnlint-utils';
3
+ import { is, isAny } from 'bpmnlint-utils';
4
4
 
5
5
  import {
6
6
  every,
@@ -216,6 +216,10 @@ function getExtensionElementNotAllowedErrorMessage(report, executionPlatform, ex
216
216
  return getSupportedMessage(`${ getIndefiniteArticle(typeString) } <${ typeString }> with <Extension properties>`, executionPlatform, executionPlatformVersion, allowedVersion);
217
217
  }
218
218
 
219
+ if (is(node, 'bpmn:ScriptTask') && is(extensionElement, 'zeebe:Script')) {
220
+ return getSupportedMessage('A <Script Task> with <Implementation: FEEL expression>', executionPlatform, executionPlatformVersion, allowedVersion);
221
+ }
222
+
219
223
  return message;
220
224
  }
221
225
 
@@ -253,6 +257,10 @@ function getExtensionElementRequiredErrorMessage(report) {
253
257
  return `${ getIndefiniteArticle(typeString) } <${ typeString }> must have a defined <Implementation>`;
254
258
  }
255
259
 
260
+ if (isArray(requiredExtensionElement) && requiredExtensionElement.includes('zeebe:Script')) {
261
+ return `${ getIndefiniteArticle(typeString) } <${ typeString }> must have a defined <Implementation>`;
262
+ }
263
+
256
264
  return message;
257
265
  }
258
266
 
@@ -335,8 +343,16 @@ function getPropertyRequiredErrorMessage(report) {
335
343
  return 'A <Business Rule Task> with <Implementation: DMN decision> must have a defined <Result variable>';
336
344
  }
337
345
 
338
- if (parentNode && is(parentNode, 'bpmn:BusinessRuleTask') && is(node, 'zeebe:TaskDefinition') && requiredProperty === 'type') {
339
- return 'A <Business Rule Task> with <Implementation: Job worker> must have a defined <Task definition type>';
346
+ if (parentNode && is(parentNode, 'bpmn:ScriptTask') && is(node, 'zeebe:Script') && requiredProperty === 'expression') {
347
+ return 'A <Script Task> with <Implementation: FEEL expression> must have a defined <FEEL expression>';
348
+ }
349
+
350
+ if (parentNode && is(parentNode, 'bpmn:ScriptTask') && is(node, 'zeebe:Script') && requiredProperty === 'resultVariable') {
351
+ return 'A <Script Task> with <Implementation: FEEL expression> must have a defined <Result variable>';
352
+ }
353
+
354
+ if (parentNode && isAny(parentNode, [ 'bpmn:BusinessRuleTask', 'bpmn:ScriptTask' ]) && is(node, 'zeebe:TaskDefinition') && requiredProperty === 'type') {
355
+ return `${ getIndefiniteArticle(typeString) } <${ typeString }> with <Implementation: Job worker> must have a defined <Task definition type>`;
340
356
  }
341
357
 
342
358
  if (is(node, 'zeebe:CalledElement') && requiredProperty === 'processId') {
@@ -59,6 +59,11 @@ export function getEntryIds(report) {
59
59
  return [ 'businessRuleImplementation' ];
60
60
  }
61
61
 
62
+ // script task
63
+ if (isExtensionElementRequiredError(data, 'zeebe:Script', 'bpmn:ScriptTask')) {
64
+ return [ 'scriptImplementation' ];
65
+ }
66
+
62
67
  if (isPropertyError(data, 'errorRef')) {
63
68
  return [ 'errorRef' ];
64
69
  }
@@ -71,10 +76,14 @@ export function getEntryIds(report) {
71
76
  return [ 'decisionId' ];
72
77
  }
73
78
 
74
- if (isPropertyError(data, 'resultVariable', 'zeebe:CalledDecision')) {
79
+ if (isPropertyError(data, 'resultVariable')) {
75
80
  return [ 'resultVariable' ];
76
81
  }
77
82
 
83
+ if (isPropertyError(data, 'expression', 'zeebe:Script')) {
84
+ return [ 'scriptExpression' ];
85
+ }
86
+
78
87
  if (isPropertyError(data, 'errorCode', 'bpmn:Error')) {
79
88
  return [ 'errorCode' ];
80
89
  }
@@ -207,6 +216,10 @@ export function getErrorMessage(id, report) {
207
216
  return;
208
217
  }
209
218
 
219
+ if (data.type === ERROR_TYPES.EXPRESSION_NOT_ALLOWED) {
220
+ return 'Cannot be an expression.';
221
+ }
222
+
210
223
  if (id === 'isExecutable') {
211
224
  const { parentNode } = data;
212
225
 
@@ -217,7 +230,7 @@ export function getErrorMessage(id, report) {
217
230
  }
218
231
  }
219
232
 
220
- if (id === 'businessRuleImplementation') {
233
+ if ([ 'businessRuleImplementation', 'scriptImplementation' ].includes(id)) {
221
234
  return 'Implementation must be defined.';
222
235
  }
223
236
 
@@ -233,11 +246,15 @@ export function getErrorMessage(id, report) {
233
246
  return 'Decision ID must be defined.';
234
247
  }
235
248
 
249
+ if (id === 'scriptExpression') {
250
+ return 'FEEL expression must be defined.';
251
+ }
252
+
236
253
  if (id === 'resultVariable') {
237
254
  return 'Result variable must be defined.';
238
255
  }
239
256
 
240
- if (id === 'errorCode') {
257
+ if (id === 'errorCode' && data.type === ERROR_TYPES.PROPERTY_REQUIRED) {
241
258
  return 'Code must be defined.';
242
259
  }
243
260
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@camunda/linting",
3
- "version": "0.11.0",
3
+ "version": "0.13.0",
4
4
  "description": "Linting for Camunda Platform",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -27,16 +27,15 @@
27
27
  "dependencies": {
28
28
  "bpmn-moddle": "^7.1.3",
29
29
  "bpmnlint": "^8.0.0",
30
- "bpmnlint-plugin-camunda-compat": "^0.16.0",
30
+ "bpmnlint-plugin-camunda-compat": "^0.18.0",
31
31
  "bpmnlint-utils": "^1.0.2",
32
32
  "min-dash": "^4.0.0",
33
33
  "min-dom": "^4.0.1",
34
- "zeebe-bpmn-moddle": "^0.15.0"
34
+ "zeebe-bpmn-moddle": "^0.17.0"
35
35
  },
36
36
  "devDependencies": {
37
- "@bpmn-io/properties-panel": "^0.23.0",
38
- "bpmn-js": "^9.4.0",
39
- "bpmn-js-properties-panel": "^1.10.0",
37
+ "bpmn-js": "^11.1.1",
38
+ "bpmn-js-properties-panel": "^1.15.0",
40
39
  "chai": "^4.3.6",
41
40
  "cross-env": "^7.0.3",
42
41
  "eslint": "^8.23.1",