bpmnlint-plugin-camunda-compat 2.11.0 → 2.12.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/index.js CHANGED
@@ -1,181 +1,178 @@
1
- const { omit } = require('min-dash');
2
-
3
- const camundaCloud10Rules = withConfig({
4
- 'implementation': 'error',
5
- 'called-element': 'error',
6
- 'collapsed-subprocess': 'error',
7
- 'duplicate-task-headers': 'error',
8
- 'element-type': 'error',
9
- 'error-reference': 'error',
10
- 'event-based-gateway-target': 'error',
11
- 'executable-process': 'error',
12
- 'loop-characteristics': 'error',
13
- 'message-reference': 'error',
14
- 'no-candidate-users': 'error',
15
- 'no-expression': 'error',
16
- 'no-loop': 'error',
17
- 'no-multiple-none-start-events': 'error',
18
- 'no-propagate-all-parent-variables': 'error',
19
- 'no-task-schedule': 'error',
20
- 'no-template': 'error',
21
- 'no-zeebe-properties': 'error',
22
- 'sequence-flow-condition': 'error',
23
- 'start-form': 'error',
24
- 'subscription': 'error',
25
- 'timer': 'error',
26
- 'user-task-form': 'error',
27
- 'feel': 'error'
28
- }, { version: '1.0' });
29
-
30
- const camundaCloud11Rules = withConfig(camundaCloud10Rules, { version: '1.1' });
31
-
32
- const camundaCloud12Rules = withConfig(camundaCloud11Rules, { version: '1.2' });
33
-
34
- const camundaCloud13Rules = withConfig(camundaCloud12Rules, { version: '1.3' });
35
-
36
- const camundaCloud80Rules = withConfig({
37
- ...omit(camundaCloud13Rules, 'no-template'),
38
- }, { version: '8.0' });
39
-
40
- const camundaCloud81Rules = withConfig({
41
- ...omit(camundaCloud80Rules, 'no-zeebe-properties'),
42
- 'inclusive-gateway': 'error'
43
- }, { version: '8.1' });
44
-
45
- const camundaCloud82Rules = withConfig({
46
- ...omit(camundaCloud81Rules, [
47
- 'no-candidate-users',
48
- 'no-propagate-all-parent-variables',
49
- 'no-task-schedule'
50
- ]),
51
- 'escalation-boundary-event-attached-to-ref': 'error',
52
- 'escalation-reference': 'error',
53
- 'link-event': 'error',
54
- 'no-signal-event-sub-process': 'error',
55
- 'task-schedule': 'error'
56
- }, { version: '8.2' });
57
-
58
- const camundaCloud83Rules = withConfig({
59
- ...omit(camundaCloud82Rules, [
60
- 'start-form',
61
- 'no-signal-event-sub-process'
62
- ]),
63
- 'secrets': 'warn',
64
- 'signal-reference': 'error'
65
- }, { version: '8.3' });
66
-
67
- const camundaCloud84Rules = withConfig(camundaCloud83Rules, { version: '8.4' });
68
-
69
- const camundaPlatform719Rules = withConfig({
70
- 'history-time-to-live': 'error'
71
- }, {
72
- platform: 'camunda-platform',
73
- version: '7.19'
74
- });
75
-
76
- const camundaPlatform720Rules = withConfig(camundaPlatform719Rules, {
77
- platform: 'camunda-platform',
78
- version: '7.20'
79
- });
80
-
81
- const camundaPlatform721Rules = withConfig(camundaPlatform720Rules, {
82
- platform: 'camunda-platform',
83
- version: '7.21'
84
- });
85
-
86
- const rules = {
87
- 'element-type': './rules/camunda-cloud/element-type',
88
- 'called-element': './rules/camunda-cloud/called-element',
89
- 'collapsed-subprocess': './rules/camunda-cloud/collapsed-subprocess',
90
- 'duplicate-task-headers': './rules/camunda-cloud/duplicate-task-headers',
91
- 'error-reference': './rules/camunda-cloud/error-reference',
92
- 'escalation-boundary-event-attached-to-ref': './rules/camunda-cloud/escalation-boundary-event-attached-to-ref',
93
- 'escalation-reference': './rules/camunda-cloud/escalation-reference',
94
- 'event-based-gateway-target': './rules/camunda-cloud/event-based-gateway-target',
95
- 'executable-process': './rules/camunda-cloud/executable-process',
96
- 'feel': './rules/camunda-cloud/feel',
97
- 'history-time-to-live': './rules/camunda-platform/history-time-to-live',
98
- 'implementation': './rules/camunda-cloud/implementation',
99
- 'inclusive-gateway': './rules/camunda-cloud/inclusive-gateway',
100
- 'link-event': './rules/camunda-cloud/link-event',
101
- 'loop-characteristics': './rules/camunda-cloud/loop-characteristics',
102
- 'message-reference': './rules/camunda-cloud/message-reference',
103
- 'no-candidate-users': './rules/camunda-cloud/no-candidate-users',
104
- 'no-expression': './rules/camunda-cloud/no-expression',
105
- 'no-loop': './rules/camunda-cloud/no-loop',
106
- 'no-multiple-none-start-events': './rules/camunda-cloud/no-multiple-none-start-events',
107
- 'no-propagate-all-parent-variables': './rules/camunda-cloud/no-propagate-all-parent-variables',
108
- 'no-signal-event-sub-process': './rules/camunda-cloud/no-signal-event-sub-process',
109
- 'no-task-schedule': './rules/camunda-cloud/no-task-schedule',
110
- 'no-template': './rules/camunda-cloud/no-template',
111
- 'no-zeebe-properties': './rules/camunda-cloud/no-zeebe-properties',
112
- 'secrets': './rules/camunda-cloud/secrets',
113
- 'sequence-flow-condition': './rules/camunda-cloud/sequence-flow-condition',
114
- 'signal-reference': './rules/camunda-cloud/signal-reference',
115
- 'start-form': './rules/camunda-cloud/start-form',
116
- 'subscription': './rules/camunda-cloud/subscription',
117
- 'task-schedule': './rules/camunda-cloud/task-schedule',
118
- 'timer': './rules/camunda-cloud/timer',
119
- 'user-task-form': './rules/camunda-cloud/user-task-form'
120
- };
121
-
122
- module.exports = {
123
- configs: {
124
- 'camunda-cloud-1-0': {
125
- rules: camundaCloud10Rules
126
- },
127
- 'camunda-cloud-1-1': {
128
- rules: camundaCloud11Rules
129
- },
130
- 'camunda-cloud-1-2': {
131
- rules: camundaCloud12Rules
132
- },
133
- 'camunda-cloud-1-3': {
134
- rules: camundaCloud13Rules
135
- },
136
- 'camunda-cloud-8-0': {
137
- rules: camundaCloud80Rules
138
- },
139
- 'camunda-cloud-8-1': {
140
- rules: camundaCloud81Rules
141
- },
142
- 'camunda-cloud-8-2': {
143
- rules: camundaCloud82Rules
144
- },
145
- 'camunda-cloud-8-3': {
146
- rules: camundaCloud83Rules
147
- },
148
- 'camunda-cloud-8-4': {
149
- rules: camundaCloud84Rules
150
- },
151
- 'camunda-platform-7-19': {
152
- rules: camundaPlatform719Rules
153
- },
154
- 'camunda-platform-7-20': {
155
- rules: camundaPlatform720Rules
156
- },
157
- 'camunda-platform-7-21': {
158
- rules: camundaPlatform721Rules
159
- },
160
- 'all': {
161
- rules: Object.keys(rules).reduce((allRules, rule) => {
162
- return {
163
- ...allRules,
164
- [ rule ]: 'error'
165
- };
166
- }, {})
167
- }
168
- },
169
- rules
170
- };
171
-
172
- function withConfig(rules, config) {
173
- let rulesWithConfig = {};
174
-
175
- for (let name in rules) {
176
- const type = Array.isArray(rules[ name ]) ? rules[ name ][0] : rules[ name ];
177
- rulesWithConfig[ name ] = [ type, config ];
178
- }
179
-
180
- return rulesWithConfig;
1
+ const { omit } = require('min-dash');
2
+
3
+ const camundaCloud10Rules = withConfig({
4
+ 'implementation': 'error',
5
+ 'called-element': 'error',
6
+ 'collapsed-subprocess': 'error',
7
+ 'duplicate-task-headers': 'error',
8
+ 'element-type': 'error',
9
+ 'error-reference': 'error',
10
+ 'event-based-gateway-target': 'error',
11
+ 'executable-process': 'error',
12
+ 'loop-characteristics': 'error',
13
+ 'message-reference': 'error',
14
+ 'no-candidate-users': 'error',
15
+ 'no-expression': 'error',
16
+ 'no-loop': 'error',
17
+ 'no-multiple-none-start-events': 'error',
18
+ 'no-propagate-all-parent-variables': 'error',
19
+ 'no-task-schedule': 'error',
20
+ 'no-template': 'error',
21
+ 'no-zeebe-properties': 'error',
22
+ 'sequence-flow-condition': 'error',
23
+ 'start-event-form': 'error',
24
+ 'subscription': 'error',
25
+ 'timer': 'error',
26
+ 'user-task-form': 'error',
27
+ 'feel': 'error'
28
+ }, { version: '1.0' });
29
+
30
+ const camundaCloud11Rules = withConfig(camundaCloud10Rules, { version: '1.1' });
31
+
32
+ const camundaCloud12Rules = withConfig(camundaCloud11Rules, { version: '1.2' });
33
+
34
+ const camundaCloud13Rules = withConfig(camundaCloud12Rules, { version: '1.3' });
35
+
36
+ const camundaCloud80Rules = withConfig({
37
+ ...omit(camundaCloud13Rules, 'no-template'),
38
+ }, { version: '8.0' });
39
+
40
+ const camundaCloud81Rules = withConfig({
41
+ ...omit(camundaCloud80Rules, 'no-zeebe-properties'),
42
+ 'inclusive-gateway': 'error'
43
+ }, { version: '8.1' });
44
+
45
+ const camundaCloud82Rules = withConfig({
46
+ ...omit(camundaCloud81Rules, [
47
+ 'no-candidate-users',
48
+ 'no-propagate-all-parent-variables',
49
+ 'no-task-schedule'
50
+ ]),
51
+ 'escalation-boundary-event-attached-to-ref': 'error',
52
+ 'escalation-reference': 'error',
53
+ 'link-event': 'error',
54
+ 'no-signal-event-sub-process': 'error',
55
+ 'task-schedule': 'error'
56
+ }, { version: '8.2' });
57
+
58
+ const camundaCloud83Rules = withConfig({
59
+ ...omit(camundaCloud82Rules, 'no-signal-event-sub-process'),
60
+ 'secrets': 'warn',
61
+ 'signal-reference': 'error'
62
+ }, { version: '8.3' });
63
+
64
+ const camundaCloud84Rules = withConfig(camundaCloud83Rules, { version: '8.4' });
65
+
66
+ const camundaPlatform719Rules = withConfig({
67
+ 'history-time-to-live': 'error'
68
+ }, {
69
+ platform: 'camunda-platform',
70
+ version: '7.19'
71
+ });
72
+
73
+ const camundaPlatform720Rules = withConfig(camundaPlatform719Rules, {
74
+ platform: 'camunda-platform',
75
+ version: '7.20'
76
+ });
77
+
78
+ const camundaPlatform721Rules = withConfig(camundaPlatform720Rules, {
79
+ platform: 'camunda-platform',
80
+ version: '7.21'
81
+ });
82
+
83
+ const rules = {
84
+ 'element-type': './rules/camunda-cloud/element-type',
85
+ 'called-element': './rules/camunda-cloud/called-element',
86
+ 'collapsed-subprocess': './rules/camunda-cloud/collapsed-subprocess',
87
+ 'duplicate-task-headers': './rules/camunda-cloud/duplicate-task-headers',
88
+ 'error-reference': './rules/camunda-cloud/error-reference',
89
+ 'escalation-boundary-event-attached-to-ref': './rules/camunda-cloud/escalation-boundary-event-attached-to-ref',
90
+ 'escalation-reference': './rules/camunda-cloud/escalation-reference',
91
+ 'event-based-gateway-target': './rules/camunda-cloud/event-based-gateway-target',
92
+ 'executable-process': './rules/camunda-cloud/executable-process',
93
+ 'feel': './rules/camunda-cloud/feel',
94
+ 'history-time-to-live': './rules/camunda-platform/history-time-to-live',
95
+ 'implementation': './rules/camunda-cloud/implementation',
96
+ 'inclusive-gateway': './rules/camunda-cloud/inclusive-gateway',
97
+ 'link-event': './rules/camunda-cloud/link-event',
98
+ 'loop-characteristics': './rules/camunda-cloud/loop-characteristics',
99
+ 'message-reference': './rules/camunda-cloud/message-reference',
100
+ 'no-candidate-users': './rules/camunda-cloud/no-candidate-users',
101
+ 'no-expression': './rules/camunda-cloud/no-expression',
102
+ 'no-loop': './rules/camunda-cloud/no-loop',
103
+ 'no-multiple-none-start-events': './rules/camunda-cloud/no-multiple-none-start-events',
104
+ 'no-propagate-all-parent-variables': './rules/camunda-cloud/no-propagate-all-parent-variables',
105
+ 'no-signal-event-sub-process': './rules/camunda-cloud/no-signal-event-sub-process',
106
+ 'no-task-schedule': './rules/camunda-cloud/no-task-schedule',
107
+ 'no-template': './rules/camunda-cloud/no-template',
108
+ 'no-zeebe-properties': './rules/camunda-cloud/no-zeebe-properties',
109
+ 'secrets': './rules/camunda-cloud/secrets',
110
+ 'sequence-flow-condition': './rules/camunda-cloud/sequence-flow-condition',
111
+ 'signal-reference': './rules/camunda-cloud/signal-reference',
112
+ 'start-event-form': './rules/camunda-cloud/start-event-form',
113
+ 'subscription': './rules/camunda-cloud/subscription',
114
+ 'task-schedule': './rules/camunda-cloud/task-schedule',
115
+ 'timer': './rules/camunda-cloud/timer',
116
+ 'user-task-form': './rules/camunda-cloud/user-task-form'
117
+ };
118
+
119
+ module.exports = {
120
+ configs: {
121
+ 'camunda-cloud-1-0': {
122
+ rules: camundaCloud10Rules
123
+ },
124
+ 'camunda-cloud-1-1': {
125
+ rules: camundaCloud11Rules
126
+ },
127
+ 'camunda-cloud-1-2': {
128
+ rules: camundaCloud12Rules
129
+ },
130
+ 'camunda-cloud-1-3': {
131
+ rules: camundaCloud13Rules
132
+ },
133
+ 'camunda-cloud-8-0': {
134
+ rules: camundaCloud80Rules
135
+ },
136
+ 'camunda-cloud-8-1': {
137
+ rules: camundaCloud81Rules
138
+ },
139
+ 'camunda-cloud-8-2': {
140
+ rules: camundaCloud82Rules
141
+ },
142
+ 'camunda-cloud-8-3': {
143
+ rules: camundaCloud83Rules
144
+ },
145
+ 'camunda-cloud-8-4': {
146
+ rules: camundaCloud84Rules
147
+ },
148
+ 'camunda-platform-7-19': {
149
+ rules: camundaPlatform719Rules
150
+ },
151
+ 'camunda-platform-7-20': {
152
+ rules: camundaPlatform720Rules
153
+ },
154
+ 'camunda-platform-7-21': {
155
+ rules: camundaPlatform721Rules
156
+ },
157
+ 'all': {
158
+ rules: Object.keys(rules).reduce((allRules, rule) => {
159
+ return {
160
+ ...allRules,
161
+ [ rule ]: 'error'
162
+ };
163
+ }, {})
164
+ }
165
+ },
166
+ rules
167
+ };
168
+
169
+ function withConfig(rules, config) {
170
+ let rulesWithConfig = {};
171
+
172
+ for (let name in rules) {
173
+ const type = Array.isArray(rules[ name ]) ? rules[ name ][0] : rules[ name ];
174
+ rulesWithConfig[ name ] = [ type, config ];
175
+ }
176
+
177
+ return rulesWithConfig;
181
178
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "bpmnlint-plugin-camunda-compat",
3
- "version": "2.11.0",
3
+ "version": "2.12.0",
4
4
  "description": "A bpmnlint plug-in for Camunda compatibility",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -0,0 +1,98 @@
1
+ const { is } = require('bpmnlint-utils');
2
+
3
+ const {
4
+ findExtensionElement,
5
+ findExtensionElements,
6
+ findParent,
7
+ hasProperties,
8
+ hasProperty
9
+ } = require('../utils/element');
10
+
11
+ const { hasNoExtensionElement } = require('../utils/element');
12
+
13
+ const { reportErrors } = require('../utils/reporter');
14
+
15
+ const { skipInNonExecutableProcess } = require('../utils/rule');
16
+
17
+ const { greaterOrEqual } = require('../utils/version');
18
+
19
+ const allowedVersion = '8.3';
20
+
21
+ module.exports = skipInNonExecutableProcess(function({ version }) {
22
+ function check(node, reporter) {
23
+ if (!is(node, 'bpmn:StartEvent')) {
24
+ return;
25
+ }
26
+
27
+ // Camunda 8.2 and older
28
+ if (!greaterOrEqual(version, allowedVersion)) {
29
+ let errors = hasNoExtensionElement(node, 'zeebe:FormDefinition', node, allowedVersion);
30
+
31
+ if (errors.length) {
32
+ reportErrors(node, reporter, errors);
33
+ }
34
+
35
+ return;
36
+ }
37
+
38
+ // Camunda 8.3 and newer
39
+ const formDefinition = findExtensionElement(node, 'zeebe:FormDefinition');
40
+
41
+ if (!formDefinition) {
42
+ return;
43
+ }
44
+
45
+ let errors = hasProperty(formDefinition, [
46
+ 'formKey',
47
+ 'formId'
48
+ ], node);
49
+
50
+ if (errors.length) {
51
+ reportErrors(node, reporter, errors);
52
+
53
+ return;
54
+ }
55
+
56
+ const formKey = formDefinition.get('formKey');
57
+
58
+ const userTaskForm = findUserTaskForm(node, formKey);
59
+
60
+ if (!userTaskForm) {
61
+ return;
62
+ }
63
+
64
+ errors = hasProperties(userTaskForm, {
65
+ body: {
66
+ required: true
67
+ }
68
+ }, node);
69
+
70
+ if (errors.length) {
71
+ reportErrors(node, reporter, errors);
72
+ }
73
+ }
74
+
75
+ return {
76
+ check
77
+ };
78
+ });
79
+
80
+ // helpers //////////
81
+
82
+ function findUserTaskForm(node, formKey) {
83
+ const process = findParent(node, 'bpmn:Process');
84
+
85
+ if (!process) {
86
+ return;
87
+ }
88
+
89
+ const userTaskForms = findExtensionElements(process, 'zeebe:UserTaskForm');
90
+
91
+ if (userTaskForms && userTaskForms.length) {
92
+ return userTaskForms.find(userTaskForm => {
93
+ const id = userTaskForm.get('id');
94
+
95
+ return `camunda-forms:bpmn:${ id }` === formKey;
96
+ });
97
+ }
98
+ }
@@ -1,115 +1,116 @@
1
- const { is } = require('bpmnlint-utils');
2
-
3
- const {
4
- findExtensionElement,
5
- findExtensionElements,
6
- findParent,
7
- hasProperties,
8
- hasProperty
9
- } = require('../utils/element');
10
-
11
- const { reportErrors } = require('../utils/reporter');
12
-
13
- const { skipInNonExecutableProcess } = require('../utils/rule');
14
-
15
- const { greaterOrEqual } = require('../utils/version');
16
-
17
- const formIdAllowedVersion = '8.3';
18
-
19
- module.exports = skipInNonExecutableProcess(function({ version }) {
20
- function check(node, reporter) {
21
- if (!is(node, 'bpmn:UserTask')) {
22
- return;
23
- }
24
-
25
- const formDefinition = findExtensionElement(node, 'zeebe:FormDefinition');
26
-
27
- if (!formDefinition) {
28
- return;
29
- }
30
-
31
- let errors = [];
32
-
33
- if (isFormIdAllowed(version)) {
34
-
35
- // Camunda 8.3 and newer
36
- errors = hasProperty(formDefinition, [
37
- 'formKey',
38
- 'formId'
39
- ], node);
40
- } else {
41
-
42
- // Camunda 8.2 and older
43
- errors = hasProperties(formDefinition, {
44
- formId: {
45
- allowed: false,
46
- allowedVersion: formIdAllowedVersion
47
- }
48
- }, node);
49
-
50
- if (errors.length) {
51
- reportErrors(node, reporter, errors);
52
-
53
- return;
54
- }
55
-
56
- errors = hasProperties(formDefinition, {
57
- formKey: {
58
- required: true
59
- }
60
- }, node);
61
- }
62
-
63
- if (errors.length) {
64
- reportErrors(node, reporter, errors);
65
-
66
- return;
67
- }
68
-
69
- const formKey = formDefinition.get('formKey');
70
-
71
- const userTaskForm = findUserTaskForm(node, formKey);
72
-
73
- if (!userTaskForm) {
74
- return;
75
- }
76
-
77
- errors = hasProperties(userTaskForm, {
78
- body: {
79
- required: true
80
- }
81
- }, node);
82
-
83
- if (errors.length) {
84
- reportErrors(node, reporter, errors);
85
- }
86
- }
87
-
88
- return {
89
- check
90
- };
91
- });
92
-
93
- // helpers //////////
94
-
95
- function findUserTaskForm(node, formKey) {
96
- const process = findParent(node, 'bpmn:Process');
97
-
98
- if (!process) {
99
- return;
100
- }
101
-
102
- const userTaskForms = findExtensionElements(process, 'zeebe:UserTaskForm');
103
-
104
- if (userTaskForms && userTaskForms.length) {
105
- return userTaskForms.find(userTaskForm => {
106
- const id = userTaskForm.get('id');
107
-
108
- return `camunda-forms:bpmn:${ id }` === formKey;
109
- });
110
- }
111
- }
112
-
113
- function isFormIdAllowed(version) {
114
- return greaterOrEqual(version, formIdAllowedVersion);
1
+ const { is } = require('bpmnlint-utils');
2
+
3
+ const {
4
+ findExtensionElement,
5
+ findExtensionElements,
6
+ findParent,
7
+ hasProperties,
8
+ hasProperty
9
+ } = require('../utils/element');
10
+
11
+ const { reportErrors } = require('../utils/reporter');
12
+
13
+ const { skipInNonExecutableProcess } = require('../utils/rule');
14
+
15
+ const { greaterOrEqual } = require('../utils/version');
16
+
17
+ const formIdAllowedVersions = {
18
+ desktop: '8.4',
19
+ web: '8.0'
20
+ };
21
+
22
+ module.exports = skipInNonExecutableProcess(function({ modeler = 'desktop', version }) {
23
+ function check(node, reporter) {
24
+ if (!is(node, 'bpmn:UserTask')) {
25
+ return;
26
+ }
27
+
28
+ const formDefinition = findExtensionElement(node, 'zeebe:FormDefinition');
29
+
30
+ if (!formDefinition) {
31
+ return;
32
+ }
33
+
34
+ let errors = [];
35
+
36
+ const formIdAllowedVersion = formIdAllowedVersions[ modeler ];
37
+
38
+ if (isFormIdAllowed(version, formIdAllowedVersion)) {
39
+ errors = hasProperty(formDefinition, [
40
+ 'formKey',
41
+ 'formId'
42
+ ], node);
43
+ } else {
44
+ errors = hasProperties(formDefinition, {
45
+ formId: {
46
+ allowed: false,
47
+ allowedVersion: formIdAllowedVersion
48
+ }
49
+ }, node);
50
+
51
+ if (errors.length) {
52
+ reportErrors(node, reporter, errors);
53
+
54
+ return;
55
+ }
56
+
57
+ errors = hasProperties(formDefinition, {
58
+ formKey: {
59
+ required: true
60
+ }
61
+ }, node);
62
+ }
63
+
64
+ if (errors.length) {
65
+ reportErrors(node, reporter, errors);
66
+
67
+ return;
68
+ }
69
+
70
+ const formKey = formDefinition.get('formKey');
71
+
72
+ const userTaskForm = findUserTaskForm(node, formKey);
73
+
74
+ if (!userTaskForm) {
75
+ return;
76
+ }
77
+
78
+ errors = hasProperties(userTaskForm, {
79
+ body: {
80
+ required: true
81
+ }
82
+ }, node);
83
+
84
+ if (errors.length) {
85
+ reportErrors(node, reporter, errors);
86
+ }
87
+ }
88
+
89
+ return {
90
+ check
91
+ };
92
+ });
93
+
94
+ // helpers //////////
95
+
96
+ function findUserTaskForm(node, formKey) {
97
+ const process = findParent(node, 'bpmn:Process');
98
+
99
+ if (!process) {
100
+ return;
101
+ }
102
+
103
+ const userTaskForms = findExtensionElements(process, 'zeebe:UserTaskForm');
104
+
105
+ if (userTaskForms && userTaskForms.length) {
106
+ return userTaskForms.find(userTaskForm => {
107
+ const id = userTaskForm.get('id');
108
+
109
+ return `camunda-forms:bpmn:${ id }` === formKey;
110
+ });
111
+ }
112
+ }
113
+
114
+ function isFormIdAllowed(version, formIdAllowedVersion) {
115
+ return greaterOrEqual(version, formIdAllowedVersion);
115
116
  }
@@ -4,6 +4,8 @@ const {
4
4
  isFunction,
5
5
  isNil,
6
6
  isObject,
7
+ isString,
8
+ isUndefined,
7
9
  some
8
10
  } = require('min-dash');
9
11
 
@@ -141,7 +143,7 @@ module.exports.hasProperties = function(node, properties, parentNode = null) {
141
143
 
142
144
  const propertyValue = node.get(propertyName);
143
145
 
144
- if (propertyChecks.required && !propertyValue) {
146
+ if (propertyChecks.required && isEmptyValue(propertyValue)) {
145
147
  return [
146
148
  ...results,
147
149
  {
@@ -164,7 +166,7 @@ module.exports.hasProperties = function(node, properties, parentNode = null) {
164
166
  if (propertyChecks.dependentRequired) {
165
167
  const dependency = node.get(propertyChecks.dependentRequired);
166
168
 
167
- if (dependency && !propertyValue) {
169
+ if (dependency && isEmptyValue(propertyValue)) {
168
170
  return [
169
171
  ...results,
170
172
  {
@@ -303,7 +305,9 @@ function findProperties(node, propertyNames) {
303
305
  const properties = [];
304
306
 
305
307
  for (const propertyName of propertyNames) {
306
- if (isDefined(node.get(propertyName))) {
308
+ const propertyValue = node.get(propertyName);
309
+
310
+ if (!isEmptyValue(propertyValue)) {
307
311
  properties.push(node.get(propertyName));
308
312
  }
309
313
  }
@@ -470,4 +474,12 @@ function findParent(node, type) {
470
474
  return findParent(parent, type);
471
475
  }
472
476
 
473
- module.exports.findParent = findParent;
477
+ module.exports.findParent = findParent;
478
+
479
+ function isEmptyString(value) {
480
+ return isString(value) && value.trim() === '';
481
+ }
482
+
483
+ function isEmptyValue(value) {
484
+ return isUndefined(value) || isNil(value) || isEmptyString(value);
485
+ }
@@ -1,29 +0,0 @@
1
- const { is } = require('bpmnlint-utils');
2
-
3
- const { hasNoExtensionElement } = require('../utils/element');
4
-
5
- const { reportErrors } = require('../utils/reporter');
6
-
7
- const { skipInNonExecutableProcess } = require('../utils/rule');
8
-
9
- const { greaterOrEqual } = require('../utils/version');
10
-
11
- const startFormAllowedVersion = '8.3';
12
-
13
- module.exports = skipInNonExecutableProcess(function({ version }) {
14
- function check(node, reporter) {
15
- if (!is(node, 'bpmn:StartEvent') || greaterOrEqual(version, startFormAllowedVersion)) {
16
- return;
17
- }
18
-
19
- let errors = hasNoExtensionElement(node, 'zeebe:FormDefinition', node, startFormAllowedVersion);
20
-
21
- if (errors.length) {
22
- reportErrors(node, reporter, errors);
23
- }
24
- }
25
-
26
- return {
27
- check
28
- };
29
- });