bpmnlint-plugin-camunda-compat 2.31.0 → 2.33.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
@@ -96,7 +96,8 @@ const camundaCloud86Rules = withConfig({
96
96
  }, { version: '8.6' });
97
97
 
98
98
  const camundaCloud87Rules = withConfig({
99
- ...camundaCloud86Rules
99
+ ...camundaCloud86Rules,
100
+ 'ad-hoc-sub-process': 'error',
100
101
  }, { version: '8.7' });
101
102
 
102
103
  const camundaCloud88Rules = withConfig({
@@ -132,6 +133,7 @@ const camundaPlatform723Rules = withConfig(camundaPlatform721Rules, {
132
133
  });
133
134
 
134
135
  const rules = {
136
+ 'ad-hoc-sub-process': './rules/camunda-cloud/ad-hoc-sub-process',
135
137
  'element-type': './rules/camunda-cloud/element-type',
136
138
  'called-element': './rules/camunda-cloud/called-element',
137
139
  'collapsed-subprocess': './rules/camunda-cloud/collapsed-subprocess',
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "bpmnlint-plugin-camunda-compat",
3
- "version": "2.31.0",
3
+ "version": "2.33.0",
4
4
  "description": "A bpmnlint plug-in for Camunda compatibility",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -24,12 +24,12 @@
24
24
  },
25
25
  "license": "MIT",
26
26
  "devDependencies": {
27
- "bpmn-moddle": "^8.1.0",
28
- "bpmnlint": "^10.2.0",
27
+ "bpmn-moddle": "^9.0.1",
28
+ "bpmnlint": "^11.2.0",
29
29
  "camunda-bpmn-moddle": "^7.0.1",
30
30
  "chai": "^4.4.1",
31
- "eslint": "^8.56.0",
32
- "eslint-plugin-bpmn-io": "^1.0.0",
31
+ "eslint": "^9.20.1",
32
+ "eslint-plugin-bpmn-io": "^2.2.0",
33
33
  "mocha": "^10.2.0",
34
34
  "modeler-moddle": "^0.2.0",
35
35
  "sinon": "^17.0.1",
@@ -37,9 +37,9 @@
37
37
  "zeebe-bpmn-moddle": "^1.9.0"
38
38
  },
39
39
  "dependencies": {
40
- "@bpmn-io/feel-lint": "^1.2.0",
40
+ "@bpmn-io/feel-lint": "^1.4.0",
41
41
  "@bpmn-io/moddle-utils": "^0.2.1",
42
- "bpmnlint-utils": "^1.0.2",
42
+ "bpmnlint-utils": "^1.1.1",
43
43
  "min-dash": "^4.1.1",
44
44
  "semver-compare": "^1.0.0"
45
45
  },
@@ -48,6 +48,6 @@
48
48
  "index.js"
49
49
  ],
50
50
  "engines": {
51
- "node": "*"
51
+ "node": ">= 20"
52
52
  }
53
53
  }
@@ -0,0 +1,34 @@
1
+ const { is, isAny } = require('bpmnlint-utils');
2
+
3
+ const { reportErrors } = require('../utils/reporter');
4
+
5
+ const { skipInNonExecutableProcess } = require('../utils/rule');
6
+
7
+ module.exports = skipInNonExecutableProcess(function() {
8
+ function check(node, reporter) {
9
+ if (!is(node, 'bpmn:AdHocSubProcess')) {
10
+ return;
11
+ }
12
+
13
+ // Ad-Hoc Sub-Process must contain at least one activity
14
+ if (node.get('flowElements').some(isActivity)) {
15
+ return;
16
+ }
17
+
18
+ reportErrors(node, reporter, {
19
+ message: 'Element of type <bpmn:AdHocSubProcess> must contain at least one activity',
20
+ data: {
21
+ node,
22
+ parentNode: null
23
+ }
24
+ });
25
+ }
26
+
27
+ return {
28
+ check
29
+ };
30
+ });
31
+
32
+ function isActivity(element) {
33
+ return isAny(element, [ 'bpmn:Task', 'bpmn:SubProcess' ]);
34
+ }
@@ -6,6 +6,8 @@ const {
6
6
  hasProperties
7
7
  } = require('../utils/element');
8
8
 
9
+ const { annotateRule } = require('../helper');
10
+
9
11
  const { reportErrors } = require('../utils/reporter');
10
12
 
11
13
  const { skipInNonExecutableProcess } = require('../utils/rule');
@@ -37,7 +39,7 @@ module.exports = skipInNonExecutableProcess(function() {
37
39
  }
38
40
  }
39
41
 
40
- return {
42
+ return annotateRule('called-element', {
41
43
  check
42
- };
44
+ });
43
45
  });
@@ -14,6 +14,8 @@ const { reportErrors } = require('../../utils/reporter');
14
14
 
15
15
  const { skipInNonExecutableProcess } = require('../../utils/rule');
16
16
 
17
+ const { annotateRule } = require('../../helper');
18
+
17
19
  module.exports = skipInNonExecutableProcess(function({ version }) {
18
20
  function check(node, reporter) {
19
21
  if (!isAny(node, [ 'bpmn:FlowElement', 'bpmn:FlowElementsContainer' ])) {
@@ -128,7 +130,7 @@ module.exports = skipInNonExecutableProcess(function({ version }) {
128
130
  }
129
131
  }
130
132
 
131
- return {
133
+ return annotateRule('element-type', {
132
134
  check
133
- };
135
+ });
134
136
  });
@@ -13,6 +13,7 @@ const { reportErrors } = require('../utils/reporter');
13
13
  const { skipInNonExecutableProcess } = require('../utils/rule');
14
14
 
15
15
  const { greaterOrEqual } = require('../utils/version');
16
+ const { annotateRule } = require('../helper');
16
17
 
17
18
  const noErrorRefAllowedVersion = '8.2';
18
19
 
@@ -62,9 +63,9 @@ module.exports = skipInNonExecutableProcess(function({ version }) {
62
63
  }
63
64
  }
64
65
 
65
- return {
66
+ return annotateRule('error-reference', {
66
67
  check
67
- };
68
+ });
68
69
  });
69
70
 
70
71
  function isNoErrorRefAllowed(node, version) {
@@ -11,6 +11,7 @@ const {
11
11
  const { reportErrors } = require('../utils/reporter');
12
12
 
13
13
  const { skipInNonExecutableProcess } = require('../utils/rule');
14
+ const { annotateRule } = require('../helper');
14
15
 
15
16
  module.exports = skipInNonExecutableProcess(function() {
16
17
  function check(node, reporter) {
@@ -57,9 +58,9 @@ module.exports = skipInNonExecutableProcess(function() {
57
58
  }
58
59
  }
59
60
 
60
- return {
61
+ return annotateRule('escalation-reference', {
61
62
  check
62
- };
63
+ });
63
64
  });
64
65
 
65
66
  function isNoEscalationRefAllowed(node) {
@@ -14,6 +14,7 @@ const { reportErrors } = require('../utils/reporter');
14
14
  const { ERROR_TYPES } = require('../utils/error-types');
15
15
 
16
16
  const { skipInNonExecutableProcess } = require('../utils/rule');
17
+ const { annotateRule } = require('../helper');
17
18
 
18
19
  module.exports = skipInNonExecutableProcess(function() {
19
20
  function check(node, reporter) {
@@ -64,9 +65,9 @@ module.exports = skipInNonExecutableProcess(function() {
64
65
  }
65
66
  }
66
67
 
67
- return {
68
+ return annotateRule('feel', {
68
69
  check
69
- };
70
+ });
70
71
  });
71
72
 
72
73
  const isFeelProperty = ([ propertyName, value ]) => {
@@ -11,6 +11,7 @@ const {
11
11
  const { reportErrors } = require('../utils/reporter');
12
12
 
13
13
  const { skipInNonExecutableProcess } = require('../utils/rule');
14
+ const { annotateRule } = require('../helper');
14
15
 
15
16
  module.exports = skipInNonExecutableProcess(function() {
16
17
  function check(node, reporter) {
@@ -55,7 +56,7 @@ module.exports = skipInNonExecutableProcess(function() {
55
56
  }
56
57
  }
57
58
 
58
- return {
59
+ return annotateRule('message-reference', {
59
60
  check
60
- };
61
+ });
61
62
  });
@@ -20,6 +20,11 @@ module.exports = skipInNonExecutableProcess(function() {
20
20
  }
21
21
 
22
22
  return {
23
+ meta: {
24
+ documentation: {
25
+ url: 'https://docs.camunda.io/docs/next/apis-tools/migration-manuals/migrate-to-zeebe-user-tasks'
26
+ }
27
+ },
23
28
  check
24
29
  };
25
30
  });
@@ -1,5 +1,7 @@
1
1
  const { is } = require('bpmnlint-utils');
2
2
 
3
+ const { annotateRule } = require('../helper');
4
+
3
5
  const { skipInNonExecutableProcess } = require('../utils/rule');
4
6
 
5
7
  module.exports = skipInNonExecutableProcess(function() {
@@ -14,7 +16,7 @@ module.exports = skipInNonExecutableProcess(function() {
14
16
  }
15
17
  }
16
18
 
17
- return {
19
+ return annotateRule('history-time-to-live', {
18
20
  check
19
- };
21
+ });
20
22
  });
@@ -0,0 +1,39 @@
1
+ const modelingGuidanceBaseUrl = 'https://docs.camunda.io/docs/next/components/modeler/reference/modeling-guidance/rules';
2
+
3
+ /**
4
+ * @typedef { any } RuleDefinition
5
+ */
6
+
7
+ /**
8
+ * Annotate a rule with core information, such as the documentation url.
9
+ *
10
+ * @param { string } ruleName
11
+ * @param { RuleDefinition } options
12
+ *
13
+ * @return { RuleDefinition }
14
+ */
15
+ function annotateRule(ruleName, options) {
16
+
17
+ const {
18
+ meta: {
19
+ documentation = {},
20
+ ...restMeta
21
+ } = {},
22
+ ...restOptions
23
+ } = options;
24
+
25
+ const documentationUrl = `${modelingGuidanceBaseUrl}/${ruleName}.md`;
26
+
27
+ return {
28
+ meta: {
29
+ documentation: {
30
+ url: documentationUrl,
31
+ ...documentation
32
+ },
33
+ ...restMeta
34
+ },
35
+ ...restOptions
36
+ };
37
+ }
38
+
39
+ module.exports.annotateRule = annotateRule;