@camunda/linting 3.27.1 → 3.27.2
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/LICENSE +21 -21
- package/README.md +75 -75
- package/assets/linting.css +37 -37
- package/lib/Resolver.js +31 -31
- package/lib/modeler/Linting.js +124 -124
- package/lib/modeler/LintingAnnotations.js +95 -95
- package/lib/modeler/OverlayComponent.js +60 -60
- package/lib/modeler/index.js +10 -10
- package/lib/plugins/bpmnLintPlugin.js +10 -10
- package/lib/plugins/index.js +4 -4
- package/lib/utils/documentation.js +36 -36
- package/lib/utils/types.js +46 -46
- package/lib/utils/version.js +8 -8
- package/package.json +85 -85
package/LICENSE
CHANGED
|
@@ -1,21 +1,21 @@
|
|
|
1
|
-
MIT License
|
|
2
|
-
|
|
3
|
-
Copyright (c) 2022-present Camunda Services GmbH
|
|
4
|
-
|
|
5
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
-
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
-
in the Software without restriction, including without limitation the rights
|
|
8
|
-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
-
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
-
furnished to do so, subject to the following conditions:
|
|
11
|
-
|
|
12
|
-
The above copyright notice and this permission notice shall be included in all
|
|
13
|
-
copies or substantial portions of the Software.
|
|
14
|
-
|
|
15
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
-
SOFTWARE.
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2022-present Camunda Services GmbH
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -1,75 +1,75 @@
|
|
|
1
|
-
# @camunda/linting
|
|
2
|
-
|
|
3
|
-
[](https://github.com/camunda/linting/actions/workflows/CI.yml)
|
|
4
|
-
|
|
5
|
-
The BPMN linter used by the Camunda Desktop and Web Modeler. Batteries included. 🔋
|
|
6
|
-
|
|
7
|
-
## Features
|
|
8
|
-
|
|
9
|
-
* bundles [bpmnlint](https://github.com/bpmn-io/bpmnlint) and [bpmnlint-plugin-camunda-compat](https://github.com/camunda/bpmnlint-plugin-camunda-compat/)
|
|
10
|
-
* configures linter based on `modeler:executionPlatform` and `modeler:executionPlatformVersion`
|
|
11
|
-
* creates error messages to be shown in desktop and web modeler
|
|
12
|
-
* creates errors to be shown in properties panel
|
|
13
|
-
* creates error overlays to be shown on canvas
|
|
14
|
-
|
|
15
|
-
## Usage
|
|
16
|
-
|
|
17
|
-
```javascript
|
|
18
|
-
import Modeler from 'bpmn-js/lib/Modeler';
|
|
19
|
-
|
|
20
|
-
import { Linter } from '@camunda/linting';
|
|
21
|
-
|
|
22
|
-
import lintingModule from '@camunda/linting/modeler';
|
|
23
|
-
|
|
24
|
-
import '@camunda/linting/assets/linting.css';
|
|
25
|
-
|
|
26
|
-
const modeler = new Modeler({
|
|
27
|
-
additionalModules: [
|
|
28
|
-
lintingModule
|
|
29
|
-
]
|
|
30
|
-
});
|
|
31
|
-
|
|
32
|
-
// configure to be used with desktop or web modeler
|
|
33
|
-
const linter = new Linter({
|
|
34
|
-
modeler: 'web', // `desktop` or `web` modeler, defaults to `desktop`
|
|
35
|
-
type: 'cloud' // `cloud` or `platform` diagrams, defaults to `cloud`
|
|
36
|
-
});
|
|
37
|
-
|
|
38
|
-
// lint by passing definitions
|
|
39
|
-
const reports = await linter.lint(definitions);
|
|
40
|
-
|
|
41
|
-
// or passing XML
|
|
42
|
-
const reports = await linter.lint(xml);
|
|
43
|
-
|
|
44
|
-
...
|
|
45
|
-
|
|
46
|
-
// update errors on canvas and in properties panel (requires bpmn-js-properties-panel >= 1.3.0)
|
|
47
|
-
modeler.get('linting').setErrors(reports);
|
|
48
|
-
|
|
49
|
-
// show error by selecting element and properties panel entry
|
|
50
|
-
modeler.get('linting').showError(report);
|
|
51
|
-
|
|
52
|
-
// activate and deactivate errors on canvas
|
|
53
|
-
modeler.get('linting').activate();
|
|
54
|
-
modeler.get('linting').deactivate();
|
|
55
|
-
```
|
|
56
|
-
|
|
57
|
-
## Development
|
|
58
|
-
|
|
59
|
-
```sh
|
|
60
|
-
# install
|
|
61
|
-
npm i
|
|
62
|
-
|
|
63
|
-
# run tests
|
|
64
|
-
npm t
|
|
65
|
-
|
|
66
|
-
# run tests in watch mode
|
|
67
|
-
npm run test:watch
|
|
68
|
-
|
|
69
|
-
# run example
|
|
70
|
-
npm start
|
|
71
|
-
```
|
|
72
|
-
|
|
73
|
-
## License
|
|
74
|
-
|
|
75
|
-
MIT
|
|
1
|
+
# @camunda/linting
|
|
2
|
+
|
|
3
|
+
[](https://github.com/camunda/linting/actions/workflows/CI.yml)
|
|
4
|
+
|
|
5
|
+
The BPMN linter used by the Camunda Desktop and Web Modeler. Batteries included. 🔋
|
|
6
|
+
|
|
7
|
+
## Features
|
|
8
|
+
|
|
9
|
+
* bundles [bpmnlint](https://github.com/bpmn-io/bpmnlint) and [bpmnlint-plugin-camunda-compat](https://github.com/camunda/bpmnlint-plugin-camunda-compat/)
|
|
10
|
+
* configures linter based on `modeler:executionPlatform` and `modeler:executionPlatformVersion`
|
|
11
|
+
* creates error messages to be shown in desktop and web modeler
|
|
12
|
+
* creates errors to be shown in properties panel
|
|
13
|
+
* creates error overlays to be shown on canvas
|
|
14
|
+
|
|
15
|
+
## Usage
|
|
16
|
+
|
|
17
|
+
```javascript
|
|
18
|
+
import Modeler from 'bpmn-js/lib/Modeler';
|
|
19
|
+
|
|
20
|
+
import { Linter } from '@camunda/linting';
|
|
21
|
+
|
|
22
|
+
import lintingModule from '@camunda/linting/modeler';
|
|
23
|
+
|
|
24
|
+
import '@camunda/linting/assets/linting.css';
|
|
25
|
+
|
|
26
|
+
const modeler = new Modeler({
|
|
27
|
+
additionalModules: [
|
|
28
|
+
lintingModule
|
|
29
|
+
]
|
|
30
|
+
});
|
|
31
|
+
|
|
32
|
+
// configure to be used with desktop or web modeler
|
|
33
|
+
const linter = new Linter({
|
|
34
|
+
modeler: 'web', // `desktop` or `web` modeler, defaults to `desktop`
|
|
35
|
+
type: 'cloud' // `cloud` or `platform` diagrams, defaults to `cloud`
|
|
36
|
+
});
|
|
37
|
+
|
|
38
|
+
// lint by passing definitions
|
|
39
|
+
const reports = await linter.lint(definitions);
|
|
40
|
+
|
|
41
|
+
// or passing XML
|
|
42
|
+
const reports = await linter.lint(xml);
|
|
43
|
+
|
|
44
|
+
...
|
|
45
|
+
|
|
46
|
+
// update errors on canvas and in properties panel (requires bpmn-js-properties-panel >= 1.3.0)
|
|
47
|
+
modeler.get('linting').setErrors(reports);
|
|
48
|
+
|
|
49
|
+
// show error by selecting element and properties panel entry
|
|
50
|
+
modeler.get('linting').showError(report);
|
|
51
|
+
|
|
52
|
+
// activate and deactivate errors on canvas
|
|
53
|
+
modeler.get('linting').activate();
|
|
54
|
+
modeler.get('linting').deactivate();
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
## Development
|
|
58
|
+
|
|
59
|
+
```sh
|
|
60
|
+
# install
|
|
61
|
+
npm i
|
|
62
|
+
|
|
63
|
+
# run tests
|
|
64
|
+
npm t
|
|
65
|
+
|
|
66
|
+
# run tests in watch mode
|
|
67
|
+
npm run test:watch
|
|
68
|
+
|
|
69
|
+
# run example
|
|
70
|
+
npm start
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
## License
|
|
74
|
+
|
|
75
|
+
MIT
|
package/assets/linting.css
CHANGED
|
@@ -1,38 +1,38 @@
|
|
|
1
|
-
:root {
|
|
2
|
-
--cl-color-white: hsl(0, 0%, 100%);
|
|
3
|
-
|
|
4
|
-
--cl-color-info: #0f62fe;
|
|
5
|
-
--cl-color-warning: #ff832b;
|
|
6
|
-
--cl-color-error: #da1e26;
|
|
7
|
-
--cl-color-success: #52b415;
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
.cl-icon, .cl-icon * {
|
|
11
|
-
box-sizing: border-box;
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
.cl-icon {
|
|
15
|
-
--icon-color: white;
|
|
16
|
-
--icon-bg-color: #333;
|
|
17
|
-
background: var(--icon-bg-color);
|
|
18
|
-
color: var(--icon-color);
|
|
19
|
-
border-radius: 100%;
|
|
20
|
-
height: 20px;
|
|
21
|
-
width: 20px;
|
|
22
|
-
border: solid 4px var(--icon-bg-color);
|
|
23
|
-
display: flex;
|
|
24
|
-
align-items: center;
|
|
25
|
-
justify-content: center;
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
.cl-icon-error {
|
|
29
|
-
--icon-bg-color: var(--cl-color-error);
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
.cl-icon-warn {
|
|
33
|
-
--icon-bg-color: var(--cl-color-warning);
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
.cl-icon-info {
|
|
37
|
-
--icon-bg-color: var(--cl-color-info);
|
|
1
|
+
:root {
|
|
2
|
+
--cl-color-white: hsl(0, 0%, 100%);
|
|
3
|
+
|
|
4
|
+
--cl-color-info: #0f62fe;
|
|
5
|
+
--cl-color-warning: #ff832b;
|
|
6
|
+
--cl-color-error: #da1e26;
|
|
7
|
+
--cl-color-success: #52b415;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
.cl-icon, .cl-icon * {
|
|
11
|
+
box-sizing: border-box;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
.cl-icon {
|
|
15
|
+
--icon-color: white;
|
|
16
|
+
--icon-bg-color: #333;
|
|
17
|
+
background: var(--icon-bg-color);
|
|
18
|
+
color: var(--icon-color);
|
|
19
|
+
border-radius: 100%;
|
|
20
|
+
height: 20px;
|
|
21
|
+
width: 20px;
|
|
22
|
+
border: solid 4px var(--icon-bg-color);
|
|
23
|
+
display: flex;
|
|
24
|
+
align-items: center;
|
|
25
|
+
justify-content: center;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
.cl-icon-error {
|
|
29
|
+
--icon-bg-color: var(--cl-color-error);
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
.cl-icon-warn {
|
|
33
|
+
--icon-bg-color: var(--cl-color-warning);
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
.cl-icon-info {
|
|
37
|
+
--icon-bg-color: var(--cl-color-info);
|
|
38
38
|
}
|
package/lib/Resolver.js
CHANGED
|
@@ -1,31 +1,31 @@
|
|
|
1
|
-
export default class NestedResolver {
|
|
2
|
-
constructor(resolvers) {
|
|
3
|
-
this.resolvers = resolvers.slice().reverse();
|
|
4
|
-
}
|
|
5
|
-
|
|
6
|
-
resolveRule(pkg, ruleName) {
|
|
7
|
-
for (const resolver of this.resolvers) {
|
|
8
|
-
try {
|
|
9
|
-
return resolver.resolveRule(pkg, ruleName);
|
|
10
|
-
} catch (err) {
|
|
11
|
-
|
|
12
|
-
// ignore
|
|
13
|
-
}
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
throw new Error(`unknown rule <${ pkg }/${ ruleName }>`);
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
resolveConfig(pkg, configName) {
|
|
20
|
-
for (const resolver of this.resolvers) {
|
|
21
|
-
try {
|
|
22
|
-
return resolver.resolveConfig(pkg, configName);
|
|
23
|
-
} catch (err) {
|
|
24
|
-
|
|
25
|
-
// ignore
|
|
26
|
-
}
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
throw new Error(`unknown config <${ pkg }/${ configName }>`);
|
|
30
|
-
}
|
|
31
|
-
}
|
|
1
|
+
export default class NestedResolver {
|
|
2
|
+
constructor(resolvers) {
|
|
3
|
+
this.resolvers = resolvers.slice().reverse();
|
|
4
|
+
}
|
|
5
|
+
|
|
6
|
+
resolveRule(pkg, ruleName) {
|
|
7
|
+
for (const resolver of this.resolvers) {
|
|
8
|
+
try {
|
|
9
|
+
return resolver.resolveRule(pkg, ruleName);
|
|
10
|
+
} catch (err) {
|
|
11
|
+
|
|
12
|
+
// ignore
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
throw new Error(`unknown rule <${ pkg }/${ ruleName }>`);
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
resolveConfig(pkg, configName) {
|
|
20
|
+
for (const resolver of this.resolvers) {
|
|
21
|
+
try {
|
|
22
|
+
return resolver.resolveConfig(pkg, configName);
|
|
23
|
+
} catch (err) {
|
|
24
|
+
|
|
25
|
+
// ignore
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
throw new Error(`unknown config <${ pkg }/${ configName }>`);
|
|
30
|
+
}
|
|
31
|
+
}
|
package/lib/modeler/Linting.js
CHANGED
|
@@ -1,124 +1,124 @@
|
|
|
1
|
-
import { getBusinessObject, is } from 'bpmn-js/lib/util/ModelUtil';
|
|
2
|
-
|
|
3
|
-
import { getErrors } from '../utils/properties-panel';
|
|
4
|
-
|
|
5
|
-
export default class Linting {
|
|
6
|
-
constructor(canvas, config, elementRegistry, eventBus, lintingAnnotations, selection) {
|
|
7
|
-
this._canvas = canvas;
|
|
8
|
-
this._elementRegistry = elementRegistry;
|
|
9
|
-
this._eventBus = eventBus;
|
|
10
|
-
this._lintingAnnotations = lintingAnnotations;
|
|
11
|
-
this._selection = selection;
|
|
12
|
-
|
|
13
|
-
this._active = config && config.active || false;
|
|
14
|
-
this._reports = [];
|
|
15
|
-
|
|
16
|
-
eventBus.on('selection.changed', () => this._update());
|
|
17
|
-
|
|
18
|
-
eventBus.on('lintingAnnotations.click', ({ report }) => this.showError(report));
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
showError(report) {
|
|
22
|
-
const {
|
|
23
|
-
id,
|
|
24
|
-
propertiesPanel = {}
|
|
25
|
-
} = report;
|
|
26
|
-
|
|
27
|
-
const selectableElement = this._getSelectableElement(id);
|
|
28
|
-
|
|
29
|
-
if (selectableElement) {
|
|
30
|
-
this._canvas.scrollToElement(selectableElement);
|
|
31
|
-
|
|
32
|
-
if (selectableElement === this._canvas.getRootElement()) {
|
|
33
|
-
this._selection.select();
|
|
34
|
-
} else {
|
|
35
|
-
this._selection.select(selectableElement);
|
|
36
|
-
}
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
const { entryIds = [] } = propertiesPanel;
|
|
40
|
-
|
|
41
|
-
// TODO(philippfromme): remove timeout once properties panel is fixed
|
|
42
|
-
setTimeout(() => {
|
|
43
|
-
this._eventBus.fire('propertiesPanel.showEntry', {
|
|
44
|
-
id: entryIds[ Math.max(0, entryIds.length - 1) ]
|
|
45
|
-
});
|
|
46
|
-
});
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
setErrors(reports) {
|
|
50
|
-
this._reports = reports;
|
|
51
|
-
|
|
52
|
-
this._update();
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
activate() {
|
|
56
|
-
this._active = true;
|
|
57
|
-
|
|
58
|
-
this._update();
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
deactivate() {
|
|
62
|
-
this._active = false;
|
|
63
|
-
|
|
64
|
-
this._update();
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
isActive() {
|
|
68
|
-
return this._active;
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
_update() {
|
|
72
|
-
|
|
73
|
-
// set annotations
|
|
74
|
-
this._lintingAnnotations.setErrors(this.isActive() ? this._reports : []);
|
|
75
|
-
|
|
76
|
-
// set properties panel errors
|
|
77
|
-
const selectedElement = this._getSelectedElement();
|
|
78
|
-
|
|
79
|
-
this._eventBus.fire('propertiesPanel.setErrors', {
|
|
80
|
-
errors: getErrors(this._reports, selectedElement)
|
|
81
|
-
});
|
|
82
|
-
}
|
|
83
|
-
|
|
84
|
-
_getSelectableElement(id) {
|
|
85
|
-
let element = this._elementRegistry.get(id);
|
|
86
|
-
|
|
87
|
-
if (!element) {
|
|
88
|
-
element = this._elementRegistry.filter(element => {
|
|
89
|
-
return is(element, 'bpmn:Participant') && getBusinessObject(element).get('processRef').get('id') === id;
|
|
90
|
-
})[ 0 ];
|
|
91
|
-
}
|
|
92
|
-
|
|
93
|
-
return element;
|
|
94
|
-
}
|
|
95
|
-
|
|
96
|
-
_getSelectedElement() {
|
|
97
|
-
const selection = this._selection.get();
|
|
98
|
-
|
|
99
|
-
if (!selection || !selection.length) {
|
|
100
|
-
return this._canvas.getRootElement();
|
|
101
|
-
}
|
|
102
|
-
|
|
103
|
-
const selectedElement = selection[ 0 ];
|
|
104
|
-
|
|
105
|
-
if (isLabel(selectedElement)) {
|
|
106
|
-
return selectedElement.labelTarget;
|
|
107
|
-
}
|
|
108
|
-
|
|
109
|
-
return selectedElement;
|
|
110
|
-
}
|
|
111
|
-
}
|
|
112
|
-
|
|
113
|
-
Linting.$inject = [
|
|
114
|
-
'canvas',
|
|
115
|
-
'config.linting',
|
|
116
|
-
'elementRegistry',
|
|
117
|
-
'eventBus',
|
|
118
|
-
'lintingAnnotations',
|
|
119
|
-
'selection'
|
|
120
|
-
];
|
|
121
|
-
|
|
122
|
-
function isLabel(element) {
|
|
123
|
-
return !!element.labelTarget;
|
|
124
|
-
}
|
|
1
|
+
import { getBusinessObject, is } from 'bpmn-js/lib/util/ModelUtil';
|
|
2
|
+
|
|
3
|
+
import { getErrors } from '../utils/properties-panel';
|
|
4
|
+
|
|
5
|
+
export default class Linting {
|
|
6
|
+
constructor(canvas, config, elementRegistry, eventBus, lintingAnnotations, selection) {
|
|
7
|
+
this._canvas = canvas;
|
|
8
|
+
this._elementRegistry = elementRegistry;
|
|
9
|
+
this._eventBus = eventBus;
|
|
10
|
+
this._lintingAnnotations = lintingAnnotations;
|
|
11
|
+
this._selection = selection;
|
|
12
|
+
|
|
13
|
+
this._active = config && config.active || false;
|
|
14
|
+
this._reports = [];
|
|
15
|
+
|
|
16
|
+
eventBus.on('selection.changed', () => this._update());
|
|
17
|
+
|
|
18
|
+
eventBus.on('lintingAnnotations.click', ({ report }) => this.showError(report));
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
showError(report) {
|
|
22
|
+
const {
|
|
23
|
+
id,
|
|
24
|
+
propertiesPanel = {}
|
|
25
|
+
} = report;
|
|
26
|
+
|
|
27
|
+
const selectableElement = this._getSelectableElement(id);
|
|
28
|
+
|
|
29
|
+
if (selectableElement) {
|
|
30
|
+
this._canvas.scrollToElement(selectableElement);
|
|
31
|
+
|
|
32
|
+
if (selectableElement === this._canvas.getRootElement()) {
|
|
33
|
+
this._selection.select();
|
|
34
|
+
} else {
|
|
35
|
+
this._selection.select(selectableElement);
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
const { entryIds = [] } = propertiesPanel;
|
|
40
|
+
|
|
41
|
+
// TODO(philippfromme): remove timeout once properties panel is fixed
|
|
42
|
+
setTimeout(() => {
|
|
43
|
+
this._eventBus.fire('propertiesPanel.showEntry', {
|
|
44
|
+
id: entryIds[ Math.max(0, entryIds.length - 1) ]
|
|
45
|
+
});
|
|
46
|
+
});
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
setErrors(reports) {
|
|
50
|
+
this._reports = reports;
|
|
51
|
+
|
|
52
|
+
this._update();
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
activate() {
|
|
56
|
+
this._active = true;
|
|
57
|
+
|
|
58
|
+
this._update();
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
deactivate() {
|
|
62
|
+
this._active = false;
|
|
63
|
+
|
|
64
|
+
this._update();
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
isActive() {
|
|
68
|
+
return this._active;
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
_update() {
|
|
72
|
+
|
|
73
|
+
// set annotations
|
|
74
|
+
this._lintingAnnotations.setErrors(this.isActive() ? this._reports : []);
|
|
75
|
+
|
|
76
|
+
// set properties panel errors
|
|
77
|
+
const selectedElement = this._getSelectedElement();
|
|
78
|
+
|
|
79
|
+
this._eventBus.fire('propertiesPanel.setErrors', {
|
|
80
|
+
errors: getErrors(this._reports, selectedElement)
|
|
81
|
+
});
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
_getSelectableElement(id) {
|
|
85
|
+
let element = this._elementRegistry.get(id);
|
|
86
|
+
|
|
87
|
+
if (!element) {
|
|
88
|
+
element = this._elementRegistry.filter(element => {
|
|
89
|
+
return is(element, 'bpmn:Participant') && getBusinessObject(element).get('processRef').get('id') === id;
|
|
90
|
+
})[ 0 ];
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
return element;
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
_getSelectedElement() {
|
|
97
|
+
const selection = this._selection.get();
|
|
98
|
+
|
|
99
|
+
if (!selection || !selection.length) {
|
|
100
|
+
return this._canvas.getRootElement();
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
const selectedElement = selection[ 0 ];
|
|
104
|
+
|
|
105
|
+
if (isLabel(selectedElement)) {
|
|
106
|
+
return selectedElement.labelTarget;
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
return selectedElement;
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
Linting.$inject = [
|
|
114
|
+
'canvas',
|
|
115
|
+
'config.linting',
|
|
116
|
+
'elementRegistry',
|
|
117
|
+
'eventBus',
|
|
118
|
+
'lintingAnnotations',
|
|
119
|
+
'selection'
|
|
120
|
+
];
|
|
121
|
+
|
|
122
|
+
function isLabel(element) {
|
|
123
|
+
return !!element.labelTarget;
|
|
124
|
+
}
|
|
@@ -1,96 +1,96 @@
|
|
|
1
|
-
import { groupBy } from 'min-dash';
|
|
2
|
-
|
|
3
|
-
import { domify } from 'min-dom';
|
|
4
|
-
|
|
5
|
-
import { renderOverlay } from './OverlayComponent';
|
|
6
|
-
import { is } from 'bpmn-js/lib/util/ModelUtil';
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
export default class LintingAnnotations {
|
|
10
|
-
constructor(canvas, elementRegistry, eventBus, overlays) {
|
|
11
|
-
this._canvas = canvas;
|
|
12
|
-
this._elementRegistry = elementRegistry;
|
|
13
|
-
this._eventBus = eventBus;
|
|
14
|
-
this._overlays = overlays;
|
|
15
|
-
|
|
16
|
-
this._reportsByElement = {};
|
|
17
|
-
|
|
18
|
-
this._overlayIds = {};
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
setErrors(reports) {
|
|
22
|
-
this._reportsByElement = groupBy(reports.filter(report => report.category !== 'rule-error'), 'id');
|
|
23
|
-
|
|
24
|
-
this._update();
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
_update(reportsByElement) {
|
|
28
|
-
if (!reportsByElement) {
|
|
29
|
-
reportsByElement = this._reportsByElement;
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
this._overlays.remove({ type: 'linting' });
|
|
33
|
-
|
|
34
|
-
Object.entries(reportsByElement).forEach(([ id, reports ]) => {
|
|
35
|
-
const element = this._elementRegistry.get(id);
|
|
36
|
-
|
|
37
|
-
if (!element || element === this._canvas.getRootElement()) {
|
|
38
|
-
return;
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
const html = domify(`
|
|
42
|
-
<div class="cl-overlay-root"></div>
|
|
43
|
-
`);
|
|
44
|
-
|
|
45
|
-
renderOverlay(html, {
|
|
46
|
-
reports,
|
|
47
|
-
onClick: () => {
|
|
48
|
-
this._eventBus.fire('lintingAnnotations.click', { report: reports[ 0 ] });
|
|
49
|
-
}
|
|
50
|
-
});
|
|
51
|
-
|
|
52
|
-
const position = getAnnotationPosition(element);
|
|
53
|
-
|
|
54
|
-
const overlayId = this._overlays.add(element, 'linting', {
|
|
55
|
-
position,
|
|
56
|
-
html,
|
|
57
|
-
scale: {
|
|
58
|
-
min: .7
|
|
59
|
-
}
|
|
60
|
-
});
|
|
61
|
-
|
|
62
|
-
this._overlayIds[ id ] = overlayId;
|
|
63
|
-
});
|
|
64
|
-
}
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
LintingAnnotations.$inject = [
|
|
68
|
-
'canvas',
|
|
69
|
-
'elementRegistry',
|
|
70
|
-
'eventBus',
|
|
71
|
-
'overlays'
|
|
72
|
-
];
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
function getAnnotationPosition(element) {
|
|
76
|
-
|
|
77
|
-
if (!element.parent) {
|
|
78
|
-
|
|
79
|
-
if (is(element, 'bpmn:SubProcess')) {
|
|
80
|
-
return {
|
|
81
|
-
top: 50,
|
|
82
|
-
left: 150
|
|
83
|
-
};
|
|
84
|
-
}
|
|
85
|
-
|
|
86
|
-
return {
|
|
87
|
-
top: 20,
|
|
88
|
-
left: 150
|
|
89
|
-
};
|
|
90
|
-
}
|
|
91
|
-
|
|
92
|
-
return {
|
|
93
|
-
bottom: 14,
|
|
94
|
-
left: -6
|
|
95
|
-
};
|
|
1
|
+
import { groupBy } from 'min-dash';
|
|
2
|
+
|
|
3
|
+
import { domify } from 'min-dom';
|
|
4
|
+
|
|
5
|
+
import { renderOverlay } from './OverlayComponent';
|
|
6
|
+
import { is } from 'bpmn-js/lib/util/ModelUtil';
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
export default class LintingAnnotations {
|
|
10
|
+
constructor(canvas, elementRegistry, eventBus, overlays) {
|
|
11
|
+
this._canvas = canvas;
|
|
12
|
+
this._elementRegistry = elementRegistry;
|
|
13
|
+
this._eventBus = eventBus;
|
|
14
|
+
this._overlays = overlays;
|
|
15
|
+
|
|
16
|
+
this._reportsByElement = {};
|
|
17
|
+
|
|
18
|
+
this._overlayIds = {};
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
setErrors(reports) {
|
|
22
|
+
this._reportsByElement = groupBy(reports.filter(report => report.category !== 'rule-error'), 'id');
|
|
23
|
+
|
|
24
|
+
this._update();
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
_update(reportsByElement) {
|
|
28
|
+
if (!reportsByElement) {
|
|
29
|
+
reportsByElement = this._reportsByElement;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
this._overlays.remove({ type: 'linting' });
|
|
33
|
+
|
|
34
|
+
Object.entries(reportsByElement).forEach(([ id, reports ]) => {
|
|
35
|
+
const element = this._elementRegistry.get(id);
|
|
36
|
+
|
|
37
|
+
if (!element || element === this._canvas.getRootElement()) {
|
|
38
|
+
return;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
const html = domify(`
|
|
42
|
+
<div class="cl-overlay-root"></div>
|
|
43
|
+
`);
|
|
44
|
+
|
|
45
|
+
renderOverlay(html, {
|
|
46
|
+
reports,
|
|
47
|
+
onClick: () => {
|
|
48
|
+
this._eventBus.fire('lintingAnnotations.click', { report: reports[ 0 ] });
|
|
49
|
+
}
|
|
50
|
+
});
|
|
51
|
+
|
|
52
|
+
const position = getAnnotationPosition(element);
|
|
53
|
+
|
|
54
|
+
const overlayId = this._overlays.add(element, 'linting', {
|
|
55
|
+
position,
|
|
56
|
+
html,
|
|
57
|
+
scale: {
|
|
58
|
+
min: .7
|
|
59
|
+
}
|
|
60
|
+
});
|
|
61
|
+
|
|
62
|
+
this._overlayIds[ id ] = overlayId;
|
|
63
|
+
});
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
LintingAnnotations.$inject = [
|
|
68
|
+
'canvas',
|
|
69
|
+
'elementRegistry',
|
|
70
|
+
'eventBus',
|
|
71
|
+
'overlays'
|
|
72
|
+
];
|
|
73
|
+
|
|
74
|
+
|
|
75
|
+
function getAnnotationPosition(element) {
|
|
76
|
+
|
|
77
|
+
if (!element.parent) {
|
|
78
|
+
|
|
79
|
+
if (is(element, 'bpmn:SubProcess')) {
|
|
80
|
+
return {
|
|
81
|
+
top: 50,
|
|
82
|
+
left: 150
|
|
83
|
+
};
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
return {
|
|
87
|
+
top: 20,
|
|
88
|
+
left: 150
|
|
89
|
+
};
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
return {
|
|
93
|
+
bottom: 14,
|
|
94
|
+
left: -6
|
|
95
|
+
};
|
|
96
96
|
}
|
|
@@ -1,61 +1,61 @@
|
|
|
1
|
-
import {
|
|
2
|
-
render as renderComponent,
|
|
3
|
-
html
|
|
4
|
-
} from '@bpmn-io/diagram-js-ui';
|
|
5
|
-
|
|
6
|
-
import classNames from 'clsx';
|
|
7
|
-
|
|
8
|
-
const errorSvg = html`
|
|
9
|
-
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 32 32">
|
|
10
|
-
<path d="M16,2C8.3,2,2,8.3,2,16s6.3,14,14,14s14-6.3,14-14S23.7,2,16,2z M21.4,23L16,17.6L10.6,23L9,21.4l5.4-5.4L9,10.6L10.6,9
|
|
11
|
-
l5.4,5.4L21.4,9l1.6,1.6L17.6,16l5.4,5.4L21.4,23z" fill="currentColor" />
|
|
12
|
-
</svg>
|
|
13
|
-
`;
|
|
14
|
-
|
|
15
|
-
const warningSvg = html`
|
|
16
|
-
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 32 32">
|
|
17
|
-
<path d="M16,2C8.3,2,2,8.3,2,16s6.3,14,14,14s14-6.3,14-14C30,8.3,23.7,2,16,2z M14.9,8h2.2v11h-2.2V8z M16,25
|
|
18
|
-
c-0.8,0-1.5-0.7-1.5-1.5S15.2,22,16,22c0.8,0,1.5,0.7,1.5,1.5S16.8,25,16,25z" fill="currentColor" />
|
|
19
|
-
</svg>
|
|
20
|
-
`;
|
|
21
|
-
|
|
22
|
-
const infoSvg = html`
|
|
23
|
-
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 32 32">
|
|
24
|
-
<path d="M16,2A14,14,0,1,0,30,16,14,14,0,0,0,16,2Zm0,6a1.5,1.5,0,1,1-1.5,1.5A1.5,1.5,0,0,1,16,8Zm4,16.125H12v-2.25h2.875v-5.75H13v-2.25h4.125v8H20Z" fill="currentColor" />
|
|
25
|
-
</svg>
|
|
26
|
-
`;
|
|
27
|
-
|
|
28
|
-
const icons = {
|
|
29
|
-
error: errorSvg,
|
|
30
|
-
warn: warningSvg,
|
|
31
|
-
info: infoSvg
|
|
32
|
-
};
|
|
33
|
-
|
|
34
|
-
export function OverlayComponent(props) {
|
|
35
|
-
|
|
36
|
-
const {
|
|
37
|
-
onClick = () => {},
|
|
38
|
-
reports
|
|
39
|
-
} = props;
|
|
40
|
-
|
|
41
|
-
const category =
|
|
42
|
-
reports.find(({ category }) => category === 'error')
|
|
43
|
-
? 'error'
|
|
44
|
-
: reports.find(({ category }) => category === 'warn')
|
|
45
|
-
? 'warn'
|
|
46
|
-
: 'info';
|
|
47
|
-
|
|
48
|
-
return html`
|
|
49
|
-
<div
|
|
50
|
-
class=${ classNames('cl-icon',`cl-icon-${category}`) }
|
|
51
|
-
onClick=${ onClick }
|
|
52
|
-
title="Click to show issue"
|
|
53
|
-
>
|
|
54
|
-
${ icons[category] }
|
|
55
|
-
</div>
|
|
56
|
-
`;
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
export function renderOverlay(el, props) {
|
|
60
|
-
return renderComponent(html`<${OverlayComponent} ...${props} />`, el);
|
|
1
|
+
import {
|
|
2
|
+
render as renderComponent,
|
|
3
|
+
html
|
|
4
|
+
} from '@bpmn-io/diagram-js-ui';
|
|
5
|
+
|
|
6
|
+
import classNames from 'clsx';
|
|
7
|
+
|
|
8
|
+
const errorSvg = html`
|
|
9
|
+
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 32 32">
|
|
10
|
+
<path d="M16,2C8.3,2,2,8.3,2,16s6.3,14,14,14s14-6.3,14-14S23.7,2,16,2z M21.4,23L16,17.6L10.6,23L9,21.4l5.4-5.4L9,10.6L10.6,9
|
|
11
|
+
l5.4,5.4L21.4,9l1.6,1.6L17.6,16l5.4,5.4L21.4,23z" fill="currentColor" />
|
|
12
|
+
</svg>
|
|
13
|
+
`;
|
|
14
|
+
|
|
15
|
+
const warningSvg = html`
|
|
16
|
+
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 32 32">
|
|
17
|
+
<path d="M16,2C8.3,2,2,8.3,2,16s6.3,14,14,14s14-6.3,14-14C30,8.3,23.7,2,16,2z M14.9,8h2.2v11h-2.2V8z M16,25
|
|
18
|
+
c-0.8,0-1.5-0.7-1.5-1.5S15.2,22,16,22c0.8,0,1.5,0.7,1.5,1.5S16.8,25,16,25z" fill="currentColor" />
|
|
19
|
+
</svg>
|
|
20
|
+
`;
|
|
21
|
+
|
|
22
|
+
const infoSvg = html`
|
|
23
|
+
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 32 32">
|
|
24
|
+
<path d="M16,2A14,14,0,1,0,30,16,14,14,0,0,0,16,2Zm0,6a1.5,1.5,0,1,1-1.5,1.5A1.5,1.5,0,0,1,16,8Zm4,16.125H12v-2.25h2.875v-5.75H13v-2.25h4.125v8H20Z" fill="currentColor" />
|
|
25
|
+
</svg>
|
|
26
|
+
`;
|
|
27
|
+
|
|
28
|
+
const icons = {
|
|
29
|
+
error: errorSvg,
|
|
30
|
+
warn: warningSvg,
|
|
31
|
+
info: infoSvg
|
|
32
|
+
};
|
|
33
|
+
|
|
34
|
+
export function OverlayComponent(props) {
|
|
35
|
+
|
|
36
|
+
const {
|
|
37
|
+
onClick = () => {},
|
|
38
|
+
reports
|
|
39
|
+
} = props;
|
|
40
|
+
|
|
41
|
+
const category =
|
|
42
|
+
reports.find(({ category }) => category === 'error')
|
|
43
|
+
? 'error'
|
|
44
|
+
: reports.find(({ category }) => category === 'warn')
|
|
45
|
+
? 'warn'
|
|
46
|
+
: 'info';
|
|
47
|
+
|
|
48
|
+
return html`
|
|
49
|
+
<div
|
|
50
|
+
class=${ classNames('cl-icon',`cl-icon-${category}`) }
|
|
51
|
+
onClick=${ onClick }
|
|
52
|
+
title="Click to show issue"
|
|
53
|
+
>
|
|
54
|
+
${ icons[category] }
|
|
55
|
+
</div>
|
|
56
|
+
`;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
export function renderOverlay(el, props) {
|
|
60
|
+
return renderComponent(html`<${OverlayComponent} ...${props} />`, el);
|
|
61
61
|
}
|
package/lib/modeler/index.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import Linting from './Linting';
|
|
2
|
-
import LintingAnnotations from './LintingAnnotations';
|
|
3
|
-
|
|
4
|
-
export default {
|
|
5
|
-
__init__: [
|
|
6
|
-
'linting',
|
|
7
|
-
'lintingAnnotations'
|
|
8
|
-
],
|
|
9
|
-
linting: [ 'type', Linting ],
|
|
10
|
-
lintingAnnotations: [ 'type', LintingAnnotations ]
|
|
1
|
+
import Linting from './Linting';
|
|
2
|
+
import LintingAnnotations from './LintingAnnotations';
|
|
3
|
+
|
|
4
|
+
export default {
|
|
5
|
+
__init__: [
|
|
6
|
+
'linting',
|
|
7
|
+
'lintingAnnotations'
|
|
8
|
+
],
|
|
9
|
+
linting: [ 'type', Linting ],
|
|
10
|
+
lintingAnnotations: [ 'type', LintingAnnotations ]
|
|
11
11
|
};
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import StaticResolver from 'bpmnlint/lib/resolver/static-resolver';
|
|
2
|
-
import rule from 'bpmnlint/rules/no-bpmndi';
|
|
3
|
-
|
|
4
|
-
export default {
|
|
5
|
-
config: {
|
|
6
|
-
rules: {
|
|
7
|
-
'bpmnlint/no-bpmndi': 'warn'
|
|
8
|
-
}
|
|
9
|
-
},
|
|
10
|
-
resolver: new StaticResolver({ 'rule:bpmnlint/no-bpmndi': rule })
|
|
1
|
+
import StaticResolver from 'bpmnlint/lib/resolver/static-resolver';
|
|
2
|
+
import rule from 'bpmnlint/rules/no-bpmndi';
|
|
3
|
+
|
|
4
|
+
export default {
|
|
5
|
+
config: {
|
|
6
|
+
rules: {
|
|
7
|
+
'bpmnlint/no-bpmndi': 'warn'
|
|
8
|
+
}
|
|
9
|
+
},
|
|
10
|
+
resolver: new StaticResolver({ 'rule:bpmnlint/no-bpmndi': rule })
|
|
11
11
|
};
|
package/lib/plugins/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import bpmnLintPlugin from './bpmnLintPlugin';
|
|
2
|
-
|
|
3
|
-
export default [
|
|
4
|
-
bpmnLintPlugin
|
|
1
|
+
import bpmnLintPlugin from './bpmnLintPlugin';
|
|
2
|
+
|
|
3
|
+
export default [
|
|
4
|
+
bpmnLintPlugin
|
|
5
5
|
];
|
|
@@ -1,37 +1,37 @@
|
|
|
1
|
-
const baseUrl = 'https://docs.camunda.io/docs/next/components/modeler/reference/modeling-guidance/rules';
|
|
2
|
-
|
|
3
|
-
export function getDocumentationUrl(rule) {
|
|
4
|
-
if (rule === 'camunda-compat/called-element') {
|
|
5
|
-
return getUrl('called-element');
|
|
6
|
-
}
|
|
7
|
-
|
|
8
|
-
if (rule === 'camunda-compat/element-type') {
|
|
9
|
-
return getUrl('element-type');
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
if (rule === 'camunda-compat/error-reference') {
|
|
13
|
-
return getUrl('error-reference');
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
if (rule === 'camunda-compat/escalation-reference') {
|
|
17
|
-
return getUrl('escalation-reference');
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
if (rule === 'camunda-compat/feel') {
|
|
21
|
-
return getUrl('feel');
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
if (rule === 'camunda-compat/message-reference') {
|
|
25
|
-
return getUrl('message-reference');
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
if (rule === 'camunda-compat/history-time-to-live') {
|
|
29
|
-
return getUrl('history-time-to-live');
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
return null;
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
function getUrl(rule) {
|
|
36
|
-
return `${ baseUrl }/${ rule }`;
|
|
1
|
+
const baseUrl = 'https://docs.camunda.io/docs/next/components/modeler/reference/modeling-guidance/rules';
|
|
2
|
+
|
|
3
|
+
export function getDocumentationUrl(rule) {
|
|
4
|
+
if (rule === 'camunda-compat/called-element') {
|
|
5
|
+
return getUrl('called-element');
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
if (rule === 'camunda-compat/element-type') {
|
|
9
|
+
return getUrl('element-type');
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
if (rule === 'camunda-compat/error-reference') {
|
|
13
|
+
return getUrl('error-reference');
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
if (rule === 'camunda-compat/escalation-reference') {
|
|
17
|
+
return getUrl('escalation-reference');
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
if (rule === 'camunda-compat/feel') {
|
|
21
|
+
return getUrl('feel');
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
if (rule === 'camunda-compat/message-reference') {
|
|
25
|
+
return getUrl('message-reference');
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
if (rule === 'camunda-compat/history-time-to-live') {
|
|
29
|
+
return getUrl('history-time-to-live');
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
return null;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
function getUrl(rule) {
|
|
36
|
+
return `${ baseUrl }/${ rule }`;
|
|
37
37
|
}
|
package/lib/utils/types.js
CHANGED
|
@@ -1,47 +1,47 @@
|
|
|
1
|
-
function getEventDefinition(node) {
|
|
2
|
-
const eventDefinitions = node.get('eventDefinitions');
|
|
3
|
-
|
|
4
|
-
return eventDefinitions && eventDefinitions[ 0 ];
|
|
5
|
-
}
|
|
6
|
-
|
|
7
|
-
function getEventDefinitionPrefix(eventDefinition) {
|
|
8
|
-
const localType = getLocalType(eventDefinition);
|
|
9
|
-
|
|
10
|
-
return localType.replace('EventDefinition', '');
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
function getLocalType(node) {
|
|
14
|
-
const { $descriptor } = node;
|
|
15
|
-
|
|
16
|
-
const { localName } = $descriptor.ns;
|
|
17
|
-
|
|
18
|
-
return localName;
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
function formatTypeString(string) {
|
|
22
|
-
return string.replace(/([a-z])([A-Z])/g, '$1 $2').trim();
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
export function getTypeString(node) {
|
|
26
|
-
let type = getLocalType(node);
|
|
27
|
-
|
|
28
|
-
const eventDefinition = getEventDefinition(node);
|
|
29
|
-
|
|
30
|
-
if (eventDefinition) {
|
|
31
|
-
type = `${ getEventDefinitionPrefix(eventDefinition) }${ type }`;
|
|
32
|
-
} else if ([
|
|
33
|
-
'BoundaryEvent',
|
|
34
|
-
'EndEvent',
|
|
35
|
-
'IntermediateCatchEvent',
|
|
36
|
-
'IntermediateThrowEvent',
|
|
37
|
-
'StartEvent'
|
|
38
|
-
].includes(type)) {
|
|
39
|
-
type = `Undefined ${ type }`;
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
if (type === 'Task') {
|
|
43
|
-
type = 'Undefined Task';
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
return formatTypeString(type);
|
|
1
|
+
function getEventDefinition(node) {
|
|
2
|
+
const eventDefinitions = node.get('eventDefinitions');
|
|
3
|
+
|
|
4
|
+
return eventDefinitions && eventDefinitions[ 0 ];
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
function getEventDefinitionPrefix(eventDefinition) {
|
|
8
|
+
const localType = getLocalType(eventDefinition);
|
|
9
|
+
|
|
10
|
+
return localType.replace('EventDefinition', '');
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
function getLocalType(node) {
|
|
14
|
+
const { $descriptor } = node;
|
|
15
|
+
|
|
16
|
+
const { localName } = $descriptor.ns;
|
|
17
|
+
|
|
18
|
+
return localName;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
function formatTypeString(string) {
|
|
22
|
+
return string.replace(/([a-z])([A-Z])/g, '$1 $2').trim();
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
export function getTypeString(node) {
|
|
26
|
+
let type = getLocalType(node);
|
|
27
|
+
|
|
28
|
+
const eventDefinition = getEventDefinition(node);
|
|
29
|
+
|
|
30
|
+
if (eventDefinition) {
|
|
31
|
+
type = `${ getEventDefinitionPrefix(eventDefinition) }${ type }`;
|
|
32
|
+
} else if ([
|
|
33
|
+
'BoundaryEvent',
|
|
34
|
+
'EndEvent',
|
|
35
|
+
'IntermediateCatchEvent',
|
|
36
|
+
'IntermediateThrowEvent',
|
|
37
|
+
'StartEvent'
|
|
38
|
+
].includes(type)) {
|
|
39
|
+
type = `Undefined ${ type }`;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
if (type === 'Task') {
|
|
43
|
+
type = 'Undefined Task';
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
return formatTypeString(type);
|
|
47
47
|
}
|
package/lib/utils/version.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import cmp from 'semver-compare';
|
|
2
|
-
|
|
3
|
-
export function greaterOrEqual(a, b) {
|
|
4
|
-
return cmp(a, b) !== -1;
|
|
5
|
-
}
|
|
6
|
-
|
|
7
|
-
export function toSemverMinor(executionPlatformVersion) {
|
|
8
|
-
return executionPlatformVersion.split('.').slice(0, 2).join('.');
|
|
1
|
+
import cmp from 'semver-compare';
|
|
2
|
+
|
|
3
|
+
export function greaterOrEqual(a, b) {
|
|
4
|
+
return cmp(a, b) !== -1;
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
export function toSemverMinor(executionPlatformVersion) {
|
|
8
|
+
return executionPlatformVersion.split('.').slice(0, 2).join('.');
|
|
9
9
|
}
|
package/package.json
CHANGED
|
@@ -1,85 +1,85 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "@camunda/linting",
|
|
3
|
-
"version": "3.27.
|
|
4
|
-
"description": "Linting for Camunda",
|
|
5
|
-
"main": "index.js",
|
|
6
|
-
"scripts": {
|
|
7
|
-
"all": "npm run lint && npm test",
|
|
8
|
-
"dev": "npm run test:watch",
|
|
9
|
-
"lint": "eslint .",
|
|
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",
|
|
13
|
-
"test": "npm run compile-config && karma start",
|
|
14
|
-
"test:watch": "npm test -- --auto-watch --no-single-run",
|
|
15
|
-
"compile-config": "node tasks/compile-config.js",
|
|
16
|
-
"prepublish": "npm run compile-config"
|
|
17
|
-
},
|
|
18
|
-
"keywords": [
|
|
19
|
-
"bpmnlint",
|
|
20
|
-
"camunda"
|
|
21
|
-
],
|
|
22
|
-
"author": {
|
|
23
|
-
"name": "Philipp Fromme",
|
|
24
|
-
"url": "https://github.com/philippfromme"
|
|
25
|
-
},
|
|
26
|
-
"repository": {
|
|
27
|
-
"type": "git",
|
|
28
|
-
"url": "https://github.com/camunda/linting"
|
|
29
|
-
},
|
|
30
|
-
"license": "MIT",
|
|
31
|
-
"dependencies": {
|
|
32
|
-
"@bpmn-io/diagram-js-ui": "^0.2.3",
|
|
33
|
-
"bpmn-moddle": "^9.0.1",
|
|
34
|
-
"bpmnlint": "^10.3.1",
|
|
35
|
-
"bpmnlint-plugin-camunda-compat": "^2.26.
|
|
36
|
-
"bpmnlint-utils": "^1.0.2",
|
|
37
|
-
"camunda-bpmn-moddle": "^7.0.1",
|
|
38
|
-
"clsx": "^2.0.0",
|
|
39
|
-
"min-dash": "^4.0.0",
|
|
40
|
-
"min-dom": "^5.1.1",
|
|
41
|
-
"modeler-moddle": "^0.2.0",
|
|
42
|
-
"semver-compare": "^1.0.0",
|
|
43
|
-
"zeebe-bpmn-moddle": "^1.6.0"
|
|
44
|
-
},
|
|
45
|
-
"devDependencies": {
|
|
46
|
-
"bpmn-js": "^17.11.
|
|
47
|
-
"bpmn-js-element-templates": "^2.2.1",
|
|
48
|
-
"bpmn-js-properties-panel": "^5.
|
|
49
|
-
"camunda-bpmn-js-behaviors": "^1.6.1",
|
|
50
|
-
"chai": "^4.5.0",
|
|
51
|
-
"cross-env": "^7.0.3",
|
|
52
|
-
"eslint": "^8.57.1",
|
|
53
|
-
"eslint-plugin-bpmn-io": "^1.0.1",
|
|
54
|
-
"karma": "^6.4.4",
|
|
55
|
-
"karma-chrome-launcher": "^3.2.0",
|
|
56
|
-
"karma-debug-launcher": "0.0.5",
|
|
57
|
-
"karma-env-preprocessor": "^0.1.1",
|
|
58
|
-
"karma-mocha": "^2.0.1",
|
|
59
|
-
"karma-sinon-chai": "^2.0.2",
|
|
60
|
-
"karma-webpack": "^5.0.1",
|
|
61
|
-
"mocha": "^10.7.3",
|
|
62
|
-
"mocha-test-container-support": "^0.2.0",
|
|
63
|
-
"puppeteer": "^23.3.1",
|
|
64
|
-
"sinon": "^17.0.1",
|
|
65
|
-
"sinon-chai": "^3.7.0",
|
|
66
|
-
"webpack": "^5.94.0"
|
|
67
|
-
},
|
|
68
|
-
"peerDependencies": {
|
|
69
|
-
"bpmn-js-properties-panel": ">= 2.0.0"
|
|
70
|
-
},
|
|
71
|
-
"peerDependenciesMeta": {
|
|
72
|
-
"bpmn-js-properties-panel": {
|
|
73
|
-
"optional": true
|
|
74
|
-
}
|
|
75
|
-
},
|
|
76
|
-
"files": [
|
|
77
|
-
"assets",
|
|
78
|
-
"lib",
|
|
79
|
-
"index.js",
|
|
80
|
-
"modeler.js"
|
|
81
|
-
],
|
|
82
|
-
"publishConfig": {
|
|
83
|
-
"access": "public"
|
|
84
|
-
}
|
|
85
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"name": "@camunda/linting",
|
|
3
|
+
"version": "3.27.2",
|
|
4
|
+
"description": "Linting for Camunda",
|
|
5
|
+
"main": "index.js",
|
|
6
|
+
"scripts": {
|
|
7
|
+
"all": "npm run lint && npm test",
|
|
8
|
+
"dev": "npm run test:watch",
|
|
9
|
+
"lint": "eslint .",
|
|
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",
|
|
13
|
+
"test": "npm run compile-config && karma start",
|
|
14
|
+
"test:watch": "npm test -- --auto-watch --no-single-run",
|
|
15
|
+
"compile-config": "node tasks/compile-config.js",
|
|
16
|
+
"prepublish": "npm run compile-config"
|
|
17
|
+
},
|
|
18
|
+
"keywords": [
|
|
19
|
+
"bpmnlint",
|
|
20
|
+
"camunda"
|
|
21
|
+
],
|
|
22
|
+
"author": {
|
|
23
|
+
"name": "Philipp Fromme",
|
|
24
|
+
"url": "https://github.com/philippfromme"
|
|
25
|
+
},
|
|
26
|
+
"repository": {
|
|
27
|
+
"type": "git",
|
|
28
|
+
"url": "https://github.com/camunda/linting"
|
|
29
|
+
},
|
|
30
|
+
"license": "MIT",
|
|
31
|
+
"dependencies": {
|
|
32
|
+
"@bpmn-io/diagram-js-ui": "^0.2.3",
|
|
33
|
+
"bpmn-moddle": "^9.0.1",
|
|
34
|
+
"bpmnlint": "^10.3.1",
|
|
35
|
+
"bpmnlint-plugin-camunda-compat": "^2.26.1",
|
|
36
|
+
"bpmnlint-utils": "^1.0.2",
|
|
37
|
+
"camunda-bpmn-moddle": "^7.0.1",
|
|
38
|
+
"clsx": "^2.0.0",
|
|
39
|
+
"min-dash": "^4.0.0",
|
|
40
|
+
"min-dom": "^5.1.1",
|
|
41
|
+
"modeler-moddle": "^0.2.0",
|
|
42
|
+
"semver-compare": "^1.0.0",
|
|
43
|
+
"zeebe-bpmn-moddle": "^1.6.0"
|
|
44
|
+
},
|
|
45
|
+
"devDependencies": {
|
|
46
|
+
"bpmn-js": "^17.11.1",
|
|
47
|
+
"bpmn-js-element-templates": "^2.2.1",
|
|
48
|
+
"bpmn-js-properties-panel": "^5.24.0",
|
|
49
|
+
"camunda-bpmn-js-behaviors": "^1.6.1",
|
|
50
|
+
"chai": "^4.5.0",
|
|
51
|
+
"cross-env": "^7.0.3",
|
|
52
|
+
"eslint": "^8.57.1",
|
|
53
|
+
"eslint-plugin-bpmn-io": "^1.0.1",
|
|
54
|
+
"karma": "^6.4.4",
|
|
55
|
+
"karma-chrome-launcher": "^3.2.0",
|
|
56
|
+
"karma-debug-launcher": "0.0.5",
|
|
57
|
+
"karma-env-preprocessor": "^0.1.1",
|
|
58
|
+
"karma-mocha": "^2.0.1",
|
|
59
|
+
"karma-sinon-chai": "^2.0.2",
|
|
60
|
+
"karma-webpack": "^5.0.1",
|
|
61
|
+
"mocha": "^10.7.3",
|
|
62
|
+
"mocha-test-container-support": "^0.2.0",
|
|
63
|
+
"puppeteer": "^23.3.1",
|
|
64
|
+
"sinon": "^17.0.1",
|
|
65
|
+
"sinon-chai": "^3.7.0",
|
|
66
|
+
"webpack": "^5.94.0"
|
|
67
|
+
},
|
|
68
|
+
"peerDependencies": {
|
|
69
|
+
"bpmn-js-properties-panel": ">= 2.0.0"
|
|
70
|
+
},
|
|
71
|
+
"peerDependenciesMeta": {
|
|
72
|
+
"bpmn-js-properties-panel": {
|
|
73
|
+
"optional": true
|
|
74
|
+
}
|
|
75
|
+
},
|
|
76
|
+
"files": [
|
|
77
|
+
"assets",
|
|
78
|
+
"lib",
|
|
79
|
+
"index.js",
|
|
80
|
+
"modeler.js"
|
|
81
|
+
],
|
|
82
|
+
"publishConfig": {
|
|
83
|
+
"access": "public"
|
|
84
|
+
}
|
|
85
|
+
}
|