@camunda/linting 3.38.0 → 3.40.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/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
+ }
@@ -48,6 +48,7 @@ const rules = {
48
48
  "camunda-compat/inclusive-gateway": "error",
49
49
  "camunda-compat/link-event": "error",
50
50
  "camunda-compat/loop-characteristics": "error",
51
+ "camunda-compat/io-mapping": "error",
51
52
  "camunda-compat/message-reference": "error",
52
53
  "camunda-compat/no-binding-type": "error",
53
54
  "camunda-compat/no-candidate-users": "error",
@@ -78,6 +79,7 @@ const rules = {
78
79
  "camunda-compat/user-task-form": "error",
79
80
  "camunda-compat/version-tag": "error",
80
81
  "camunda-compat/wait-for-completion": "error",
82
+ "start-event-required": "error",
81
83
  "ad-hoc-sub-process": "error",
82
84
  "event-sub-process-typed-start-event": "error",
83
85
  "link-event": "error",
@@ -175,146 +177,154 @@ import rule_18 from 'bpmnlint-plugin-camunda-compat/rules/camunda-cloud/loop-cha
175
177
 
176
178
  cache['bpmnlint-plugin-camunda-compat/loop-characteristics'] = rule_18;
177
179
 
178
- import rule_19 from 'bpmnlint-plugin-camunda-compat/rules/camunda-cloud/message-reference';
180
+ import rule_19 from 'bpmnlint-plugin-camunda-compat/rules/camunda-cloud/io-mapping';
179
181
 
180
- cache['bpmnlint-plugin-camunda-compat/message-reference'] = rule_19;
182
+ cache['bpmnlint-plugin-camunda-compat/io-mapping'] = rule_19;
181
183
 
182
- import rule_20 from 'bpmnlint-plugin-camunda-compat/rules/camunda-cloud/no-binding-type';
184
+ import rule_20 from 'bpmnlint-plugin-camunda-compat/rules/camunda-cloud/message-reference';
183
185
 
184
- cache['bpmnlint-plugin-camunda-compat/no-binding-type'] = rule_20;
186
+ cache['bpmnlint-plugin-camunda-compat/message-reference'] = rule_20;
185
187
 
186
- import rule_21 from 'bpmnlint-plugin-camunda-compat/rules/camunda-cloud/no-candidate-users';
188
+ import rule_21 from 'bpmnlint-plugin-camunda-compat/rules/camunda-cloud/no-binding-type';
187
189
 
188
- cache['bpmnlint-plugin-camunda-compat/no-candidate-users'] = rule_21;
190
+ cache['bpmnlint-plugin-camunda-compat/no-binding-type'] = rule_21;
189
191
 
190
- import rule_22 from 'bpmnlint-plugin-camunda-compat/rules/camunda-cloud/no-execution-listeners';
192
+ import rule_22 from 'bpmnlint-plugin-camunda-compat/rules/camunda-cloud/no-candidate-users';
191
193
 
192
- cache['bpmnlint-plugin-camunda-compat/no-execution-listeners'] = rule_22;
194
+ cache['bpmnlint-plugin-camunda-compat/no-candidate-users'] = rule_22;
193
195
 
194
- import rule_23 from 'bpmnlint-plugin-camunda-compat/rules/camunda-cloud/no-expression';
196
+ import rule_23 from 'bpmnlint-plugin-camunda-compat/rules/camunda-cloud/no-execution-listeners';
195
197
 
196
- cache['bpmnlint-plugin-camunda-compat/no-expression'] = rule_23;
198
+ cache['bpmnlint-plugin-camunda-compat/no-execution-listeners'] = rule_23;
197
199
 
198
- import rule_24 from 'bpmnlint-plugin-camunda-compat/rules/camunda-cloud/no-loop';
200
+ import rule_24 from 'bpmnlint-plugin-camunda-compat/rules/camunda-cloud/no-expression';
199
201
 
200
- cache['bpmnlint-plugin-camunda-compat/no-loop'] = rule_24;
202
+ cache['bpmnlint-plugin-camunda-compat/no-expression'] = rule_24;
201
203
 
202
- import rule_25 from 'bpmnlint-plugin-camunda-compat/rules/camunda-cloud/no-multiple-none-start-events';
204
+ import rule_25 from 'bpmnlint-plugin-camunda-compat/rules/camunda-cloud/no-loop';
203
205
 
204
- cache['bpmnlint-plugin-camunda-compat/no-multiple-none-start-events'] = rule_25;
206
+ cache['bpmnlint-plugin-camunda-compat/no-loop'] = rule_25;
205
207
 
206
- import rule_26 from 'bpmnlint-plugin-camunda-compat/rules/camunda-cloud/no-priority-definition';
208
+ import rule_26 from 'bpmnlint-plugin-camunda-compat/rules/camunda-cloud/no-multiple-none-start-events';
207
209
 
208
- cache['bpmnlint-plugin-camunda-compat/no-priority-definition'] = rule_26;
210
+ cache['bpmnlint-plugin-camunda-compat/no-multiple-none-start-events'] = rule_26;
209
211
 
210
- import rule_27 from 'bpmnlint-plugin-camunda-compat/rules/camunda-cloud/no-propagate-all-parent-variables';
212
+ import rule_27 from 'bpmnlint-plugin-camunda-compat/rules/camunda-cloud/no-priority-definition';
211
213
 
212
- cache['bpmnlint-plugin-camunda-compat/no-propagate-all-parent-variables'] = rule_27;
214
+ cache['bpmnlint-plugin-camunda-compat/no-priority-definition'] = rule_27;
213
215
 
214
- import rule_28 from 'bpmnlint-plugin-camunda-compat/rules/camunda-cloud/no-signal-event-sub-process';
216
+ import rule_28 from 'bpmnlint-plugin-camunda-compat/rules/camunda-cloud/no-propagate-all-parent-variables';
215
217
 
216
- cache['bpmnlint-plugin-camunda-compat/no-signal-event-sub-process'] = rule_28;
218
+ cache['bpmnlint-plugin-camunda-compat/no-propagate-all-parent-variables'] = rule_28;
217
219
 
218
- import rule_29 from 'bpmnlint-plugin-camunda-compat/rules/camunda-cloud/no-task-schedule';
220
+ import rule_29 from 'bpmnlint-plugin-camunda-compat/rules/camunda-cloud/no-signal-event-sub-process';
219
221
 
220
- cache['bpmnlint-plugin-camunda-compat/no-task-schedule'] = rule_29;
222
+ cache['bpmnlint-plugin-camunda-compat/no-signal-event-sub-process'] = rule_29;
221
223
 
222
- import rule_30 from 'bpmnlint-plugin-camunda-compat/rules/camunda-cloud/no-task-listeners';
224
+ import rule_30 from 'bpmnlint-plugin-camunda-compat/rules/camunda-cloud/no-task-schedule';
223
225
 
224
- cache['bpmnlint-plugin-camunda-compat/no-task-listeners'] = rule_30;
226
+ cache['bpmnlint-plugin-camunda-compat/no-task-schedule'] = rule_30;
225
227
 
226
- import rule_31 from 'bpmnlint-plugin-camunda-compat/rules/camunda-cloud/no-template';
228
+ import rule_31 from 'bpmnlint-plugin-camunda-compat/rules/camunda-cloud/no-task-listeners';
227
229
 
228
- cache['bpmnlint-plugin-camunda-compat/no-template'] = rule_31;
230
+ cache['bpmnlint-plugin-camunda-compat/no-task-listeners'] = rule_31;
229
231
 
230
- import rule_32 from 'bpmnlint-plugin-camunda-compat/rules/camunda-cloud/no-version-tag';
232
+ import rule_32 from 'bpmnlint-plugin-camunda-compat/rules/camunda-cloud/no-template';
231
233
 
232
- cache['bpmnlint-plugin-camunda-compat/no-version-tag'] = rule_32;
234
+ cache['bpmnlint-plugin-camunda-compat/no-template'] = rule_32;
233
235
 
234
- import rule_33 from 'bpmnlint-plugin-camunda-compat/rules/camunda-cloud/no-zeebe-properties';
236
+ import rule_33 from 'bpmnlint-plugin-camunda-compat/rules/camunda-cloud/no-version-tag';
235
237
 
236
- cache['bpmnlint-plugin-camunda-compat/no-zeebe-properties'] = rule_33;
238
+ cache['bpmnlint-plugin-camunda-compat/no-version-tag'] = rule_33;
237
239
 
238
- import rule_34 from 'bpmnlint-plugin-camunda-compat/rules/camunda-cloud/no-zeebe-user-task';
240
+ import rule_34 from 'bpmnlint-plugin-camunda-compat/rules/camunda-cloud/no-zeebe-properties';
239
241
 
240
- cache['bpmnlint-plugin-camunda-compat/no-zeebe-user-task'] = rule_34;
242
+ cache['bpmnlint-plugin-camunda-compat/no-zeebe-properties'] = rule_34;
241
243
 
242
- import rule_35 from 'bpmnlint-plugin-camunda-compat/rules/camunda-cloud/priority-definition';
244
+ import rule_35 from 'bpmnlint-plugin-camunda-compat/rules/camunda-cloud/no-zeebe-user-task';
243
245
 
244
- cache['bpmnlint-plugin-camunda-compat/priority-definition'] = rule_35;
246
+ cache['bpmnlint-plugin-camunda-compat/no-zeebe-user-task'] = rule_35;
245
247
 
246
- import rule_36 from 'bpmnlint-plugin-camunda-compat/rules/camunda-cloud/zeebe-user-task';
248
+ import rule_36 from 'bpmnlint-plugin-camunda-compat/rules/camunda-cloud/priority-definition';
247
249
 
248
- cache['bpmnlint-plugin-camunda-compat/zeebe-user-task'] = rule_36;
250
+ cache['bpmnlint-plugin-camunda-compat/priority-definition'] = rule_36;
249
251
 
250
- import rule_37 from 'bpmnlint-plugin-camunda-compat/rules/camunda-cloud/secrets';
252
+ import rule_37 from 'bpmnlint-plugin-camunda-compat/rules/camunda-cloud/zeebe-user-task';
251
253
 
252
- cache['bpmnlint-plugin-camunda-compat/secrets'] = rule_37;
254
+ cache['bpmnlint-plugin-camunda-compat/zeebe-user-task'] = rule_37;
253
255
 
254
- import rule_38 from 'bpmnlint-plugin-camunda-compat/rules/camunda-cloud/sequence-flow-condition';
256
+ import rule_38 from 'bpmnlint-plugin-camunda-compat/rules/camunda-cloud/secrets';
255
257
 
256
- cache['bpmnlint-plugin-camunda-compat/sequence-flow-condition'] = rule_38;
258
+ cache['bpmnlint-plugin-camunda-compat/secrets'] = rule_38;
257
259
 
258
- import rule_39 from 'bpmnlint-plugin-camunda-compat/rules/camunda-cloud/signal-reference';
260
+ import rule_39 from 'bpmnlint-plugin-camunda-compat/rules/camunda-cloud/sequence-flow-condition';
259
261
 
260
- cache['bpmnlint-plugin-camunda-compat/signal-reference'] = rule_39;
262
+ cache['bpmnlint-plugin-camunda-compat/sequence-flow-condition'] = rule_39;
261
263
 
262
- import rule_40 from 'bpmnlint-plugin-camunda-compat/rules/camunda-cloud/start-event-form';
264
+ import rule_40 from 'bpmnlint-plugin-camunda-compat/rules/camunda-cloud/signal-reference';
263
265
 
264
- cache['bpmnlint-plugin-camunda-compat/start-event-form'] = rule_40;
266
+ cache['bpmnlint-plugin-camunda-compat/signal-reference'] = rule_40;
265
267
 
266
- import rule_41 from 'bpmnlint-plugin-camunda-compat/rules/camunda-cloud/subscription';
268
+ import rule_41 from 'bpmnlint-plugin-camunda-compat/rules/camunda-cloud/start-event-form';
267
269
 
268
- cache['bpmnlint-plugin-camunda-compat/subscription'] = rule_41;
270
+ cache['bpmnlint-plugin-camunda-compat/start-event-form'] = rule_41;
269
271
 
270
- import rule_42 from 'bpmnlint-plugin-camunda-compat/rules/camunda-cloud/task-listener';
272
+ import rule_42 from 'bpmnlint-plugin-camunda-compat/rules/camunda-cloud/subscription';
271
273
 
272
- cache['bpmnlint-plugin-camunda-compat/task-listener'] = rule_42;
274
+ cache['bpmnlint-plugin-camunda-compat/subscription'] = rule_42;
273
275
 
274
- import rule_43 from 'bpmnlint-plugin-camunda-compat/rules/camunda-cloud/task-schedule';
276
+ import rule_43 from 'bpmnlint-plugin-camunda-compat/rules/camunda-cloud/task-listener';
275
277
 
276
- cache['bpmnlint-plugin-camunda-compat/task-schedule'] = rule_43;
278
+ cache['bpmnlint-plugin-camunda-compat/task-listener'] = rule_43;
277
279
 
278
- import rule_44 from 'bpmnlint-plugin-camunda-compat/rules/camunda-cloud/timer';
280
+ import rule_44 from 'bpmnlint-plugin-camunda-compat/rules/camunda-cloud/task-schedule';
279
281
 
280
- cache['bpmnlint-plugin-camunda-compat/timer'] = rule_44;
282
+ cache['bpmnlint-plugin-camunda-compat/task-schedule'] = rule_44;
281
283
 
282
- import rule_45 from 'bpmnlint-plugin-camunda-compat/rules/camunda-cloud/user-task-definition';
284
+ import rule_45 from 'bpmnlint-plugin-camunda-compat/rules/camunda-cloud/timer';
283
285
 
284
- cache['bpmnlint-plugin-camunda-compat/user-task-definition'] = rule_45;
286
+ cache['bpmnlint-plugin-camunda-compat/timer'] = rule_45;
285
287
 
286
- import rule_46 from 'bpmnlint-plugin-camunda-compat/rules/camunda-cloud/user-task-form';
288
+ import rule_46 from 'bpmnlint-plugin-camunda-compat/rules/camunda-cloud/user-task-definition';
287
289
 
288
- cache['bpmnlint-plugin-camunda-compat/user-task-form'] = rule_46;
290
+ cache['bpmnlint-plugin-camunda-compat/user-task-definition'] = rule_46;
289
291
 
290
- import rule_47 from 'bpmnlint-plugin-camunda-compat/rules/camunda-cloud/version-tag';
292
+ import rule_47 from 'bpmnlint-plugin-camunda-compat/rules/camunda-cloud/user-task-form';
291
293
 
292
- cache['bpmnlint-plugin-camunda-compat/version-tag'] = rule_47;
294
+ cache['bpmnlint-plugin-camunda-compat/user-task-form'] = rule_47;
293
295
 
294
- import rule_48 from 'bpmnlint-plugin-camunda-compat/rules/camunda-cloud/wait-for-completion';
296
+ import rule_48 from 'bpmnlint-plugin-camunda-compat/rules/camunda-cloud/version-tag';
295
297
 
296
- cache['bpmnlint-plugin-camunda-compat/wait-for-completion'] = rule_48;
298
+ cache['bpmnlint-plugin-camunda-compat/version-tag'] = rule_48;
297
299
 
298
- import rule_49 from 'bpmnlint/rules/ad-hoc-sub-process';
300
+ import rule_49 from 'bpmnlint-plugin-camunda-compat/rules/camunda-cloud/wait-for-completion';
299
301
 
300
- cache['bpmnlint/ad-hoc-sub-process'] = rule_49;
302
+ cache['bpmnlint-plugin-camunda-compat/wait-for-completion'] = rule_49;
301
303
 
302
- import rule_50 from 'bpmnlint/rules/event-sub-process-typed-start-event';
304
+ import rule_50 from 'bpmnlint/rules/start-event-required';
303
305
 
304
- cache['bpmnlint/event-sub-process-typed-start-event'] = rule_50;
306
+ cache['bpmnlint/start-event-required'] = rule_50;
305
307
 
306
- import rule_51 from 'bpmnlint/rules/link-event';
308
+ import rule_51 from 'bpmnlint/rules/ad-hoc-sub-process';
307
309
 
308
- cache['bpmnlint/link-event'] = rule_51;
310
+ cache['bpmnlint/ad-hoc-sub-process'] = rule_51;
309
311
 
310
- import rule_52 from 'bpmnlint/rules/no-duplicate-sequence-flows';
312
+ import rule_52 from 'bpmnlint/rules/event-sub-process-typed-start-event';
311
313
 
312
- cache['bpmnlint/no-duplicate-sequence-flows'] = rule_52;
314
+ cache['bpmnlint/event-sub-process-typed-start-event'] = rule_52;
313
315
 
314
- import rule_53 from 'bpmnlint/rules/sub-process-blank-start-event';
316
+ import rule_53 from 'bpmnlint/rules/link-event';
315
317
 
316
- cache['bpmnlint/sub-process-blank-start-event'] = rule_53;
318
+ cache['bpmnlint/link-event'] = rule_53;
317
319
 
318
- import rule_54 from 'bpmnlint/rules/single-blank-start-event';
320
+ import rule_54 from 'bpmnlint/rules/no-duplicate-sequence-flows';
319
321
 
320
- cache['bpmnlint/single-blank-start-event'] = rule_54;
322
+ cache['bpmnlint/no-duplicate-sequence-flows'] = rule_54;
323
+
324
+ import rule_55 from 'bpmnlint/rules/sub-process-blank-start-event';
325
+
326
+ cache['bpmnlint/sub-process-blank-start-event'] = rule_55;
327
+
328
+ import rule_56 from 'bpmnlint/rules/single-blank-start-event';
329
+
330
+ cache['bpmnlint/single-blank-start-event'] = rule_56;
@@ -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
+ }