@camunda/linting 0.5.0 → 0.6.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/README.md +7 -5
- package/lib/utils/error-messages.js +11 -2
- package/lib/utils/properties-panel.js +8 -0
- package/package.json +6 -4
package/README.md
CHANGED
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
# @camunda/linting
|
|
2
2
|
|
|
3
|
+
[](https://github.com/camunda/linting/actions/workflows/CI.yml)
|
|
4
|
+
|
|
3
5
|
The BPMN linter used by the Camunda Desktop and Web Modeler. Batteries included. 🔋
|
|
4
6
|
|
|
5
|
-
|
|
7
|
+
## Features
|
|
6
8
|
|
|
7
9
|
* bundles [bpmnlint](https://github.com/bpmn-io/bpmnlint) and [bpmnlint-plugin-camunda-compat](https://github.com/camunda/bpmnlint-plugin-camunda-compat/)
|
|
8
10
|
* configures linter based on `modeler:executionPlatform` and `modeler:executionPlatformVersion`
|
|
@@ -10,7 +12,7 @@ The BPMN linter used by the Camunda Desktop and Web Modeler. Batteries included.
|
|
|
10
12
|
* creates errors to be shown in properties panel
|
|
11
13
|
* creates error overlays to be shown on canvas
|
|
12
14
|
|
|
13
|
-
|
|
15
|
+
## Usage
|
|
14
16
|
|
|
15
17
|
```javascript
|
|
16
18
|
import Modeler from 'bpmn-js/lib/Modeler';
|
|
@@ -47,7 +49,7 @@ modeler.get('linting').setErrors(reports);
|
|
|
47
49
|
modeler.get('linting').showError(report);
|
|
48
50
|
```
|
|
49
51
|
|
|
50
|
-
|
|
52
|
+
## Development
|
|
51
53
|
|
|
52
54
|
```sh
|
|
53
55
|
# install
|
|
@@ -63,6 +65,6 @@ npm run test:watch
|
|
|
63
65
|
npm start
|
|
64
66
|
```
|
|
65
67
|
|
|
66
|
-
|
|
68
|
+
## License
|
|
67
69
|
|
|
68
|
-
MIT
|
|
70
|
+
MIT
|
|
@@ -59,6 +59,7 @@ function getIndefiniteArticle(type) {
|
|
|
59
59
|
'Error',
|
|
60
60
|
'Escalation',
|
|
61
61
|
'Event',
|
|
62
|
+
'Inclusive',
|
|
62
63
|
'Intermediate',
|
|
63
64
|
'Undefined'
|
|
64
65
|
].includes(type.split(' ')[ 0 ])) {
|
|
@@ -200,9 +201,9 @@ function getPropertyNotAllowedErrorMessage(report, executionPlatformLabel, model
|
|
|
200
201
|
property
|
|
201
202
|
} = error;
|
|
202
203
|
|
|
203
|
-
|
|
204
|
-
const typeString = getTypeString(parentNode || node);
|
|
204
|
+
const typeString = getTypeString(parentNode || node);
|
|
205
205
|
|
|
206
|
+
if (property === 'modelerTemplate') {
|
|
206
207
|
if (modeler === 'desktop') {
|
|
207
208
|
return `${ getIndefiniteArticle(typeString) } <Template ${ typeString }> is not supported by ${ executionPlatformLabel }`;
|
|
208
209
|
} else if (modeler === 'web') {
|
|
@@ -210,6 +211,10 @@ function getPropertyNotAllowedErrorMessage(report, executionPlatformLabel, model
|
|
|
210
211
|
}
|
|
211
212
|
}
|
|
212
213
|
|
|
214
|
+
if (is(node, 'bpmn:InclusiveGateway') && property === 'incoming') {
|
|
215
|
+
return `${ getIndefiniteArticle(typeString) } <${ typeString }> with more than one incoming <Sequence Flow> is not supported by ${ executionPlatformLabel }`;
|
|
216
|
+
}
|
|
217
|
+
|
|
213
218
|
return message;
|
|
214
219
|
}
|
|
215
220
|
|
|
@@ -284,6 +289,10 @@ function getPropertyRequiredErrorMessage(report, executionPlatformLabel) {
|
|
|
284
289
|
return `${ getIndefiniteArticle(typeString) } <${ typeString }> with <Form type: Camunda forms> must have a defined <Form JSON configuration>`;
|
|
285
290
|
}
|
|
286
291
|
|
|
292
|
+
if (is(node, 'bpmn:SequenceFlow') && requiredProperty === 'conditionExpression') {
|
|
293
|
+
return `${ getIndefiniteArticle(typeString) } <${ typeString }> must have a defined <Condition expression> or be the default <Sequence Flow>`;
|
|
294
|
+
}
|
|
295
|
+
|
|
287
296
|
return message;
|
|
288
297
|
}
|
|
289
298
|
|
|
@@ -130,6 +130,10 @@ export function getEntryIds(report) {
|
|
|
130
130
|
});
|
|
131
131
|
}
|
|
132
132
|
|
|
133
|
+
if (isPropertyRequiredError(error, 'conditionExpression', 'bpmn:SequenceFlow')) {
|
|
134
|
+
return [ 'conditionExpression' ];
|
|
135
|
+
}
|
|
136
|
+
|
|
133
137
|
return [];
|
|
134
138
|
}
|
|
135
139
|
|
|
@@ -201,6 +205,10 @@ export function getErrorMessage(id) {
|
|
|
201
205
|
if (/^.+-extensionProperty-[0-9]+-name$/.test(id)) {
|
|
202
206
|
return 'Not supported.';
|
|
203
207
|
}
|
|
208
|
+
|
|
209
|
+
if (id === 'conditionExpression') {
|
|
210
|
+
return 'Condition expression must be defined.';
|
|
211
|
+
}
|
|
204
212
|
}
|
|
205
213
|
|
|
206
214
|
function isExtensionElementNotAllowedError(error, extensionElement, type) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@camunda/linting",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.6.0",
|
|
4
4
|
"description": "Linting for Camunda Platform",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"scripts": {
|
|
@@ -26,15 +26,16 @@
|
|
|
26
26
|
"dependencies": {
|
|
27
27
|
"bpmn-moddle": "^7.1.2",
|
|
28
28
|
"bpmnlint": "^7.8.0",
|
|
29
|
-
"bpmnlint-plugin-camunda-compat": "^0.
|
|
29
|
+
"bpmnlint-plugin-camunda-compat": "^0.12.0",
|
|
30
30
|
"bpmnlint-utils": "^1.0.2",
|
|
31
31
|
"min-dash": "^3.8.1",
|
|
32
32
|
"min-dom": "^3.2.1",
|
|
33
|
-
"
|
|
34
|
-
"zeebe-bpmn-moddle": "^0.14.0"
|
|
33
|
+
"zeebe-bpmn-moddle": "^0.15.0"
|
|
35
34
|
},
|
|
36
35
|
"devDependencies": {
|
|
36
|
+
"@bpmn-io/properties-panel": "^0.20.2",
|
|
37
37
|
"bpmn-js": "^9.4.0",
|
|
38
|
+
"bpmn-js-properties-panel": "^1.6.1",
|
|
38
39
|
"chai": "^4.3.6",
|
|
39
40
|
"cross-env": "^7.0.3",
|
|
40
41
|
"eslint": "^4.11.0",
|
|
@@ -48,6 +49,7 @@
|
|
|
48
49
|
"karma-webpack": "^5.0.0",
|
|
49
50
|
"mocha": "^4.0.1",
|
|
50
51
|
"mocha-test-container-support": "^0.2.0",
|
|
52
|
+
"modeler-moddle": "^0.2.0",
|
|
51
53
|
"puppeteer": "^16.2.0",
|
|
52
54
|
"sinon": "^14.0.0",
|
|
53
55
|
"sinon-chai": "^3.7.0",
|