bpmnlint-plugin-camunda-compat 0.7.1 → 0.8.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/CHANGELOG.md CHANGED
@@ -6,6 +6,10 @@ All notable changes to [bpmnlint-plugin-camunda-compat](https://github.com/camun
6
6
 
7
7
  ___Note:__ Yet to be released changes appear here._
8
8
 
9
+ ## 0.8.0
10
+
11
+ * `FEAT`: add templates rule ([#31](https://github.com/camunda/bpmnlint-plugin-camunda-compat/pull/31))
12
+
9
13
  ## 0.7.1
10
14
 
11
15
  * `FIX`: lint subscription only if start event child of sub process ([#34](https://github.com/camunda/bpmnlint-plugin-camunda-compat/pull/34))
@@ -17,7 +21,7 @@ ___Note:__ Yet to be released changes appear here._
17
21
 
18
22
  ### Breaking Changes
19
23
 
20
- * configuration not selected based on execution platform and version anymore
24
+ * configuration not selected based on execution platform and version anymore, either configure manually or use [`@camunda/linting`](https://github.com/camunda/linting)
21
25
  * error message not adjusted to be shown in Camunda Modeler anymore
22
26
  * error type ELEMENT_TYPE changed to ELEMENT_TYPE_NOT_ALLOWED
23
27
  * error type PROPERTY_TYPE changed to PROPERTY_TYPE_NOT_ALLOWED
package/README.md CHANGED
@@ -2,25 +2,24 @@
2
2
 
3
3
  [![CI](https://github.com/camunda/bpmnlint-plugin-camunda-compat/workflows/CI/badge.svg)](https://github.com/camunda/bpmnlint-plugin-camunda-compat/actions?query=workflow%3ACI)
4
4
 
5
- Camunda BPMN compatibility, packed as a [bpmnlint](https://github.com/bpmn-io/bpmnlint) plug-in.
5
+ Camunda BPMN compatibility provided as a [bpmnlint](https://github.com/bpmn-io/bpmnlint) plug-in.
6
6
 
7
7
 
8
8
  ## Usage
9
9
 
10
- Add the plug-in via your `.bpmnlintrc` file:
10
+ To configure the linter dynamically based on the [execution platform and version](https://github.com/camunda/modeler-moddle), use [`@camunda/linting`](https://github.com/camunda/linting).
11
+
12
+ To configure the linter statically, add the configuration corresponding to your execution platform and version to your `.bpmnlintrc` file:
11
13
 
12
14
  ```
13
15
  {
14
16
  "extends": [
15
17
  "bpmnlint:recommended",
16
- "plugin:camunda-compat/recommended"
18
+ "plugin:camunda-compat/camunda-cloud-8-0"
17
19
  ]
18
20
  }
19
21
  ```
20
22
 
21
- To validate a diagram it must be pinned to a particular execution platform via the [`modeler`](https://github.com/camunda/modeler-moddle) BPMN 2.0 extension.
22
-
23
-
24
23
  ## Resources
25
24
 
26
25
  * [Issues](https://github.com/camunda/bpmnlint-plugin-camunda-compat/issues)
package/index.js CHANGED
@@ -1,61 +1,65 @@
1
- const hasCalledDecisionOrTaskDefinitionConfig = require('./rules/has-called-decision-or-task-definition/config'),
2
- isElementConfig = require('./rules/is-element/config');
1
+ const calledDecisionOrTaskDefinitionConfig = require('./rules/called-decision-or-task-definition/config'),
2
+ elementTypeConfig = require('./rules/element-type/config');
3
3
 
4
4
  module.exports = {
5
5
  configs: {
6
6
  'camunda-cloud-1-0': {
7
7
  rules: {
8
- 'has-called-decision-or-task-definition': [ 'error', hasCalledDecisionOrTaskDefinitionConfig.camundaCloud10 ],
9
- 'has-called-element': 'error',
10
- 'has-error-reference': 'error',
11
- 'has-loop-characteristics': 'error',
12
- 'has-message-reference': 'error',
13
- 'has-subscription': 'error',
14
- 'is-element': [ 'error', isElementConfig.camundaCloud10 ]
8
+ 'called-decision-or-task-definition': [ 'error', calledDecisionOrTaskDefinitionConfig.camundaCloud10 ],
9
+ 'called-element': 'error',
10
+ 'element-type': [ 'error', elementTypeConfig.camundaCloud10 ],
11
+ 'error-reference': 'error',
12
+ 'loop-characteristics': 'error',
13
+ 'message-reference': 'error',
14
+ 'no-template': 'error',
15
+ 'subscription': 'error'
15
16
  }
16
17
  },
17
18
  'camunda-cloud-1-1': {
18
19
  rules: {
19
- 'has-called-decision-or-task-definition': [ 'error', hasCalledDecisionOrTaskDefinitionConfig.camundaCloud11 ],
20
- 'has-called-element': 'error',
21
- 'has-error-reference': 'error',
22
- 'has-loop-characteristics': 'error',
23
- 'has-message-reference': 'error',
24
- 'has-subscription': 'error',
25
- 'is-element': [ 'error', isElementConfig.camundaCloud11 ]
20
+ 'called-decision-or-task-definition': [ 'error', calledDecisionOrTaskDefinitionConfig.camundaCloud11 ],
21
+ 'called-element': 'error',
22
+ 'element-type': [ 'error', elementTypeConfig.camundaCloud11 ],
23
+ 'error-reference': 'error',
24
+ 'loop-characteristics': 'error',
25
+ 'message-reference': 'error',
26
+ 'no-template': 'error',
27
+ 'subscription': 'error'
26
28
  }
27
29
  },
28
30
  'camunda-cloud-1-2': {
29
31
  rules: {
30
- 'has-called-decision-or-task-definition': [ 'error', hasCalledDecisionOrTaskDefinitionConfig.camundaCloud12 ],
31
- 'has-called-element': 'error',
32
- 'has-error-reference': 'error',
33
- 'has-loop-characteristics': 'error',
34
- 'has-message-reference': 'error',
35
- 'has-subscription': 'error',
36
- 'is-element': [ 'error', isElementConfig.camundaCloud12 ]
32
+ 'called-decision-or-task-definition': [ 'error', calledDecisionOrTaskDefinitionConfig.camundaCloud12 ],
33
+ 'called-element': 'error',
34
+ 'element-type': [ 'error', elementTypeConfig.camundaCloud12 ],
35
+ 'error-reference': 'error',
36
+ 'loop-characteristics': 'error',
37
+ 'message-reference': 'error',
38
+ 'no-template': 'error',
39
+ 'subscription': 'error'
37
40
  }
38
41
  },
39
42
  'camunda-cloud-1-3': {
40
43
  rules: {
41
- 'has-called-decision-or-task-definition': [ 'error', hasCalledDecisionOrTaskDefinitionConfig.camundaCloud13 ],
42
- 'has-called-element': 'error',
43
- 'has-error-reference': 'error',
44
- 'has-loop-characteristics': 'error',
45
- 'has-message-reference': 'error',
46
- 'has-subscription': 'error',
47
- 'is-element': [ 'error', isElementConfig.camundaCloud12 ]
44
+ 'called-decision-or-task-definition': [ 'error', calledDecisionOrTaskDefinitionConfig.camundaCloud13 ],
45
+ 'called-element': 'error',
46
+ 'element-type': [ 'error', elementTypeConfig.camundaCloud12 ],
47
+ 'error-reference': 'error',
48
+ 'loop-characteristics': 'error',
49
+ 'message-reference': 'error',
50
+ 'no-template': 'error',
51
+ 'subscription': 'error'
48
52
  }
49
53
  },
50
54
  'camunda-cloud-8-0': {
51
55
  rules: {
52
- 'has-called-decision-or-task-definition': [ 'error', hasCalledDecisionOrTaskDefinitionConfig.camundaCloud13 ],
53
- 'has-called-element': 'error',
54
- 'has-error-reference': 'error',
55
- 'has-loop-characteristics': 'error',
56
- 'has-message-reference': 'error',
57
- 'has-subscription': 'error',
58
- 'is-element': [ 'error', isElementConfig.camundaCloud12 ]
56
+ 'called-decision-or-task-definition': [ 'error', calledDecisionOrTaskDefinitionConfig.camundaCloud13 ],
57
+ 'called-element': 'error',
58
+ 'element-type': [ 'error', elementTypeConfig.camundaCloud12 ],
59
+ 'error-reference': 'error',
60
+ 'loop-characteristics': 'error',
61
+ 'message-reference': 'error',
62
+ 'subscription': 'error'
59
63
  }
60
64
  }
61
65
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "bpmnlint-plugin-camunda-compat",
3
- "version": "0.7.1",
3
+ "version": "0.8.0",
4
4
  "description": "A bpmnlint plug-in for Camunda Platform compatibility",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -25,7 +25,6 @@
25
25
  "devDependencies": {
26
26
  "bpmn-moddle": "^7.1.2",
27
27
  "bpmnlint": "^7.8.0",
28
- "camunda-bpmn-moddle": "^6.1.1",
29
28
  "chai": "^4.3.5",
30
29
  "eslint": "^7.32.0",
31
30
  "eslint-plugin-bpmn-io": "^0.13.0",
@@ -33,7 +32,7 @@
33
32
  "modeler-moddle": "^0.1.0",
34
33
  "sinon": "^13.0.1",
35
34
  "sinon-chai": "^3.7.0",
36
- "zeebe-bpmn-moddle": "^0.10.0"
35
+ "zeebe-bpmn-moddle": "^0.12.1"
37
36
  },
38
37
  "dependencies": {
39
38
  "@philippfromme/moddle-helpers": "^0.1.0",
File without changes
File without changes
@@ -0,0 +1,21 @@
1
+ const { hasProperties } = require('./utils/element');
2
+
3
+ const { reportErrors } = require('./utils/reporter');
4
+
5
+ module.exports = function() {
6
+ function check(node, reporter) {
7
+ const errors = hasProperties(node, {
8
+ modelerTemplate: {
9
+ allowed: false
10
+ }
11
+ }, node);
12
+
13
+ if (errors && errors.length) {
14
+ reportErrors(node, reporter, errors);
15
+ }
16
+ }
17
+
18
+ return {
19
+ check
20
+ };
21
+ };
File without changes
@@ -1,5 +1,6 @@
1
1
  const {
2
2
  isArray,
3
+ isDefined,
3
4
  some
4
5
  } = require('min-dash');
5
6
 
@@ -144,6 +145,24 @@ module.exports.hasProperties = function(node, properties, parentNode = null) {
144
145
  ];
145
146
  }
146
147
 
148
+ if (propertyChecks.allowed === false && isDefined(propertyValue)) {
149
+ return [
150
+ ...results,
151
+ {
152
+ message: `Property <${ propertyName }> not allowed`,
153
+ path: path
154
+ ? [ ...path, propertyName ]
155
+ : [ propertyName ],
156
+ error: {
157
+ type: ERROR_TYPES.PROPERTY_NOT_ALLOWED,
158
+ node,
159
+ parentNode: parentNode == node ? null : parentNode,
160
+ property: propertyName
161
+ }
162
+ }
163
+ ];
164
+ }
165
+
147
166
  return results;
148
167
  }, []);
149
168
  };
@@ -3,6 +3,7 @@ module.exports.ERROR_TYPES = Object.freeze({
3
3
  EXTENSION_ELEMENT_NOT_ALLOWED: 'extensionElementNotAllowed',
4
4
  EXTENSION_ELEMENT_REQUIRED: 'extensionElementRequired',
5
5
  PROPERTY_DEPENDEND_REQUIRED: 'propertyDependendRequired',
6
+ PROPERTY_NOT_ALLOWED: 'propertyNotAllowed',
6
7
  PROPERTY_REQUIRED: 'propertyRequired',
7
8
  PROPERTY_TYPE_NOT_ALLOWED: 'propertyTypeNotAllowed'
8
9
  });